-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhcx-genlst-hswifi
executable file
·55 lines (41 loc) · 1.27 KB
/
hcx-genlst-hswifi
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
#!/usr/bin/env python3
# generate wordlist from word
import sys
# print usage
if len(sys.argv) <= 1:
print("USAGE: " + sys.argv[0] + " <words.txt>")
exit()
def out(word):
print(word)
# num variations
def print_wi(word, i): out(word + i)
def print_iw(word, i): out(i + word)
def genlst(word, callback):
for i in range(0, 10000):
callback(word, str(i).rjust(4, '0'))
words = set()
def addword(word):
if word not in words:
words.add(word)
file_path = sys.argv[1]
with open(file_path, 'r') as file:
lines = [line.strip() for line in file]
for i in lines:
addword(i)
words_n = len(words)
update_interval = words_n // 100
if update_interval == 0: # Handle case where words_n is less than 100
update_interval = 1
def print_progress_bar(current, total, length=50):
percent_complete = (current / total) * 100
filled_length = int(length * percent_complete // 100)
bar = '#' * filled_length + '-' * (length - filled_length)
sys.stderr.write(f'\r[{bar}] {percent_complete:.0f}% Complete')
sys.stderr.flush()
for x, i in enumerate(words):
if x % update_interval == 0 or x == words_n - 1:
print_progress_bar(x + 1, words_n)
genlst(i, print_wi)
genlst(i, print_iw)
sys.stderr.write(f'\n')
sys.stderr.flush()