Created
April 2, 2019 21:55
-
-
Save jmcblane/daba82701dd28cc8a328ac1263c6d976 to your computer and use it in GitHub Desktop.
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
#!/usr/bin/sh | |
password=$(echo -n $@ | sha1sum | sed 's/ -$//') | |
first_five=$(echo -n $password | cut -c 1-5) | |
all_the_rest=$(echo -n $password | cut -c 6-) | |
curl -s https://api.pwnedpasswords.com/range/$first_five > /tmp/pwned | |
retrieve=$(cat /tmp/pwned | grep -i $all_the_rest | cut -d':' -f2) | |
if [ -n $retrieve ]; then | |
echo "Password is safe!" | |
else | |
echo "Times found in database:" | |
echo $retrieve | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment