Skip to content

Instantly share code, notes, and snippets.

@dualfade
Created December 13, 2018 19:47
Show Gist options
  • Save dualfade/41ea28b014a4375740af326ee5ad41ba to your computer and use it in GitHub Desktop.
Save dualfade/41ea28b014a4375740af326ee5ad41ba to your computer and use it in GitHub Desktop.
7zip-jtr.sh; lord and savior baby jesus
https://gist.githubusercontent.com/bcoles/421cc413d07cd9ba7855/raw/fd8b6f0d63f88c334beb45d2615c8097f06743b6/7zip-jtr.sh
#!/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 <7z file> <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
Lord and Savior ! --
┌[cdowns@7242-alpha-reticuli] [/dev/pts/15] [130]
└[~/Documents/Hack_The_Box/LightWeight]> ./7zip-jtr.sh backup.7z /usr/share/wordlists/rockyou.txt 2>/dev/null
7zip-JTR Decrypt Script
7-Zip [64] 16.02 : Copyright (c) 1999-2016 Igor Pavlov : 2016-05-21
p7zip Version 16.02 (locale=en_US.UTF-8,Utf16=on,HugeFiles=on,64 bits,8 CPUs Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz (806EA),ASM,AES-NI)
Scanning the drive for archives:
1 file, 3411 bytes (4 KiB)
Listing archive: backup.7z
--
Path = backup.7z
Type = 7z
Physical Size = 3411
Headers Size = 259
Method = LZMA2:12k 7zAES
Solid = +
Blocks = 1
Date Time Attr Size Compressed Name
------------------- ----- ------------ ------------ ------------------------
2018-06-13 12:48:41 ....A 4218 3152 index.php
2018-06-13 12:47:14 ....A 1764 info.php
2018-06-10 09:08:57 ....A 360 reset.php
2018-06-14 13:06:33 ....A 2400 status.php
2018-06-13 12:47:46 ....A 1528 user.php
------------------- ----- ------------ ------------ ------------------------
2018-06-14 13:06:33 10270 3152 5 files
Generating wordlist...
Archive password is: "delete"
┌[cdowns@7242-alpha-reticuli] [/dev/pts/15]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment