Skip to content

Instantly share code, notes, and snippets.

@jahil
Last active August 29, 2015 14:08
Show Gist options
  • Save jahil/69768e3b56a092af1df1 to your computer and use it in GitHub Desktop.
Save jahil/69768e3b56a092af1df1 to your computer and use it in GitHub Desktop.
GRC's Perfect Passwords Generator
#!/bin/bash
# GRC's Perfect Passwords Generator
WGET="/usr/bin/wget"
FILE=`tempfile`
$WGET -q --tries=10 --timeout=5 http://www.google.com -O $FILE &> /dev/null
[ -z "$1" ] && echo -e "\E[31mGRC's\E[37m Ultra High Security Password Generator v0.1\r\033[0m" && echo -e '--------------------------------------------------\n' &&
echo -e '\E[37mUsage: ppassword [\E[31m-an alphanumeric\E[37m ] [\E[32m-as ascii\E[37m ] [ -hex hexadecimal ]' && exit 100
case "$1" in
-an)
if [ ! -s $FILE ];then
echo "ERROR: Please check you internet connectivity."
else
curl -s https://www.grc.com/passwords.htm | grep alpha | head -n1 | perl -wlne 'm/font>(.*)<\/font/i && print $1' | sed -e "s/&#xB0;//g" | cut -d" " -f14 | sed 's/size=2>//g'
fi
;;
-as)
if [ ! -s $FILE ];then
echo "ERROR: Please check you internet connectivity."
else
curl -s https://www.grc.com/passwords.htm | grep ASCII | head -n1 | perl -wlne 'm/font>(.*)<\/font/i && print $1' | sed -e "s/&#xB0;//g" | cut -d" " -f14 | sed 's/size=2>//g'
fi
;;
-hex)
if [ ! -s $FILE ];then
echo "ERROR: Please check you internet connectivity."
else
curl -s https://www.grc.com/passwords.htm | grep hexadecimal | head -n1 | perl -wlne 'm/font>(.*)<\/font/i && print $1' | sed -e "s/&#xB0;//g" | cut -d" " -f14 | sed 's/size=2>//g'
fi
;;
*)
echo -e '\E[37mUsage: ppassword [\E[31m-an alphanumeric\E[37m ] [\E[32m-as ascii\E[37m ] [\E[37m -hex hexadecimal ]'
;;
esac
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment