-
Notifications
You must be signed in to change notification settings - Fork 4
/
mkwordlist.py
executable file
·47 lines (34 loc) · 916 Bytes
/
mkwordlist.py
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
#!/usr/bin/env python2
# This program generates various kinds of typos in the given password.
#
# Useful for generating wordlists in case you mistyped your password twice when setting it.
#
# SUBSTS = {'s': 'ad', 'h': 'jg', ...}
# PWD = 'my secret original password'
from substs import SUBSTS, PWD
def mogrify(pwd):
guesses = set()
for i in xrange(len(pwd)):
x = pwd[i]
if x in SUBSTS:
for r in SUBSTS[x]:
guesses.add(pwd[:i] + r + pwd[i+1:])
return guesses
def leave_out(pwd):
guesses = set()
for i in xrange(len(pwd)):
guesses.add(pwd[:i] + pwd[i+1:])
return guesses
guesses = {PWD}
def perform(action):
global guesses
sub = set()
for guess in guesses:
sub |= action(guess)
guesses |= sub
perform(mogrify)
perform(mogrify)
#perform(leave_out)
perform(leave_out)
for guess in guesses:
print guess