diff --git a/Makefile b/Makefile index 3d5059f7..9699a0ad 100644 --- a/Makefile +++ b/Makefile @@ -17,7 +17,7 @@ #TEST_MMAP=1 PROGNAME = afl -VERSION = $(shell grep '^\#define VERSION ' config.h | cut -d '"' -f2) +VERSION = $(shell grep '^\#define VERSION ' include/config.h | cut -d '"' -f2) PREFIX ?= /usr/local BIN_PATH = $(PREFIX)/bin @@ -31,7 +31,7 @@ PROGS = afl-gcc afl-fuzz afl-showmap afl-tmin afl-gotcpu afl-analyze SH_PROGS = afl-plot afl-cmin afl-whatsup afl-system-config CFLAGS ?= -O3 -funroll-loops -CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign \ +CFLAGS += -Wall -D_FORTIFY_SOURCE=2 -g -Wno-pointer-sign -I include/ \ -DAFL_PATH=\"$(HELPER_PATH)\" -DDOC_PATH=\"$(DOC_PATH)\" \ -DBIN_PATH=\"$(BIN_PATH)\" @@ -47,7 +47,7 @@ else TEST_CC = afl-clang endif -COMM_HDR = alloc-inl.h config.h debug.h types.h +COMM_HDR = include/alloc-inl.h include/config.h include/debug.h include/types.h ifeq "$(shell echo '\#include @int main() {return 0; }' | tr @ '\n' | $(CC) -x c - -o .test -I$(PYTHON_INCLUDE) -lpython2.7 2>/dev/null && echo 1 || echo 0 )" "1" @@ -123,37 +123,37 @@ endif ready: @echo "[+] Everything seems to be working, ready to compile." -afl-gcc: afl-gcc.c $(COMM_HDR) | test_x86 - $(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS) +afl-gcc: src/afl-gcc.c $(COMM_HDR) | test_x86 + $(CC) $(CFLAGS) src/$@.c -o $@ $(LDFLAGS) set -e; for i in afl-g++ afl-clang afl-clang++; do ln -sf afl-gcc $$i; done -afl-as: afl-as.c afl-as.h $(COMM_HDR) | test_x86 - $(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS) +afl-as: src/afl-as.c include/afl-as.h $(COMM_HDR) | test_x86 + $(CC) $(CFLAGS) src/$@.c -o $@ $(LDFLAGS) ln -sf afl-as as -afl-common.o : afl-common.c - $(CC) $(CFLAGS) -c afl-common.c +afl-common.o : src/afl-common.c include/common.h + $(CC) $(CFLAGS) -c src/afl-common.c -afl-forkserver.o : afl-forkserver.c - $(CC) $(CFLAGS) -c afl-forkserver.c +afl-forkserver.o : src/afl-forkserver.c include/forkserver.h + $(CC) $(CFLAGS) -c src/afl-forkserver.c -afl-sharedmem.o : afl-sharedmem.c - $(CC) $(CFLAGS) -c afl-sharedmem.c +afl-sharedmem.o : src/afl-sharedmem.c include/sharedmem.h + $(CC) $(CFLAGS) -c src/afl-sharedmem.c -afl-fuzz: afl-fuzz.c afl-common.o afl-sharedmem.o afl-forkserver.o $(COMM_HDR) | test_x86 - $(CC) $(CFLAGS) $@.c afl-common.o afl-sharedmem.o afl-forkserver.o -o $@ $(LDFLAGS) $(PYFLAGS) +afl-fuzz: src/afl-fuzz.c afl-common.o afl-sharedmem.o afl-forkserver.o $(COMM_HDR) | test_x86 + $(CC) $(CFLAGS) src/$@.c afl-common.o afl-sharedmem.o afl-forkserver.o -o $@ $(LDFLAGS) $(PYFLAGS) -afl-showmap: afl-showmap.c afl-common.o afl-sharedmem.o $(COMM_HDR) | test_x86 - $(CC) $(CFLAGS) $@.c afl-common.o afl-sharedmem.o -o $@ $(LDFLAGS) +afl-showmap: src/afl-showmap.c afl-common.o afl-sharedmem.o $(COMM_HDR) | test_x86 + $(CC) $(CFLAGS) src/$@.c afl-common.o afl-sharedmem.o -o $@ $(LDFLAGS) -afl-tmin: afl-tmin.c afl-common.o afl-sharedmem.o afl-forkserver.o $(COMM_HDR) | test_x86 - $(CC) $(CFLAGS) $@.c afl-common.o afl-sharedmem.o afl-forkserver.o -o $@ $(LDFLAGS) +afl-tmin: src/afl-tmin.c afl-common.o afl-sharedmem.o afl-forkserver.o $(COMM_HDR) | test_x86 + $(CC) $(CFLAGS) src/$@.c afl-common.o afl-sharedmem.o afl-forkserver.o -o $@ $(LDFLAGS) -afl-analyze: afl-analyze.c afl-common.o afl-sharedmem.o $(COMM_HDR) | test_x86 - $(CC) $(CFLAGS) $@.c afl-common.o afl-sharedmem.o -o $@ $(LDFLAGS) +afl-analyze: src/afl-analyze.c afl-common.o afl-sharedmem.o $(COMM_HDR) | test_x86 + $(CC) $(CFLAGS) src/$@.c afl-common.o afl-sharedmem.o -o $@ $(LDFLAGS) -afl-gotcpu: afl-gotcpu.c $(COMM_HDR) | test_x86 - $(CC) $(CFLAGS) $@.c -o $@ $(LDFLAGS) +afl-gotcpu: src/afl-gotcpu.c $(COMM_HDR) | test_x86 + $(CC) $(CFLAGS) src/$@.c -o $@ $(LDFLAGS) ifndef AFL_NO_X86 diff --git a/TODO b/TODO index cc075abd..08dc1bb8 100644 --- a/TODO +++ b/TODO @@ -68,5 +68,5 @@ Problem: Average targets (tiff, jpeg, unrar) go through 1500 edges. qemu_mode: - persistent mode patching the return address (WinAFL style) - - instrument only comparison with immediate values by default when using compcov + - instrument only comparison with immediate values by default when using compcov (done) diff --git a/alloc-inl.h b/include/alloc-inl.h similarity index 100% rename from alloc-inl.h rename to include/alloc-inl.h diff --git a/afl-as.h b/include/as.h similarity index 100% rename from afl-as.h rename to include/as.h diff --git a/afl-common.h b/include/common.h similarity index 100% rename from afl-common.h rename to include/common.h diff --git a/config.h b/include/config.h similarity index 100% rename from config.h rename to include/config.h diff --git a/debug.h b/include/debug.h similarity index 100% rename from debug.h rename to include/debug.h diff --git a/afl-forkserver.h b/include/forkserver.h similarity index 100% rename from afl-forkserver.h rename to include/forkserver.h diff --git a/hash.h b/include/hash.h similarity index 100% rename from hash.h rename to include/hash.h diff --git a/afl-sharedmem.h b/include/sharedmem.h similarity index 100% rename from afl-sharedmem.h rename to include/sharedmem.h diff --git a/types.h b/include/types.h similarity index 100% rename from types.h rename to include/types.h diff --git a/afl-analyze.c b/src/afl-analyze.c similarity index 99% rename from afl-analyze.c rename to src/afl-analyze.c index 18b7456d..e12f9194 100644 --- a/afl-analyze.c +++ b/src/afl-analyze.c @@ -26,8 +26,8 @@ #include "debug.h" #include "alloc-inl.h" #include "hash.h" -#include "afl-sharedmem.h" -#include "afl-common.h" +#include "sharedmem.h" +#include "common.h" #include #include diff --git a/afl-as.c b/src/afl-as.c similarity index 99% rename from afl-as.c rename to src/afl-as.c index 94595f24..063e3bcd 100644 --- a/afl-as.c +++ b/src/afl-as.c @@ -35,7 +35,7 @@ #include "debug.h" #include "alloc-inl.h" -#include "afl-as.h" +#include "as.h" #include #include diff --git a/afl-common.c b/src/afl-common.c similarity index 100% rename from afl-common.c rename to src/afl-common.c diff --git a/afl-forkserver.c b/src/afl-forkserver.c similarity index 99% rename from afl-forkserver.c rename to src/afl-forkserver.c index 226175e1..0051f6b0 100644 --- a/afl-forkserver.c +++ b/src/afl-forkserver.c @@ -1,7 +1,7 @@ #include "config.h" #include "types.h" #include "debug.h" -#include "afl-forkserver.h" +#include "forkserver.h" #include #include diff --git a/afl-fuzz.c b/src/afl-fuzz.c similarity index 99% rename from afl-fuzz.c rename to src/afl-fuzz.c index ec54cc85..0285a242 100644 --- a/afl-fuzz.c +++ b/src/afl-fuzz.c @@ -33,9 +33,9 @@ #include "debug.h" #include "alloc-inl.h" #include "hash.h" -#include "afl-sharedmem.h" -#include "afl-forkserver.h" -#include "afl-common.h" +#include "sharedmem.h" +#include "forkserver.h" +#include "common.h" #include #include diff --git a/afl-gcc.c b/src/afl-gcc.c similarity index 100% rename from afl-gcc.c rename to src/afl-gcc.c diff --git a/afl-gotcpu.c b/src/afl-gotcpu.c similarity index 100% rename from afl-gotcpu.c rename to src/afl-gotcpu.c diff --git a/afl-sharedmem.c b/src/afl-sharedmem.c similarity index 99% rename from afl-sharedmem.c rename to src/afl-sharedmem.c index 400a0a46..3fd38444 100644 --- a/afl-sharedmem.c +++ b/src/afl-sharedmem.c @@ -9,7 +9,7 @@ #include "debug.h" #include "alloc-inl.h" #include "hash.h" -#include "afl-sharedmem.h" +#include "sharedmem.h" #include #include diff --git a/afl-showmap.c b/src/afl-showmap.c similarity index 99% rename from afl-showmap.c rename to src/afl-showmap.c index 96b7b5e0..66c77094 100644 --- a/afl-showmap.c +++ b/src/afl-showmap.c @@ -28,8 +28,8 @@ #include "debug.h" #include "alloc-inl.h" #include "hash.h" -#include "afl-sharedmem.h" -#include "afl-common.h" +#include "sharedmem.h" +#include "common.h" #include #include diff --git a/afl-tmin.c b/src/afl-tmin.c similarity index 99% rename from afl-tmin.c rename to src/afl-tmin.c index e83b217d..663bb510 100644 --- a/afl-tmin.c +++ b/src/afl-tmin.c @@ -27,9 +27,9 @@ #include "debug.h" #include "alloc-inl.h" #include "hash.h" -#include "afl-forkserver.h" -#include "afl-sharedmem.h" -#include "afl-common.h" +#include "forkserver.h" +#include "sharedmem.h" +#include "common.h" #include #include diff --git a/test-instr.c b/src/test-instr.c similarity index 100% rename from test-instr.c rename to src/test-instr.c