
* endif * just fix every profile * WHY YOU DONT JUST USE THE SAME NAME FOR DIR * fix * Some fuzzer want release * WHY I ALWAYS FORGET COMMA * NO MORE SPACE * rename * stb doesn't like debug build * just use release * another just use release
118 lines
2.9 KiB
TOML
118 lines
2.9 KiB
TOML
# Variables
|
|
[env]
|
|
FUZZER_NAME='fuzzer_libafl_cc'
|
|
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = ["CARGO_TARGET_DIR"] } }
|
|
PROFILE = { value = "release", condition = {env_not_set = ["PROFILE"]} }
|
|
PROFILE_DIR = {value = "release", condition = {env_not_set = ["PROFILE_DIR"] }}
|
|
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
|
|
LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx'
|
|
FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}'
|
|
PROJECT_DIR = { script = ["pwd"] }
|
|
|
|
[tasks.unsupported]
|
|
script_runner="@shell"
|
|
script='''
|
|
echo "Cargo-make not integrated yet on this"
|
|
'''
|
|
|
|
# Compilers
|
|
[tasks.cxx]
|
|
linux_alias = "cxx_unix"
|
|
mac_alias = "cxx_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.cxx_unix]
|
|
command = "cargo"
|
|
args = ["build" , "--profile","${PROFILE}"]
|
|
|
|
[tasks.cc]
|
|
linux_alias = "cc_unix"
|
|
mac_alias = "cc_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.cc_unix]
|
|
command = "cargo"
|
|
args = ["build" , "--profile", "${PROFILE}"]
|
|
|
|
[tasks.crash_cxx]
|
|
linux_alias = "crash_cxx_unix"
|
|
mac_alias = "crash_cxx_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.crash_cxx_unix]
|
|
command = "cargo"
|
|
args = ["build" , "--profile", "${PROFILE}", "--features=crash"]
|
|
|
|
[tasks.crash_cc]
|
|
linux_alias = "crash_cc_unix"
|
|
mac_alias = "crash_cc_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.crash_cc_unix]
|
|
command = "cargo"
|
|
args = ["build" , "--profile", "${PROFILE}", "--features=crash"]
|
|
|
|
# Harness
|
|
[tasks.fuzzer]
|
|
linux_alias = "fuzzer_unix"
|
|
mac_alias = "fuzzer_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.fuzzer_unix]
|
|
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc"
|
|
args = ["${PROJECT_DIR}/src/program.c", "-o", "${FUZZER_NAME}", "-lm"]
|
|
dependencies = [ "cxx", "cc" ]
|
|
|
|
# Crashing Harness
|
|
[tasks.fuzzer_crash]
|
|
linux_alias = "fuzzer_crash_unix"
|
|
mac_alias = "fuzzer_crash_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.fuzzer_crash_unix]
|
|
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc"
|
|
args = ["${PROJECT_DIR}/src/program.c", "-o", "${FUZZER_NAME}_crash", "-lm"]
|
|
dependencies = [ "crash_cxx", "crash_cc" ]
|
|
|
|
# Run the fuzzer
|
|
[tasks.run]
|
|
linux_alias = "run_unix"
|
|
mac_alias = "run_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.run_unix]
|
|
script_runner = "@shell"
|
|
script='''
|
|
taskset -c 1 ${CARGO_TARGET_DIR}/${PROFILE_DIR}/${CARGO_MAKE_PROJECT_NAME} ./${FUZZER_NAME} ./corpus/ -t 1000
|
|
'''
|
|
dependencies = [ "fuzzer" ]
|
|
|
|
|
|
# Run the fuzzer with a crash
|
|
[tasks.crash]
|
|
linux_alias = "crash_unix"
|
|
mac_alias = "crash_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.crash_unix]
|
|
script_runner = "@shell"
|
|
script='''
|
|
taskset -c 1 ${CARGO_TARGET_DIR}/${PROFILE_DIR}/${CARGO_MAKE_PROJECT_NAME} ./${FUZZER_NAME}_crash ./corpus/ -t 1000
|
|
'''
|
|
dependencies = [ "fuzzer_crash" ]
|
|
|
|
# Clean up
|
|
[tasks.clean]
|
|
linux_alias = "clean_unix"
|
|
mac_alias = "clean_unix"
|
|
windows_alias = "unsupported"
|
|
|
|
[tasks.clean_unix]
|
|
# Disable default `clean` definition
|
|
clear = true
|
|
script_runner="@shell"
|
|
script='''
|
|
rm -f ./${FUZZER_NAME}
|
|
cargo clean
|
|
'''
|