From 08336ac1eb79fe20e2fd519298ebb8065a7038de Mon Sep 17 00:00:00 2001 From: hkctkuy Date: Wed, 12 Jun 2024 15:53:13 +0300 Subject: [PATCH] Renamed option x2 --- casr/src/bin/casr-afl.rs | 11 +++++----- casr/src/bin/casr-libfuzzer.rs | 11 +++++----- casr/src/triage.rs | 6 +++--- casr/src/util.rs | 6 +++--- casr/tests/tests.rs | 14 ++++++------- docs/usage.md | 37 +++++++++++++++++----------------- 6 files changed, 42 insertions(+), 43 deletions(-) diff --git a/casr/src/bin/casr-afl.rs b/casr/src/bin/casr-afl.rs index cc09953f..eff16db3 100644 --- a/casr/src/bin/casr-afl.rs +++ b/casr/src/bin/casr-afl.rs @@ -76,14 +76,13 @@ fn main() -> Result<()> { .help("Output directory with triaged reports") ) .arg( - Arg::new("base") - .short('b') - .long("base") - .env("CASR_BASE_DIR") + Arg::new("join") + .long("join") + .env("CASR_PREV_CLSUTERS_DIR") .action(ArgAction::Set) .value_parser(clap::value_parser!(PathBuf)) - .value_name("BASE_DIR") - .help("Base directory with previously triaged reports") + .value_name("PREV_CLSUTERS_DIR") + .help("Use directory with previously triaged reports for new reports accumulation") ) .arg( Arg::new("force-remove") diff --git a/casr/src/bin/casr-libfuzzer.rs b/casr/src/bin/casr-libfuzzer.rs index b5d3356f..dc182360 100644 --- a/casr/src/bin/casr-libfuzzer.rs +++ b/casr/src/bin/casr-libfuzzer.rs @@ -75,14 +75,13 @@ fn main() -> Result<()> { .help("Output directory with triaged reports") ) .arg( - Arg::new("base") - .short('b') - .long("base") - .env("CASR_BASE_DIR") + Arg::new("join") + .long("join") + .env("CASR_PREV_CLSUTERS_DIR") .action(ArgAction::Set) .value_parser(clap::value_parser!(PathBuf)) - .value_name("BASE_DIR") - .help("Base directory with previously triaged reports") + .value_name("PREV_CLSUTERS_DIR") + .help("Use directory with previously triaged reports for new reports accumulation") ) .arg( Arg::new("force-remove") diff --git a/casr/src/triage.rs b/casr/src/triage.rs index fcd7fa64..0071f486 100644 --- a/casr/src/triage.rs +++ b/casr/src/triage.rs @@ -159,11 +159,11 @@ pub fn fuzzing_crash_triage_pipeline( bail!("No crashes found"); } - let base_mode = matches.contains_id("base"); + let accum_mode = matches.contains_id("join"); let output_dir = initialize_dirs(matches)?; - let casrep_dir = if base_mode { + let casrep_dir = if accum_mode { output_dir.join("casrep") } else { output_dir.to_path_buf() @@ -238,7 +238,7 @@ pub fn fuzzing_crash_triage_pipeline( } if !matches.get_flag("no-cluster") { - if base_mode { + if accum_mode { info!("Accumulating CASR reports..."); let casr_cluster_u = Command::new(&casr_cluster) .arg("-u") diff --git a/casr/src/util.rs b/casr/src/util.rs index 2494707c..7d5f6c5f 100644 --- a/casr/src/util.rs +++ b/casr/src/util.rs @@ -325,9 +325,9 @@ pub fn initialize_dirs(matches: &clap::ArgMatches) -> Result<&PathBuf> { } } - if let Some(base_dir) = matches.get_one::("base") { - copy_dir(base_dir, output_dir) - .with_context(|| format!("Couldn't copy base directory {}", base_dir.display()))?; + if let Some(join_dir) = matches.get_one::("join") { + copy_dir(join_dir, output_dir) + .with_context(|| format!("Couldn't copy join directory {}", join_dir.display()))?; // Get casrep dir let casrep_dir = output_dir.join("casrep"); if !casrep_dir.exists() && fs::create_dir_all(&casrep_dir).is_err() { diff --git a/casr/tests/tests.rs b/casr/tests/tests.rs index c7d47812..ca638d21 100644 --- a/casr/tests/tests.rs +++ b/casr/tests/tests.rs @@ -3951,7 +3951,7 @@ fn test_casr_libfuzzer() { let paths = [ abs_path("tests/casr_tests/casrep/libfuzzer_crashes_xlnt"), - abs_path("tests/tmp_tests_casr/casr_libfuzzer_base"), + abs_path("tests/tmp_tests_casr/casr_libfuzzer_join"), abs_path("tests/tmp_tests_casr/casr_libfuzzer_out"), abs_path("tests/casr_tests/bin/load_fuzzer"), ]; @@ -4039,11 +4039,11 @@ fn test_casr_libfuzzer() { // Remove several clusters let cluster_paths = [ - abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl2"), - abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl20"), - abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl21"), - abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl22"), - abs_path("tests/tmp_tests_casr/casr_libfuzzer_base/cl23"), + abs_path("tests/tmp_tests_casr/casr_libfuzzer_join/cl2"), + abs_path("tests/tmp_tests_casr/casr_libfuzzer_join/cl20"), + abs_path("tests/tmp_tests_casr/casr_libfuzzer_join/cl21"), + abs_path("tests/tmp_tests_casr/casr_libfuzzer_join/cl22"), + abs_path("tests/tmp_tests_casr/casr_libfuzzer_join/cl23"), ]; for path in cluster_paths { let _ = fs::remove_dir_all(path); @@ -4051,7 +4051,7 @@ fn test_casr_libfuzzer() { let mut cmd = Command::new(*EXE_CASR_LIBFUZZER.read().unwrap()); cmd.args([ - "-i", &paths[0], "-b", &paths[1], "-o", &paths[2], "-f", "--", &paths[3], + "-i", &paths[0], "--join", &paths[1], "-o", &paths[2], "-f", "--", &paths[3], ]) .env( "PATH", diff --git a/docs/usage.md b/docs/usage.md index 460a26d8..b0f1e78e 100644 --- a/docs/usage.md +++ b/docs/usage.md @@ -449,22 +449,22 @@ Triage crashes found by AFL++/Sharpfuzz triage C# crashes with additional options Options: - -l, --log-level Logging level [default: info] [possible values: info, - debug] - -j, --jobs Number of parallel jobs for generating CASR reports - [default: half of cpu cores] - -t, --timeout Timeout (in seconds) for target execution, 0 value means - that timeout is disabled [default: 0] - -i, --input AFL++ work directory - -o, --output Output directory with triaged reports - -s, --seed Seed directory with previously triaged reports [env: - CASR_SEED_DIR=] - -f, --force-remove Remove output project directory if it exists - --ignore-cmdline Force usage to run target instead of searching for - cmdline files in AFL fuzzing directory - --no-cluster Do not cluster CASR reports - -h, --help Print help - -V, --version Print version + -l, --log-level Logging level [default: info] [possible values: info, + debug] + -j, --jobs Number of parallel jobs for generating CASR reports + [default: half of cpu cores] + -t, --timeout Timeout (in seconds) for target execution, 0 value means + that timeout is disabled [default: 0] + -i, --input AFL++ work directory + -o, --output Output directory with triaged reports + --join Use directory with previously triaged reports for new + reports accumulation [env: CASR_PREV_CLSUTERS_DIR=] + -f, --force-remove Remove output project directory if it exists + --ignore-cmdline Force usage to run target instead of searching + for cmdline files in AFL fuzzing directory + --no-cluster Do not cluster CASR reports + -h, --help Print help + -V, --version Print version `casr-afl` provides a straightforward CASR integration with AFL++. While walking through afl instances, `casr-afl` generates crash reports depending on target binary. For @@ -592,8 +592,9 @@ Triage crashes found by libFuzzer based fuzzer Directory containing crashes found by libFuzzer [default: .] -o, --output Output directory with triaged reports - -s, --seed - Seed directory with previously triaged reports [env: CASR_SEED_DIR=] + --join + Use directory with previously triaged reports for new reports accumulation [env: + CASR_PREV_CLSUTERS_DIR=] -f, --force-remove Remove output project directory if it exists --no-cluster