-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfluffy
342 lines (292 loc) · 18.1 KB
/
fluffy
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
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
#!/usr/bin/env python3
# -d difficulty level
# -l <min> <max> limit
# -m mode
# -o output
# -s special characters
# -w meaningful words
# ----------- MODULES ----------------
import os
import sys
import itertools
# ---------- VARIABLES ---------------
wordArray = []
newArray = []
level = 4
bottomLimit = 8
topLimit = 12
meaningfulList = []
outputFile = "wordlist.txt"
openFileMode = "w"
specialChars = ""
# --------- FUNCTIONS ----------------
def WriteToFile (outputFile,openFileMode,level):
with open(outputFile,openFileMode) as file:
if level<=4:
for word in wordArray:
file.write(str(word)+"\n")
else:
for word in newArray:
file.write(str(word)+"\n")
def Combination (listv):
temp = 2
array = []
while temp<=len(listv):
array.extend([val for val in itertools.combinations(listv,temp)])
temp+=1
return array
def ToggleFunc (listv,level): # Function for 5th and 6th Level
for value in listv:
x=0
while x<len(value):
newArray.append(value[:x]+value[x].swapcase()+value[x+1:])
x+=1
if level==6: # Just for 6th Level
array = list(set(Combination(value)))
y=0
while y<len(value):
indices=[]
for i in array[y]:
indices.append(value.index(i))
newArray.extend(["".join(char.upper() if i in indices else char for i,char in enumerate(value))])
y+=1
def Level1(words,bottomLimit,topLimit):
x=0
while x<len(words):
temp = words[x]
wordArray.extend([str(temp)+str(val) for val in words if len(str(temp)+str(val))>=bottomLimit and len(str(temp)+str(val))<=topLimit])
wordArray.extend([str(val)+str(temp) for val in words if len(str(temp)+str(val))>=bottomLimit and len(str(temp)+str(val))<=topLimit])
wordArray.extend([str(val)+str(val) for val in words if len(str(temp)+str(val))>=bottomLimit and len(str(temp)+str(val))<=topLimit])
wordArray.extend([str(temp)+str(temp) for val in words if len(str(temp)+str(val))>=bottomLimit and len(str(temp)+str(val))<=topLimit])
x+=1
def Level2(words,bottomLimit,topLimit):
Level1(words,bottomLimit,topLimit)
x=0
swap = lambda word: word.swapcase()
while x<len(words):
temp= words[x]
y=0
while y<len(temp):
wordArray.extend([str(temp[y:])+str(val) for val in words if len(str(temp[y:])+str(val))>=bottomLimit and len(str(temp[y:])+str(val))<=topLimit])
wordArray.extend([str(val)+str(temp[y:]) for val in words if len(str(val)+str(temp[y:]))>=bottomLimit and len(str(val)+str(temp[y:]))<=topLimit])
wordArray.extend([str(temp[:y])+str(val) for val in words if len(str(temp[:y])+str(val))>=bottomLimit and len(str(temp[:y])+str(val))<=topLimit])
wordArray.extend([str(val)+str(temp[:y]) for val in words if len(str(val)+str(temp[:y]))>=bottomLimit and len(str(val)+str(temp[:y]))<=topLimit])
y+=1
wordArray.extend([swap(str(temp))+str(val) for val in words if len(str(temp)+str(val))>=bottomLimit and len(str(temp)+str(val))<=topLimit])
wordArray.extend([str(temp)+swap(str(val)) for val in words if len(str(temp)+str(val))>=bottomLimit and len(str(temp)+str(val))<=topLimit])
wordArray.extend([swap(str(temp))+swap(str(val)) for val in words if len(str(temp)+str(val))>=bottomLimit and len(str(temp)+str(val))<=topLimit])
x+=1
def Level3(words,bottomLimit,topLimit,specialChars):
Level1(words,bottomLimit,topLimit)
Level2(words,bottomLimit,topLimit)
x=0
while x<len(words):
temp = words[x]
for char in specialChars:
wordArray.extend([str(temp)+str(val)+str(char) for val in words if len(str(temp)+str(val)+str(char))>=bottomLimit and len(str(temp)+str(val)+str(char))<=topLimit])
wordArray.extend([str(temp)+str(char)+str(val) for val in words if len(str(temp)+str(char)+str(val))>=bottomLimit and len(str(temp)+str(char)+str(val))<=topLimit])
wordArray.extend([str(char)+str(temp)+str(val) for val in words if len(str(char)+str(temp)+str(val))>=bottomLimit and len(str(char)+str(temp)+str(val))<=topLimit])
x+=1
def Level4(words,bottomLimit,topLimit,specialChars):
Level1(words,bottomLimit,topLimit)
Level2(words,bottomLimit,topLimit)
Level3(words,bottomLimit,topLimit,specialChars)
x=0
while x<len(words):
temp = words[x]
y=0
while y<len(temp):
for char in specialChars:
wordArray.extend([str(temp[y:])+str(char)+str(val) for val in words if len(str(temp[y:])+str(char)+str(val))>=bottomLimit and len(str(temp[y:])+str(char)+str(val))<=topLimit])
wordArray.extend([str(val)+str(char)+str(temp[y:]) for val in words if len(str(val)+str(char)+str(temp[y:]))>=bottomLimit and len(str(val)+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(temp[:y])+str(char)+str(val) for val in words if len(str(temp[:y])+str(char)+str(val))>=bottomLimit and len(str(temp[:y])+str(char)+str(val))<=topLimit])
wordArray.extend([str(val)+str(char)+str(temp[:y]) for val in words if len(str(val)+str(char)+str(temp[:y]))>=bottomLimit and len(str(val)+str(char)+str(temp[:y]))<=topLimit])
wordArray.extend([str(temp[y:])+str(char)+str(val[y:]) for val in words if len(str(temp[y:])+str(char)+str(val[y:]))>=bottomLimit and len(str(temp[y:])+str(char)+str(val[y:]))<=topLimit])
wordArray.extend([str(val[y:])+str(char)+str(temp[y:]) for val in words if len(str(val[y:])+str(char)+str(temp[y:]))>=bottomLimit and len(str(val[y:])+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(temp[:y])+str(char)+str(val[y:]) for val in words if len(str(temp[:y])+str(char)+str(val[y:]))>=bottomLimit and len(str(temp[:y])+str(char)+str(val[y:]))<=topLimit])
wordArray.extend([str(val[y:])+str(char)+str(temp[:y]) for val in words if len(str(val[y:])+str(char)+str(temp[:y]))>=bottomLimit and len(str(val[y:])+str(char)+str(temp[:y]))<=topLimit])
wordArray.extend([str(temp[y:])+str(char)+str(val[:y]) for val in words if len(str(temp[y:])+str(char)+str(val[:y]))>=bottomLimit and len(str(temp[y:])+str(char)+str(val[:y]))<=topLimit])
wordArray.extend([str(val[:y])+str(char)+str(temp[y:]) for val in words if len(str(val[:y])+str(char)+str(temp[y:]))>=bottomLimit and len(str(val[:y])+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(temp[:y])+str(char)+str(val[:y]) for val in words if len(str(temp[:y])+str(char)+str(val[:y]))>=bottomLimit and len(str(temp[:y])+str(char)+str(val[:y]))<=topLimit])
wordArray.extend([str(val[:y])+str(char)+str(temp[:y]) for val in words if len(str(val[:y])+str(char)+str(temp[:y]))>=bottomLimit and len(str(val[:y])+str(char)+str(temp[:y]))<=topLimit])
wordArray.extend([str(char)+str(temp[y:])+str(val) for val in words if len(str(temp[y:])+str(char)+str(val))>=bottomLimit and len(str(temp[y:])+str(char)+str(val))<=topLimit])
wordArray.extend([str(char)+str(val)+str(temp[y:]) for val in words if len(str(val)+str(char)+str(temp[y:]))>=bottomLimit and len(str(val)+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(char)+str(temp[:y])+str(val) for val in words if len(str(temp[:y])+str(char)+str(val))>=bottomLimit and len(str(temp[:y])+str(char)+str(val))<=topLimit])
wordArray.extend([str(char)+str(val)+str(temp[:y]) for val in words if len(str(val)+str(char)+str(temp[:y]))>=bottomLimit and len(str(val)+str(char)+str(temp[:y]))<=topLimit])
wordArray.extend([str(char)+str(temp[y:])+str(val[y:]) for val in words if len(str(temp[y:])+str(char)+str(val[y:]))>=bottomLimit and len(str(temp[y:])+str(char)+str(val[y:]))<=topLimit])
wordArray.extend([str(char)+str(val[y:])+str(temp[y:]) for val in words if len(str(val[y:])+str(char)+str(temp[y:]))>=bottomLimit and len(str(val[y:])+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(char)+str(temp[:y])+str(val[y:]) for val in words if len(str(temp[:y])+str(char)+str(val[y:]))>=bottomLimit and len(str(temp[:y])+str(char)+str(val[y:]))<=topLimit])
wordArray.extend([str(char)+str(val[y:])+str(temp[:y]) for val in words if len(str(val[y:])+str(char)+str(temp[:y]))>=bottomLimit and len(str(val[y:])+str(char)+str(temp[:y]))<=topLimit])
wordArray.extend([str(char)+str(temp[y:])+str(val[:y]) for val in words if len(str(temp[y:])+str(char)+str(val[:y]))>=bottomLimit and len(str(temp[y:])+str(char)+str(val[:y]))<=topLimit])
wordArray.extend([str(char)+str(val[:y])+str(temp[y:]) for val in words if len(str(val[:y])+str(char)+str(temp[y:]))>=bottomLimit and len(str(val[:y])+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(char)+str(temp[:y])+str(val[:y]) for val in words if len(str(temp[:y])+str(char)+str(val[:y]))>=bottomLimit and len(str(temp[:y])+str(char)+str(val[:y]))<=topLimit])
wordArray.extend([str(char)+str(val[:y])+str(temp[:y]) for val in words if len(str(val[:y])+str(char)+str(temp[:y]))>=bottomLimit and len(str(val[:y])+str(char)+str(temp[:y]))<=topLimit])
wordArray.extend([str(temp[y:])+str(val)+str(char) for val in words if len(str(temp[y:])+str(char)+str(val))>=bottomLimit and len(str(temp[y:])+str(char)+str(val))<=topLimit])
wordArray.extend([str(val)+str(temp[y:])+str(char) for val in words if len(str(val)+str(char)+str(temp[y:]))>=bottomLimit and len(str(val)+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(temp[:y])+str(val)+str(char) for val in words if len(str(temp[:y])+str(char)+str(val))>=bottomLimit and len(str(temp[:y])+str(char)+str(val))<=topLimit])
wordArray.extend([str(val)+str(temp[:y])+str(char) for val in words if len(str(val)+str(char)+str(temp[:y]))>=bottomLimit and len(str(val)+str(char)+str(temp[:y]))<=topLimit])
wordArray.extend([str(temp[y:])+str(val[y:])+str(char) for val in words if len(str(temp[y:])+str(char)+str(val[y:]))>=bottomLimit and len(str(temp[y:])+str(char)+str(val[y:]))<=topLimit])
wordArray.extend([str(val[y:])+str(temp[y:])+str(char) for val in words if len(str(val[y:])+str(char)+str(temp[y:]))>=bottomLimit and len(str(val[y:])+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(temp[:y])+str(val[y:])+str(char) for val in words if len(str(temp[:y])+str(char)+str(val[y:]))>=bottomLimit and len(str(temp[:y])+str(char)+str(val[y:]))<=topLimit])
wordArray.extend([str(val[y:])+str(temp[:y])+str(char) for val in words if len(str(val[y:])+str(char)+str(temp[:y]))>=bottomLimit and len(str(val[y:])+str(char)+str(temp[:y]))<=topLimit])
wordArray.extend([str(temp[y:])+str(val[:y])+str(char) for val in words if len(str(temp[y:])+str(char)+str(val[:y]))>=bottomLimit and len(str(temp[y:])+str(char)+str(val[:y]))<=topLimit])
wordArray.extend([str(val[:y])+str(temp[y:])+str(char) for val in words if len(str(val[:y])+str(char)+str(temp[y:]))>=bottomLimit and len(str(val[:y])+str(char)+str(temp[y:]))<=topLimit])
wordArray.extend([str(temp[:y])+str(val[:y])+str(char) for val in words if len(str(temp[:y])+str(char)+str(val[:y]))>=bottomLimit and len(str(temp[:y])+str(char)+str(val[:y]))<=topLimit])
wordArray.extend([str(val[:y])+str(temp[:y])+str(char) for val in words if len(str(val[:y])+str(char)+str(temp[:y]))>=bottomLimit and len(str(val[:y])+str(char)+str(temp[:y]))<=topLimit])
y+=1
x+=1
def Level5(words,bottomLimit,topLimit,specialChars):
Level1(words,bottomLimit,topLimit)
Level2(words,bottomLimit,topLimit)
Level3(words,bottomLimit,topLimit,specialChars)
Level4(words,bottomLimit,topLimit,specialChars)
ToggleFunc(wordArray,5)
def Level6(words,bottomLimit,topLimit,specialChars):
Level1(words,bottomLimit,topLimit)
Level2(words,bottomLimit,topLimit)
Level3(words,bottomLimit,topLimit,specialChars)
Level4(words,bottomLimit,topLimit,specialChars)
Level5(words,bottomLimit,topLimit,specialChars)
ToggleFunc(wordArray,6)
def usage():
print("""
Some syntax examples:
fluffy -l 7 10 -o output.txt -m a -w muhammet ozturk 2017 -d 4 -s ?!^
description: limit 7 to 10, mode is append(a), words are "muhammet","ozturk","2017",
difficulty is 4 (add the special characters to everywhere), special characters are "?","!" and "^"
fluffy -w the quick brown fox jumps over a lazy dog -d 6 -s ?!*/^-#
description: words are "the","quick","brown","fox","jumps","over","a","lazy","dog", difficulty is 6 (top level)
by default the case limit is 8 to 12, so some words are will no print to output file.
""")
def helpFunc():
print("""
Fluffy creates wordlist including meaningful words.
Options:
-d difficulty level, as far as you know, how can the password be ?!? by default 4
for example: expectotr fluffy
level 1: thats basic, add to each other => expectotrfluffy
level 2: subtract and swap case a word => expectFLUFFY
level 3: add the special characters that given to head,middle and end => eXpect!fluffy
level 4: add the special characters everywhere (only once) => expeluffy!
level 5: swap case a few letter => expecfLuffy
level 6: combination the all things => expECTfluF!fy
-l <min> <max> limit, how long are the passwords ? You can learn this,trought to your social talent.
By default : 8 (min) 12 (max)
-m mode, what is the mode of opening file, by default : w
Probabilities:
a - append mode , append to the end of the file ex.
w - write mode, write to the file, if the file is not empty,erase all and write the new list to file
-o output file, determine the output file, by default : wordlist.txt
-s special characters
-w words, this option get meaningful words
""")
# ------------- SYSTEM ARGS -------------------
try:
if len(sys.argv) == 2:
if "--help" in sys.argv:
helpFunc()
else:
usage()
elif len(sys.argv) > 2:
if "-o" in sys.argv:
outputFile = sys.argv[sys.argv.index("-o")+1]
if "-w" in sys.argv:
a = sys.argv.index("-w")+1
while a < len(sys.argv):
if "-" not in sys.argv[a]:
meaningfulList.append(sys.argv[a])
else:
break
a+=1
if "-d" in sys.argv:
level = int(sys.argv[sys.argv.index("-d")+1])
if level<1 and level>6:
print("You can use only 1 to 6!")
usage()
if "-l" in sys.argv:
if int(sys.argv[sys.argv.index("-l")+1]) <= int(sys.argv[sys.argv.index("-l")+2]):
bottomLimit = int(sys.argv[sys.argv.index("-l")+1])
topLimit = int(sys.argv[sys.argv.index("-l")+2])
else:
print("Invalid limit.The first must be smaller than the second.")
usage()
if "-s" in sys.argv:
specialChars = sys.argv[sys.argv.index("-s")+1]
if "-m" in sys.argv:
if sys.argv[sys.argv.index("-m")+1] == "a" or sys.argv[sys.argv.index("-m")+1] == "w":
openFileMode = sys.argv[sys.argv.index("-m")+1]
else:
print("Unsupported open file mode! You can use \"w\" or \"a\"")
sys.exit()
else:
usage()
except (IndexError):
usage()
# ----------------- PROGRAM -----------------------
if len(sys.argv) > 2:
if level == 1:
os.system("clear")
print("Preparing...")
Level1(meaningfulList,bottomLimit,topLimit)
wordArray = list(set(wordArray))
WriteToFile(outputFile,openFileMode,1)
elif level== 2:
os.system("clear")
print("Preparing...")
Level2(meaningfulList,bottomLimit,topLimit)
wordArray = list(set(wordArray))
WriteToFile(outputFile,openFileMode,2)
if level== 3:
os.system("clear")
print("Preparing...")
if "-s" not in sys.argv and len(sys.argv)>2:
print("Special characters must defined!!\n")
usage()
sys.exit()
Level3(meaningfulList,bottomLimit,topLimit,specialChars)
wordArray = list(set(wordArray))
WriteToFile(outputFile,openFileMode,3)
if level== 4:
os.system("clear")
print("Preparing...")
if "-s" not in sys.argv and len(sys.argv)>2:
print("Special characters must defined!!\n")
usage()
sys.exit()
Level4(meaningfulList,bottomLimit,topLimit,specialChars)
wordArray = list(set(wordArray))
WriteToFile(outputFile,openFileMode,4)
if level == 5:
os.system("clear")
print("Preparing...")
if "-s" not in sys.argv and len(sys.argv)>2:
print("Special characters must defined!!\n")
usage()
sys.exit()
Level5(meaningfulList,bottomLimit,topLimit,specialChars)
newArray = list(set(newArray))
WriteToFile(outputFile,openFileMode,5)
if level == 6:
os.system("clear")
print("Preparing...")
if "-s" not in sys.argv and len(sys.argv)>2:
print("Special characters must defined!!\n")
usage()
sys.exit()
Level6(meaningfulList,bottomLimit,topLimit,specialChars)
newArray = list(set(newArray))
WriteToFile(outputFile,openFileMode,6)
os.system("clear")
print("""
Outputs
-m mode {}
-w words {}
-o output {}
-l limits {} to {}
-d difficulty {}
-s special characters {}
""".format(openFileMode,meaningfulList,outputFile,bottomLimit,topLimit,level,specialChars))
if level<=4:
print("List length: {}".format(len(wordArray)))
else:
print("List length: {}".format(len(newArray)))