Skip to content

Instantly share code, notes, and snippets.

@jmcblane
Created April 2, 2019 21:55
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jmcblane/daba82701dd28cc8a328ac1263c6d976 to your computer and use it in GitHub Desktop.
Save jmcblane/daba82701dd28cc8a328ac1263c6d976 to your computer and use it in GitHub Desktop.
#!/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