Move to just (#2924)

* move to just

* fuzzbench

* shell check

* version

* rme

* fixer

* fixing

* libpng friends

* pwd

* ps

* ps

* no fail fast.. for now

* windows

* l

* no powershell

* a

* fk

* fixer

* a

* Revert "fixer"

This reverts commit 76ae72d68686ead01ef914b658c5d8dac5aaee32.

* plzplz

---------

Co-authored-by: Your Name <you@example.com>
This commit is contained in:
Dongjia "toka" Zhang 2025-02-07 11:26:33 +01:00 committed by GitHub
parent 45205d4dc6
commit 00582d8494
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
37 changed files with 1209 additions and 1918 deletions

View File

@ -20,7 +20,6 @@ concurrency:
jobs: jobs:
common: common:
strategy: strategy:
fail-fast: false
matrix: matrix:
os: [ ubuntu-24.04, windows-latest, macOS-latest ] os: [ ubuntu-24.04, windows-latest, macOS-latest ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
@ -238,7 +237,7 @@ jobs:
needs: needs:
- fuzzers-preflight - fuzzers-preflight
strategy: strategy:
fail-fast: true fail-fast: false
matrix: matrix:
os: [ ubuntu-24.04 ] os: [ ubuntu-24.04 ]
fuzzer: fuzzer:
@ -321,10 +320,6 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- uses: ./.github/workflows/fuzzer-tester-prepare - uses: ./.github/workflows/fuzzer-tester-prepare
- name: Build and run example fuzzers (Linux)
if: runner.os == 'Linux'
shell: bash
run: RUN_ON_CI=1 LLVM_CONFIG=llvm-config-${{env.MAIN_LLVM_VERSION}} ./scripts/test_fuzzer.sh ${{ matrix.fuzzer }}
changes: changes:
runs-on: ubuntu-24.04 runs-on: ubuntu-24.04

View File

@ -26,6 +26,10 @@ runs:
uses: baptiste0928/cargo-install@v3 uses: baptiste0928/cargo-install@v3
with: with:
crate: cargo-make crate: cargo-make
- name: install just
uses: extractions/setup-just@v2
with:
just-version: 1.39.0
- name: install wasm-pack - name: install wasm-pack
uses: baptiste0928/cargo-install@v3 uses: baptiste0928/cargo-install@v3
with: with:

View File

@ -14,6 +14,10 @@ runs:
uses: baptiste0928/cargo-install@v3 uses: baptiste0928/cargo-install@v3
with: with:
crate: cargo-make crate: cargo-make
- name: install just
uses: extractions/setup-just@v2
with:
just-version: 1.39.0
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
submodules: true submodules: true

View File

@ -18,3 +18,7 @@ runs:
- name: install cargo-make - name: install cargo-make
shell: pwsh shell: pwsh
run: cargo install --force cargo-make run: cargo install --force cargo-make
- name: install just
uses: extractions/setup-just@v2
with:
just-version: 1.39.0

View File

@ -0,0 +1,34 @@
FUZZER_NAME := 'fuzzer_custom_executor'
PROJECT_DIR := invocation_directory_native()
PROFILE := 'release'
PROFILE_DIR := 'release'
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
alias build := fuzzer
fuzzer:
cargo build --profile={{PROFILE}}
run: fuzzer
{{FUZZER}}
[linux]
[macos]
test: fuzzer
#!/bin/bash
timeout 30s {{FUZZER}} | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
cargo clean

View File

@ -1,50 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'fuzzer_custom_executor'
PROJECT_DIR = { script = ["pwd"] }
CARGO_TARGET_DIR = { value = "target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release" }
PROFILE_DIR = { value = "release" }
FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}'
[tasks.build]
alias = "fuzzer"
[tasks.fuzzer]
description = "Build the fuzzer"
script = "cargo build --profile=${PROFILE}"
[tasks.run]
description = "Run the fuzzer"
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}"
dependencies = ["fuzzer"]
[tasks.test]
description = "Run a short test"
linux_alias = "test_unix"
mac_alias = "test_unix"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
timeout 30s ${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME} | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
# Clean up
[tasks.clean]
# Disable default `clean` definition
clear = true
script_runner = "@shell"
script = '''
cargo clean
'''

View File

@ -0,0 +1,38 @@
FUZZER_NAME := 'fuzzer_sd'
PROJECT_DIR := invocation_directory_native()
PROFILE := 'release'
PROFILE_DIR := 'release'
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
alias build := fuzzer
cc:
cargo build --profile={{PROFILE}} --bin libafl_cc
fuzzer: cc
cargo build --profile={{PROFILE}}
run: fuzzer
{{FUZZER}}
[linux]
[macos]
test: fuzzer
#!/bin/bash
timeout 30s {{FUZZER}} | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
cargo clean

View File

@ -1,58 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'fuzzer_sd'
PROJECT_DIR = { script = ["pwd"] }
CARGO_TARGET_DIR = { value = "target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release" }
PROFILE_DIR = { value = "release" }
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}'
# Compilers
[tasks.cc]
command = "cargo"
args = ["build", "--profile", "${PROFILE}", "--bin", "libafl_cc"]
# Harness
[tasks.fuzzer]
command = "cargo"
args = ["build", "--profile", "${PROFILE}", "--bin", "${FUZZER_NAME}"]
dependencies = ["cc"]
[tasks.build]
alias = "fuzzer"
# Run the fuzzer
[tasks.run]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}"
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_unix"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
timeout 30s ${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME} | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
# Clean up
[tasks.clean]
# Disable default `clean` definition
clear = true
script_runner = "@shell"
script = '''
cargo clean
'''

View File

@ -0,0 +1,22 @@
FUZZER_NAME := 'fuzzer_wasm'
PROJECT_DIR := invocation_directory_native()
PROFILE := 'release'
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
build:
cargo build --target web
[linux]
[macos]
test:
wasm-pack test --chrome --headless
[windows]
test:
echo "Unsupported on this platform"
clean:
cargo clean

View File

@ -1,29 +0,0 @@
[env]
FUZZER_NAME = "fuzzer"
PROJECT_DIR = { script = ["pwd"] }
[tasks.unsupported]
script_runner = "@shell"
script = '''
echo "Cargo-make not integrated yet on this"
'''
# Fuzzer
[tasks.build]
command = "wasm-pack"
args = ["build", "--target", "web"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_unix"
windows_alias = "unsupported"
[tasks.test_unix]
command = "wasm-pack"
args = ["test", "--chrome", "--headless"]
# Clean
[tasks.clean]
command = "cargo"
args = ["clean"]

View File

@ -0,0 +1,26 @@
FUZZER_NAME := 'fuzzer_no_std'
PROJECT_DIR := invocation_directory_native()
PROFILE := 'release'
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
build:
cargo build --profile={{PROFILE}} -Zbuild-std=core,alloc --target x86_64-unknown-linux-gnu
build_aarch:
cargo +nightly build -Zbuild-std=core,alloc --target aarch64-unknown-none -v --profile {{PROFILE}}
[linux]
test: build
cargo run -Zbuild-std=core,alloc --target x86_64-unknown-linux-gnu || true
[macos]
[windows]
test: build
echo "Unsupported on this platform"
clean:
cargo clean

View File

@ -1,45 +0,0 @@
[env]
FUZZER_NAME = "fuzzer"
PROJECT_DIR = { script = ["pwd"] }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
[tasks.unsupported]
script_runner = "@shell"
script = '''
echo "Cargo-make not integrated yet on this"
'''
# Fuzzer
[tasks.build]
command = "cargo"
args = [
"build",
"--profile",
"${PROFILE}",
"-Zbuild-std=core,alloc",
"--target",
"x86_64-unknown-linux-gnu",
]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "unsupported"
windows_alias = "unsupported"
[tasks.test_unix]
script = '''
cargo run -Zbuild-std=core,alloc --target x86_64-unknown-linux-gnu || true
'''
dependencies = ["build"]
[tasks.build_aarch]
script = "cargo +nightly build -Zbuild-std=core,alloc --target aarch64-unknown-none -v --profile ${PROFILE}"
# Clean
[tasks.clean]
command = "cargo"
args = ["clean"]

View File

@ -0,0 +1,27 @@
install_llvm_tools:
rustup toolchain install nightly --component llvm-tools-preview
install_cargo_fuzz:
cargo install cargo-fuzz
build: install_cargo_fuzz install_llvm_tools
cargo +nightly fuzz build fuzz_target_1
[linux]
test: build
#!/bin/bash
timeout 30s cargo +nightly fuzz run fuzz_target_1 2>&1 | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[macos]
[windows]
test: build
echo "Unsupported on this platform"
clean:
rm -rf fuzz/target

View File

@ -1,44 +0,0 @@
[env]
[tasks.unsupported]
script_runner = "@shell"
script = '''
echo "Cargo-make not integrated yet on this"
'''
[tasks.install_llvm_tools]
command = "rustup"
args = ["toolchain", "install", "nightly", "--component", "llvm-tools-preview"]
[tasks.install_cargo_fuzz]
command = "cargo"
args = ["install", "cargo-fuzz"]
# Fuzzer
[tasks.build]
command = "cargo"
args = ["+nightly", "fuzz", "build", "fuzz_target_1"]
dependencies = ["install_cargo_fuzz", "install_llvm_tools"]
[tasks.test]
linux_alias = "test_unix"
mac_alias = "unsupported"
windows_alias = "unsupported"
[tasks.test_unix]
script = '''
timeout 30s cargo +nightly fuzz run fuzz_target_1 2>&1 | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["build"]
# Clean
[tasks.clean]
command = "rm "
args = ["-rf", "fuzz/target"]

View File

@ -0,0 +1,77 @@
FUZZER_NAME := 'fuzzbench'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
alias build := fuzzer
alias cc := cxx
[linux]
[macos]
cxx:
cargo build --profile={{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
fuzz_o: cxx
{{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cc --libafl-no-link -O3 -c fuzz.c -o fuzz.o
[windows]
fuzz_o:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: cxx fuzz_o
{{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cxx --libafl fuzz.o -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: cxx fuzz_o
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
./{{FUZZER_NAME}} -o out -i in
[windows]
run:
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
# Allow sigterm as exit code
timeout 31s ./{{FUZZER_NAME}} -o out -i in | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
rm -rf out || true
rm -rf in || true
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
cargo clean

View File

@ -1,112 +0,0 @@
[env]
PROJECT_DIR = { script = ["pwd"] }
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
FUZZER_NAME = "fuzzer"
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
[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}"]
# fuzz.o File
[tasks.fuzz_o]
linux_alias = "fuzz_o_unix"
mac_alias = "fuzz_o_unix"
windows_alias = "unsupported"
[tasks.fuzz_o_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc"
args = ["--libafl-no-link", "-O3", "-c", "fuzz.c", "-o", "fuzz.o"]
dependencies = ["cc", "cxx"]
# Fuzzer
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = ["--libafl", "fuzz.o", "-o", "${FUZZER_NAME}", "-lm", "-lz"]
dependencies = ["cc", "cxx", "fuzz_o"]
# Run
[tasks.run]
linux_alias = "run_unix"
mac_alias = "run_unix"
windows_alias = "unsupported"
[tasks.run_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
./${FUZZER_NAME} -o out -i in
'''
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_unix"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
# Allow sigterm as exit code
timeout 31s ./${FUZZER_NAME} -o out -i in | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
rm -rf out || true
rm -rf in || true
'''
dependencies = ["fuzzer"]
# Clean
[tasks.clean]
linux_alias = "clean_unix"
mac_alias = "clean_unix"
windows_alias = "unsupported"
[tasks.clean_unix]
script_runner = "@shell"
script = '''
rm ./${FUZZER_NAME} || true
rm fuzz.o || true
'''

View File

@ -0,0 +1,77 @@
FUZZER_NAME := 'fuzzbench_ctx'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
alias build := fuzzer
alias cc := cxx
[linux]
[macos]
cxx:
cargo build --profile={{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
fuzz_o: cxx
{{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cc --libafl-no-link -O3 -c fuzz.c -o fuzz.o
[windows]
fuzz_o:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: cxx fuzz_o
{{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cxx --libafl fuzz.o -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: cxx fuzz_o
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
./{{FUZZER_NAME}} -o out -i in
[windows]
run:
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
# Allow sigterm as exit code
timeout 31s ./{{FUZZER_NAME}} -o out -i in | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
rm -rf out || true
rm -rf in || true
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
cargo clean

View File

@ -1,112 +0,0 @@
[env]
PROJECT_DIR = { script = ["pwd"] }
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
FUZZER_NAME = "fuzzer"
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
[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}"]
# fuzz.o File
[tasks.fuzz_o]
linux_alias = "fuzz_o_unix"
mac_alias = "fuzz_o_unix"
windows_alias = "unsupported"
[tasks.fuzz_o_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc"
args = ["--libafl-no-link", "-O3", "-c", "fuzz.c", "-o", "fuzz.o"]
dependencies = ["cc", "cxx"]
# Fuzzer
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = ["--libafl", "fuzz.o", "-o", "${FUZZER_NAME}", "-lm", "-lz"]
dependencies = ["cc", "cxx", "fuzz_o"]
# Run
[tasks.run]
linux_alias = "run_unix"
mac_alias = "run_unix"
windows_alias = "unsupported"
[tasks.run_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
./${FUZZER_NAME} -o out -i in
'''
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_unix"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
# Allow sigterm as exit code
timeout 31s ./${FUZZER_NAME} -o out -i in | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
rm -rf out || true
rm -rf in || true
'''
dependencies = ["fuzzer"]
# Clean
[tasks.clean]
linux_alias = "clean_unix"
mac_alias = "clean_unix"
windows_alias = "unsupported"
[tasks.clean_unix]
script_runner = "@shell"
script = '''
rm ./${FUZZER_NAME} || true
rm fuzz.o || true
'''

View File

@ -0,0 +1,77 @@
FUZZER_NAME := 'fuzzbench'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
alias build := fuzzer
alias cc := cxx
[linux]
[macos]
cxx:
cargo build --profile={{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
fuzz_o: cxx
{{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cc --libafl-no-link -O3 -c fuzz.c -o fuzz.o
[windows]
fuzz_o:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: cxx fuzz_o
{{CARGO_TARGET_DIR}}/{{PROFILE_DIR}}/libafl_cxx --libafl fuzz.o -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: cxx fuzz_o
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
./{{FUZZER_NAME}} -o out -i in
[windows]
run:
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
# Allow sigterm as exit code
timeout 31s ./{{FUZZER_NAME}} -o out -i in | tee fuzz_stdout.log || true
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
rm -rf out || true
rm -rf in || true
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
cargo clean

View File

@ -1,114 +0,0 @@
[env]
PROJECT_DIR = { script = ["pwd"] }
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
FUZZER_NAME = "fuzzer"
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
[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}"]
# fuzz.o File
[tasks.fuzz_o]
linux_alias = "fuzz_o_unix"
mac_alias = "fuzz_o_unix"
windows_alias = "unsupported"
[tasks.fuzz_o_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc"
args = ["--libafl-no-link", "-O3", "-c", "fuzz.c", "-o", "fuzz.o"]
dependencies = ["cc", "cxx"]
# Fuzzer
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = ["--libafl", "fuzz.o", "-o", "${FUZZER_NAME}", "-lm", "-lz"]
dependencies = ["cc", "cxx", "fuzz_o"]
# Run
[tasks.run]
linux_alias = "run_unix"
mac_alias = "run_unix"
windows_alias = "unsupported"
[tasks.run_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
# Allow sigterm as exit code
./${FUZZER_NAME} -o out -i in
'''
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_unix"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
mkdir in || true
echo a > in/a
# Allow sigterm as exit code
timeout 31s ./${FUZZER_NAME} -o out -i in | tee fuzz_stdout.log || true
cat fuzz_stdout.log
if grep -qa "objectives: 1" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
rm -rf out || true
rm -rf in || true
'''
dependencies = ["fuzzer"]
# Clean
[tasks.clean]
linux_alias = "clean_unix"
mac_alias = "clean_unix"
windows_alias = "unsupported"
[tasks.clean_unix]
script_runner = "@shell"
script = '''
rm ./${FUZZER_NAME} || true
rm fuzz.o || true
'''

View File

@ -0,0 +1,136 @@
FUZZER_NAME := 'fuzzer_libpng'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx"
alias cc := cxx
[linux]
[macos]
libpng:
#!/bin/bash
if [ ! -f v1.6.37.tar.gz ]; then
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
fi
tar -xvf v1.6.37.tar.gz
[windows]
libpng:
echo "Unsupported on this platform"
[linux]
[macos]
cxx:
cargo build --profile {{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
crash_cxx:
cargo build --profile {{PROFILE}} --features=crash
[windows]
crash_cxx:
echo "Unsupported on this platform"
[linux]
[macos]
lib: libpng cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
lib:
echo "Unsupported on this platform"
[linux]
[macos]
crash_lib: libpng crash_cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
crash_lib:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: lib cxx
pwd
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
crash_fuzzer: crash_lib crash_cxx
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz
[windows]
crash_fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: fuzzer
#!/bin/bash
./{{FUZZER_NAME}} &
sleep 0.2
./{{FUZZER_NAME}} 2>/dev/null
[windows]
run: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
crash: crash_fuzzer
#!/bin/bash
./{{FUZZER_NAME}} &
sleep 0.2
./{{FUZZER_NAME}} 2>/dev/null
[windows]
crash: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
(timeout 31s ./{{FUZZER_NAME}} 2>/dev/null | tee fuzz_stdout.log || true) &
sleep 0.2
timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
rm -rf {{FUZZER_NAME}}
make -C libpng-1.6.37 clean || true
cargo clean

View File

@ -1,221 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'fuzzer_libpng'
PROJECT_DIR = { script = ["pwd"] }
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx'
FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}'
[tasks.unsupported]
script_runner = "@shell"
script = '''
echo "Cargo-make not integrated yet on this"
'''
# libpng
[tasks.libpng]
linux_alias = "libpng_unix"
mac_alias = "libpng_unix"
windows_alias = "unsupported"
[tasks.libpng_unix]
condition = { files_not_exist = ["./libpng-1.6.37"] }
script_runner = "@shell"
script = '''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''
# 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"]
# Library
[tasks.lib]
linux_alias = "lib_unix"
mac_alias = "lib_unix"
windows_alias = "unsupported"
[tasks.lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "cxx", "cc"]
# Library
[tasks.crash_lib]
linux_alias = "crash_lib_unix"
mac_alias = "crash_lib_unix"
windows_alias = "unsupported"
[tasks.crash_lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "crash_cxx", "crash_cc"]
# Harness
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}",
"-lm",
"-lz",
]
dependencies = ["lib", "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_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}_crash",
"-lm",
"-lz",
]
dependencies = ["crash_lib", "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 = '''
./${FUZZER_NAME} &
sleep 0.2
./${FUZZER_NAME} 2>/dev/null
'''
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 = '''
./${FUZZER_NAME}_crash &
sleep 0.2
./${FUZZER_NAME}_crash 2>/dev/null
'''
dependencies = ["fuzzer_crash"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_mac"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
(timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log 2>/dev/null || true) &
sleep 0.2
timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
[tasks.test_mac]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
(timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log 2>/dev/null || true) &
sleep 0.2
timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true
'''
dependencies = ["fuzzer"]
# 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}
make -C libpng-1.6.37 clean
cargo clean
'''

View File

@ -0,0 +1,87 @@
FUZZER_NAME := 'fuzzer_libpng_accounting'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx"
alias cc := cxx
[linux]
[macos]
libpng:
#!/bin/bash
if [ ! -f v1.6.37.tar.gz ]; then
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
fi
tar -xvf v1.6.37.tar.gz
[windows]
libpng:
echo "Unsupported on this platform"
[linux]
[macos]
cxx:
cargo build --profile {{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
lib: libpng cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
lib:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: lib cxx
pwd
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: fuzzer
./{{FUZZER_NAME}} --cores 0 --input ./corpus
[windows]
run: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
timeout 31s ./{{FUZZER_NAME}} --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
rm -rf {{FUZZER_NAME}}
make -C libpng-1.6.37 clean || true
cargo clean

View File

@ -1,146 +0,0 @@
# Variables
[env]
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
FUZZER_NAME = 'fuzzer_libpng_accounting'
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/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 platform"
'''
# libpng
[tasks.libpng]
linux_alias = "libpng_unix"
mac_alias = "libpng_unix"
windows_alias = "unsupported"
[tasks.libpng_unix]
condition = { files_not_exist = ["./libpng-1.6.37"] }
script_runner = "@shell"
script = '''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''
# 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}"]
# Library
[tasks.lib]
linux_alias = "lib_unix"
mac_alias = "lib_unix"
windows_alias = "unsupported"
[tasks.lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "cxx", "cc"]
# Harness
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}",
"-lm",
"-lz",
]
dependencies = ["lib", "cxx", "cc"]
# Run the fuzzer
[tasks.run]
linux_alias = "run_unix"
mac_alias = "run_unix"
windows_alias = "unsupported"
[tasks.run_unix]
script_runner = "@shell"
script = '''
./${FUZZER_NAME} --cores 0 --input ./corpus
'''
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_mac"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus | tee fuzz_stdout.log 2>/dev/null || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
[tasks.test_mac]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus | tee fuzz_stdout.log 2>/dev/null || true
'''
dependencies = ["fuzzer"]
# 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}
make -C libpng-1.6.37 clean
cargo clean
'''

View File

@ -0,0 +1,87 @@
FUZZER_NAME := 'fuzzer_libpng_centralized'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx"
alias cc := cxx
[linux]
[macos]
libpng:
#!/bin/bash
if [ ! -f v1.6.37.tar.gz ]; then
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
fi
tar -xvf v1.6.37.tar.gz
[windows]
libpng:
echo "Unsupported on this platform"
[linux]
[macos]
cxx:
cargo build --profile {{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
lib: libpng cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
lib:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: lib cxx
pwd
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: fuzzer
./{{FUZZER_NAME}} --cores 0-1 --input ./corpus
[windows]
run: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
timeout 31s ./{{FUZZER_NAME}} --cores 0-1 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
rm -rf {{FUZZER_NAME}}
make -C libpng-1.6.37 clean || true
cargo clean

View File

@ -1,146 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'fuzzer_libpng_launcher'
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/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 platform"
'''
# libpng
[tasks.libpng]
linux_alias = "libpng_unix"
mac_alias = "libpng_unix"
windows_alias = "unsupported"
[tasks.libpng_unix]
condition = { files_not_exist = ["./libpng-1.6.37"] }
script_runner = "@shell"
script = '''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''
# 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}"]
# Library
[tasks.lib]
linux_alias = "lib_unix"
mac_alias = "lib_unix"
windows_alias = "unsupported"
[tasks.lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "cxx", "cc"]
# Harness
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}",
"-lm",
"-lz",
]
dependencies = ["lib", "cxx", "cc"]
# Run the fuzzer
[tasks.run]
linux_alias = "run_unix"
mac_alias = "run_unix"
windows_alias = "unsupported"
[tasks.run_unix]
script_runner = "@shell"
script = '''
./${FUZZER_NAME} --cores 0-1 --input ./corpus
'''
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_mac"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
timeout 31s ./${FUZZER_NAME} --cores 0-1 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
[tasks.test_mac]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true
'''
dependencies = ["fuzzer"]
# 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}
make -C libpng-1.6.37 clean
cargo clean
'''

View File

@ -0,0 +1,136 @@
FUZZER_NAME := 'fuzzer_libpng_cmin'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx"
alias cc := cxx
[linux]
[macos]
libpng:
#!/bin/bash
if [ ! -f v1.6.37.tar.gz ]; then
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
fi
tar -xvf v1.6.37.tar.gz
[windows]
libpng:
echo "Unsupported on this platform"
[linux]
[macos]
cxx:
cargo build --profile {{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
crash_cxx:
cargo build --profile {{PROFILE}} --features=crash
[windows]
crash_cxx:
echo "Unsupported on this platform"
[linux]
[macos]
lib: libpng cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
lib:
echo "Unsupported on this platform"
[linux]
[macos]
crash_lib: libpng crash_cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
crash_lib:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: lib cxx
pwd
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz -lz3
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
crash_fuzzer: crash_lib crash_cxx
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz -lz3
[windows]
crash_fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: fuzzer
#!/bin/bash
./{{FUZZER_NAME}} &
sleep 0.2
./{{FUZZER_NAME}} 2>/dev/null
[windows]
run: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
crash: crash_fuzzer
#!/bin/bash
./{{FUZZER_NAME}} &
sleep 0.2
./{{FUZZER_NAME}} 2>/dev/null
[windows]
crash: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
(timeout 31s ./{{FUZZER_NAME}} 2>/dev/null | tee fuzz_stdout.log|| true) &
sleep 0.2
timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
rm -rf {{FUZZER_NAME}}
make -C libpng-1.6.37 clean || true
cargo clean

View File

@ -1,223 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'fuzzer_libpng'
PROJECT_DIR = { script = ["pwd"] }
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx'
FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}'
[tasks.unsupported]
script_runner = "@shell"
script = '''
echo "Cargo-make not integrated yet on this"
'''
# libpng
[tasks.libpng]
linux_alias = "libpng_unix"
mac_alias = "libpng_unix"
windows_alias = "unsupported"
[tasks.libpng_unix]
condition = { files_not_exist = ["./libpng-1.6.37"] }
script_runner = "@shell"
script = '''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''
# 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"]
# Library
[tasks.lib]
linux_alias = "lib_unix"
mac_alias = "lib_unix"
windows_alias = "unsupported"
[tasks.lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "cxx", "cc"]
# Library
[tasks.crash_lib]
linux_alias = "crash_lib_unix"
mac_alias = "crash_lib_unix"
windows_alias = "unsupported"
[tasks.crash_lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "crash_cxx", "crash_cc"]
# Harness
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}",
"-lm",
"-lz",
"-lz3",
]
dependencies = ["lib", "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_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}_crash",
"-lm",
"-lz",
"-lz3",
]
dependencies = ["crash_lib", "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 = '''
./${FUZZER_NAME} &
sleep 0.2
./${FUZZER_NAME} 2>/dev/null
'''
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 = '''
./${FUZZER_NAME}_crash &
sleep 0.2
./${FUZZER_NAME}_crash 2>/dev/null
'''
dependencies = ["fuzzer_crash"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_mac"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log &
sleep 0.2
timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
[tasks.test_mac]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log &
sleep 0.2
timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true
'''
dependencies = ["fuzzer"]
# 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}
make -C libpng-1.6.37 clean
cargo clean
'''

View File

@ -0,0 +1,88 @@
FUZZER_NAME := 'fuzzer_libpng_launcher'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx"
LIBTOOL := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_libtool"
alias cc := cxx
[linux]
[macos]
libpng:
#!/bin/bash
if [ ! -f v1.6.37.tar.gz ]; then
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
fi
tar -xvf v1.6.37.tar.gz
[windows]
libpng:
echo "Unsupported on this platform"
[linux]
[macos]
cxx:
cargo build --profile {{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
lib: libpng cxx
#!/bin/bash
cd libpng-1.6.37 && CC={{LIBAFL_CC}} CXX={{LIBAFL_CXX}} ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}" LIBTOOL="{{LIBTOOL}}"
[windows]
lib:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: lib cxx
pwd
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: fuzzer
./{{FUZZER_NAME}}.coverage --broker-port 21337 --cores 0 --input ./corpus
[windows]
run: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
timeout 31s ./{{FUZZER_NAME}}.coverage --broker-port 21337 --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
rm -rf {{FUZZER_NAME}}
make -C libpng-1.6.37 clean || true
cargo clean

View File

@ -1,147 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'fuzzer_libpng_launcher'
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx'
LIBAFL_LIBTOOL = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_libtool'
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 platform"
'''
# libpng
[tasks.libpng]
linux_alias = "libpng_unix"
mac_alias = "libpng_unix"
windows_alias = "unsupported"
[tasks.libpng_unix]
condition = { files_not_exist = ["./libpng-1.6.37"] }
script_runner = "@shell"
script = '''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''
# 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}"]
# Library
[tasks.lib]
linux_alias = "lib_unix"
mac_alias = "lib_unix"
windows_alias = "unsupported"
[tasks.lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx" LIBTOOL=${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_libtool
'''
dependencies = ["libpng", "cxx", "cc"]
# Harness
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}",
"-lm",
"-lz",
]
dependencies = ["lib", "cxx", "cc"]
# Run the fuzzer
[tasks.run]
linux_alias = "run_unix"
mac_alias = "run_unix"
windows_alias = "unsupported"
[tasks.run_unix]
script_runner = "@shell"
script = '''
./${FUZZER_NAME}.coverage --broker-port 21337 --cores 0 --input ./corpus
'''
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_mac"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
timeout 31s ./${FUZZER_NAME}.coverage --broker-port 21337 --cores 0 --input ./corpus | tee fuzz_stdout.log || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
[tasks.test_mac]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true
'''
dependencies = ["fuzzer"]
# 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}
make -C libpng-1.6.37 clean
cargo clean
'''

