Saturday, May 16, 2015

Bash Script and References to Cracking 7z, zip or rar Password Protected Files

I found an old bash script that I wrote to conduct a dictionary attack against a 7z file.  Thought I would post it and then a few references of better ways of cracking zip passwords:

#!/bin/bash
# The script will conduct a dictionary attack on a 7z file.  It will delete the temporary file that it creates when the file fails to extract.
while read line
do
     7z x file.7z -p $line &> /dev/null
     fileSize = `stat -c %s file.7z
     if [ $fileSize -lt 5000 ]; then
          rm -f file.txt
     else
          exit 0
     fi

done < dictionary.file

A great blog post about using John the Ripper to crack Zip and rar files is located here.

Another tool that you can use is fcrackzip.  Here are a couple of references:
http://allanfeid.com/content/cracking-zip-files-fcrackzip
http://rarcrack.sourceforge.net/
http://linuxers.org/article/how-crack-zip-file-passwords-linux-using-fcrackzip

No comments:

Post a Comment

Test Authentication from Linux Console using python3 pexpect

Working with the IT420 lab, you will discover that we need to discover a vulnerable user account.  The following python3 script uses the pex...