Last active
August 29, 2015 14:06
-
-
Save 9ete/3c1b821058bc675035fd to your computer and use it in GitHub Desktop.
Command line password generator. Setup an alias and you're good to go.
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 | |
echo " " | |
echo "Password Length(#1-100):" | |
read PLENGTH | |
#return date in number format | |
DATE=$(date +%s) | |
#create password string of 4 letters | |
PASSWORD1=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 4 | head -n 1) | |
#create password string of random numbers | |
PASSWORD2=`echo "((($RANDOM * $DATE)/$RANDOM)/$RANDOM)/100" | bc` | |
#create password string of 5 letters | |
PASSWORD3=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 5 | head -n 1) | |
#create password string of random numbers | |
PASSWORD4=`echo "(($RANDOM * $RANDOM)/$RANDOM)/100" | bc` | |
#create password string of 4 letters | |
PASSWORD5=$(cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 4 | head -n 1) | |
PASSWORD=$PASSWORD1$PASSWORD2$PASSWORD3$PASSWORD4$PASSWORD5 | |
echo " " | |
echo $PASSWORD | sha256sum | base64 | head -c $PLENGTH | |
echo " " |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment