-
Notifications
You must be signed in to change notification settings - Fork 0
/
pw.gen
executable file
·71 lines (56 loc) · 1.63 KB
/
pw.gen
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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
#!/usr/bin/python
import argparse
letters_dict = {
' ': ['@', '#', '$', '-', '_', '+', ''],
'a': ['a', 'A', '@'],
'b': ['b', 'B', '8'],
'c': ['c', 'C', 'k', 'K'],
'd': ['d', 'D'],
'e': ['e', 'E', '3'],
'f': ['f', 'F', 'ph', 'pH', 'Ph', 'PH'],
'g': ['g', 'G', '6', '9'],
'h': ['h', 'H', ],
'i': ['i', 'I', '!', '1'],
'j': ['j', 'J'],
'k': ['k', 'K'],
'l': ['l', 'L', '1'],
'm': ['m', 'M'],
'n': ['n', 'N'],
'o': ['o', 'O', '0'],
'p': ['p', 'P'],
'q': ['q', 'Q', 'k', 'K'],
'r': ['r', 'R', '2'],
's': ['s', 'S', '5'],
't': ['t', 'T', '7'],
'u': ['u', 'U'],
'v': ['v', 'V'],
'w': ['w', 'W', 'vv', 'VV'],
'x': ['x', 'X'],
'y': ['y', 'Y'],
'z': ['z', 'Z', '2']
}
def permute(word):
if len(word) > 0:
current = word[0].lower()
rest = word[1:]
if current in letters_dict:
substitutions = letters_dict[current]
else:
substitutions = [current]
if len(rest) > 0:
perms = [s + p for s in substitutions for p in permute(rest)]
else:
perms = substitutions
return perms
def main():
parser = argparse.ArgumentParser(description='Permutate wordlists.')
parser.add_argument('input_file', help='an input wordlist')
parser.add_argument('output_file', help='an output file')
args = parser.parse_args()
with open(args.input_file) as f:
words = f.readlines()
with open(args.output_file, "w") as out:
for word in words:
out.writelines([p for p in permute(word)])
if __name__ == '__main__':
main()