Hi folks,
in the last days I have several issues with passwords, so I needed a small bash script for checking a STRING (password) if this is secure or not, or with other hands, was the password powned in the past and shoud not be used anymore.
For that reason I wrote a small script
This file contains hidden or 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 | |
# check if password was insert | |
if [ $# -eq 0 ] | |
then | |
echo "no password was insert, syntax is ./check-password.sh password" | |
else | |
#create sha1sum of password for transfering to online check | |
sha1pass=`echo -n "$1" | sha1sum | cut -d ' ' -f1` | |
#run test and get a result from api | |
result=`curl -s https://api.pwnedpasswords.com/pwnedpassword/$sha1pass` | |
# if password was found we will get a number of entries only if result is empty the password was not found, so we check if result is empty | |
if [ -z "$result" ] | |
then | |
echo "Your lucky your password was not found in the Database!" | |
else | |
echo "Your password was found: $result times." | |
fi | |
fi |
br
Chris