./c0de/others/dicgen.txt

0.
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
31.
32.
33.
34.
35.
36.
37.
38.
39.
40.
41.
42.
43.
44.
45.
46.
47.
48.
49.
#!/bin/bash
# brute force dictonary generator in bash <[email protected]>
 
bf_mnlen=1
bf_mxlen=3
bf_dictchrs="a b c d e f g h i j k l m n o p q r s t u v w x y z 0 1 2 3 4 5 6 7 8 9"
 
otherFunc(){
 
        printf "%s\n" $1
}
 
bf(){
        for c in $bf_dictchrs ; do
 
                nc=$[$nc+1]
                ch[$nc]=$c
        done
        for x in `seq 1 $[$bf_mxlen+1]` ; do
 
                if [ $bf_mnlen -ge $x ] ; then
                        ci[$x]=1
                else
                        ci[$x]=0
                fi
        done
        for clen in `seq $bf_mnlen $bf_mxlen` ; do
                while [ ${ci[$[$clen+1]]} -ne 1 ] ; do
                        wrd=""
                        for x in `seq $clen -1 1` ; do
                                wrd=$wrd${ch[${ci[$x]}]}
                        done
 
                        # do something with the word..
                        otherFunc $wrd
 
                        ci[1]=$[${ci[1]}+1]
                        for x in `seq 1 $clen`; do
                                if [ ${ci[$x]} -gt $nc ] ; then
                                        ci[$x]=1
                                        ci[$[$x+1]]=$[${ci[$[$x+1]]}+1]
                                fi
                        done
                done
        done
}
 
bf
# @=X 

Back