Added password generator functions

pull/4/head
Aaron Johnson 7 years ago
parent 401560c28b
commit 733c00cd3b

31
alias

@ -21,7 +21,38 @@ alias digs='dig +short'
alias ssu='sudo su -'
# Some handy tool functions
function getcert () {
openssl s_client -servername ${1} -host ${1} -port 443 < /dev/null 2> /dev/null | sed -n '/BEGIN CERTIFICATE/,/END CERTIFICATE/p'
}
# Generate a 14-character random password that is MySQL and PostgreSQL friendly (just letters/numbers)
function sqlpass()
{
export LC_ALL=C
export LC_CTYPE=C
ranpass=`cat /dev/urandom | tr -dc '[:upper:][:lower:][:digit:]' | fold -w 14 | head -n 1`
echo "Random SQL-Friendly Password:\n$ranpass"
unset ranpass
}
# Generate a 63-character random password that is IPSec PSK friendly
function pskpass()
{
export LC_ALL=C
export LC_CTYPE=C
ranpass=`cat /dev/urandom | tr -dc '[:upper:][:lower:][:digit:][!#$%&()+\-./:;<=>@\\^_{|}]' | fold -w 63 | head -n 1`
echo "Random IPSec PSK-Friendly Password:\n$ranpass"
unset ranpass
}
# Generate a 14-character random password that is NOT SQL friendly, as it also includes punctuation/special characters
function rpass()
{
export LC_ALL=C
export LC_CTYPE=C
ranpass=`cat /dev/urandom | tr -dc '[:upper:][:lower:][:digit:][!#$%&()+\-./:;<=>@\\^_{|}]' | fold -w 14 | head -n 1`
echo "Random Password(NOT SQL-Friendly):\n$ranpass"
unset ranpass
}

Loading…
Cancel
Save