Created
February 3, 2025 11:13
-
-
Save ReeseWang/a9bf0478b1e5ef6f465b35fd3372cbc4 to your computer and use it in GitHub Desktop.
Batch extract encrypted .zip files when only the password pattern is known.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env bash | |
# This script is designed for situations where there is only one file per .zip file. | |
args=( *.zip ) | |
zip2john "${args[@]}" > hashes.txt | |
john --format=PKZIP '--mask=?d?d?d?d?d?d' hashes.txt | |
john --show hashes.txt | head -n -2 | while IFS=':' read -r col1 password filepath zipfile remainder; do | |
unzip -oP "$password" -j "$zipfile" "$filepath" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment