From 05825a888e967071a1bdd2c51c8a8bf909b37d74 Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Sun, 15 Dec 2019 18:48:57 +0100 Subject: Fixes for unicorn testscases --- test/test.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.sh b/test/test.sh index ee497298..64c76758 100755 --- a/test/test.sh +++ b/test/test.sh @@ -550,8 +550,8 @@ test -d ../unicorn_mode/unicorn && { test -e ../unicorn_mode/samples/simple/simple_target.bin -a -e ../unicorn_mode/samples/compcov_x64/compcov_target.bin && { { # travis workaround - PY=`which python2.7` - test "$PY" = "/opt/pyenv/shims/python2.7" -a -x /usr/bin/python2.7 && PY=/usr/bin/python2.7 + PY=`which python` + test "$PY" = "/opt/pyenv/shims/python" -a -x /usr/bin/python && PY=/usr/bin/python mkdir -p in echo 0 > in/in $ECHO "$GREY[*] Using python binary $PY" -- cgit 1.4.1 From fc1a52b1c68d60ac27809536e27cb7d32f6cbdcc Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Sun, 15 Dec 2019 21:39:38 +0100 Subject: make travis happy --- test/test.sh | 4 +--- unicorn_mode/unicorn | 2 +- 2 files changed, 2 insertions(+), 4 deletions(-) (limited to 'test') diff --git a/test/test.sh b/test/test.sh index 64c76758..90dc0dfe 100755 --- a/test/test.sh +++ b/test/test.sh @@ -550,11 +550,9 @@ test -d ../unicorn_mode/unicorn && { test -e ../unicorn_mode/samples/simple/simple_target.bin -a -e ../unicorn_mode/samples/compcov_x64/compcov_target.bin && { { # travis workaround - PY=`which python` - test "$PY" = "/opt/pyenv/shims/python" -a -x /usr/bin/python && PY=/usr/bin/python + PY=python mkdir -p in echo 0 > in/in - $ECHO "$GREY[*] Using python binary $PY" $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 25 seconds" { ../afl-fuzz -V25 -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ >>errors 2>&1 diff --git a/unicorn_mode/unicorn b/unicorn_mode/unicorn index c15508a3..bc8e43e4 160000 --- a/unicorn_mode/unicorn +++ b/unicorn_mode/unicorn @@ -1 +1 @@ -Subproject commit c15508a3731d42fdd3b1a98d72ff80e2597def6b +Subproject commit bc8e43e458636de4dcb861565c0928130cb1667c -- cgit 1.4.1 From e79a4faf10eb4ff46ea907b6e27befca044ec739 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Sun, 15 Dec 2019 22:25:06 +0100 Subject: Revert "make travis happy" This reverts commit fc1a52b1c68d60ac27809536e27cb7d32f6cbdcc. --- test/test.sh | 4 +++- unicorn_mode/unicorn | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'test') diff --git a/test/test.sh b/test/test.sh index 90dc0dfe..64c76758 100755 --- a/test/test.sh +++ b/test/test.sh @@ -550,9 +550,11 @@ test -d ../unicorn_mode/unicorn && { test -e ../unicorn_mode/samples/simple/simple_target.bin -a -e ../unicorn_mode/samples/compcov_x64/compcov_target.bin && { { # travis workaround - PY=python + PY=`which python` + test "$PY" = "/opt/pyenv/shims/python" -a -x /usr/bin/python && PY=/usr/bin/python mkdir -p in echo 0 > in/in + $ECHO "$GREY[*] Using python binary $PY" $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 25 seconds" { ../afl-fuzz -V25 -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ >>errors 2>&1 diff --git a/unicorn_mode/unicorn b/unicorn_mode/unicorn index bc8e43e4..c15508a3 160000 --- a/unicorn_mode/unicorn +++ b/unicorn_mode/unicorn @@ -1 +1 @@ -Subproject commit bc8e43e458636de4dcb861565c0928130cb1667c +Subproject commit c15508a3731d42fdd3b1a98d72ff80e2597def6b -- cgit 1.4.1 From c5d4e8d0c76bc43c3639faa0652edbc06ac48f5d Mon Sep 17 00:00:00 2001 From: Dominik Maier Date: Mon, 16 Dec 2019 00:30:05 +0100 Subject: more prints, ignoring crashdumps --- .gitignore | 1 + test/test.sh | 6 ++++++ 2 files changed, 7 insertions(+) (limited to 'test') diff --git a/.gitignore b/.gitignore index 604e4f76..1e653a08 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ afl-whatsup.8 qemu_mode/libcompcov/compcovtest as qemu_mode/qemu-* +core\.* diff --git a/test/test.sh b/test/test.sh index 64c76758..7b3b2046 100755 --- a/test/test.sh +++ b/test/test.sh @@ -555,6 +555,12 @@ test -d ../unicorn_mode/unicorn && { mkdir -p in echo 0 > in/in $ECHO "$GREY[*] Using python binary $PY" + $ECHO "$GREY[*] emulating one input in unicornafl" + $PY ../unicorn_mode/samples/simple/simple_test_harness.py ../unicorn_mode/samples/simple/sample_inputs/sample1.bin + $ECHO "$GREY[*] emulating a single fuzz test in unicorn_mode" + AFL_NO_UI=1 AFL_BENCH_UNTIL_CRASH=1 AFL_BENCH_JUST_ONE=1 AFL_DEBUG_CHILD_OUTPUT=1 ../afl-fuzz -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ + $ECHO "$GREEN[*] if you saw UC returned Error: above, everything worked fine - afl unicorn found the crash. :)" + $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 25 seconds" { ../afl-fuzz -V25 -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ >>errors 2>&1 -- cgit 1.4.1 From 26d27d912178bbffe5116790409d403f22629fe1 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Mon, 16 Dec 2019 09:44:17 +0100 Subject: skip unicorn tests if cannot import unicornafl --- test/test.sh | 72 ++++++++++++++++++++++++++++++------------------------------ 1 file changed, 36 insertions(+), 36 deletions(-) (limited to 'test') diff --git a/test/test.sh b/test/test.sh index 7b3b2046..a75f991d 100755 --- a/test/test.sh +++ b/test/test.sh @@ -555,45 +555,45 @@ test -d ../unicorn_mode/unicorn && { mkdir -p in echo 0 > in/in $ECHO "$GREY[*] Using python binary $PY" - $ECHO "$GREY[*] emulating one input in unicornafl" - $PY ../unicorn_mode/samples/simple/simple_test_harness.py ../unicorn_mode/samples/simple/sample_inputs/sample1.bin - $ECHO "$GREY[*] emulating a single fuzz test in unicorn_mode" - AFL_NO_UI=1 AFL_BENCH_UNTIL_CRASH=1 AFL_BENCH_JUST_ONE=1 AFL_DEBUG_CHILD_OUTPUT=1 ../afl-fuzz -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ - $ECHO "$GREEN[*] if you saw UC returned Error: above, everything worked fine - afl unicorn found the crash. :)" - - $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 25 seconds" + if ! $PY -c 'import unicornafl' 2> /dev/null ; then + $ECHO "$YELLOW[-] we cannot test unicorn_mode because it is not present" + else { - ../afl-fuzz -V25 -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ >>errors 2>&1 - } >>errors 2>&1 - test -n "$( ls out/queue/id:000002* 2> /dev/null )" && { - $ECHO "$GREEN[+] afl-fuzz is working correctly with unicorn_mode" - } || { - echo CUT------------------------------------------------------------------CUT - cat errors - echo CUT------------------------------------------------------------------CUT - $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode" - CODE=1 - } - rm -f errors + $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 25 seconds" + { + ../afl-fuzz -V25 -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/simple/simple_test_harness.py @@ >>errors 2>&1 + } >>errors 2>&1 + test -n "$( ls out/queue/id:000002* 2> /dev/null )" && { + $ECHO "$GREEN[+] afl-fuzz is working correctly with unicorn_mode" + } || { + echo CUT------------------------------------------------------------------CUT + cat errors + echo CUT------------------------------------------------------------------CUT + $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode" + CODE=1 + } + rm -f errors - printf '\x01\x01' > in/in - # This seed is close to the first byte of the comparison. - # If CompCov works, a new tuple will appear in the map => new input in queue - $ECHO "$GREY[*] running afl-fuzz for unicorn_mode compcov, this will take approx 35 seconds" - { - export AFL_COMPCOV_LEVEL=2 - ../afl-fuzz -V35 -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/compcov_x64/compcov_test_harness.py @@ >>errors 2>&1 - } >>errors 2>&1 - test -n "$( ls out/queue/id:000001* 2> /dev/null )" && { - $ECHO "$GREEN[+] afl-fuzz is working correctly with unicorn_mode compcov" - } || { - echo CUT------------------------------------------------------------------CUT - cat errors - echo CUT------------------------------------------------------------------CUT - $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode compcov" - CODE=1 + printf '\x01\x01' > in/in + # This seed is close to the first byte of the comparison. + # If CompCov works, a new tuple will appear in the map => new input in queue + $ECHO "$GREY[*] running afl-fuzz for unicorn_mode compcov, this will take approx 35 seconds" + { + export AFL_COMPCOV_LEVEL=2 + ../afl-fuzz -V35 -U -i in -o out -d -- "$PY" ../unicorn_mode/samples/compcov_x64/compcov_test_harness.py @@ >>errors 2>&1 + } >>errors 2>&1 + test -n "$( ls out/queue/id:000001* 2> /dev/null )" && { + $ECHO "$GREEN[+] afl-fuzz is working correctly with unicorn_mode compcov" + } || { + echo CUT------------------------------------------------------------------CUT + cat errors + echo CUT------------------------------------------------------------------CUT + $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode compcov" + CODE=1 + } + rm -rf in out errors } - rm -rf in out errors + fi } } || { $ECHO "$RED[-] missing sample binaries in unicorn_mode/samples/ - what is going on??" -- cgit 1.4.1