View Single Post
  #1   (View Single Post)  
Old 27th February 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,125
Default Generating passwords with jot(1)

The EXAMPLES section of jot(1) shows how to generate random passwords:
Code:
     Generate 20 random 8-letter strings (note that the character `{' comes
     after the character `z' in the ASCII character set):

           $ jot -r -c 160 a { | rs -g0 0 8
If we run this we get the following:
Code:
$ jot -r -c 160 a { | rs -g0 0 8
hyoxlfjd
wbaesvin
gsqyqddi
fdbgemht
dbhcbcgv
mxqhiowu
peeehzgb
rzsfxrhl
wovotepg
wxjboxxb
olppczdn
ihluusoj
wnomxtmp
pcrwqqrk
svsnhouz
srcbyhyt
tyezavfb
zkncnbmw
lfwhlbfl
lffkrnhu
The passwords only use lower case, while a mix of upper and lower case is recommended.
In the jot command jot -r -c 160 a {, the 'a }' specify a range in the ASCII character set. From ascii(7):
Code:

     The hexadecimal set:

     00 nul   01 soh   02 stx   03 etx   04 eot   05 enq   06 ack   07 bel
     08 bs    09 ht    0a nl    0b vt    0c np    0d cr    0e so    0f si
     10 dle   11 dc1   12 dc2   13 dc3   14 dc4   15 nak   16 syn   17 etb
     18 can   19 em    1a sub   1b esc   1c fs    1d gs    1e rs    1f us
     20 sp    21  !    22  "    23  #    24  $    25  %    26  &    27  '
     28  (    29  )    2a  *    2b  +    2c  ,    2d  -    2e  .    2f  /
     30  0    31  1    32  2    33  3    34  4    35  5    36  6    37  7
     38  8    39  9    3a  :    3b  ;    3c  <    3d  =    3e  >    3f  ?
     40  @    41  A    42  B    43  C    44  D    45  E    46  F    47  G
     48  H    49  I    4a  J    4b  K    4c  L    4d  M    4e  N    4f  O
     50  P    51  Q    52  R    53  S    54  T    55  U    56  V    57  W
     58  X    59  Y    5a  Z    5b  [    5c  \    5d  ]    5e  ^    5f  _
     60  `    61  a    62  b    63  c    64  d    65  e    66  f    67  g
     68  h    69  i    6a  j    6b  k    6c  l    6d  m    6e  n    6f  o
     70  p    71  q    72  r    73  s    74  t    75  u    76  v    77  w
     78  x    79  y    7a  z    7b  {    7c  |    7d  }    7e  ~    7f del
So the range is hexadecimal 61 ('a') to hexadecimal 7d ('}').
To include the uppercase characters starting at 41 we simply replace the lower case 'a' with it's uppercase cousin
Code:
 jot -r -c 160 A { | rs -g0 0 8 
^iz]KHzZ
it[Mf^nL
palwGVSH
mbicqSVv
AxebFSNA
nvfUhgqM
haBaREHM
bHi^FK]g
[Pw[KLyS
Ac\PzxFX
GpXZgmNb
vx_^\]QJ
mkFEZWTe
PojZjt`]
hWjAtj^h
EwI[bPij
JCl]k\DA
o^BeO\XP
JzPY\oHT
co[pp[Pe
For an even better version, including characters as "!" (hexadecimal 21), we j use:
Code:
$ jot -r -c 160 ! { | rs -g0 0 8
EpE-:?5b
G6SY"]pW
>hI'D.!Y
2QpeTSNo
)K(7![%^
KA^N7j!?
<_)>8y[m
//N:M>dU
u*#!m.+E
*'4mZ2gF
T6lzpXVY
YhJKJ'%k
xI0!*!/W
j!O-b3)n
907panXg
HpPwh"7H
HoK:i3>a
,`v_9mh^
NX!:7Lk?
A simple modification for the dyslexic among us, or those with diminishing eyesight
Code:
$ jot -r -c 300 ! { | rs 0 12
&  B  w  7  +  -  l  $  Z  (  (  M
.  >  >  u  7  a  a  $  s  4  7  V
=  /  x  i  v  O  >  *  H  [  T  V
%  -  5  [  x  *  8  3  f  f  "  *
o  ,  u  "  o  N  r  _  :  z  b  @
$  I  F  w  *  .  V  I  S  &  (  O
*  X  8  1  =  r  ;  4  `  p  7  F
m  l  /  ^  @  6  _  B  i  S  -  w
(  ^  @  8  M  D  h  p  "  x  ;  G
B  s  a  x  F  &  b  1  h  !  G  j
X  .  M  )  +  2  4  )  t  7  ?  [
c  3  o  f  %  ]  P  \  d  p  8  Y
K  =  N  x  y  z  9  Q  h  m  U  6
9  8  K  N  O  V  p  &  3  [  F  !
4  -  A  ;  /  P  O  \  9  !  f  Z
"  j  K  3  G  b  @  F  !  -  A  L
$  *  g  j  U  &  9  p  %  j  U  U
+  7  ?  Z  @  J  G  X  V  A  4  F
^  =  (  >  g  E  S  )  q  y  &  2
#  p  l  o  -  &  V  a  3  "  m  7
=  5  E  D  m  >  7  (  ;  C  #  H
3  ?  v  l  +  Y  E  C  =  `  K  X
=  F  U  g  D  D  d  j  ^  g  k  7
n  z  A  N  A  p  k  k  u  (  ]  @
x  0  9  i  D  R  Z  g  $  J  z  N
The -c option for jot, specifies the number of characters, while the last option for rs(1) controls the size of the rows.
For 10 passwords of 15 characters long:
Code:
$ jot -r -c 150 ! { | rs 0 15
D  $  A  v  [  =  A  T  @  d  *  ;  /  B  (
c  8  s  g  `  )  n  5  D  5  ?  W  k  K  o
5  $  g  I  O  U  o  J  V  M  n  >  Y  j  ,
3  @  j  r  '  T  R  6  2  6  t  B  t  T  Y
y  _  .  F  [  T  4  J  k  U  +  x  #  m  l
`  l  k  ^  L  L  ,  d  u  o  L  Y  ^  I  U
>  w  !  %  M  k  9  C  q  z  (  I  _  e  V
b  i  >  Z  4  E  P  !  4  D  g  $  5  K  i
:  y  C  .  %  p  0  2  I  U  h  _  A  B  [
@  U  f  T  \  0  c  =  _  >  x  q  ^  R  m
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump

Last edited by J65nko; 3rd March 2009 at 09:15 PM. Reason: typo
Reply With Quote