How to brute-force password protected zip file?

Posted on November 9, 2007
Filed Under bash, linux, mac os x | 1 Comment

Imagine a situation when you need to unzip a password protected zip file. So, how do we do it? 

synack@deimos $ cat crack.sh
#!/bin/bash
# Author: K. Jusupov
# Date: 09/11/2007
# Description: Brute force the password protected zip file using 'password' from a file

while read line; do
unzip -P $line $1;
if [ $? = 0 ]; then
# successful unzip
clear
echo "Password found: $line"
break
fi
done < passwd.txt

Comments

One Response to “How to brute-force password protected zip file?”

  1. Chris on July 13th, 2009 8:39 pm

    Nice script.

    Though I had to add ‘-t’ to the unzip command to make it just test the archive. Otherwise it would ask to overwrite existing files if the password had the right length. And the script stopped after that, without finding the right password.

    unzip -P $line -t $1;

Leave a Reply