#!/usr/bin/env bash # Run a fuzzing test using american fuzzy lop # Add input strings in input set -eux if [ $# -ne 0 ]; then echo "usage: $0" exit 255 fi APPNAME=example cfg=$(pwd)/conf.xml cat < $cfg $cfg ietf-netconf:startup clixon-restconf:allow-auth-none /usr/local/share/clixon clixon-hello hello /usr/local/lib/hello/clispec /usr/local/var/hello.sock /usr/local/var/hello.pidfile /usr/local/var/hello init clicon true www-data drop_perm true none false 0 file default
0.0.0.0
8088 false
EOF MEGS=500 # memory limit for child process (50 MB) # Kill previous echo "cfg: $cfg" sudo clixon_backend -z -f $cfg -s init # Start backend sudo clixon_backend -f $cfg -s init # remove input and input dirs #test ! -d input || rm -rf input test ! -d output || sudo rm -rf output # create if dirs dont exists #test -d input || mkdir input test -d output || mkdir output if false; then # Dryrun without afl (comment this if you run for real) sudo /usr/local/sbin/clixon_restconf -rf $cfg < input/1.http || true sudo /usr/local/sbin/clixon_restconf -rf $cfg < input/2.http || true sudo /usr/local/sbin/clixon_restconf -rf $cfg < input/3.http || true sudo /usr/local/sbin/clixon_restconf -rf $cfg < input/4.http || true exit fi # Run script # CC=/usr/bin/afl-clang sudo afl-fuzz -i input -o output -d -m $MEGS -- /usr/local/sbin/clixon_restconf -rf $cfg # To continue existing #sudo afl-fuzz -i - -o output -d -m $MEGS -- /usr/local/sbin/clixon_restconf -rf $cfg