From: fennecdjay Date: Thu, 6 Jun 2019 17:13:19 +0000 (+0200) Subject: :art: Update scripts X-Git-Tag: nightly~2444^2 X-Git-Url: http://10.10.0.4:5575/?a=commitdiff_plain;h=eded9a08aa62bf897cf6fe4824663c8f906c1e38;p=gwion.git :art: Update scripts --- diff --git a/help/afl.sh b/help/afl.sh new file mode 100644 index 00000000..02d4363f --- /dev/null +++ b/help/afl.sh @@ -0,0 +1,32 @@ +#!/bin/sh +: "${AFL_PREFIX:=afl-}" +: "${AFL_CC:=afl-gcc}" +: "${RESULT_DIR:=${AFL_PREFIX}result}" + +clean_lib() { + echo "🛀 cleaning $1" + cd "$1" && make clean all && cd .. +} + +compile() { + export CC="$AFL_CC" + clean_lib util + clean_lib ast + clean_lib "$PWD" +} + +prepare() { + CRASH_DIR=${AFL_PREFIX}crash + if [ -d "$CRASH_DIR" ] + then echo "✋ $CRASH_DIR already contains at risk data" + else mkdir "$CRASH_DIR" + fi + for file in "$RESULT_DIR"/*/crashes/id* + do + NEW_NAME="$(basename "$file" | sed 's/id:0*\([0-9]*\),.*/\1.gw/')" + cp "$file" "$NEW_NAME" + done +} + +#compile +prepare diff --git a/help/struct_check.sh b/help/struct_check.sh index 6e906358..34fa0af3 100755 --- a/help/struct_check.sh +++ b/help/struct_check.sh @@ -1,7 +1,7 @@ #!/bin/sh : "${PRG:=./gwion}" -pahole -s ${PRG} | while read name size gap -do [ $size -gt 64 ] && echo $name $size - [ $gap -gt 0 ] && echo "$name has a gap" +pahole -s ${PRG} | while read -r name size gap +do [ "$size" -gt 64 ] && echo "$name $size" + [ "$gap" -gt 0 ] && echo "$name has a gap" done diff --git a/help/test.sh b/help/test.sh index cb582588..6ae46d1a 100644 --- a/help/test.sh +++ b/help/test.sh @@ -465,7 +465,7 @@ clean() { [ -f test.log ] && rm test.log [ $# -ne 0 ] && do_test "${@}" | consummer -if [ -f test.log ] && [ -z $NO_LOG ] +if [ -f test.log ] && [ -z "$NO_LOG" ] then cat test.log exit 1