Skip to content

Commit 62abf9d

Browse files
Add compilation of AFL and AFL wrapper script
1 parent 1dcc324 commit 62abf9d

File tree

13 files changed

+50
-4
lines changed

13 files changed

+50
-4
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
.DS_Store
2+
afl-sync

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,6 @@
1010
[submodule "sources/wasmerio"]
1111
path = sources/wasmerio
1212
url = https://github.com/wasmerio/c-http-server.git
13+
[submodule "sources/AFL"]
14+
path = sources/AFL
15+
url = https://github.com/google/AFL.git

Makefile

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,19 @@ all: build
88
# Build sources
99
build: sources/aaron-kalair/server
1010

11-
sources/aaron-kalair/server:
12-
$(MAKE) ./sources/aaron-kalair/makefile server
13-
1411
init:
15-
git submodule init sources/aaron-kalair sources/soywood sources/wasmerio sources/wsic
12+
git submodule init sources/aaron-kalair sources/soywood sources/wasmerio sources/wsic sources/AFL
1613
$(MAKE) apply-patches
1714

15+
sources/AFL/afl-g++:
16+
AFL_CC=gcc AFL_CXX=g++ $(MAKE) -C ./sources/AFL afl-g++
17+
18+
sources/AFL/afl-gcc:
19+
AFL_CC=gcc AFL_CXX=g++ $(MAKE) -C ./sources/AFL afl-gcc
20+
21+
sources/aaron-kalair/server: sources/AFL/afl-gcc
22+
AFL_CC=gcc AFL_CXX=g++ AFL_HARDEN=1 CC=$(PWD)/sources/AFL/afl-gcc $(MAKE) -C ./sources/aaron-kalair server
23+
1824
apply-patches:
1925
cd sources/aaron-kalair && git apply --stat ../../patches/aaron-kalair.patch || true
2026
cd sources/soywood && git apply --stat ../../patches/soywood.patch || true

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,9 @@ make init
1111

1212
Other commands:
1313
```bash
14+
# Build AFL
15+
make afl
16+
1417
# Create patches from altered sources
1518
make create-patches
1619

afl.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
3+
binary="$1"
4+
shift
5+
6+
rm -rf afl-sync
7+
mkdir -p afl-sync
8+
9+
function cleanup {
10+
echo "Cleaning up fuzzers"
11+
kill -9 "$fuzzer01" || true
12+
kill -9 "$fuzzer02" || true
13+
kill -9 "$fuzzer03" || true
14+
kill -9 "$fuzzer04" || true
15+
}
16+
trap cleanup EXIT
17+
18+
./sources/AFL/afl-fuzz -i inputs/afl -o afl-sync -M fuzzer01 "$binary" "$@" > /dev/null &
19+
fuzzer01="$!"
20+
sleep 5
21+
22+
./sources/AFL/afl-fuzz -i inputs/afl -o afl-sync -S fuzzer02 "$binary" "$@" > /dev/null &
23+
fuzzer02="$!"
24+
25+
./sources/AFL/afl-fuzz -i inputs/afl -o afl-sync -S fuzzer03 "$binary" "$@" > /dev/null &
26+
fuzzer03="$!"
27+
28+
./sources/AFL/afl-fuzz -i inputs/afl -o afl-sync -S fuzzer04 "$binary" "$@" > /dev/null &
29+
fuzzer04="$!"
30+
31+
watch ./sources/AFL/afl-whatsup afl-sync
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)