View Single Post
  #2   (View Single Post)  
Old 5th March 2009
J65nko J65nko is offline
Administrator
 
Join Date: May 2008
Location: Budel - the Netherlands
Posts: 4,131
Default

It is also possible to specify the character range using numbers. This has the advantage that we can include the '~' (tilde). The shell normally expands '~' , to the home directory of the user.

Another reason for using number is the following:

The jot(1) page states:
Quote:
The values at the beginning and end of the interval are generated less frequently than the other values. There are several ways to solve this problem and generate evenly distributed integers.
The proposed solution still does not work out well for the first character '!' and the last one '~'. Both are only generated 563 and 484 times, while the others are generated more than 1000 times.
Code:
$ jot -r -c  100000 33.5 126.5 | sort | uniq -c
 563 !
1046 "
1104 #
1124 $
1084 %
1056 &
1089 '
1083 (
1104 )
1086 *
1052 +
1056 ,
1092 -
1066 .
1049 /
1099 0
1128 1
1074 2
1092 3
1096 4
1072 5
1035 6
1123 7
1033 8
1061 9
1078 :
1109 ;
1164 <
1079 =
1064 >
1092 ?
1051 @
1057 A
1083 B
1070 C
1093 D
1041 E
1041 F
1053 G
1039 H
1154 I
1042 J
1035 K
1082 L
1086 M
1068 N
1057 O
1069 P
1109 Q
1064 R
1049 S
1046 T
1084 U
1043 V
1050 W
1067 X
1134 Y
1047 Z
1067 [
1044 \
1058 ]
1036 ^
1045 _
1096 `
1049 a
1041 b
1073 c
1025 d
1052 e
1121 f
1097 g
1116 h
1106 i
1090 j
1049 k
1055 l
1093 m
1050 n
1135 o
1079 p
1122 q
1083 r
1063 s
1098 t
1063 u
1042 v
1093 w
1099 x
1047 y
1066 z
1072 {
1130 |
1094 }
 484 ~
Note: jot(1) uses floating point numbers internally. Decimal 33 is the ASCII code for "!' and decimal 126 is the '~'.

A small modification improves the frequency of the "!' and '~':
Code:
$ jot -r -c  100000 33.01 126.99 | sort | uniq -c
1101 !
1072 "
1023 #
1063 $
1098 %
1063 &
1054 '
1062 (
1115 )
1093 *
1049 +
1121 ,
1036 -
1085 .
1094 /
1067 0
1045 1
 989 2
1061 3
1012 4
1050 5
1013 6
1119 7
1059 8
1021 9
1086 :
1094 ;
1020 <
1101 =
1060 >
1039 ?
1018 @
1060 A
1046 B
1091 C
1091 D
1077 E
1039 F
1001 G
1055 H
1059 I
1039 J
1062 K
1137 L
1066 M
1063 N
1055 O
1036 P
1124 Q
1070 R
1055 S
1039 T
1076 U
1056 V
1075 W
1073 X
1092 Y
1103 Z
1069 [
1097 \
1136 ]
1106 ^
1110 _
1011 `
1055 a
1072 b
1095 c
1036 d
1086 e
1090 f
1023 g
1007 h
1085 i
1012 j
1040 k
1056 l
1067 m
1000 n
1011 o
1063 p
1054 q
1047 r
1110 s
1074 t
1043 u
1059 v
1114 w
1088 x
1050 y
1061 z
1067 {
1049 |
1084 }
1050 ~
Applying this range to generate some passwords strings of size 12
Code:
$ jot -r -c  300 33.01 126.99 | rs 0 12   
9  U  /  ~  i  6  v  =  S  @  i  L
O  N  E  s  T  ~  )  8  9  &  \  [
<  \  8  r  B  Q  x  N  ^  W  3  r
n  ;  t  H  (  k  0  N  C  k  T  R
r  w  *  k  X  p  ~  H  B  Z  4  '
z  z  h  m  t  i  <  ^  5  q  N  U
)  l  t  I  )  j  y  c  ,  s  T  \
z  +  j  |  6  7  !  C  F  [  c  b
^  w  ]  4  a  C  `  _  l  3  J  ~
;  o  =  >  J  m  7  n  O  U  w  k
8  r  $  &  N  N  Q  W  S  M  J  P
g  a  9  &  {  v  m  C  >  S  {  R
y  d  x  0  \  O  c  %  J  E  M  V
m  z  L  M  "  5  &  .  G  '  q  5
f  2  U  h  '  r  U  J  5  r  7  ~
E  c  "  "  '  e  3  T  _  p  h  I
<  9  ?  '  _  v  r  |  }  [  @  @
r  %  M  2  _  3  -  l  <  e  ^  y
$  P  y  ;  Q  !  Y  W  v  {  c  6
G  %  E  n  @  !  e  O  M  N  J  @
M  d  c  d  G  s  ?  &  v  |  z  {
a  @  q  D  .  E  x  +  Z  _  -  +
a  u  !  R  3  u  o  9  x  =  U  ~
7  /  *  k  ?  ;  T  $  $  0  >  7
S  `  >  P  N  h  M  `  U  w  A  p
__________________
You don't need to be a genius to debug a pf.conf firewall ruleset, you just need the guts to run tcpdump
Reply With Quote