Skip to content

Instantly share code, notes, and snippets.

@adithyaxx
Created July 27, 2018 06:45
Show Gist options
  • Save adithyaxx/7dda95fbf2fde57d95db03cdfdd5516d to your computer and use it in GitHub Desktop.
Save adithyaxx/7dda95fbf2fde57d95db03cdfdd5516d to your computer and use it in GitHub Desktop.
Script to recursively brute-force and extract password protected zip files
#!/usr/bin/env bash
while [ -e *.zip ]; do
files=*.zip;
for file in $files; do
echo -n "Cracking ${file}… ";
output="$(fcrackzip -u -l 1-6 -c '1' *.zip | tr -d '\n')";
password="${output/PASSWORD FOUND\!\!\!\!: pw == /}";
if [ -z "${password}" ]; then
echo "Failed to find password";
break 2;
fi;
echo "Found password: \`${password}\`";
unzip -q -P "${password}" "$file";
rm "${file}";
done;
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment