Files
svr/usr/bin/unzip_bruteforce
T
2026-04-02 19:02:40 +02:00

33 lines
565 B
Bash
Executable File

#!/usr/bin/env bash
set -euo pipefail
LIST=${1:-list}
FILE=${2:-}
usage() {
echo "usage: $0 [wordlist] <zipfile>"
echo "default wordlist: ./list"
exit 1
}
[[ -z "$FILE" ]] && usage
[[ ! -f "$LIST" ]] && { echo "missing wordlist: $LIST"; exit 1; }
[[ ! -f "$FILE" ]] && { echo "missing zip: $FILE"; exit 1; }
i=0
while IFS= read -r line; do
((i++))
(( i % 1000 == 0 )) && echo "$i tried..."
if unzip -P "$line" -t "$FILE" >/dev/null 2>&1; then
echo "FOUND: $line"
exit 0
fi
done < "$LIST"
echo "not found"
exit 1