Dominik Maier 12c470a707
Atheris example to fuzz Python Code (#300)
* initial atheris libfuzzer harness

* cmplog, kinda

* added makefile to generic_inmemory

* Makefile for atheris fuzzer

* moved away from clap yaml

* fixed arg parsing

* fuzzing

* ldpreload lib to replace exit with abort

* fixed docker, docs

* fix docker some more

* better documentation

* less commented out important things

* Make makefile less crashy
2021-11-03 10:13:05 +01:00

55 lines
1.4 KiB
Makefile

FUZZER_NAME="fuzzer"
PROJECT_DIR=$(shell dirname $(realpath $(firstword $(MAKEFILE_LIST))))
UNAME :="$(shell uname)"
LIB_DIR :="$(PROJECT_DIR)/target/release/libafl_atheris.a"
DEEXIT_PATH = "$(PROJECT_DIR)/../../target/release/libdeexit.dylib"
PHONY: all
all: fuzzer deexit
deexit: $(DEEXIT_PATH)
$(DEEXIT_PATH):
cd ../.. && cargo build --release -p deexit
atheris:
git clone https://github.com/google/atheris.git
target/release/libafl_atheris.a: src/*
# Build the libpng libfuzzer library
cargo build --release
fuzzer: target/release/libafl_atheris.a atheris env
(\
source env/bin/activate; \
cd atheris; \
LIBFUZZER_LIB=$(LIB_DIR) pip install .; \
)
clean:
rm env
run: all
./$(FUZZER_NAME) --cores 0 &
env:
python3 -m pip install --user virtualenv
python3 -m venv env
short_test: all
(\
rm -rf libafl_unix_shmem_server || true; \
source env/bin/activate; \
LDPRELOAD=$(DEEXIT_PATH) DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=$(DEEXIT_PATH) RUST_BACKTRACE=1 timeout 10s python3 ./atheris/example_fuzzers/fuzzing_example.py --cores 0 -i in -o out || true; \
rm -rf out; \
)
test: all
(\
rm -rf libafl_unix_shmem_server || true; \
source env/bin/activate; \
LDPRELOAD=$(DEEXIT_PATH) DYLD_FORCE_FLAT_NAMESPACE=1 DYLD_INSERT_LIBRARIES=$(DEEXIT_PATH) RUST_BACKTRACE=1 timeout 60s python3 ./atheris/example_fuzzers/fuzzing_example.py --cores 0 -i in -o out || true; \
rm -rf out; \
)