Skip to content

Instantly share code, notes, and snippets.

@Rajchowdhury420
Created February 22, 2021 03:00
Show Gist options
  • Save Rajchowdhury420/5e8d8375f0ca14049efae2d2b5121a2d to your computer and use it in GitHub Desktop.
Save Rajchowdhury420/5e8d8375f0ca14049efae2d2b5121a2d to your computer and use it in GitHub Desktop.
A recursive Zip file cracker Script for CTF solves
#!/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