Last active
February 21, 2018 23:14
-
-
Save jamiepenney/e4b16224ee30172eaa8b10b8817af639 to your computer and use it in GitHub Desktop.
Check the pwnedpasswords.com database for breached passwords from your local terminal
This file contains hidden or 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
#!/bin/bash | |
read -s -p "Enter password to check: " password | |
echo "" | |
echo "Checking that password..." | |
hash=$(echo -n "$password" | openssl sha1 | tr '[:lower:]' '[:upper:]') | |
curl -s "https://api.pwnedpasswords.com/range/$(echo $hash | head -c5)"|\ | |
grep $(echo $hash | cut -c 6-) |\ | |
awk '{split($0,a,":"); print "Your password has been found in the breach database"} END { if (!NR) print "Password not found in database"}' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment