Skip to content

Commit 448da63

Browse files
authored
forkserver_example_nautilus: enable Python grammars; small fixes (#3368)
* forkserver_example_nautilus: make tree depth configurable * forkserver_example_nautilus: enable Python grammars; fix example
1 parent 4403cd0 commit 448da63

File tree

7 files changed

+99
-6
lines changed

7 files changed

+99
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ paste = "1.0.15"
117117
postcard = { version = "1.0.10", features = [
118118
"alloc",
119119
], default-features = false } # no_std compatible serde serialization format
120-
pyo3 = "0.24.1"
120+
pyo3 = { version = "0.24.1", features = ["auto-initialize"] }
121121
pyo3-build-config = "0.25.0"
122122
rangemap = "1.5.1"
123123
regex = "1.10.6"

fuzzers/structure_aware/forkserver_simple_nautilus/Cargo.lock

Lines changed: 82 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

fuzzers/structure_aware/forkserver_simple_nautilus/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ libafl = { path = "../../../crates/libafl", features = [
2222
"std",
2323
"derive",
2424
"nautilus",
25+
"nautilus_py",
2526
] }
2627
libafl_bolts = { path = "../../../crates/libafl_bolts" }
2728
log = { version = "0.4.22", features = ["release_max_level_info"] }

fuzzers/structure_aware/forkserver_simple_nautilus/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,5 @@ This downloads AFLplusplus/AFLplusplus and compiles the example harness program
99
After you build it you can run
1010
`cp ./target/release/forkserver_simple .` to copy the fuzzer into this directory,
1111
and you can run
12-
`taskset -c 1 ./forkserver_simple ./target/release/program ./corpus/ -t 1000` to run the fuzzer.
12+
`taskset -c 1 ./target/release/forkserver_simple -g src/grammar.py -t 1000 -- ./target/release/program` to run the fuzzer.
1313
`taskset` binds this process to a specific core to improve the throughput.

fuzzers/structure_aware/forkserver_simple_nautilus/corpus/testfile

Lines changed: 0 additions & 1 deletion
This file was deleted.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
ctx.rule("START", "{INPUT}")
2+
ctx.rule("INPUT", "bad")
3+
ctx.rule("INPUT", "vuln")

fuzzers/structure_aware/forkserver_simple_nautilus/src/main.rs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ use nix::sys::signal::Signal;
4242
)]
4343
struct Opt {
4444
#[arg(
45-
help = "The instrumented binary we want to fuzz",
45+
help = "Instrumented binary we want to fuzz",
4646
name = "EXEC",
4747
required = true
4848
)]
@@ -81,8 +81,16 @@ struct Opt {
8181
)]
8282
signal: Signal,
8383

84-
#[arg(help = "The nautilus grammar file", short)]
84+
#[arg(help = "Nautilus grammar file (Python or JSON)", short)]
8585
grammar: PathBuf,
86+
87+
#[arg(
88+
help = "Nautilus tree depth",
89+
short = 'T',
90+
long = "tree-depth",
91+
default_value = "15"
92+
)]
93+
tree_depth: usize,
8694
}
8795

8896
pub fn main() {
@@ -111,7 +119,7 @@ pub fn main() {
111119
// Create an observation channel to keep track of the execution time
112120
let time_observer = TimeObserver::new("time");
113121

114-
let context = NautilusContext::from_file(15, opt.grammar).unwrap();
122+
let context = NautilusContext::from_file(opt.tree_depth, opt.grammar).unwrap();
115123

116124
// Feedback to rate the interestingness of an input
117125
// This one is composed by two Feedbacks in OR

0 commit comments

Comments
 (0)