Skip to content

Crack zip file password with tqdm(brute force) #204

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 31, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file added Python/Crack_Zip_File/.DS_Store
Binary file not shown.
29 changes: 29 additions & 0 deletions Python/Crack_Zip_File/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
## Crack a Zip file Password using tqdm (Brute Force)
The aim of the program is to crack a zip file's password using simple brute force approach from a given words list.

### Library Used:
* Python [**tqdm**](https://pypi.org/project/tqdm/) - Instantly shows a smart progress meter for loops.

### Prerequisites:
Can be installed using pip/pip3

`>> pip3 install tqdm`

### Usage:
`>> python crack_zip.py`

### I/O:
```
Enter Words list filename: $(wordlist)

Enter zip filename: $(zipfile)

Total passwords to test: $(total_number_of_words_being_checked)

Password found: $(password)
```
**OR**
```
Password not found, try other wordlist.
```
***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).***
27 changes: 27 additions & 0 deletions Python/Crack_Zip_File/crack_zip.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
from tqdm import tqdm
import zipfile
import sys

# input from user
wordlist = input("Enter Words list filename: ")
zip_file = input("Enter zip filename: ")

# initialize the Zip File object
zip_file = zipfile.ZipFile(zip_file)
# count the number of words in this wordlist
n_words = len(list(open(wordlist, "rb")))
# print the total number of passwords
print("Total passwords to test:", n_words)
with open(wordlist, "rb") as wordlist:
for word in tqdm(wordlist, total=n_words, unit="word"):
try:
# Check if the current selected password unzips the zip file
zip_file.extractall(pwd=word.strip())
except:
continue
else:
# if password found from the word list,
# exit from program
print("Password found:", word.decode().strip())
exit(0)
print("Password not found, try other wordlist.")
Binary file added Python/Crack_Zip_File/secret.zip
Binary file not shown.