-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
42 lines (34 loc) · 956 Bytes
/
main.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
import zipfile
import os
import time
zip_file = input("[+] ZIP file: ")
word_list = input("[+] Password list: ")
start = time.time()
end = time.time()
def alertAndExit(message):
print(message)
os.sys.exit()
try:
zipf = zipfile.ZipFile(zip_file)
except zipfile.BadZipfile:
alertAndExit("[!] Bad or collapsed zip file.")
except FileNotFoundError:
alertAndExit("[!] Zip file is not found.")
try:
open(word_list, "rb")
except FileNotFoundError:
alertAndExit("[!] Wordlist is not found.")
with open(word_list, "rb") as f:
passes = [x.strip() for x in f.readlines()]
for x in passes:
print(x)
print(f"Trying {x.decode('utf8')}")
try:
zipf.extractall('results', None, x)
print("[*] Password found.")
end = time.time()
print("Total time used:", (end - start)//60, " mins", (end - start)%60, " seconds")
alertAndExit(f"[*] Password: {x.decode('utf8')}")
except Exception:
pass
print("[!] Valid password is not found.")