Skip to content

Commit

Permalink
Merge branch 'main' into libafl
Browse files Browse the repository at this point in the history
  • Loading branch information
louismerlin committed Oct 16, 2023
2 parents f965490 + 205a95e commit 68f35ee
Show file tree
Hide file tree
Showing 4 changed files with 79 additions and 60 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
# Changes

## 0.8.0 - 2023-10-16

- New and improved terminal user interface

## 0.7.2 - 2023-10-12

- Add `-z, --ziggy-output` flag and `ZIGGY_OUTPUT` environment variable to set ziggy's output directory
Expand Down
48 changes: 24 additions & 24 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ziggy"
version = "0.7.2"
version = "0.8.0"
edition = "2021"
license = "Apache-2.0"
description = "A multi-fuzzer management utility for all of your Rust fuzzing needs πŸ§‘β€πŸŽ€"
Expand Down
85 changes: 50 additions & 35 deletions src/bin/cargo-ziggy/fuzz.rs
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,7 @@ impl Fuzz {
);
}

eprintln!("\nSee live information by running:");
eprintln!("\nSee more live information by running:");
if afl_jobs > 0 {
eprintln!(
" {}",
Expand All @@ -486,11 +486,6 @@ impl Fuzz {
.bold()
);
}
eprintln!("\n\n\n\n\n");
eprintln!(" Waiting for fuzzers to");
eprintln!(" finish executing the");
eprintln!(" existing corpus once");
eprintln!("\n\n");

Ok(fuzzer_handles)
}
Expand Down Expand Up @@ -581,18 +576,29 @@ impl Fuzz {
}

pub fn print_stats(&self) {
let fuzzer_name = format!(" {} ", self.target);

let reset = "\x1b[0m";
let gray = "\x1b[1;90m";
let red = "\x1b[1;91m";
let green = "\x1b[1;92m";
let yellow = "\x1b[1;93m";
let purple = "\x1b[1;95m";
let blue = "\x1b[1;96m";

// First step: execute afl-whatsup
let mut afl_status = String::from("running ─");
let mut afl_status = format!("{green}running{reset} ─");
let mut afl_total_execs = String::new();
let mut afl_instances = String::new();
let mut afl_speed = String::new();
let mut afl_coverage = String::new();
let mut afl_crashes = String::new();
let mut afl_timeouts = String::new();
let mut afl_new_finds = String::new();
let mut afl_faves = String::new();

if !self.afl() {
afl_status = String::from("disabled ")
afl_status = format!("{yellow}disabled{reset} ")
} else {
let cargo = env::var("CARGO").unwrap_or_else(|_| String::from("cargo"));
let afl_stats_process = process::Command::new(cargo)
Expand Down Expand Up @@ -620,6 +626,8 @@ impl Fuzz {
afl_coverage = String::from(coverage);
} else if let Some(crashes) = line.strip_prefix("Crashes saved : ") {
afl_crashes = String::from(crashes);
} else if let Some(timeouts) = line.strip_prefix("Hangs saved : ") {
afl_timeouts = String::from(timeouts.split(' ').next().unwrap_or_default());
} else if let Some(new_finds) = line.strip_prefix("Time without finds : ") {
afl_new_finds =
String::from(new_finds.split(',').next().unwrap_or_default());
Expand All @@ -638,16 +646,17 @@ impl Fuzz {
}

// Second step: Get stats from honggfuzz logs
let mut hf_status = String::from("running ─");
let mut hf_status = format!("{green}running{reset} ─");
let mut hf_total_execs = String::new();
let mut hf_threads = String::new();
let mut hf_speed = String::new();
let mut hf_coverage = String::new();
let mut hf_crashes = String::new();
let mut hf_timeouts = String::new();
let mut hf_new_finds = String::new();

if !self.honggfuzz() {
hf_status = String::from("disabled ");
hf_status = format!("{yellow}disabled{reset} ");
} else {
let hf_stats_process = process::Command::new("tail")
.args([
Expand Down Expand Up @@ -686,6 +695,8 @@ impl Fuzz {
);
} else if let Some(crashes) = line.strip_prefix("Crashes : ") {
hf_crashes = String::from(crashes.split(' ').next().unwrap_or_default());
} else if let Some(timeouts) = line.strip_prefix("Timeouts : ") {
hf_timeouts = String::from(timeouts.split(' ').next().unwrap_or_default());
} else if let Some(new_finds) = line.strip_prefix("Cov Update : ") {
hf_new_finds = String::from(new_finds.trim());
hf_new_finds = String::from(
Expand Down Expand Up @@ -722,35 +733,39 @@ impl Fuzz {
}

// Fourth step: Print stats
// TODO Colors, of course!
// Move 11 lines up and clear line
eprint!("\x1B[11A\x1B[K");
eprint!("\x1B[K");
eprintln!("β”Œβ”€β”€ ziggy rocking ──────────────────────────────────────────────────────────┐");
eprint!("\x1B[K");
// We start by clearing the screen
eprint!("\x1B[1;1H\x1B[2J");
eprintln!("β”Œβ”€ {blue}ziggy{reset} {purple}rocking{reset} ─────────{fuzzer_name:─^25.25}──────────────────{blue}/{red}///{reset}───┐");
eprintln!(
"β”‚ run time : {total_run_time:17} β”‚"
"β”‚{gray}run time :{reset} {total_run_time:17.17} {blue}/{red}//////{reset} β”‚"
);
eprint!("\x1B[K");
eprintln!("β”œβ”€β”€ afl++ {afl_status:0}───────────────────┬── honggfuzz {hf_status:0}────────────────");
eprint!("\x1B[K");
eprintln!("β”œβ”€ {blue}afl++{reset} {afl_status:0}────────────────────┬────────────────────────────────{blue}/{red}//{reset}───");
if !afl_status.contains("disabled") {
eprintln!("β”‚ {gray}instances :{reset} {afl_instances:17.17} β”‚ {gray}best coverage :{reset} {afl_coverage:11.11} {blue}/{red}//{reset} β”‚");
if afl_crashes == "0" {
eprintln!("β”‚{gray}cumulative speed :{reset} {afl_speed:17.17} β”‚ {gray}crashes saved :{reset} {afl_crashes:11.11} {blue}/{red}//{reset} β”‚");
} else {
eprintln!("β”‚{gray}cumulative speed :{reset} {afl_speed:17.17} β”‚ {gray}crashes saved :{reset} {red}{afl_crashes:11.11}{reset} {blue}/{red}//{reset} β”‚");
}
eprintln!(
"β”‚ {gray}total execs :{reset} {afl_total_execs:17.17} β”‚{gray}timeouts saved :{reset} {afl_timeouts:17.17} β”‚"
);
eprintln!("β”‚ {gray}top inputs todo :{reset} {afl_faves:17.17} β”‚ {gray}no find for :{reset} {afl_new_finds:17.17} β”‚");
}
eprintln!(
"β”‚ total execs : {afl_total_execs:17} β”‚ total execs : {hf_total_execs:17} β”‚"
"β”œβ”€ {blue}honggfuzz{reset} {hf_status:0}β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”¬β”€β”€β”€β”€β”˜"
);
eprint!("\x1B[K");
eprintln!("β”‚ instances : {afl_instances:17} β”‚ threads : {hf_threads:17} β”‚");
eprint!("\x1B[K");
eprintln!("β”‚cumulative speed : {afl_speed:17} β”‚ average Speed : {hf_speed:17} β”‚");
eprint!("\x1B[K");
eprintln!("β”‚ best coverage : {afl_coverage:17} β”‚ coverage : {hf_coverage:17} β”‚");
eprint!("\x1B[K");
eprintln!("β”‚ crashes saved : {afl_crashes:17} β”‚ crashes saved : {hf_crashes:17} β”‚");
eprint!("\x1B[K");
eprintln!("β”‚ no find for : {afl_new_finds:17} β”‚ no find for : {hf_new_finds:17} β”‚");
eprint!("\x1B[K");
eprintln!("β”‚ top inputs todo : {afl_faves:17} β”‚ β”‚");
eprint!("\x1B[K");
eprintln!("β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜");
if !hf_status.contains("disabled") {
eprintln!("β”‚ {gray}threads :{reset} {hf_threads:17.17} β”‚ {gray}coverage :{reset} {hf_coverage:17.17} β”‚");
if hf_crashes == "0" {
eprintln!("β”‚{gray}average Speed :{reset} {hf_speed:17.17} β”‚ {gray}crashes saved :{reset} {hf_crashes:17.17} β”‚");
} else {
eprintln!("β”‚{gray}average Speed :{reset} {hf_speed:17.17} β”‚ {gray}crashes saved :{reset} {red}{hf_crashes:17.17}{reset} β”‚");
}
eprintln!("β”‚ {gray}total execs :{reset} {hf_total_execs:17.17} β”‚{gray}timeouts saved :{reset} {hf_timeouts:17.17} β”‚");
eprintln!("β”‚ β”‚ {gray}no find for :{reset} {hf_new_finds:17.17} β”‚");
}
eprintln!("β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜");
}
}

Expand Down

0 comments on commit 68f35ee

Please sign in to comment.