Some comments from collegues:
Why all the variables?
Why not just use pwgen?
all valid points...
anyway;
Code: Select all
## Random Personal Password generator.
## Inspired by www.passweird.com
## Dodgy bash script by WuX
# 2 Numbers chosen to pick a random word from dictionary
WORDNUMBER=($RANDOM * $RANDOM)
WORDNUMBER2=($RANDOM * $RANDOM)
# Get how many words are in dict/
LISTNUMBER=`wc -w /usr/share/dict/words | cut -c1-5`
# Modulo those two variables to make 2 constrained random numbers
MAGICNUMBER=$(($WORDNUMBER % $LISTNUMBER))
MAGICNUMBER2=$(($WORDNUMBER2 % $LISTNUMBER))
# Get a random word with 'p' appended so sed doesnt add a newline, sed any damn " 's " off of the word.
RNDWORD=`sed -n $MAGICNUMBER"p" /usr/share/dict/words | sed s/\'s//`
RNDWORD2=`sed -n $MAGICNUMBER2"p" /usr/share/dict/words | sed s/\'s//`
# make a 2 digit random number
RND=($RANDOM / $RANDOM)
RND=`echo $RND | cut -c 1-2`
# Add them together, split with a hyphen, short random number appended.
PASS="$RNDWORD"-"$RNDWORD2""$RND"
# Lighty L33t it
echo $PASS | tr [eos] [305]
Full of hideous overly complex bash techniques.
No switches, no options in general.
Occasionally uses a non ascii letter.
Not a lot of different passwords generated at once.
Pros,
No dependencies.
Very strong passwords, but sometimes too long.
It works.
Samples;
Code: Select all
c3ll0phan3-H3rrick11
Whit3h0r53-c0pil0t570
abridg3d-c0n5truct3d25
c0ntrivanc3-adm0ni5h3d32
Elt0n-c0qu3tt323
c0ngr3gati0n5-Jahangir62
Grail-bl00m18
am3ndm3nt-c0rr35p0nd3nt17
Hayw0rth-c0rr3ct3r16
c0nj0ining-Th0r0ughbr3d29
EDIT, might drop the l33ting on one word and lose the number at the end
seems as strong a pass and easy to read/remember