Skip to content

Building 70 Projects ranging from beginner to advanced so anyone can — learn from, build upon, use as a reference, or even copy directly. Owned by my cybersecurity company đŸ‘‡

feat(lisdex): M6.0 - the coverage curve was already on disk, and reading it by position would have been wrong

CarterPerez-dev62e11a41f1b0
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/lib.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/lib.rs
index 60a59c87..675522ea 100644
--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/lib.rs
+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/lib.rs
@@ -2,6 +2,7 @@
// lib.rs
pub mod minimize;
+pub mod plot;
pub mod runner;
pub mod stats;
pub mod symbolize;
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/plot.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/plot.rs
new file mode 100644
index 00000000..e31b8de7
--- /dev/null
+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/src/plot.rs
@@ -0,0 +1,284 @@
+// ©AngelaMos | 2026
+// plot.rs
+
+pub const PLOT_FILE_NAME: &str = "plot_data";
+
+const HEADER_PREFIX: char = '#';
+const FIELD_SEPARATOR: char = ',';
+const PERCENT_SUFFIX: char = '%';
+
+const COLUMN_RELATIVE_TIME: &str = "relative_time";
+const COLUMN_CORPUS_COUNT: &str = "corpus_count";
+const COLUMN_EDGES_FOUND: &str = "edges_found";
+const COLUMN_EXECS_PER_SEC: &str = "execs_per_sec";
+const COLUMN_TOTAL_EXECS: &str = "total_execs";
+const COLUMN_SAVED_CRASHES: &str = "saved_crashes";
+const COLUMN_MAP_SIZE: &str = "map_size";
+
+const REQUIRED_COLUMNS: [&str; 7] = [
+ COLUMN_RELATIVE_TIME,
+ COLUMN_CORPUS_COUNT,
+ COLUMN_EDGES_FOUND,
+ COLUMN_EXECS_PER_SEC,
+ COLUMN_TOTAL_EXECS,
+ COLUMN_SAVED_CRASHES,
+ COLUMN_MAP_SIZE,
+];
+
+#[derive(Debug, thiserror::Error, PartialEq, Eq)]
+pub enum PlotError {
+ #[error("plot_data has no header line, so its columns cannot be named")]
+ MissingHeader,
+ #[error("plot_data header does not name column {0}")]
+ MissingColumn(&'static str),
+ #[error("plot_data row {row} has {found} fields, but the header names {expected}")]
+ ShortRow {
+ row: usize,
+ found: usize,
+ expected: usize,
+ },
+ #[error("plot_data column {column} has unparsable value {value}")]
+ BadValue { column: &'static str, value: String },
+}
+
+#[derive(Debug, Clone, Copy, PartialEq)]
+pub struct CoverageSample {
+ pub relative_time: u64,
+ pub corpus_count: u64,
+ pub edges_found: u64,
+ pub execs_per_sec: f64,
+ pub total_execs: u64,
+ pub saved_crashes: u64,
+ pub map_size_pct: f64,
+}
+
+#[derive(Debug, Clone, PartialEq)]
+pub struct CoverageCurve {
+ samples: Vec<CoverageSample>,
+}
+
+impl CoverageCurve {
+ #[must_use]
+ pub fn samples(&self) -> &[CoverageSample] {
+ &self.samples
+ }
+
+ #[must_use]
+ pub fn is_empty(&self) -> bool {
+ self.samples.is_empty()
+ }
+
+ #[must_use]
+ pub fn last(&self) -> Option<&CoverageSample> {
+ self.samples.last()
+ }
+
+ #[must_use]
+ pub fn duration_secs(&self) -> u64 {
+ self.samples.last().map_or(0, |sample| sample.relative_time)
+ }
+
+ #[must_use]
+ pub fn peak_edges(&self) -> u64 {
+ self.samples
+ .iter()
+ .map(|sample| sample.edges_found)
+ .max()
+ .unwrap_or(0)
+ }
+
+ #[must_use]
+ pub fn edges_are_monotonic(&self) -> bool {
+ self.samples
+ .windows(2)
+ .all(|pair| pair[1].edges_found >= pair[0].edges_found)
+ }
+}
+
+fn header_index(header: &str) -> Result<Vec<&str>, PlotError> {
+ let names: Vec<&str> = header
+ .trim_start_matches(HEADER_PREFIX)
+ .split(FIELD_SEPARATOR)
+ .map(str::trim)
+ .collect();
+ for required in REQUIRED_COLUMNS {
+ if !names.contains(&required) {
+ return Err(PlotError::MissingColumn(required));
+ }
+ }
+ Ok(names)
+}
+
+fn cell<'a>(
+ fields: &[&'a str],
+ names: &[&str],
+ column: &'static str,
+) -> Result<&'a str, PlotError> {
+ let index = names
+ .iter()
+ .position(|name| *name == column)
+ .ok_or(PlotError::MissingColumn(column))?;
+ fields
+ .get(index)
+ .copied()
+ .ok_or(PlotError::MissingColumn(column))
+}
+
+fn integer(fields: &[&str], names: &[&str], column: &'static str) -> Result<u64, PlotError> {
+ let value = cell(fields, names, column)?;
+ value.parse().map_err(|_| PlotError::BadValue {
+ column,
+ value: value.to_owned(),
+ })
+}
+
+fn decimal(fields: &[&str], names: &[&str], column: &'static str) -> Result<f64, PlotError> {
+ let value = cell(fields, names, column)?;
+ value
+ .trim_end_matches(PERCENT_SUFFIX)
+ .parse()
+ .map_err(|_| PlotError::BadValue {
+ column,
+ value: value.to_owned(),
+ })
+}
+
+pub fn parse(text: &str) -> Result<CoverageCurve, PlotError> {
+ let mut lines = text.lines().filter(|line| !line.trim().is_empty());
+ let header = lines.next().ok_or(PlotError::MissingHeader)?;
+ if !header.trim_start().starts_with(HEADER_PREFIX) {
+ return Err(PlotError::MissingHeader);
+ }
+ let names = header_index(header)?;
+
+ let mut samples = Vec::new();
+ for (row, line) in lines.enumerate() {
+ if line.trim_start().starts_with(HEADER_PREFIX) {
+ continue;
+ }
+ let fields: Vec<&str> = line.split(FIELD_SEPARATOR).map(str::trim).collect();
+ if fields.len() < names.len() {
+ return Err(PlotError::ShortRow {
+ row,
+ found: fields.len(),
+ expected: names.len(),
+ });
+ }
+ samples.push(CoverageSample {
+ relative_time: integer(&fields, &names, COLUMN_RELATIVE_TIME)?,
+ corpus_count: integer(&fields, &names, COLUMN_CORPUS_COUNT)?,
+ edges_found: integer(&fields, &names, COLUMN_EDGES_FOUND)?,
+ execs_per_sec: decimal(&fields, &names, COLUMN_EXECS_PER_SEC)?,
+ total_execs: integer(&fields, &names, COLUMN_TOTAL_EXECS)?,
+ saved_crashes: integer(&fields, &names, COLUMN_SAVED_CRASHES)?,
+ map_size_pct: decimal(&fields, &names, COLUMN_MAP_SIZE)?,
+ });
+ }
+ Ok(CoverageCurve { samples })
+}
+
+#[cfg(test)]
+mod tests {
+ use super::*;
+
+ const REAL_HEADER: &str = "# relative_time, cycles_done, cur_item, corpus_count, pending_total, pending_favs, map_size, saved_crashes, saved_hangs, max_depth, execs_per_sec, total_execs, edges_found, total_crashes, servers_count";
+
+ const REAL_PLOT: &str = "# relative_time, cycles_done, cur_item, corpus_count, pending_total, pending_favs, map_size, saved_crashes, saved_hangs, max_depth, execs_per_sec, total_execs, edges_found, total_crashes, servers_count
+62, 3, 755, 945, 18, 0, 16.96%, 21, 0, 16, 46602.89, 1677996, 11726, 463, 0
+124, 6, 900, 980, 4, 0, 17.10%, 24, 0, 17, 45011.02, 3400000, 11800, 500, 0
+";
+
+ #[test]
+ fn a_real_plot_data_parses_by_column_name() {
+ let curve = parse(REAL_PLOT).expect("real plot_data must parse");
+ assert_eq!(curve.samples().len(), 2);
+ let first = curve.samples()[0];
+ assert_eq!(first.relative_time, 62);
+ assert_eq!(first.corpus_count, 945);
+ assert_eq!(first.edges_found, 11726);
+ assert_eq!(first.total_execs, 1_677_996);
+ assert_eq!(first.saved_crashes, 21);
+ assert!((first.execs_per_sec - 46602.89).abs() < f64::EPSILON);
+ assert!(
+ (first.map_size_pct - 16.96).abs() < f64::EPSILON,
+ "map_size carries a percent suffix in the real file and has to be stripped, not parsed as text"
+ );
+ }
+
+ #[test]
+ fn the_columns_are_found_by_name_so_a_new_one_cannot_shift_the_rest() {
+ let reordered = "# edges_found, relative_time, corpus_count, execs_per_sec, total_execs, saved_crashes, map_size, brand_new_column
+11726, 62, 945, 46602.89, 1677996, 21, 16.96%, 999
+";
+ let curve = parse(reordered).expect("column order must not matter");
+ let first = curve.samples()[0];
+ assert_eq!(
+ (first.edges_found, first.relative_time),
+ (11726, 62),
+ "AFL++ has added columns to this file before (servers_count is recent); reading by position would silently attribute one column's values to another field"
+ );
+ }
+
+ #[test]
+ fn a_header_missing_a_column_we_need_is_refused_rather_than_guessed() {
+ let without_edges = "# relative_time, corpus_count, execs_per_sec, total_execs, saved_crashes, map_size\n62, 945, 46602.89, 1677996, 21, 16.96%\n";
+ assert_eq!(
+ parse(without_edges),
+ Err(PlotError::MissingColumn(COLUMN_EDGES_FOUND))
+ );
+ }
+
+ #[test]
+ fn a_file_with_no_header_is_refused_because_its_columns_cannot_be_named() {
+ assert_eq!(
+ parse("62, 3, 755, 945\n"),
+ Err(PlotError::MissingHeader),
+ "a headerless file could only be read positionally, which is the thing this parser exists to avoid"
+ );
+ assert_eq!(parse(""), Err(PlotError::MissingHeader));
+ }
+
+ #[test]
+ fn a_truncated_row_is_refused_rather_than_read_short() {
+ let truncated = format!("{REAL_HEADER}\n62, 3, 755\n");
+ assert!(matches!(
+ parse(&truncated),
+ Err(PlotError::ShortRow {
+ row: 0,
+ found: 3,
+ ..
+ })
+ ));
+ }
+
+ #[test]
+ fn a_header_only_file_is_an_empty_curve_and_not_an_error() {
+ let curve = parse(&format!("{REAL_HEADER}\n"))
+ .expect("a campaign that wrote no row yet is not malformed");
+ assert!(curve.is_empty());
+ assert_eq!(curve.duration_secs(), 0);
+ assert_eq!(curve.peak_edges(), 0);
+ assert_eq!(curve.last(), None);
+ }
+
+ #[test]
+ fn the_curve_reports_its_own_shape() {
+ let curve = parse(REAL_PLOT).unwrap();
+ assert_eq!(curve.duration_secs(), 124);
+ assert_eq!(curve.peak_edges(), 11800);
+ assert!(curve.edges_are_monotonic());
+ }
+
+ #[test]
+ fn edges_going_backwards_is_reported_rather_than_smoothed_over() {
+ let regressed = format!(
+ "{REAL_HEADER}\n62, 3, 755, 945, 18, 0, 16.96%, 21, 0, 16, 46602.89, 1677996, 11726, 463, 0\n124, 6, 900, 980, 4, 0, 17.10%, 24, 0, 17, 45011.02, 3400000, 9000, 500, 0\n"
+ );
+ let curve = parse(&regressed).unwrap();
+ assert!(
+ !curve.edges_are_monotonic(),
+ "edges found can only grow within one campaign, so a fall means the file was rotated, resumed over, or concatenated, and a caller comparing first to last would understate coverage"
+ );
+ assert_eq!(curve.peak_edges(), 11726);
+ }
+}
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/tests/fixtures/plot_data.txt b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/tests/fixtures/plot_data.txt
new file mode 100644
index 00000000..5237520a
--- /dev/null
+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/tests/fixtures/plot_data.txt
@@ -0,0 +1,107 @@
+# relative_time, cycles_done, cur_item, corpus_count, pending_total, pending_favs, map_size, saved_crashes, saved_hangs, max_depth, execs_per_sec, total_execs, edges_found, total_crashes, servers_count
+62, 3, 755, 945, 18, 0, 16.96%, 21, 0, 16, 46602.89, 1677996, 11726, 463, 0
+67, 4, 830, 963, 7, 0, 16.98%, 22, 0, 17, 51315.60, 1944707, 11739, 559, 0
+72, 5, 997, 1002, 25, 0, 17.07%, 22, 0, 17, 3221.18, 2148466, 11798, 634, 0
+77, 5, 836, 1064, 42, 1, 17.24%, 22, 0, 18, 51401.37, 2393880, 11918, 704, 0
+82, 5, 1065, 1081, 34, 0, 17.25%, 24, 0, 19, 753.98, 2569232, 11922, 753, 0
+87, 6, 850, 1104, 18, 0, 17.39%, 25, 0, 19, 55592.20, 2862950, 12020, 803, 0
+92, 7, 731, 1115, 7, 0, 17.39%, 25, 0, 19, 57950.46, 3155297, 12021, 879, 0
+97, 7, 1108, 1122, 4, 0, 17.39%, 27, 0, 19, 58611.15, 3457607, 12023, 948, 0
+102, 8, 1047, 1134, 8, 0, 17.65%, 28, 0, 19, 61552.82, 3711778, 12200, 996, 0
+108, 9, 349, 1146, 6, 0, 17.65%, 30, 0, 19, 54145.97, 3986423, 12204, 1064, 0
+113, 9, 698, 1146, 4, 0, 17.65%, 30, 0, 19, 534.53, 4083882, 12204, 1085, 0
+118, 9, 1150, 1151, 6, 1, 17.90%, 30, 0, 19, 48295.67, 4300824, 12374, 1128, 0
+123, 10, 1169, 1206, 12, 0, 18.97%, 33, 0, 19, 55460.74, 4586420, 13116, 1203, 0
+128, 10, 718, 1220, 9, 0, 18.98%, 34, 0, 19, 59280.88, 4894296, 13121, 1267, 0
+133, 11, 605, 1230, 9, 0, 19.14%, 34, 0, 19, 60508.09, 5199816, 13231, 1365, 0
+138, 12, 1117, 1241, 3, 0, 19.27%, 34, 0, 19, 74136.94, 5463112, 13319, 1457, 0
+144, 12, 866, 1248, 2, 0, 19.28%, 34, 0, 19, 63807.22, 5781551, 13325, 1528, 0
+149, 13, 795, 1249, 1, 0, 19.28%, 36, 0, 19, 60326.57, 6075355, 13325, 1618, 0
+154, 13, 304, 1259, 2, 0, 19.41%, 36, 0, 19, 56962.53, 6360099, 13416, 1657, 0
+159, 14, 649, 1260, 1, 0, 19.41%, 37, 0, 19, 62064.40, 6683875, 13416, 1738, 0
+164, 15, 1064, 1268, 3, 0, 19.41%, 38, 0, 19, 57938.44, 6966765, 13416, 1809, 0
+169, 15, 265, 1276, 5, 0, 19.42%, 39, 0, 19, 61171.29, 7268771, 13425, 1859, 0
+174, 16, 759, 1280, 3, 0, 19.42%, 39, 0, 19, 63287.00, 7596379, 13426, 1938, 0
+179, 16, 644, 1289, 7, 0, 19.42%, 40, 0, 21, 62225.60, 7922897, 13426, 2013, 0
+184, 17, 446, 1291, 3, 0, 19.42%, 40, 0, 21, 52409.52, 8133242, 13426, 2046, 0
+190, 17, 606, 1293, 1, 0, 19.42%, 41, 0, 21, 61890.44, 8462652, 13428, 2118, 0
+195, 18, 1163, 1295, 3, 0, 19.42%, 42, 0, 21, 64964.62, 8795671, 13428, 2216, 0
+200, 19, 352, 1297, 1, 0, 19.43%, 42, 0, 21, 64959.28, 9129114, 13430, 2280, 0
+205, 19, 1120, 1298, 2, 0, 19.43%, 44, 0, 21, 66420.45, 9455500, 13430, 2318, 0
+210, 20, 186, 1304, 2, 0, 19.43%, 45, 0, 21, 62132.97, 9763125, 13430, 2363, 0
+215, 20, 460, 1307, 1, 0, 19.49%, 45, 0, 21, 63774.40, 10080506, 13474, 2431, 0
+220, 21, 954, 1307, 1, 0, 19.49%, 47, 0, 21, 64333.10, 10403907, 13474, 2466, 0
+225, 21, 978, 1308, 1, 0, 19.49%, 47, 0, 21, 53948.08, 10656218, 13474, 2518, 0
+230, 22, 866, 1313, 4, 0, 19.49%, 47, 0, 21, 64955.71, 11007029, 13474, 2598, 0
+235, 23, 667, 1317, 2, 0, 19.49%, 49, 0, 21, 61884.13, 11287477, 13474, 2672, 0
+240, 23, 732, 1317, 1, 0, 19.49%, 51, 0, 21, 60017.09, 11590245, 13474, 2729, 0
+246, 24, 995, 1318, 0, 0, 19.49%, 52, 0, 21, 51276.10, 11849186, 13474, 2781, 0
+251, 24, 794, 1318, 0, 0, 19.49%, 52, 0, 21, 47776.87, 12132932, 13474, 2832, 0
+257, 25, 670, 1321, 1, 0, 19.49%, 55, 0, 21, 5289.14, 12452222, 13474, 2892, 0
+262, 25, 132, 1330, 2, 0, 19.53%, 57, 0, 21, 58185.51, 12760335, 13503, 2957, 0
+267, 26, 1333, 1335, 0, 0, 19.53%, 57, 0, 21, 66259.64, 13113397, 13503, 3010, 0
+272, 27, 676, 1337, 2, 0, 19.53%, 58, 0, 21, 59213.60, 13395071, 13503, 3074, 0
+278, 27, 671, 1337, 2, 0, 19.53%, 58, 0, 21, 57223.86, 13666434, 13503, 3142, 0
+283, 28, 238, 1337, 0, 0, 19.53%, 58, 0, 21, 64302.14, 14004514, 13503, 3193, 0
+288, 28, 694, 1337, 0, 0, 19.53%, 59, 0, 21, 65506.87, 14317819, 13503, 3246, 0
+293, 29, 1117, 1340, 0, 0, 19.54%, 59, 0, 21, 65203.71, 14617526, 13505, 3265, 0
+298, 29, 389, 1341, 0, 0, 19.54%, 59, 0, 21, 61614.47, 14923364, 13505, 3301, 0
+303, 30, 1236, 1341, 0, 0, 19.54%, 59, 0, 21, 63456.25, 15211478, 13505, 3349, 0
+308, 31, 389, 1344, 2, 0, 19.54%, 59, 0, 21, 55713.33, 15480655, 13505, 3414, 0
+313, 31, 1212, 1346, 2, 0, 19.54%, 60, 0, 22, 24038.41, 15750564, 13505, 3469, 0
+318, 32, 853, 1346, 0, 0, 19.54%, 60, 0, 22, 56521.07, 16058151, 13505, 3527, 0
+323, 32, 1079, 1347, 0, 0, 19.54%, 61, 0, 22, 61801.75, 16378805, 13505, 3581, 0
+329, 33, 499, 1349, 0, 0, 19.54%, 62, 0, 22, 54282.59, 16588698, 13506, 3614, 0
+334, 33, 1092, 1349, 0, 0, 19.54%, 62, 0, 22, 49599.67, 16764146, 13506, 3640, 0
+339, 34, 774, 1349, 0, 0, 19.54%, 63, 0, 22, 64059.99, 17110818, 13506, 3724, 0
+344, 34, 1233, 1349, 0, 0, 19.54%, 64, 0, 22, 65741.69, 17445769, 13506, 3770, 0
+349, 35, 1229, 1351, 0, 0, 19.54%, 65, 0, 22, 63720.74, 17680888, 13506, 3797, 0
+354, 35, 777, 1352, 1, 0, 19.54%, 66, 0, 22, 67046.28, 18030195, 13506, 3859, 0
+359, 36, 1127, 1355, 1, 0, 19.54%, 66, 0, 22, 66012.33, 18365417, 13506, 3902, 0
+365, 37, 1320, 1355, 0, 0, 19.54%, 66, 0, 22, 65968.22, 18684151, 13506, 3942, 0
+370, 37, 1212, 1355, 0, 0, 19.54%, 66, 0, 22, 51931.37, 18947572, 13506, 4008, 0
+375, 38, 1021, 1356, 0, 0, 19.54%, 66, 0, 22, 62590.46, 19277356, 13506, 4112, 0
+380, 38, 430, 1356, 0, 0, 19.54%, 67, 0, 22, 44732.67, 19511279, 13506, 4260, 0
+385, 39, 1237, 1363, 4, 0, 19.54%, 68, 0, 22, 60832.70, 19842175, 13507, 4340, 0
+390, 39, 241, 1365, 0, 0, 19.54%, 69, 0, 22, 55429.65, 20109566, 13507, 4397, 0
+395, 40, 265, 1366, 0, 0, 19.54%, 69, 0, 22, 60708.12, 20399652, 13507, 4451, 0
+400, 40, 456, 1366, 0, 0, 19.54%, 69, 0, 22, 62742.25, 20718371, 13507, 4488, 0
+406, 41, 720, 1366, 0, 0, 19.54%, 69, 0, 22, 4941.21, 20972668, 13507, 4525, 0
+411, 41, 1136, 1366, 0, 0, 19.54%, 69, 0, 22, 62763.53, 21319574, 13507, 4582, 0
+417, 42, 915, 1367, 0, 0, 19.54%, 69, 0, 22, 66646.21, 21671913, 13507, 4649, 0
+422, 43, 978, 1368, 1, 0, 19.54%, 69, 0, 22, 69115.57, 22025904, 13507, 4688, 0
+427, 43, 732, 1368, 0, 0, 19.54%, 69, 0, 22, 70569.48, 22390946, 13507, 4730, 0
+432, 44, 1092, 1369, 0, 0, 19.54%, 69, 0, 22, 46910.78, 22652960, 13507, 4791, 0
+437, 44, 1138, 1369, 0, 0, 19.54%, 70, 0, 22, 65787.37, 23010570, 13507, 4845, 0
+442, 45, 260, 1369, 0, 0, 19.54%, 70, 0, 22, 72145.95, 23347392, 13507, 4885, 0
+447, 46, 400, 1369, 0, 0, 19.54%, 70, 0, 22, 69119.59, 23687523, 13507, 4945, 0
+452, 46, 1213, 1370, 1, 0, 19.54%, 70, 0, 22, 68679.10, 24032886, 13507, 5010, 0
+458, 47, 1011, 1370, 0, 0, 19.54%, 70, 0, 22, 71930.46, 24388920, 13507, 5049, 0
+463, 47, 1368, 1371, 0, 0, 19.54%, 71, 0, 22, 71158.26, 24746612, 13507, 5109, 0
+468, 48, 820, 1371, 0, 0, 19.54%, 71, 0, 22, 71986.03, 25108537, 13507, 5155, 0
+473, 49, 1233, 1375, 3, 0, 19.54%, 72, 0, 22, 80921.37, 25479350, 13511, 5248, 0
+478, 49, 701, 1375, 2, 0, 19.54%, 72, 0, 22, 3673.48, 25751495, 13511, 5272, 0
+483, 50, 530, 1378, 1, 0, 19.54%, 72, 0, 22, 70053.21, 26117544, 13511, 5311, 0
+488, 51, 1382, 1387, 0, 0, 19.74%, 73, 0, 22, 71350.41, 26494021, 13646, 5386, 0
+494, 51, 1256, 1387, 0, 0, 19.74%, 73, 0, 22, 74227.76, 26875142, 13646, 5435, 0
+499, 52, 679, 1388, 0, 0, 19.74%, 73, 0, 22, 77244.30, 27268260, 13646, 5511, 0
+504, 53, 236, 1392, 2, 0, 19.74%, 73, 0, 22, 72125.00, 27640756, 13646, 5568, 0
+509, 53, 1256, 1393, 1, 0, 19.74%, 74, 0, 22, 68725.37, 27900926, 13647, 5611, 0
+514, 54, 440, 1398, 2, 0, 19.74%, 74, 0, 22, 74478.99, 28287210, 13647, 5682, 0
+519, 54, 1078, 1398, 0, 0, 19.74%, 76, 0, 22, 77584.24, 28695812, 13647, 5766, 0
+524, 55, 1236, 1398, 0, 0, 19.74%, 77, 0, 22, 72109.75, 29050071, 13647, 5831, 0
+530, 56, 413, 1399, 0, 0, 19.74%, 78, 0, 22, 76827.03, 29440504, 13647, 5882, 0
+535, 56, 1337, 1400, 1, 0, 19.74%, 78, 0, 22, 75631.94, 29764552, 13647, 5931, 0
+540, 57, 1338, 1401, 0, 0, 19.74%, 79, 0, 22, 67828.78, 30094703, 13647, 5977, 0
+545, 57, 1238, 1404, 1, 0, 19.74%, 79, 0, 22, 79128.66, 30431498, 13647, 6010, 0
+550, 58, 891, 1406, 1, 0, 19.74%, 79, 0, 22, 75519.39, 30799067, 13647, 6083, 0
+555, 59, 1171, 1407, 1, 0, 19.74%, 79, 0, 22, 72098.25, 31148958, 13647, 6130, 0
+560, 59, 581, 1408, 1, 0, 19.74%, 79, 0, 22, 72252.20, 31489169, 13647, 6197, 0
+565, 60, 1357, 1408, 0, 0, 19.74%, 79, 0, 22, 8537.66, 31794418, 13647, 6229, 0
+570, 60, 820, 1410, 1, 0, 19.74%, 80, 0, 22, 69666.63, 32171663, 13647, 6253, 0
+575, 61, 1100, 1412, 1, 0, 19.74%, 80, 0, 22, 74379.90, 32560391, 13647, 6328, 0
+581, 62, 686, 1412, 0, 0, 19.74%, 80, 0, 22, 72566.00, 32916349, 13647, 6373, 0
+586, 62, 731, 1412, 0, 0, 19.74%, 80, 0, 22, 46835.54, 33218844, 13647, 6416, 0
+591, 63, 1235, 1413, 0, 0, 19.74%, 80, 0, 22, 76942.40, 33642893, 13647, 6476, 0
+596, 64, 848, 1413, 0, 0, 19.74%, 80, 0, 22, 75687.46, 34043760, 13647, 6574, 0
+600, 64, 1324, 1413, 0, 0, 19.74%, 80, 0, 22, 71170.98, 34283406, 13647, 6607, 0
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/tests/real_plot_data.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/tests/real_plot_data.rs
new file mode 100644
index 00000000..6ff43853
--- /dev/null
+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-fuzz/tests/real_plot_data.rs
@@ -0,0 +1,58 @@
+// ©AngelaMos | 2026
+// real_plot_data.rs
+
+use lisdex_fuzz::plot;
+
+const REAL_PLOT: &str = include_str!("fixtures/plot_data.txt");
+
+const CAMPAIGN_SECONDS: u64 = 600;
+
+#[test]
+fn the_curve_from_a_real_campaign_parses_whole() {
+ let curve = plot::parse(REAL_PLOT).expect("a plot_data AFL++ actually wrote must parse");
+ assert!(
+ curve.samples().len() > 100,
+ "this capture is the 600s magma libpng campaign the M8 gate ran; a parser that read only its first rows would still look green on a synthetic two-row fixture"
+ );
+}
+
+#[test]
+fn the_campaign_ran_for_the_duration_it_was_given() {
+ let curve = plot::parse(REAL_PLOT).unwrap();
+ assert_eq!(
+ curve.duration_secs(),
+ CAMPAIGN_SECONDS,
+ "relative_time is seconds since the campaign began, and the last row should land on the wall-clock limit the run was given"
+ );
+}
+
+#[test]
+fn coverage_only_grows_within_one_real_campaign() {
+ let curve = plot::parse(REAL_PLOT).unwrap();
+ assert!(
+ curve.edges_are_monotonic(),
+ "edges_found cannot fall inside a single campaign; if this fails the capture was resumed over or concatenated, and any first-to-last coverage delta computed from it would be wrong"
+ );
+ let last = curve.last().expect("a real campaign wrote rows");
+ assert_eq!(curve.peak_edges(), last.edges_found);
+}
+
+#[test]
+fn the_real_curve_carries_the_numbers_a_campaign_report_needs() {
+ let curve = plot::parse(REAL_PLOT).unwrap();
+ let last = curve.last().unwrap();
+ assert!(last.edges_found > 0, "no coverage was recorded at all");
+ assert!(last.total_execs > 0, "no executions were recorded at all");
+ assert!(
+ last.execs_per_sec > 0.0,
+ "execs_per_sec is one of the two numbers M6's exit gate asks to be recorded"
+ );
+ assert!(
+ last.map_size_pct > 0.0 && last.map_size_pct < 100.0,
+ "map_size is a percentage of the coverage bitmap and must survive its percent suffix as a number"
+ );
+ assert!(
+ last.corpus_count > 0,
+ "a campaign that kept no corpus entry never made progress"
+ );
+}
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/src/main.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/src/main.rs
index 7757de58..1ec00f7d 100644
--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/src/main.rs
+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex/src/main.rs
@@ -2,6 +2,7 @@
// main.rs
use std::error::Error;
+use std::io::Write;
use std::path::PathBuf;
use std::process::ExitCode;
use std::time::Duration;
@@ -21,6 +22,7 @@ use lisdex_core::dedup;
use lisdex_core::report::SanitizerReport;
use lisdex_core::store::Store;
use lisdex_fuzz::minimize::{self, Outcome, TminInvocation};
+use lisdex_fuzz::plot;
use lisdex_fuzz::runner::{self, AflOptions};
use lisdex_harness::coverage::EdgeSet;
use lisdex_harness::emit;
@@ -67,6 +69,8 @@ const LLM_PROBE_SUBJECT: &str = "is the parameter src a byte buffer or a nul-ter
const LLM_PROBE_EVIDENCE: &str =
"int LZ4_decompress_safe(const char *src, char *dst, int compressedSize, int dstCapacity);";
const LLM_PROBE_BALLOT: [&str; 2] = ["byte_buffer", "nul_terminated_string"];
+const SAMPLE_CSV_HEADER: &str =
+ "relative_time,corpus_count,edges_found,execs_per_sec,total_execs,saved_crashes,map_size_pct";
#[derive(Parser)]
#[command(
@@ -107,6 +111,22 @@ enum Command {
about = "write a self-contained reproducer bundle per distinct bug: advisory, PoC, report, repro script"
)]
Bundle(BundleArgs),
+ #[command(about = "report the coverage curve a campaign recorded, over time")]
+ Coverage(CoverageArgs),
+}
+
+#[derive(clap::Args)]
+struct CoverageArgs {
+ #[arg(
+ long,
+ help = "afl-fuzz output directory written by a previous campaign"
+ )]
+ findings: PathBuf,
+ #[arg(
+ long,
+ help = "print every sample as CSV instead of a summary, for plotting"
+ )]
+ samples: bool,
}
#[derive(clap::Args)]
@@ -463,6 +483,7 @@ fn dispatch() -> Result<(), Box<dyn Error>> {
Command::Crashes(args) => crashes(args),
Command::Advisory(args) => advisories(args),
Command::Bundle(args) => bundles(args),
+ Command::Coverage(args) => coverage(args),
Command::Minimize(args) => minimize_campaign(args),
Command::Llm(args) => llm(args),
}
@@ -1173,6 +1194,13 @@ fn fuzz(args: &FuzzArgs) -> Result<(), Box<dyn Error>> {
})
});
+ if let Some(parent) = args
+ .db
+ .parent()
+ .filter(|parent| !parent.as_os_str().is_empty())
+ {
+ std::fs::create_dir_all(parent)?;
+ }
let store = Store::open(&args.db)?;
let mut campaign = Campaign::new(label.clone());
let campaign_id = store.insert_campaign(&campaign)?;
@@ -1236,6 +1264,7 @@ fn fuzz(args: &FuzzArgs) -> Result<(), Box<dyn Error>> {
println!("crashes_saved {}", stats.saved_crashes);
println!("crashes_persisted {persisted}");
+ print_coverage_curve(&options.findings);
print_triaged_crashes(&harvested);
for problem in problems.iter().chain(store_problems.iter()) {
@@ -1294,6 +1323,79 @@ fn crash_line(crash: &Crash) -> String {
)
}
+fn finish_stream(err: &std::io::Error) -> Result<(), Box<dyn Error>> {
+ if err.kind() == std::io::ErrorKind::BrokenPipe {
+ return Ok(());
+ }
+ Err(format!("writing to stdout: {err}").into())
+}
+
+fn coverage(args: &CoverageArgs) -> Result<(), Box<dyn Error>> {
+ let curve = coverage_curve(&args.findings)?;
+ if curve.is_empty() {
+ return Err("the coverage curve is empty; the campaign wrote no sample".into());
+ }
+ if args.samples {
+ let stdout = std::io::stdout();
+ let mut out = stdout.lock();
+ if let Err(err) = writeln!(out, "{SAMPLE_CSV_HEADER}") {
+ return finish_stream(&err);
+ }
+ for sample in curve.samples() {
+ let written = writeln!(
+ out,
+ "{},{},{},{:.2},{},{},{:.2}",
+ sample.relative_time,
+ sample.corpus_count,
+ sample.edges_found,
+ sample.execs_per_sec,
+ sample.total_execs,
+ sample.saved_crashes,
+ sample.map_size_pct
+ );
+ if let Err(err) = written {
+ return finish_stream(&err);
+ }
+ }
+ return Ok(());
+ }
+ print_coverage_curve(&args.findings);
+ Ok(())
+}
+
+fn coverage_curve(findings: &std::path::Path) -> Result<plot::CoverageCurve, Box<dyn Error>> {
+ let path = findings
+ .join(runner::DEFAULT_INSTANCE)
+ .join(plot::PLOT_FILE_NAME);
+ let text =
+ std::fs::read_to_string(&path).map_err(|err| format!("{}: {err}", path.display()))?;
+ Ok(plot::parse(&text)?)
+}
+
+fn print_coverage_curve(findings: &std::path::Path) {
+ let curve = match coverage_curve(findings) {
+ Ok(curve) => curve,
+ Err(err) => {
+ eprintln!("warning: no coverage curve recorded: {err}");
+ return;
+ }
+ };
+ let Some(last) = curve.last() else {
+ eprintln!("warning: the coverage curve is empty; the campaign wrote no sample");
+ return;
+ };
+ println!("curve_samples {}", curve.samples().len());
+ println!("curve_seconds {}", curve.duration_secs());
+ println!("curve_peak_edges {}", curve.peak_edges());
+ println!("curve_corpus {}", last.corpus_count);
+ if !curve.edges_are_monotonic() {
+ eprintln!(
+ "warning: coverage fell during this campaign, so {} was resumed over or concatenated and any first-to-last delta understates it",
+ plot::PLOT_FILE_NAME
+ );
+ }
+}
+
fn print_triaged_crashes(harvested: &[Crash]) {
let grouping = dedup::group_crashes(harvested);
println!("distinct_bugs {}", grouping.keyed_bugs());