aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorhexcoder- <heiko@hexco.de>2019-09-26 00:28:25 +0200
committerhexcoder- <heiko@hexco.de>2019-09-26 00:28:25 +0200
commitf66c0a5d980c0e472d937de44da1a5fe4886b06a (patch)
tree285d5d11a05a2a23ccddbd3b0b9da159a3ace156
parenta609b08c0ad1c3e9825604b3b97b634ac9bf344c (diff)
parente63c9ec05e34c3cf1e32c319ba295e8e5facf41d (diff)
downloadafl++-f66c0a5d980c0e472d937de44da1a5fe4886b06a.tar.gz
Merge branch 'master' of https://github.com/vanhauser-thc/AFLplusplus
-rw-r--r--libtokencap/Makefile5
-rw-r--r--qemu_mode/README.md2
-rwxr-xr-xtest/test.sh41
3 files changed, 44 insertions, 4 deletions
diff --git a/libtokencap/Makefile b/libtokencap/Makefile
index 0faad511..3fd01b2c 100644
--- a/libtokencap/Makefile
+++ b/libtokencap/Makefile
@@ -21,7 +21,10 @@ VERSION = $(shell grep '^\#define VERSION ' ../config.h | cut -d '"' -f2)
CFLAGS ?= -O3 -funroll-loops -I ../include/
CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign
-all: libtokencap.so
+ifeq "$(shell uname)" "Linux"
+ TARGETS = libtokencap.so
+endif
+all: $(TARGETS)
libtokencap.so: libtokencap.so.c ../config.h
$(CC) $(CFLAGS) -shared -fPIC $< -o ../$@ $(LDFLAGS)
diff --git a/qemu_mode/README.md b/qemu_mode/README.md
index 5406371e..81e91854 100644
--- a/qemu_mode/README.md
+++ b/qemu_mode/README.md
@@ -99,7 +99,7 @@ on the x86 and x86_64 targets.
Highly recommended.
-## 6) Bonus feature #3: Wine mode
+## 6) Bonus feature #4: Wine mode
AFL++ QEMU can use Wine to fuzz WIn32 PE binaries. Use the -W flag of afl-fuzz.
diff --git a/test/test.sh b/test/test.sh
index 6f6fe693..2d367fc9 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,10 +207,47 @@ 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"
+$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 ?