-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.py
70 lines (64 loc) · 2.17 KB
/
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
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
import pyzipper
import os
from datetime import datetime
import tkinter as tk
from tkinter import filedialog
import threading
import time
tries = 0
os.system("title ZiPCracker")
#Helpers
def cls():
os.system("cls")
def title(total):
while True:
os.system(f"title {tries}/{total}")
time.sleep(0.00001)
#Main
def crack(file, wordlist):
global tries
cls()
print("Loading Wordlist")
words = []
os.system("title Loading wordlist")
wordlistsize = 0
startTime = datetime.now()
with open (wordlist.name, "r", encoding="latin-1") as f:
lines = f.readlines()
for line in lines:
line = line.replace("\n", "")
wordlistsize += 1
words.append(line)
print(f"Word list loaded. Took: {(datetime.now() - startTime).total_seconds()}")
foldername = file.name.split("/")[-1]
foldername = foldername.split(".")[0]
x = threading.Thread(target=title, args=(str(wordlistsize),))
x.start()
for word in words:
try:
with pyzipper.AESZipFile(file.name, "r") as z:
z.extractall(foldername, pwd=bytes(word, 'utf-8'))
except PermissionError:
print("I don't have permission to create a folder here!")
return
except:
tries += 1
else:
print(f"The password was found. It is \"{word}\" and it was found at the try {tries}")
os.system(f"explorer \"{os.getcwd()}\\{foldername}\"")
return
print("The password was not found. Try using another wordlist")
root = tk.Tk()
root.withdraw()
print("What file do you want to crack")
file = filedialog.askopenfile(mode='r', title="Select a file to crack", initialdir=os.getcwdb(), filetypes=(("Zip file", ".zip"),))
print(file)
print("Select your wordlist (If you don't have search for \"Rockyou\")")
wordlist = filedialog.askopenfile(mode='r', title="Wordlist", initialdir=os.getcwdb(), filetypes=(("Text files", ".txt"),))
try:
crack(file, wordlist)
print("Program stopped")
os.system("pause >nul")
except KeyboardInterrupt:
print("leaving")
time.sleep(2)