-
Notifications
You must be signed in to change notification settings - Fork 0
/
CrackRZ.py
53 lines (45 loc) · 1.55 KB
/
CrackRZ.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
###################################
##### Made by Hous Unus ######
###################################
print("""###################################
##### Made by Hous Unus ######
###################################""")
import optparse
import zipfile
import rarfile
import Brute_force as BF
def crack_zip(file,tp,password):
try :
if(tp=="zip"):
file.extractall(pwd= str.encode(password))
else :
file.extractall(pwd= password)
print("Done")
print("[+] Password Found " + password)
return True
except Exception as e:
return False
def main():
PG = BF.password_generator()
parser = optparse.OptionParser("usage %programe " + "-t <fileformat> (zip or rar) -f <zipfileName> ")
parser.add_option("-t",dest = "type",type="string",help = "'rar' or 'zip ")
parser.add_option("-f",dest = "name",type="string",help = "Specify the file name ")
(option ,arg)= parser.parse_args()
if(option.name==None or option.type ==None):
print(parser.usage)
return
else:
name = option.name
if(option.type =="zip"):
file = zipfile.ZipFile(name)
elif(option.type == "rar"):
file = file = rarfile.RarFile(name)
else:
print("Bad file Format")
return
print("[+] Cracking ...")
while True :
if(crack_zip(file,option.type,PG.GetPassword())):
break
if __name__ == "__main__":
main()