Created
January 18, 2019 16:25
-
-
Save click0/b0deabfc167d655b63d8c94041aa4782 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/env sh | |
set -e | |
#set -x | |
# ask user for password | |
read -p "Input password for check: " -t 30 passwd | |
# sha1sum replaced openssl sha1 | awk '{ print $2;}' | |
if [ -n "$passwd" ]; then | |
echo -n "$passwd" | openssl sha1 | awk '{ print $2;}' | \ | |
awk '{ | |
prefix=substr($1,1,5); reminder=substr($1,6,35); | |
if(system("curl -sk https://api.pwnedpasswords.com/range/" prefix "> ./pwhashes.txt")){print "Error"; exit} | |
cmd="cat ./pwhashes.txt | tr [A-Z] [a-z] | grep \"" reminder "\""; | |
cmd | getline result; close(cmd); split(result,arr,":"); | |
if(!length(arr[2])) print "Password not found"; else print "Password found: " arr[2] | |
system("rm ./pwhashes.txt"); | |
}' | |
fi |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment