Last active
April 23, 2024 19:17
-
-
Save bcoles/421cc413d07cd9ba7855 to your computer and use it in GitHub Desktop.
7zip-JTR Decrypt Script
This file contains 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
#!/bin/bash | |
# 7zip-JTR Decrypt Script | |
# | |
# Clone of JTR Decrypt Scripts by synacl modified for 7zip | |
# - RAR-JTR Decrypt Script - https://synacl.wordpress.com/2012/02/10/using-john-the-ripper-to-crack-a-password-protected-rar-archive/ | |
# - ZIP-JTR Decrypt Script - https://synacl.wordpress.com/2012/08/18/decrypting-a-zip-using-john-the-ripper/ | |
echo "7zip-JTR Decrypt Script"; | |
if [ $# -ne 2 ] | |
then | |
echo "Usage $0 <file.7z> <wordlist>"; | |
exit; | |
fi | |
7z l "${1}" | |
echo "Generating wordlist..." | |
john --wordlist="${2}" --rules --stdout | while read i | |
do | |
echo -ne "\rTrying \"$i\" " | |
7z x -p"${i}" "${1}" -aoa >/dev/null | |
STATUS=$? | |
if [ $STATUS -eq 0 ]; then | |
echo -e "\rArchive password is: \"${i}\"" | |
break | |
fi | |
done |
@readonlymaio I've changed it back
@readonlymaio I've changed it back
it was wrong redirection, should be:
7z x -p$i $1 -aoa >/dev/null 2>&1
vs
7z x -p$i $1 -aoa >/dev/null 2&>1
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you want to make it work you need to remove "2&>1" because with that further redirection $? and status is always 0... and the scripts just prompts the first line of the password file