/
WPS-script.py
46 lines (33 loc) · 1.02 KB
/
WPS-script.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
#---Python2
'''
Have problems to pins that start with zero, so crunch this way "crunch 7 7 123456789 -o crunch-7-7.txt -d 3% -t @%%%%%%"
And this crunch output is large, some machines can freezy, in this case "split crunch-7-7.txt -n l/2 -d crunch" can be used
'''
#---input 7num wordlist
with open("crunch01") as f:
content = f.read().splitlines()
Lista = content
#---input 7num wordlist
NovaLista = []
for i in range (0, len(Lista)) :
n = int(i)
pin = int(Lista[n])
#---checksum log
class WPS(object):
def algoritimo(self, pin):
num = 0
while pin:
num += (3 * (pin % 10))
pin = int(pin / 10)
num += (pin % 10)
pin = int(pin / 10)
return ((10 - num % 10) % 10)
checksum = WPS().algoritimo(pin)
#---chechsum log
i = i + 1
NovaLista.append(str(pin) + str(checksum))
#---output wordlist
with open('wps2.txt', 'w') as f:
for item in NovaLista:
print >> f, item
#---output wordlist