-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathscript.py
41 lines (29 loc) · 1.11 KB
/
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
# import necessary modules
from pathlib import Path
from zipfile import ZipFile
from tqdm import tqdm
# import the word-list
word_list = Path(str(input('[0] Word List Path: ')))
zip_file_path = Path(str(input('[1] Zip File Path: ')))
def crack_password():
# initialize the zip-file object
zip_file = ZipFile(zip_file_path)
# count the number of words in the word-list
n_words = len(list(open(word_list, 'rb')))
# check how many passwords there are to test
print('[2] Total passwords to test:', f'{n_words:,}')
with open(word_list, 'rb') as wordlist:
for word in tqdm(wordlist, total=n_words, unit='word'):
try:
zip_file.extractall(pwd=word.strip())
except:
continue
else:
print('\n[+] Password found:', word.decode().strip())
exit(0)
print("\n[!] Password not found, try other wordlist.")
if word_list.exists() and zip_file_path.exists():
crack_password()
else:
print('[x] An incorrect or non-existent path was entered')
exit(1)