This generates a list of passwords, as a pad, I carry a subset of one of these with me in case I need a truly random password while I’m out.
#!/bin/bash
# SRJ 2016-09-20 Create reasonable passwords
# 0 1 2 3 4 5 6 7
# 1234567890123456789012345678901234567890123456789012345678901234567890123456789
Chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.!@#$%&-_=+abcdefghijklmnopqrstuvwxyz"
# The column labels are taken from the beginning of the $Chars string
Count=${#Chars} # Length of $Chars
R="60" # Number of rows in output, 60 works well
C="6" # Number of columns in output, 6 is the way
L="12" # Length of string, 12 is ideal
# Shouldn't need to change anything below here
if [ ! -z ${1} ] ; then R="${1}" ; fi
if [ ! -z ${2} ] ; then C="${2}" ; fi
if [ ! -z ${3} ] ; then L="${3}" ; fi
d=$((L/2)) ; ((d++)) # Half of L plus 1
Sep="-" # The Seperator at the top of each column
Blanks="" # This line and next generate the empty space at the beginning of each line
for z in $(seq 1 ${#R}) ; do Blanks+=" " ; done
Ran()
{
Offset=$(($(head -c4 /dev/urandom | od -N2 -tu2 | sed -ne '1s/.* //p')%$Count))
echo "${Chars:${Offset}:1}"
};
# Generate the top two lines of the report, labeling the columns and adding
# a seperator line
for Row in $(seq -w 0 1)
do echo -n "${Blanks}| "
for Column in $(seq -w 1 ${C})
do for Place in $(seq -w 1 ${L})
do if [ ${Row} = "1" ] ; then
echo -n "${Sep}"
else if [ ${Place} -eq ${d} ] ; then
echo -n ${Chars:$((Column-1)):1}
else echo -n " " ; fi ; fi
done ; if [ ! ${Column} -eq ${C} ] ; then echo -n " " ; fi
done ; echo ""
done
# Send out the rows and columns of random characters
for Row in $(seq -w 1 ${R})
do echo -n "${Row}| "
for Column in $(seq -w 1 ${C})
do for Place in $(seq -w 1 ${L})
do echo -n "$(Ran)"
done ; if [ ! ${Column} -eq ${C} ] ; then echo -n " " ; fi
done ; echo ""
done |
#!/bin/bash
# SRJ 2016-09-20 Create reasonable passwords
# 0 1 2 3 4 5 6 7
# 1234567890123456789012345678901234567890123456789012345678901234567890123456789
Chars="ABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.!@#$%&-_=+abcdefghijklmnopqrstuvwxyz"
# The column labels are taken from the beginning of the $Chars string
Count=${#Chars} # Length of $Chars
R="60" # Number of rows in output, 60 works well
C="6" # Number of columns in output, 6 is the way
L="12" # Length of string, 12 is ideal
# Shouldn't need to change anything below here
if [ ! -z ${1} ] ; then R="${1}" ; fi
if [ ! -z ${2} ] ; then C="${2}" ; fi
if [ ! -z ${3} ] ; then L="${3}" ; fi
d=$((L/2)) ; ((d++)) # Half of L plus 1
Sep="-" # The Seperator at the top of each column
Blanks="" # This line and next generate the empty space at the beginning of each line
for z in $(seq 1 ${#R}) ; do Blanks+=" " ; done
Ran()
{
Offset=$(($(head -c4 /dev/urandom | od -N2 -tu2 | sed -ne '1s/.* //p')%$Count))
echo "${Chars:${Offset}:1}"
};
# Generate the top two lines of the report, labeling the columns and adding
# a seperator line
for Row in $(seq -w 0 1)
do echo -n "${Blanks}| "
for Column in $(seq -w 1 ${C})
do for Place in $(seq -w 1 ${L})
do if [ ${Row} = "1" ] ; then
echo -n "${Sep}"
else if [ ${Place} -eq ${d} ] ; then
echo -n ${Chars:$((Column-1)):1}
else echo -n " " ; fi ; fi
done ; if [ ! ${Column} -eq ${C} ] ; then echo -n " " ; fi
done ; echo ""
done
# Send out the rows and columns of random characters
for Row in $(seq -w 1 ${R})
do echo -n "${Row}| "
for Column in $(seq -w 1 ${C})
do for Place in $(seq -w 1 ${L})
do echo -n "$(Ran)"
done ; if [ ! ${Column} -eq ${C} ] ; then echo -n " " ; fi
done ; echo ""
done