-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathZipPassowrdCrack.py
52 lines (45 loc) · 1.28 KB
/
ZipPassowrdCrack.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
#!/usr/bin/env python
#-*- coding: utf-8 -*-
#author:lazynms
import zipfile
import os
import sys
#Zip CrackFunction
def ZipCrackFuc(zipfilename,password):
try:
zipFile=zipfile.ZipFile(zipfilename)
zipFile.extractall(pwd=str(password))
return True
except Exception, e:
return False
clear = lambda: os.system('cls')
def main():
if len(sys.argv)==3:
ZipFileName=sys.argv[1]
PassWordFileName=sys.argv[2]
if not os.path.isfile(ZipFileName):
print "[-] "+ZipFileName+" does not exists..."
exit(0)
if not os.access(PassWordFileName,os.R_OK):
print "[-] "+PassWordFileName+" access denied..."
exit(0)
#everything ok! let's try to crack it
print "[+] Cracking ...."
pwdfilenamefp=open(PassWordFileName,"r") #open the password
# try every password if succeed and return True
for linepassword in pwdfilenamefp:
crackpassword=linepassword.split()[0]
CrackResult=ZipCrackFuc(ZipFileName,crackpassword)
# If Ret True and then break
if CrackResult == True:
print "[+] "+"Crack Success!"+" PassWord: "+crackpassword
break
else:
continue
pwdfilenamefp.close()
else:
print "[-]\t "+"Usage:"
print "[-]\t "+sys.argv[0]+" Crack.zip(Your Zipfile) "+" pass.txt(Your Password File)"
print "[+] "+"Cracking End..."
if __name__=="__main__":
main()