From a2719cf559653100199c79bf85883669435c4582 Mon Sep 17 00:00:00 2001 From: Lei Zhu Date: Wed, 10 May 2023 19:53:40 +0800 Subject: [PATCH] Add suggestion for `arg` & `args` (#1257) * Add suggestion for arg & args * Make fmt happy * Explain @@ * Spotlight afl-fuzz --------- Co-authored-by: Dominik Maier Co-authored-by: Dongjia "toka" Zhang --- libafl/src/executors/command.rs | 10 +++++++++- libafl/src/executors/forkserver.rs | 6 ++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/libafl/src/executors/command.rs b/libafl/src/executors/command.rs index 64bb700581..e4d7694ffa 100644 --- a/libafl/src/executors/command.rs +++ b/libafl/src/executors/command.rs @@ -256,7 +256,9 @@ where }) } - /// Parses an AFL-like commandline, replacing `@@` with the input file. + /// Parses an AFL-like commandline, replacing `@@` with the input file + /// generated by the fuzzer (similar to the `afl-fuzz` command line). + /// /// If no `@@` was found, will use stdin for input. /// The arg 0 is the program. pub fn parse_afl_cmdline( @@ -479,12 +481,18 @@ impl CommandExecutorBuilder { } /// Adds an argument to the program's commandline. + /// + /// You may want to use [`CommandExecutor::parse_afl_cmdline`] if you're going to pass `@@` + /// represents the input file generated by the fuzzer (similar to the `afl-fuzz` command line). pub fn arg>(&mut self, arg: O) -> &mut CommandExecutorBuilder { self.args.push(arg.as_ref().to_owned()); self } /// Adds a range of arguments to the program's commandline. + /// + /// You may want to use [`CommandExecutor::parse_afl_cmdline`] if you're going to pass `@@` + /// represents the input file generated by the fuzzer (similar to the `afl-fuzz` command line). pub fn args(&mut self, args: IT) -> &mut CommandExecutorBuilder where IT: IntoIterator, diff --git a/libafl/src/executors/forkserver.rs b/libafl/src/executors/forkserver.rs index ed622b1e93..445aaeb4f4 100644 --- a/libafl/src/executors/forkserver.rs +++ b/libafl/src/executors/forkserver.rs @@ -898,6 +898,9 @@ impl<'a, SP> ForkserverExecutorBuilder<'a, SP> { } /// Adds an argument to the harness's commandline + /// + /// You may want to use `parse_afl_cmdline` if you're going to pass `@@` + /// represents the input file generated by the fuzzer (similar to the `afl-fuzz` command line). #[must_use] pub fn arg(mut self, arg: O) -> Self where @@ -908,6 +911,9 @@ impl<'a, SP> ForkserverExecutorBuilder<'a, SP> { } /// Adds arguments to the harness's commandline + /// + /// You may want to use `parse_afl_cmdline` if you're going to pass `@@` + /// represents the input file generated by the fuzzer (similar to the `afl-fuzz` command line). #[must_use] pub fn args(mut self, args: IT) -> Self where