View File

@ -0,0 +1,136 @@
FUZZER_NAME := 'fuzzer_libpng_norestart'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx"
alias cc := cxx
[linux]
[macos]
libpng:
#!/bin/bash
if [ ! -f v1.6.37.tar.gz ]; then
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
fi
tar -xvf v1.6.37.tar.gz
[windows]
libpng:
echo "Unsupported on this platform"
[linux]
[macos]
cxx:
cargo build --profile {{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
crash_cxx:
cargo build --profile {{PROFILE}} --features=crash
[windows]
crash_cxx:
echo "Unsupported on this platform"
[linux]
[macos]
lib: libpng cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
lib:
echo "Unsupported on this platform"
[linux]
[macos]
crash_lib: libpng crash_cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
crash_lib:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: lib cxx
pwd
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
crash_fuzzer: crash_lib crash_cxx
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz
[windows]
crash_fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: fuzzer
#!/bin/bash
./{{FUZZER_NAME}} &
sleep 0.2
./{{FUZZER_NAME}} 2>/dev/null
[windows]
run: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
crash: crash_fuzzer
#!/bin/bash
./{{FUZZER_NAME}} &
sleep 0.2
./{{FUZZER_NAME}} 2>/dev/null
[windows]
crash: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
(timeout 31s ./{{FUZZER_NAME}} 2>/dev/null | tee fuzz_stdout.log || true) &
sleep 0.2
timeout 30s ./{{FUZZER_NAME}} >/dev/null 2>/dev/null || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
rm -rf {{FUZZER_NAME}}
make -C libpng-1.6.37 clean || true
cargo clean

View File

@ -1,135 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'fuzzer_libpng_launcher'
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/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 platform"
'''
# libpng
[tasks.libpng]
linux_alias = "libpng_unix"
mac_alias = "libpng_unix"
windows_alias = "unsupported"
[tasks.libpng_unix]
condition = { files_not_exist = ["./libpng-1.6.37"] }
script_runner = "@shell"
script = '''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''
[tasks.cc]
linux_alias = "cc_unix"
mac_alias = "cc_unix"
windows_alias = "unsupported"
[tasks.cc_unix]
command = "cargo"
args = ["build", "--profile", "${PROFILE}"]
# Library
[tasks.lib]
linux_alias = "lib_unix"
mac_alias = "lib_unix"
windows_alias = "unsupported"
[tasks.lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "cc"]
# Harness
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}",
"-lm",
"-lz",
]
dependencies = ["lib", "cc"]
# Run the fuzzer
[tasks.run]
linux_alias = "run_unix"
mac_alias = "run_unix"
windows_alias = "unsupported"
[tasks.run_unix]
script_runner = "@shell"
script = '''
rm -rf corpus/ || true
mkdir corpus/ || true
cp seeds/* corpus/ || true
./${FUZZER_NAME} --cores 0 --input ./corpus
'''
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_unix"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
rm -rf corpus/ || true
mkdir corpus/ || true
cp seeds/* corpus/ || true
timeout 31s ./${FUZZER_NAME} --cores 0 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
# 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 -rf corpus/ || true
rm -f ./${FUZZER_NAME}
make -C libpng-1.6.37 clean
cargo clean
'''

View File

@ -0,0 +1,87 @@
FUZZER_NAME := 'fuzzer_libpng_tcp_manager'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
FUZZER := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / FUZZER_NAME
LIBAFL_CC := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cc"
LIBAFL_CXX := PROJECT_DIR / CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx"
alias cc := cxx
[linux]
[macos]
libpng:
#!/bin/bash
if [ ! -f v1.6.37.tar.gz ]; then
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
fi
tar -xvf v1.6.37.tar.gz
[windows]
libpng:
echo "Unsupported on this platform"
[linux]
[macos]
cxx:
cargo build --profile {{PROFILE}}
[windows]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
lib: libpng cxx
#!/bin/bash
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd {{PROJECT_DIR}}
make -C libpng-1.6.37 CC="{{LIBAFL_CC}}" CXX="{{LIBAFL_CXX}}"
[windows]
lib:
echo "Unsupported on this platform"
[linux]
[macos]
fuzzer: lib cxx
pwd
{{LIBAFL_CXX}} {{PROJECT_DIR}}/harness.cc {{PROJECT_DIR}}/libpng-1.6.37/.libs/libpng16.a -I {{PROJECT_DIR}}/libpng-1.6.37/ -o {{FUZZER_NAME}} -lm -lz
[windows]
fuzzer:
echo "Unsupported on this platform"
[linux]
[macos]
run: fuzzer
./{{FUZZER_NAME}} --cores 0-1 --input ./corpus
[windows]
run: fuzzer
echo "Unsupported on this platform"
[linux]
[macos]
test: fuzzer
#!/bin/bash
rm -rf libafl_unix_shmem_server || true
timeout 31s ./{{FUZZER_NAME}} --cores 0-1 --input ./corpus 2>/dev/null | tee fuzz_stdout.log || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
[windows]
test: fuzzer
echo "Unsupported on this platform"
clean:
rm -rf {{FUZZER_NAME}}
make -C libpng-1.6.37 clean || true
cargo clean

View File

@ -1,221 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'fuzzer_libpng'
PROJECT_DIR = { script = ["pwd"] }
CARGO_TARGET_DIR = { value = "${PROJECT_DIR}/target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
LIBAFL_CC = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc'
LIBAFL_CXX = '${CARGO_TARGET_DIR}/${PROFILE}/libafl_cxx'
FUZZER = '${CARGO_TARGET_DIR}/${PROFILE_DIR}/${FUZZER_NAME}'
[tasks.unsupported]
script_runner = "@shell"
script = '''
echo "Cargo-make not integrated yet on this"
'''
# libpng
[tasks.libpng]
linux_alias = "libpng_unix"
mac_alias = "libpng_unix"
windows_alias = "unsupported"
[tasks.libpng_unix]
condition = { files_not_exist = ["./libpng-1.6.37"] }
script_runner = "@shell"
script = '''
wget https://github.com/glennrp/libpng/archive/refs/tags/v1.6.37.tar.gz
tar -xvf v1.6.37.tar.gz
'''
# 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"]
# Library
[tasks.lib]
linux_alias = "lib_unix"
mac_alias = "lib_unix"
windows_alias = "unsupported"
[tasks.lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "cxx", "cc"]
# Library
[tasks.crash_lib]
linux_alias = "crash_lib_unix"
mac_alias = "crash_lib_unix"
windows_alias = "unsupported"
[tasks.crash_lib_unix]
script_runner = "@shell"
script = '''
cd libpng-1.6.37 && ./configure --enable-shared=no --with-pic=yes --enable-hardware-optimizations=yes
cd "${PROJECT_DIR}"
make -C libpng-1.6.37 CC="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cc" CXX="${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
'''
dependencies = ["libpng", "crash_cxx", "crash_cc"]
# Harness
[tasks.fuzzer]
linux_alias = "fuzzer_unix"
mac_alias = "fuzzer_unix"
windows_alias = "unsupported"
[tasks.fuzzer_unix]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}",
"-lm",
"-lz",
]
dependencies = ["lib", "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_cxx"
args = [
"${PROJECT_DIR}/harness.cc",
"${PROJECT_DIR}/libpng-1.6.37/.libs/libpng16.a",
"-I",
"${PROJECT_DIR}/libpng-1.6.37/",
"-o",
"${FUZZER_NAME}_crash",
"-lm",
"-lz",
]
dependencies = ["crash_lib", "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 = '''
./${FUZZER_NAME} &
sleep 0.2
./${FUZZER_NAME} 2>/dev/null
'''
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 = '''
./${FUZZER_NAME}_crash &
sleep 0.2
./${FUZZER_NAME}_crash 2>/dev/null
'''
dependencies = ["fuzzer_crash"]
# Test
[tasks.test]
linux_alias = "test_unix"
mac_alias = "test_mac"
windows_alias = "unsupported"
[tasks.test_unix]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
(timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log 2>/dev/null || true) &
sleep 0.2
timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true
if grep -qa "corpus: 30" fuzz_stdout.log; then
echo "Fuzzer is working"
else
echo "Fuzzer does not generate any testcases or any crashes"
exit 1
fi
'''
dependencies = ["fuzzer"]
[tasks.test_mac]
script_runner = "@shell"
script = '''
rm -rf libafl_unix_shmem_server || true
(timeout 31s ./${FUZZER_NAME} | tee fuzz_stdout.log 2>/dev/null || true) &
sleep 0.2
timeout 30s ./${FUZZER_NAME} >/dev/null 2>/dev/null || true
'''
dependencies = ["fuzzer"]
# 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}
make -C libpng-1.6.37 clean
cargo clean
'''

View File

@ -0,0 +1,57 @@
FUZZER_NAME := 'libfuzzer_windows_asan'
PROJECT_DIR := invocation_directory_native()
PROFILE := env("PROFILE", "release")
PROFILE_DIR := if PROFILE == "release" { "release" } else if PROFILE == "dev" { "debug" } else { "debug" }
CARGO_TARGET_DIR := env("CARGO_TARGET_DIR", "target")
LIBAFL_CXX := CARGO_TARGET_DIR / PROFILE_DIR / "libafl_cxx"
set shell := ["cmd.exe", "/c"]
alias cc := cxx
[windows]
cxx:
cargo build --profile {{PROFILE}}
[linux]
[macos]
cxx:
echo "Unsupported on this platform"
[linux]
[macos]
cxx:
cargo build --profile {{PROFILE}}
[windows]
fuzzer: cxx
.\target\{{PROFILE}}\libafl_cxx .\harness.cpp -o {{FUZZER_NAME}}.exe
[linux]
[macos]
fuzzer:
echo "Unsupported on this platform"
[windows]
test: fuzzer
start {{FUZZER_NAME}}.exe
start {{FUZZER_NAME}}.exe
ping -n 10 127.0.0.1>NUL && taskkill /im {{FUZZER_NAME}}.exe /F
dir /a-d crashes && (echo Files exist) || (exit /b 1337)
[linux]
[macos]
test:
echo "Unsupported on this platform"
[windows]
clean:
del ./{{FUZZER_NAME}}
cargo clean
[linux]
[macos]
clean:
echo "Unsupported on this platform"

View File

@ -1,109 +0,0 @@
# Variables
[env]
FUZZER_NAME = 'libfuzzer_windows_asan'
CARGO_TARGET_DIR = { value = "./target", condition = { env_not_set = [
"CARGO_TARGET_DIR",
] } }
PROFILE = { value = "release", condition = { env_not_set = ["PROFILE"] } }
PROFILE_DIR = { source = "${PROFILE}", default_value = "release", mapping = { "release" = "release", "dev" = "debug" }, condition = { env_not_set = [
"PROFILE_DIR",
] } }
[tasks.unsupported]
script_runner = "@shell"
script = '''
echo "Cargo-make not integrated yet on this"
'''
# Compilers
[tasks.cxx]
linux_alias = "unsupported"
mac_alias = "unsupported"
windows_alias = "cxx_unix"
[tasks.cxx_unix]
command = "cargo"
args = ["build", "--profile", "${PROFILE}"]
[tasks.cc]
linux_alias = "cc_unix"
mac_alias = "cc_unix"
windows_alias = "cc_unix"
[tasks.cc_unix]
command = "cargo"
args = ["build", "--profile", "${PROFILE}"]
[tasks.crash_cxx]
linux_alias = "unsupported"
mac_alias = "unsupported"
windows_alias = "unsupported"
[tasks.crash_cc]
linux_alias = "unsupported"
mac_alias = "unsupported"
windows_alias = "unsupported"
# Library
[tasks.lib]
linux_alias = "unsupported"
mac_alias = "unsupported"
windows_alias = "lib_unix"
[tasks.lib_unix]
dependencies = ["cxx", "cc"]
# Harness
[tasks.fuzzer]
linux_alias = "unsupported"
mac_alias = "unsupported"
windows_alias = "fuzzer_windows"
[tasks.fuzzer_windows]
command = "${CARGO_TARGET_DIR}/${PROFILE_DIR}/libafl_cxx"
args = ["./harness.cpp", "-o", "${FUZZER_NAME}.exe"]
dependencies = ["lib", "cxx", "cc"]
# Run the fuzzer
[tasks.run]
linux_alias = "unsupported"
mac_alias = "unsupported"
windows_alias = "run_windows" # TODO
[tasks.run_windows]
script_runner = "@shell"
script = '''
'''
dependencies = ["fuzzer"]
# Test
[tasks.test]
linux_alias = "unsupported"
mac_alias = "unsupported"
windows_alias = "test_windows" # TODO
[tasks.test_windows]
script_runner = "@shell"
script = '''
start "" "${FUZZER_NAME}.exe"
start "" "${FUZZER_NAME}.exe"
#ping is for timeout
ping -n 10 127.0.0.1>NUL && taskkill /im ${FUZZER_NAME}.exe /F
>nul 2>nul dir /a-d "crashes\*" && (echo Files exist) || (exit /b 1337)
'''
dependencies = ["fuzzer"]
# Clean up
[tasks.clean]
linux_alias = "unsupported"
mac_alias = "unsupported"
windows_alias = "clean_windows"
[tasks.clean_windows]
# Disable default `clean` definition
clear = true
script_runner = "@shell"
script = '''
del ./${FUZZER_NAME}
cargo clean
'''

View File

@ -64,6 +64,10 @@ do
echo "[*] Testing $fuzzer" echo "[*] Testing $fuzzer"
cargo make test || exit 1 cargo make test || exit 1
echo "[+] Done testing $fuzzer" echo "[+] Done testing $fuzzer"
elif [ -e ./Justfile ]; then
echo "[*] Testing $fuzzer"
just test || exit 1
echo "[+] Done testing $fuzzer"
else else
echo "[*] Building $fuzzer" echo "[*] Building $fuzzer"
cargo build || exit 1 cargo build || exit 1