-
Notifications
You must be signed in to change notification settings - Fork 176
/
zip-cracker.py
executable file
·39 lines (35 loc) · 1.09 KB
/
zip-cracker.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
#!/usr/bin/python
"""
Dictionary attack ZIP password cracker
https://github.com/igniteflow/violent-python/blob/master/pwd-crackers/zip-crack.py
"""
import zipfile
import argparse
def main(zipfilename, dictionary):
counter = 0
"""
Zipfile password cracker using a brute-force dictionary attack
"""
password = None
zip_file = zipfile.ZipFile(zipfilename)
passwords = open(dictionary, 'r').readlines()
for p in passwords:
password = p.strip('\n')
counter = counter + 1
if counter % 10000 == 0:
print "[+] {} password checked so far...".format(counter)
try:
zip_file.extractall(pwd=password)
print 'Password found: %s' % password
except:
pass
if __name__ == '__main__':
parser = argparse.ArgumentParser()
parser.add_argument("zipfilename", help="Specify a .zip file to crack")
parser.add_argument(
"-w", "--wordlist", help="dictionary file")
args = parser.parse_args()
try:
main(args.zipfilename, args.wordlist)
except:
print "[-] arguments error :("