Created
August 15, 2019 07:56
-
-
Save JonasAlfredsson/eaba99f48b1e6cdfd23ebf113f1119ce to your computer and use it in GitHub Desktop.
Have I Been 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 | |
# A small script for querying the https://haveibeenpwned.com/ API to see if your | |
# password has been leaked, and how many have the same passphrase. | |
# It is only the first 5 characters of the hash of your password that is sent to | |
# the server, and what will be printed is something like this: | |
# 018E42F7FF3A3AD8DFD5A4EB6C78AFFA87C:16173 | |
# which is the whole hash of the password, and how many occurences that was found. | |
while true; do | |
read -s -p "enter password> " N | |
hash=$(echo -n $N | tr -d '\n' | sha1sum) | |
curl https://api.pwnedpasswords.com/range/${hash:0:5} 2>/dev/null \ | |
| grep $(echo ${hash:5:35} | tr '[:lower:]' '[:upper:]') | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment