Skip to content

Commit

Permalink
ndmitchell#6, add a script to compile and run AFL
Browse files Browse the repository at this point in the history
  • Loading branch information
ndmitchell committed Dec 22, 2016
1 parent 99c97f5 commit 389f80f
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions afl.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# Script based on code from https://github.com/ndmitchell/hexml/issues/6
# More examples of things to do are at that ticket

# First install AFL
# $ wget http://lcamtuf.coredump.cx/afl/releases/afl-latest.tgz
# $ tar xf afl-latest.tgz
# $ cd afl-*
# $ make
# $ cd llvm_mode && make && cd ../
# $ sudo make install
# $ cd libdislocator
# $ make && sudo make install

# Compile it
AFL_HARDEN=1 afl-clang-fast -O2 -Icbits cbits/fuzz.c -o $PWD/hexml-fuzz

# Fuzz it
AFL_PRELOAD=/usr/local/lib/afl/libdislocator.so afl-fuzz -T hexml -x /usr/local/share/afl/dictionaries/xml.dict -i $PWD/xml -o $PWD/results -- $PWD/hexml-fuzz @@

# Minimize failures
# $ AFL_PRELOAD=/usr/local/lib/afl/libdislocator.so afl-cmin -i results/crashes/ -o results.shrunk -- $PWD/a.out @@
# $ mkdir results.min
# $ for x in `ls results.shrunk`; do AFL_PRELOAD=/usr/local/lib/afl/libdislocator.so afl-tmin -i results.shrunk/$x -o results.min/$x -- $PWD/a.out @@; done
# $ AFL_PRELOAD=/usr/local/lib/afl/libdislocator.so afl-analyze -i results.shrunk/id:000013,sig:11,src:000002,op:havoc,rep:4 -- ./a.out @@

0 comments on commit 389f80f

Please sign in to comment.