-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathtest.py
75 lines (59 loc) · 1.89 KB
/
test.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
from itertools import permutations
# Input data
first_name = 'emmitt'
second_name = 'romano'
surname = 'howard'
birthdate = '15081947'
pfirst_name = 'melissa'
psecond_name = 'hoggan'
pnickname = 'davis'
pbirthdate = '01051959'
petname = 'baibre'
special_text = 'flowers,fish,goat'
special_num = '1,22,123'
# Functions to generate variations
def capitalize_variations(name):
return [name, name.capitalize(), name[:3], name[:3].capitalize()]
def date_variations(date):
return [
date, date[:2], date[2:4], date[4:6], date[6:], date[:4], date[-2:], date[-3:], date[-4:]
]
# Generate permutations
def permut():
a = (
capitalize_variations(first_name) +
capitalize_variations(second_name) +
capitalize_variations(surname) +
date_variations(birthdate) +
capitalize_variations(pfirst_name) +
capitalize_variations(psecond_name) +
capitalize_variations(pnickname) +
date_variations(pbirthdate) +
[petname, petname.capitalize(), petname[:3], petname[:3].capitalize()]
)
special_word = special_text.split(',')
special_numbers = special_num.split(',')
a.extend(special_word)
a.extend(special_numbers)
c = []
b = list(permutations(a, 2))
for pair in b:
if len(pair[0] + pair[1]) >= 6:
c.append(pair[0] + pair[1])
return c
# Save permutations to file and remove duplicates
def save_to_file(filename, data):
with open(filename, 'w') as file:
for item in data:
file.write(f"{item}\n")
def remove_duplicates(filename):
with open(filename, 'r') as file:
lines = set(file.readlines())
with open(filename, 'w') as file:
file.writelines(lines)
# File operations
filename = f'{first_name}.txt'
wordlist = permut()
save_to_file(filename, wordlist)
remove_duplicates(filename)
print(f'Wordlist generated and saved to {filename}')