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?
- Get a password file (file that will contain possible passwords one per line)
- Write a bash script, total 8 lines of code
- Run the script and wait… (depends on processing power, password file size, etc)
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 filewhile 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?”
Leave a Reply
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;