-
Notifications
You must be signed in to change notification settings - Fork 0
/
keygen-dictionary.py
executable file
·213 lines (183 loc) · 7.51 KB
/
keygen-dictionary.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
#!/usr/bin/python3
import os
import itertools
import operator
from datetime import datetime
class DictionaryMaker:
def __init__(self):
self.aditionalData = []
self.simpleCollection = ["admin", "adm", "adm", ".", "-", "_", "@"]
self.convinationLevel = 2
self.domainName = False
self.fullName = False
self.address = False
self.importantDate = False
self.identification = False
self.fillSimpleCollection()
def fillSimpleCollection(self):
# Populate with the latest 10 years
current_year = datetime.now().year
list_years = [str(i) for i in range(current_year -10, current_year)]
list_years_end = [str(i)[-2:] for i in range(current_year -10, current_year)]
self.simpleCollection.extend(list_years)
self.simpleCollection.extend(list_years_end)
print(self.simpleCollection)
def welcome(self):
print("Welcome human, Please answer the following questions...")
self.getInputs()
self.processInput()
self.generateDictionary()
def getInputs(self):
print("Usage: it is possible to enter an empty response...")
convination = input("convination level: (2 recomended)")
self.convinationLevel = 2
if convination != "" :
self.convinationLevel = int(convination)
self.makeQuestion("Domain url?", "domainName")
self.makeQuestion("Address?", "address")
self.makeQuestion("Full Name?", "fullName")
self.makeQuestion(
"Birthdate or important date?(dd-mm-yyyy)", "importantDate")
self.makeQuestion(
"Identifier or identification number?", "identification")
self.makeQuestion("Aditional data?", "aditionalData")
def processNumbers(self, inStr):
numbers = [str(s) for s in inStr.split() if s.isdigit()]
response = []
for number in numbers:
for i in range(1, len(number)):
res = itertools.product(number, repeat=i)
for convination in res:
response.append(''.join(convination))
return response
def processStr(self, inStr):
response = [str(s) for s in inStr.split() if not s.isdigit()]
response.append(inStr)
response.append("".join(inStr.split()))
return response
def processName(self, inStr):
response = self.processStr(inStr)
words = [str(s) for s in inStr.split() if not s.isdigit()]
for word in words:
response.append(word[0])
response.append(word[0].title())
res = itertools.product(response, repeat=2)
for convination in res:
response.append(''.join(convination))
return self.cleanList(response)
def processDomain(self, inStr):
response = []
response.append(inStr)
response.extend(inStr.split("."))
return response
def processAddress(self, inStr):
response = []
response.append(inStr)
response.extend(inStr.split())
response.append(''.join(inStr.split()))
response.extend(self.processNumbers(inStr))
response.extend(self.processStr(inStr))
return response
def processDate(self, inStr):
response = []
if "/" in inStr:
response.extend(inStr.split("/"))
if "-" in inStr:
response.extend(inStr.split("-"))
if len(response) == 3 and len(response[2]) == 4:
response.append(response[2][:2])
response.append(response[2][2:])
if len(response) == 0:
return response
res = itertools.combinations(response, 3)
for convination in res:
response.append(''.join(convination))
print("date convinations: " + str(len(response)) + ".")
return self.cleanList(response)
def processIdentification(self, inStr):
if(len(str(inStr)) == 1):
numbers = [str(inStr)]
else:
numbers = [str(s) for s in inStr.split() if s.isdigit()]
response = []
for number in numbers:
for i in range(1, len(number)):
response.append(number[0:i])
response.append(number[:i])
return self.cleanList(response)
def makeQuestion(self, questionStr, storeStr):
nextQuestion = True
if not getattr(self, storeStr):
setattr(self, storeStr, [])
storeSelf = getattr(self, storeStr)
while nextQuestion:
tempAnswer = input(questionStr + " (empty = next question): ")
if tempAnswer != "":
storeSelf.append(tempAnswer)
else:
nextQuestion = False
setattr(self, storeStr, storeSelf)
def processInput(self):
print("Starting processing...")
if len(self.domainName) > 0:
print("Processing domain name...")
for domain in self.domainName:
self.simpleCollection.extend(self.processDomain(domain))
if len(self.fullName) > 0:
print("Processing full name...")
for fullName in self.fullName:
self.simpleCollection.extend(self.processName(fullName))
if len(self.address) > 0:
print("Processing address...")
for address in self.address:
self.simpleCollection.extend(self.processAddress(address))
if len(self.aditionalData) > 0:
print("Processing additional data...")
for data in self.aditionalData:
self.simpleCollection.extend(self.processStr(data))
if len(self.importantDate) > 0:
print("Processing dates...")
for date in self.importantDate:
self.simpleCollection.extend(self.processDate(date))
if len(self.identification) > 0:
print("Processing identification...")
for identification in self.identification:
self.simpleCollection.extend(
self.processIdentification(identification))
tempTitles = []
for text in self.simpleCollection:
if not str(text).title() in tempTitles:
tempTitles.append(str(text).title())
self.simpleCollection.extend(tempTitles)
self.greenPrint("Done")
def cleanList(self, list):
return sorted(set(list))
def greenPrint(self, text):
print('\033[92m' + text + " " + u'\u2713' + '\033[0m')
def generateDictionary(self):
print("making words convinations...")
print(str(len(self.simpleCollection)) + " words.")
lines = []
for i in range(1, self.convinationLevel + 1):
print("starting level: " + str(i) + ".")
res = itertools.product(self.cleanList(
self.simpleCollection), repeat=i)
for j in res:
posiblePass = ''.join(j)
lines.append(posiblePass)
self.greenPrint("leven " + str(i) + ": done")
print("cleaning List... " + str(len(lines)))
lines = self.cleanList(lines)
self.greenPrint("clen list done lines: " + str(len(lines)) + ".")
print("writing " + str(len(lines)) + " lines in file...")
self.makeFile(lines)
self.greenPrint("write file done")
def makeFile(self, lines):
with open('pass.txt', 'a') as passFile:
for line in lines:
passFile.write(line + '\n')
try:
dictionaryMaker = DictionaryMaker()
dictionaryMaker.welcome()
except KeyboardInterrupt:
print("\n\nKeygen interrupt, Bye!")