unzip_bruteforce should be good

This commit is contained in:
Your Name
2026-04-02 19:02:40 +02:00
parent 260db0dff7
commit b8104380ca
+22 -17
View File
@@ -1,27 +1,32 @@
#!/usr/bin/bash #!/usr/bin/env bash
if [ "$#" -lt 1 ] || [ "$#" -gt 3 ]; then set -euo pipefail
echo "Usage: $0 list file.zip"
LIST=${1:-list}
FILE=${2:-}
usage() {
echo "usage: $0 [wordlist] <zipfile>"
echo "default wordlist: ./list"
exit 1 exit 1
fi }
LIST=$1 [[ -z "$FILE" ]] && usage
FILE=$2 [[ ! -f "$LIST" ]] && { echo "missing wordlist: $LIST"; exit 1; }
COUNT=$(mktemp) [[ ! -f "$FILE" ]] && { echo "missing zip: $FILE"; exit 1; }
echo 0 > "$COUNT"
export FILE COUNT
xargs -a "$LIST" -P4 -I{} bash -c ' i=0
line="$1"
# atomic-ish counter while IFS= read -r line; do
n=$(($(<"$COUNT")+1)) ((i++))
echo "$n" > "$COUNT"
((n % 1000 == 0)) && echo "$n tries..." (( i % 1000 == 0 )) && echo "$i tried..."
if unzip -P "$line" -t "$FILE" >/dev/null 2>&1; then if unzip -P "$line" -t "$FILE" >/dev/null 2>&1; then
echo "FOUND: $line" echo "FOUND: $line"
killall xargs 2>/dev/null exit 0
fi fi
' _ {} done < "$LIST"
echo "not found"
exit 1