From 9baee07c94ab4a5240943b8b53e3d716f520af56 Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Wed, 25 Sep 2019 22:18:16 +0200 Subject: unicorn mode test --- test/test.sh | 29 ++++++++++++++++++++++++++++- 1 file changed, 28 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.sh b/test/test.sh index d230cf71..47d98215 100755 --- a/test/test.sh +++ b/test/test.sh @@ -211,6 +211,33 @@ test -e ../afl-qemu-trace && { rm -f test-instr test-compcov } || $ECHO "$YELLOW[-] qemu_mode is not compiled, cannot test" +$ECHO "$BLUE[*] Testing: unicorn_mode" +test -d ../unicorn_mode/unicorn && { + test -e ../unicorn_mode/samples/simple/simple_target.bin -a -e ../unicorn_mode/samples/compcov_x64/compcov_target.bin && { + test -n "$TIMEOUT" && { + mkdir -p in + echo 0 > in/in + $ECHO "$GREY[*] running afl-fuzz for unicorn_mode, this will take approx 15 seconds" + { + timeout -s KILL 15 ../afl-fuzz -U -i in -o out -d -- python ../unicorn_mode/samples/simple/simple_test_harness.py @@ > /dev/null 2>&1 + } > /dev/null 2>&1 + test -n "$( ls out/queue/id:000002* 2> /dev/null )" && { + $ECHO "$GREEN[+] afl-fuzz is working correctly with unicorn_mode" + } || $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode" + + $ECHO "$GREY[*] running afl-fuzz for unicorn_mode compcov, this will take approx 15 seconds" + { + export AFL_COMPCOV_LEVEL=2 + timeout -s KILL 15 ../afl-fuzz -U -i in -o out -d -- python ../unicorn_mode/samples/compcov_x64/compcov_test_harness.py @@ > /dev/null 2>&1 + } > /dev/null 2>&1 + test -n "$( ls out/queue/id:000001* 2> /dev/null )" && { + $ECHO "$GREEN[+] afl-fuzz is working correctly with unicorn_mode compcov" + } || $ECHO "$RED[!] afl-fuzz is not working correctly with unicorn_mode compcov" + rm -rf in out + } || $ECHO "$YELLOW[-] we cannot test afl-fuzz because we are missing the timeout command" + } || $ECHO "$RED[-] missing sample binaries in unicorn_mode/samples/ - what is going on??" + +} || $ECHO "$YELLOW[-] qemu_mode is not compiled, cannot test" + $ECHO "$GREY[*] all test cases completed.$RESET" -# unicorn_mode ? -- cgit 1.4.1 From 4936322dbc9ec4ac432a7d16409b603e78fd748c Mon Sep 17 00:00:00 2001 From: Andrea Fioraldi Date: Wed, 25 Sep 2019 22:36:54 +0200 Subject: persistent qemu test (commented) --- test/test.sh | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) (limited to 'test') diff --git a/test/test.sh b/test/test.sh index 47d98215..943865ba 100755 --- a/test/test.sh +++ b/test/test.sh @@ -177,7 +177,7 @@ rm -f test-compcov $ECHO "$BLUE[*] Testing: qemu_mode" test -e ../afl-qemu-trace && { - gcc -o test-instr ../test-instr.c + gcc -no-pie -o test-instr ../test-instr.c gcc -o test-compcov test-compcov.c test -e test-instr -a -e test-compcov && { test -n "$TIMEOUT" && { @@ -207,6 +207,16 @@ test -e ../afl-qemu-trace && { } || $ECHO "$RED[-] gcc compilation of test targets failed - what is going on??" $ECHO "$YELLOW[?] we need a test case for qemu_mode persistent mode" + # This works but there are already problems with persistent (e.g. stability) + #$ECHO "$GREY[*] running afl-fuzz for persistent qemu_mode, this will take approx 10 seconds" + #{ + # export AFL_QEMU_PERSISTENT_ADDR=0x$(nm test-instr | grep "T main" | awk '{ print $1 }') + # export AFL_QEMU_PERSISTENT_GPR=1 + # timeout -s KILL 10 ../afl-fuzz -Q -i in -o out -- ./test-instr > /dev/null 2>&1 + #} > /dev/null 2>&1 + #test -n "$( ls out/queue/id:000002* 2> /dev/null )" && { + # $ECHO "$GREEN[+] afl-fuzz is working correctly with persistent qemu_mode" + #} || $ECHO "$RED[!] afl-fuzz is not working correctly with persistent qemu_mode" rm -f test-instr test-compcov } || $ECHO "$YELLOW[-] qemu_mode is not compiled, cannot test" -- cgit 1.4.1