aboutsummaryrefslogtreecommitdiff
path: root/test/test.sh
diff options
context:
space:
mode:
authorvan Hauser <vh@thc.org>2020-05-12 11:04:18 +0200
committerGitHub <noreply@github.com>2020-05-12 11:04:18 +0200
commit1317433a51a7f7336c82c80a592835ddda9ef60f (patch)
treee623506f1d0a8771c3fc266eed0a75b626a88724 /test/test.sh
parentbdd2a412c476cbd5aea0fff67ef096305815953b (diff)
parenta578d719e1f556db07ca3c7e2fe38b7668c204d8 (diff)
downloadafl++-1317433a51a7f7336c82c80a592835ddda9ef60f.tar.gz
Merge pull request #359 from AFLplusplus/dev
push to master
Diffstat (limited to 'test/test.sh')
-rwxr-xr-xtest/test.sh33
1 files changed, 32 insertions, 1 deletions
diff --git a/test/test.sh b/test/test.sh
index 90633a9f..919d7a9c 100755
--- a/test/test.sh
+++ b/test/test.sh
@@ -949,7 +949,7 @@ test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
}
test -e test-custom-mutator.c -a -e ${CUSTOM_MUTATOR_PATH}/example.c -a -e ${CUSTOM_MUTATOR_PATH}/example.py && {
unset AFL_CC
- # Compile the vulnerable program
+ # Compile the vulnerable program for single mutator
test -e ../afl-clang-fast && {
../afl-clang-fast -o test-custom-mutator test-custom-mutator.c > /dev/null 2>&1
} || {
@@ -959,6 +959,16 @@ test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
../afl-gcc -o test-custom-mutator test-custom-mutator.c > /dev/null 2>&1
}
}
+ # Compile the vulnerable program for multiple mutators
+ test -e ../afl-clang-fast && {
+ ../afl-clang-fast -o test-multiple-mutators test-multiple-mutators.c > /dev/null 2>&1
+ } || {
+ test -e ../afl-gcc-fast && {
+ ../afl-gcc-fast -o test-multiple-mutators test-multiple-mutators.c > /dev/null 2>&1
+ } || {
+ ../afl-gcc -o test-multiple-mutators test-multiple-mutators.c > /dev/null 2>&1
+ }
+ }
# Compile the custom mutator
make -C ../examples/custom_mutators libexamplemutator.so > /dev/null 2>&1
test -e test-custom-mutator -a -e ${CUSTOM_MUTATOR_PATH}/libexamplemutator.so && {
@@ -986,6 +996,25 @@ test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
# Clean
rm -rf out errors
+ #Run afl-fuzz w/ multiple C mutators
+ $ECHO "$GREY[*] running afl-fuzz with multiple custom C mutators, this will take approx 20 seconds"
+ {
+ AFL_CUSTOM_MUTATOR_LIBRARY="${CUSTOM_MUTATOR_PATH}/libexamplemutator.so;${CUSTOM_MUTATOR_PATH}/libexamplemutator.so" ../afl-fuzz -V20 -m ${MEM_LIMIT} -i in -o out -- ./test-multiple-mutators >>errors 2>&1
+ } >>errors 2>&1
+
+ test -n "$( ls out/crashes/id:000000* 2>/dev/null )" && { # TODO: update here
+ $ECHO "$GREEN[+] afl-fuzz is working correctly with multiple C mutators"
+ } || {
+ echo CUT------------------------------------------------------------------CUT
+ cat errors
+ echo CUT------------------------------------------------------------------CUT
+ $ECHO "$RED[!] afl-fuzz is not working correctly with multiple C mutators"
+ CODE=1
+ }
+
+ # Clean
+ rm -rf out errors
+
# Run afl-fuzz w/ the Python mutator
$ECHO "$GREY[*] running afl-fuzz for the Python mutator, this will take approx 10 seconds"
{
@@ -1010,6 +1039,7 @@ test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
# Clean
rm -rf in out errors
rm -rf ${CUSTOM_MUTATOR_PATH}/__pycache__/
+ rm -f test-multiple-mutators
} || {
ls .
ls ${CUSTOM_MUTATOR_PATH}
@@ -1021,6 +1051,7 @@ test "1" = "`../afl-fuzz | grep -i 'without python' >/dev/null; echo $?`" && {
make -C ../examples/custom_mutators clean > /dev/null 2>&1
rm -f test-custom-mutator
+ rm -f test-custom-mutators
} || {
$ECHO "$YELLOW[-] no custom mutators in $CUSTOM_MUTATOR_PATH, cannot test"
INCOMPLETE=1