Hi Josh,
Having such strict rules about your passwords obviously reduces the
keyspace and makes them far less secure. Also for the really paranoid
$RANDOM in bash is a pseudo-random number generator that could
possibly be predicted - you should use a more secure random source.
Here is my attempt at the script you are looking for. I'm guessing you
wanted the middle of the password to be lower-case only? Anyway
shouldn't be too hard to modify if this is not what your after.
"""
#!/bin/bash
ULENGTH=1 # number of upper-case letters
LLENGTH=5 # number of lower-case letters
NUMLENGTH=2 # number of numbers
ULETTERS="ABCDEFGHIJKLMNOPQRSTUVWXYZ"
LLETTERS="abcdefghijklmnopqrstuvwxyz"
NUMBERS="123456789"
for (( i=0; i<$ULENGTH; i++ ))
do
PASS="$PASS${ULETTERS:$(($RANDOM%${#ULETTERS})):1}"
done
for (( i=0; i<$LLENGTH; i++ ))
do
PASS="$PASS${LLETTERS:$(($RANDOM%${#LLETTERS})):1}"
done
for (( i=0; i<$NUMLENGTH; i++ ))
do
PASS="$PASS${NUMBERS:$(($RANDOM%${#NUMBERS})):1}"
done
echo "$PASS"
exit
"""
Joel
On Tue, Mar 16, 2010 at 6:18 PM, Josh Smith
<[email protected]> wrote:
>
>
> Hey everybody.
>
>
> I am using this script at the moment. It a little password generator
> script I was wondering if anyone could help me out.
>
> I would like the First letter to be a Capital and the last two to be any
> digits?
>
> The one that I have puts capitals all over the place and sometimes it
> does not have any number's at all.
>
> I plan to use this for work for the (DRN) I have run out of things to
> put as my password and I am not aloud to have the same password twice
>
>
> Thanks in advance Josh.
>
> --
> SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
> Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html
>
--
SLUG - Sydney Linux User's Group Mailing List - http://slug.org.au/
Subscription info and FAQs: http://slug.org.au/faq/mailinglists.html