Skip to content

Commit 90d09e5

Browse files
authored
Merge pull request #204 from HaripriyaB/crack_zip_tqdm
Crack zip file password with tqdm(brute force)
2 parents 24168f5 + 03588ef commit 90d09e5

File tree

4 files changed

+56
-0
lines changed

4 files changed

+56
-0
lines changed

Python/Crack_Zip_File/.DS_Store

6 KB
Binary file not shown.

Python/Crack_Zip_File/README.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
## Crack a Zip file Password using tqdm (Brute Force)
2+
The aim of the program is to crack a zip file's password using simple brute force approach from a given words list.
3+
4+
### Library Used:
5+
* Python [**tqdm**](https://pypi.org/project/tqdm/) - Instantly shows a smart progress meter for loops.
6+
7+
### Prerequisites:
8+
Can be installed using pip/pip3
9+
10+
`>> pip3 install tqdm`
11+
12+
### Usage:
13+
`>> python crack_zip.py`
14+
15+
### I/O:
16+
```
17+
Enter Words list filename: $(wordlist)
18+
19+
Enter zip filename: $(zipfile)
20+
21+
Total passwords to test: $(total_number_of_words_being_checked)
22+
23+
Password found: $(password)
24+
```
25+
**OR**
26+
```
27+
Password not found, try other wordlist.
28+
```
29+
***NOTE: Example words list can be downloaded from this [link](https://drive.google.com/file/d/19vpcd907W9MnlG93F1ovIRv8H1YKCJhk/view?usp=sharing) along with sample zip file attached with the code file(secret.zip).***

Python/Crack_Zip_File/crack_zip.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
from tqdm import tqdm
2+
import zipfile
3+
import sys
4+
5+
# input from user
6+
wordlist = input("Enter Words list filename: ")
7+
zip_file = input("Enter zip filename: ")
8+
9+
# initialize the Zip File object
10+
zip_file = zipfile.ZipFile(zip_file)
11+
# count the number of words in this wordlist
12+
n_words = len(list(open(wordlist, "rb")))
13+
# print the total number of passwords
14+
print("Total passwords to test:", n_words)
15+
with open(wordlist, "rb") as wordlist:
16+
for word in tqdm(wordlist, total=n_words, unit="word"):
17+
try:
18+
# Check if the current selected password unzips the zip file
19+
zip_file.extractall(pwd=word.strip())
20+
except:
21+
continue
22+
else:
23+
# if password found from the word list,
24+
# exit from program
25+
print("Password found:", word.decode().strip())
26+
exit(0)
27+
print("Password not found, try other wordlist.")

Python/Crack_Zip_File/secret.zip

20.1 KB
Binary file not shown.

0 commit comments

Comments
 (0)