Created
September 30, 2018 19:31
-
-
Save elementalvoid/b316bb4fa9d801f1ab6b3d3bf380ee30 to your computer and use it in GitHub Desktop.
p0wned? zsh shell func to check against api.pwnedpasswords.com for your password.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Uses the range check to avoid sending your actual password and then checks the returned list locally. | |
p0wned () { | |
read -s 'pass?Enter password: ' | |
echo | |
sum=$(echo -n "$pass" | sha1sum | cut -c1-40) | |
short=$(echo -n $sum | cut -c1-5) | |
remain=$(echo -n $sum | cut -c6-40) | |
curl -s https://api.pwnedpasswords.com/range/${short} | grep -i ${remain} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment