Created
May 29, 2018 15:09
-
-
Save Serpens/463fff82cc78567cb901bdf809ae17fe to your computer and use it in GitHub Desktop.
Check if a password, given as command line argument, is pwned
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
#!/bin/bash | |
PASSWORD=$1 | |
HASH=$(echo -n $1 | sha1sum | cut -f1 -d' ' | tr '[:lower:]' '[:upper:]') | |
HASH_START=$(echo $HASH | cut -c1-5) | |
HASH_END=$(echo $HASH | cut -c6-40) | |
curl -s https://api.pwnedpasswords.com/range/$HASH_START | grep $HASH_END &>/dev/null && echo 'weak password' || echo 'strong password' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment