Skip to content

Commit 3fa9ebb

Browse files
Angular OrbitAngular Orbit
Angular Orbit
authored and
Angular Orbit
committed
added brute force script
1 parent 05a9933 commit 3fa9ebb

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed

README.md

+16
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,18 @@
11
# python-zip-bruteforce-gci
22
Python script to brute force a zip file's password from a word list.
3+
4+
```
5+
./brute_force_zip.py --help
6+
7+
usage: brute_force_zip.py [-h] zipfile wordlist
8+
9+
Bruteforce the password of a zip file.
10+
11+
positional arguments:
12+
zipfile
13+
wordlist
14+
15+
optional arguments:
16+
-h, --help show this help message and exit
17+
18+
```

brute_force_zip.py

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
#!/usr/bin/env python3
2+
import zipfile
3+
import argparse
4+
import os
5+
6+
parser = argparse.ArgumentParser(description='Bruteforce the password of a zip file.')
7+
parser.add_argument('zipfile',type=str)
8+
parser.add_argument('wordlist',type=str)
9+
10+
args = parser.parse_args()
11+
zip_file_name = os.path.abspath(os.path.realpath(args.zipfile))
12+
wordlist_name = os.path.abspath(os.path.realpath(args.wordlist))
13+
14+
with zipfile.ZipFile(zip_file_name,'r') as zip_file:
15+
with open(wordlist_name,'r') as wordlist:
16+
for line in wordlist:
17+
try :
18+
password_bytes = line.rstrip('\n').encode('utf-8')
19+
zip_file.extractall(pwd=password_bytes)
20+
print('success')
21+
try :
22+
zip_file.extractall()
23+
print('zip is unencrypted');
24+
except:
25+
print( 'password is {}'.format(line.rstrip('\n')) )
26+
break
27+
except:
28+
pass
29+
else:
30+
print('fail, no password matched')

0 commit comments

Comments
 (0)