-
Notifications
You must be signed in to change notification settings - Fork 0
/
Zip Password Recover.pyw
222 lines (201 loc) · 8.31 KB
/
Zip Password Recover.pyw
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
import webbrowser,os,shutil
from pathlib import Path
import tkinter as tk
from tkinter.ttk import *
import tkinter.ttk as ttk
from tkinter.filedialog import askopenfilename
from tkinter import messagebox
global root,username,style
import re
from itertools import product
from subprocess import PIPE,Popen,CREATE_NO_WINDOW,call
global zip7
import hashlib
import urllib.request
checkhash = True
root = tk.Tk()
root.title("Zip password recover")
root.configure(background='#202020')
root.geometry("204x160")
root.resizable(False,False)
usbtn = ttk.Style()
usbtn.theme_use("alt")
usbtn.configure("cyan.TButton",height = 1,width = 25,foreground = "cyan",background = "#202020",activebackground = "#202124",border = 0)
usbtn.map("cyan.TButton",
foreground=[('pressed', 'blue'), ('active', 'white'),('disabled', 'red')],
background=[('pressed', '#101010'), ('active', '#202020')],
)
def hash_bytestr_iter(bytesiter, hasher, ashexstr=False):
for block in bytesiter:
hasher.update(block)
return hasher.hexdigest() if ashexstr else hasher.digest()
def file_as_blockiter(afile, blocksize=65536):
with afile:
block = afile.read(blocksize)
while len(block) > 0:
yield block
block = afile.read(blocksize)
try:
hashfolder = []
for fname in os.listdir():
try:
if fname == "Zip Password Recover.pyw":
hashfolder.append((str(hash_bytestr_iter(file_as_blockiter(open(fname, 'rb')), hashlib.sha256()))))
except:
pass
hashfolder = ''.join(hashfolder)
githublink = []
for line in urllib.request.urlopen("https://raw.githubusercontent.com/LoreBadTime/zip-password-recover/main/hash.txt"):
githublink = line.decode('utf-8')
hashonline = ''
for letter in githublink:
if letter != '\n':
hashonline = hashonline + letter
if str(hashonline) != str(hashfolder):
checkhash = False
del hashonline
del githublink
del hashfolder
except:
checkhash = False
selection = 0
filename = ""
txt1=""
txt3="Chose file"
def openlicence():
webbrowser.open("https://github.com/LoreBadTime/zip-password-recover/blob/main/LICENSE", new=2)
try:
root.iconbitmap('icon.ico')
except:
pass
def breacker():
global T,zip7
chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789\|"£$/()=><._-çò@?ìà°#ù#*+]}èé[{'
for length in range(1, 32):
to_attempt = product(chars, repeat=length)
for attempt in to_attempt:
passwd = ''.join(attempt)
try:
T.delete('1.0', tk.END)
T.insert(tk.END, passwd)
except:
pass
output = Popen(str(zip7 + ' x -p"'+ str(passwd) + '" ' + file + ' -y'),stderr=PIPE,stdin=PIPE, stdout=PIPE,creationflags = CREATE_NO_WINDOW)
streamdata = output.communicate()[0]
rc = output.returncode
if rc == 0:
try:
T.delete('1.0', tk.END)
final = "files recovered pass: \n" + passwd
T.insert(tk.END, final)
except:
pass
return
try:
root.update()
except:
return
def open7z():
webbrowser.open('https://www.7-zip.org/', new=2)
try:
root.destroy()
except:
pass
def callback():
global build,filename,T,b,k,c,directory,file,f_w_ext,configfile,chars
filename = askopenfilename()
directory = os.path.dirname(filename)
file = os.path.basename(filename)
f_w_ext = Path(filename).stem
if filename == "" or (file.endswith('.7z') != True and file.endswith('.zip') != True and file.endswith('.rar') != True):
T.delete('1.0', tk.END)
T.insert(tk.END, "Warning no file chosen")
k.state(["disabled"])
else:
T.delete('1.0', tk.END)
T.insert(tk.END, file)
k.state(["!disabled"])
try:
return filename,directory,file,f_w_ext
except:
pass
def cracker():
global filename,directory,file,f_w_ext
if filename == "" or filename == None or (file.endswith('.7z') != True and file.endswith('.zip') != True and file.endswith('.rar') != True):
T.delete('1.0', tk.END)
T.insert(tk.END, "Warning no file chosen")
k.state(["disabled"])
else:
os.chdir(directory)
if filename != "":
T.delete('1.0', tk.END)
T.insert(tk.END, file)
root.update()
if (file.endswith('.7z') != True and file.endswith('.zip') != True and file.endswith('.rar') != True):
T.delete('1.0', tk.END)
T.insert(tk.END, "not a source file")
k.state(["disabled"])
else:
T.delete('1.0', tk.END)
T.insert(tk.END, file)
breacker()
try:
return filename,directory,file,f_w_ext
except:
pass
licenceacp = False
try:
if os.path.isfile('ACCEPTEDLIC') == True:
licenceacp = True
else:
licenceacp = messagebox.askyesno("Disclamer", "The program that is licensed to you is absolutely legal and you can use it provided that you are the legal owner of all files or data you are going to recover through the use of this software or have permission from the legitimate owner to perform these acts. Any illegal use of this software will be solely your responsibility. Accordingly, you affirm that you have the legal right to access all data, information and files that have been hidden.You further attest that the recovered data, passwords and/or files will not be used for any illegal purpose. Be aware password recovery and the subsequencial data decryption of unauthorized or otherwise illegally obtained files may constitute theft or another wrongful action and may result in your civil and (or) criminal prosecution,this popup will appear only the first time")
if licenceacp == False:
exit()
else:
with open("ACCEPTEDLIC", "w+"):
pass
except:
pass
if os.path.isfile("C:\\Program Files\\7-Zip\\7z.exe") == True or os.path.isfile("C:\\Program Files (x86)\\7-Zip\\7z.exe") == True :
root.geometry("204x160")
if os.path.isfile("C:\\Program Files\\7-Zip\\7z.exe") == True:
zip7 = '"C:\\Program Files\\7-Zip\\7z.exe"'
else:
zip7 = '"C:\\Program Files (x86)\\7-Zip\\7z.exe"'
c = ttk.Button(root, text=txt3)
c.configure(command=lambda :callback(),style = "cyan.TButton")
c.place(x=20 ,y=20)
k = ttk.Button(root, text="Recover archive",style = "cyan.TButton")
k.state(["disabled"])
k.configure(command=lambda :cracker())
k.place(x=20 ,y=50)
w = ttk.Button(root, text="Licence",style = "cyan.TButton")
w.configure(command=lambda :openlicence())
w.place(x=20 ,y=80)
T = tk.Text(root, height = 2, width = 22,)
T.place(x=10 ,y=110)
T.insert(tk.END, "Chose your protected archive")
if licenceacp == False:
exit()
if checkhash == False:
if messagebox.askyesno("Exit", "Cannot verify files integrity,be sure you have downloaded the software from https://github.com/LoreBadTime/zip-password-recover or else i suggest you to do an antivirus scan ,do you want to continue?") == False:
exit()
else:
root.geometry("204x60")
j = tk.Button(root, text="Download 7zip", height = 1,width = 25,activebackground='black',background='black',foreground='cyan',activeforeground='yellow')
j.configure(command=lambda :open7z())
j.place(x=10 ,y=20)
if licenceacp == False:
exit()
if checkhash == False:
if messagebox.askyesno("Exit", "Cannot verify files integrity,be sure you have downloaded the software from https://github.com/LoreBadTime/zip-password-recover or else i suggest you to do an antivirus scan ,do you want to continue?") == False:
exit()
def close():
if messagebox.askokcancel("Exit", "Do you want to exit?"):
root.destroy()
try:
root.protocol("WM_DELETE_WINDOW", close)
except:
pass
root.mainloop()
#by LorebadTime