-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathzipcrack.py
49 lines (44 loc) · 1.19 KB
/
zipcrack.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
import zipfile
import os
import sys
import time
def bruteforce(filename,zfile):
#zFile=zfile
dic=open(filename,'r')
line=dic.readline()
while line:
password=line.strip()
#print password
try:
print "[!]Trying password -> "+str(password)
zfile.extractall(pwd=password)
print ("FOUND")
print ("[+]Password cracked ->"+str(password))
#exit(0)
#line=dic.readline()
except Exception , e:
print "[-]NOT MATCHED[-]"
line=dic.readline()
dic.close()
def checkipfile():
if len(sys.argv)==3:
filename=sys.argv[1]
zfile=sys.argv[2]
if not os.path.isfile(filename):
print "[-]File does not exist[-]"
if not os.path.isfile(zfile):
print "[-]File does not exist[-]"
if not os.access(zfile,os.R_OK):
print "[-]File dont have read access[-]"
if not os.access(filename,os.R_OK):
print "[-]File dont have read access[-]"
#pwd=str(os.system('pwd'))
#zfile=pwd+str(zfile)
#print zfile
#time.sleep(10)
ZIPFILE = zipfile.ZipFile(zfile) #!! DAMN IMPORTANT!! -> else will create an [ERROR] "'str' object has no attribute 'extractall' "
bruteforce(filename,ZIPFILE)
def main():
checkipfile()
if __name__=='__main__':
main()