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 👇
Go aicertificationcloud-engineeringcybercybersecuritycybersecurity-analystcybersecurity-certificationcybersecurity-certificationscybersecurity-educationcybersecurity-jobscybersecurity-portfoliocybersecurity-projectscybersecurity-toolsgrchackinglearningpentestingproject-repositoryprojetcspython
feat(lisdex): M7.2 - the key had been persisted for a while and never once answered a question
CarterPerez-deve520b04888ed
diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/dedup.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/dedup.rsnew file mode 100644index 00000000..81cf9e19--- /dev/null+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/dedup.rs@@ -0,0 +1,173 @@+// ©AngelaMos | 2026+// dedup.rs++use std::collections::BTreeMap;++use crate::crash::Crash;++#[derive(Debug, Clone, PartialEq, Eq)]+pub struct CrashGroup<'a> {+ key: &'a str,+ crashes: Vec<&'a Crash>,+}++impl<'a> CrashGroup<'a> {+ #[must_use]+ pub fn key(&self) -> &'a str {+ self.key+ }++ #[must_use]+ pub fn crashes(&self) -> &[&'a Crash] {+ &self.crashes+ }++ #[must_use]+ pub fn len(&self) -> usize {+ self.crashes.len()+ }++ #[must_use]+ pub fn is_empty(&self) -> bool {+ self.crashes.is_empty()+ }++ #[must_use]+ pub fn representative(&self) -> Option<&'a Crash> {+ self.crashes.first().copied()+ }+}++#[derive(Debug, Clone, PartialEq, Eq, Default)]+pub struct Grouping<'a> {+ groups: Vec<CrashGroup<'a>>,+ unkeyed: Vec<&'a Crash>,+}++impl<'a> Grouping<'a> {+ #[must_use]+ pub fn groups(&self) -> &[CrashGroup<'a>] {+ &self.groups+ }++ #[must_use]+ pub fn unkeyed(&self) -> &[&'a Crash] {+ &self.unkeyed+ }++ #[must_use]+ pub fn keyed_bugs(&self) -> usize {+ self.groups.len()+ }++ #[must_use]+ pub fn unkeyed_crashes(&self) -> usize {+ self.unkeyed.len()+ }+}++#[must_use]+pub fn group_crashes(crashes: &[Crash]) -> Grouping<'_> {+ let mut by_key: BTreeMap<&str, Vec<&Crash>> = BTreeMap::new();+ let mut unkeyed = Vec::new();++ for crash in crashes {+ match crash.stack_hash() {+ Some(key) => by_key.entry(key).or_default().push(crash),+ None => unkeyed.push(crash),+ }+ }++ let mut groups: Vec<CrashGroup<'_>> = by_key+ .into_iter()+ .map(|(key, crashes)| CrashGroup { key, crashes })+ .collect();+ groups.sort_by(|left, right| right.len().cmp(&left.len()).then(left.key.cmp(right.key)));++ Grouping { groups, unkeyed }+}++#[cfg(test)]+mod tests {+ use super::*;+ use crate::campaign::CampaignId;++ const CAMPAIGN: CampaignId = CampaignId(1);++ fn crash(input: &str, hash: Option<&str>) -> Crash {+ Crash::new(+ CAMPAIGN,+ input.as_bytes().to_vec(),+ "report",+ hash.map(str::to_owned),+ )+ }++ #[test]+ fn crashes_sharing_a_key_collapse_to_one_group() {+ let crashes = vec![+ crash("a", Some("deadbeef")),+ crash("b", Some("deadbeef")),+ crash("c", Some("cafebabe")),+ ];+ let grouping = group_crashes(&crashes);+ assert_eq!(grouping.keyed_bugs(), 2);+ assert_eq!(grouping.groups()[0].key(), "deadbeef");+ assert_eq!(grouping.groups()[0].len(), 2);+ }++ #[test]+ fn unkeyed_crashes_are_never_merged_with_each_other() {+ let crashes = vec![+ crash("a", None),+ crash("b", None),+ crash("c", None),+ crash("d", Some("deadbeef")),+ ];+ let grouping = group_crashes(&crashes);+ assert_eq!(+ grouping.keyed_bugs(),+ 1,+ "a missing key is the absence of evidence, not evidence of sameness; bucketing NULL together would re-merge exactly what stack_hash refuses to key"+ );+ assert_eq!(grouping.unkeyed_crashes(), 3);+ assert!(+ grouping+ .groups()+ .iter()+ .all(|group| !group.crashes().iter().any(|c| c.stack_hash().is_none())),+ "no unkeyed crash may appear inside a keyed group"+ );+ }++ #[test]+ fn groups_are_ordered_largest_first_then_by_key() {+ let crashes = vec![+ crash("a", Some("bbbb")),+ crash("b", Some("aaaa")),+ crash("c", Some("aaaa")),+ crash("d", Some("cccc")),+ ];+ let grouping = group_crashes(&crashes);+ let keys: Vec<&str> = grouping.groups().iter().map(CrashGroup::key).collect();+ assert_eq!(keys, vec!["aaaa", "bbbb", "cccc"]);+ }++ #[test]+ fn an_empty_crash_set_groups_to_nothing() {+ let grouping = group_crashes(&[]);+ assert_eq!(grouping.keyed_bugs(), 0);+ assert_eq!(grouping.unkeyed_crashes(), 0);+ }++ #[test]+ fn a_representative_is_drawn_from_the_group() {+ let crashes = vec![+ crash("first", Some("deadbeef")),+ crash("second", Some("deadbeef")),+ ];+ let grouping = group_crashes(&crashes);+ let representative = grouping.groups()[0].representative().unwrap();+ assert_eq!(representative.input(), b"first");+ }+}diff --git a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/lib.rs b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/lib.rsindex 73470241..7ab6b366 100644--- a/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/lib.rs+++ b/PROJECTS/advanced/zero-day-vulnerability-scanner/crates/lisdex-core/src/lib.rs@@ -4,6 +4,7 @@pub mod campaign;pub mod config;pub mod crash;+pub mod dedup;pub mod process;pub mod report;pub mod store;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.rsindex a745681c..f0947916 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@@ -14,6 +14,8 @@ use lisdex_build::layout::{BuildLayout, VARIANT_AFL, VARIANT_BENCH};use lisdex_build::verify::Requirements;use lisdex_core::campaign::{Campaign, CampaignId, CampaignStatus};use lisdex_core::config::LlmTier;+use lisdex_core::crash::Crash;+use lisdex_core::dedup;use lisdex_core::report::SanitizerReport;use lisdex_core::store::Store;use lisdex_fuzz::runner::{self, AflOptions};@@ -30,6 +32,7 @@ use lisdex_surface::surface::{self, SurfaceOptions};const UNKNOWN_TARGET: &str = "unknown";const UNPARSED_KIND: &str = "unparsed";const NO_STACK_HASH: &str = "none";+const UNKEYED_MARKER: &str = "unkeyed";const STACK_HASH_SHORT_LEN: usize = 16;const DISPLAYED_FRAMES: usize = 6;const SOURCES_DIR: &str = "sources";@@ -1135,19 +1138,7 @@ fn fuzz(args: &FuzzArgs) -> Result<(), Box<dyn Error>> {println!("crashes_saved {}", stats.saved_crashes);println!("crashes_persisted {persisted}");- for crash in &harvested {- let report = SanitizerReport::parse(crash.sanitizer_report());- println!(- " {} {} bytes {} {}",- short_hash(crash.stack_hash()),- crash.input().len(),- report.as_ref().map_or(UNPARSED_KIND, |r| r.kind()),- report- .as_ref()- .and_then(SanitizerReport::crash_site)- .unwrap_or_default()- );- }+ print_triaged_crashes(&harvested);for problem in problems.iter().chain(store_problems.iter()) {eprintln!("warning: {problem}");@@ -1178,6 +1169,40 @@ fn fuzz(args: &FuzzArgs) -> Result<(), Box<dyn Error>> {Ok(())}+fn crash_line(crash: &Crash) -> String {+ let report = SanitizerReport::parse(crash.sanitizer_report());+ format!(+ "{} bytes {} {}",+ crash.input().len(),+ report.as_ref().map_or(UNPARSED_KIND, |r| r.kind()),+ report+ .as_ref()+ .and_then(SanitizerReport::crash_site)+ .unwrap_or_default()+ )+}++fn print_triaged_crashes(harvested: &[Crash]) {+ let grouping = dedup::group_crashes(harvested);+ println!("distinct_bugs {}", grouping.keyed_bugs());+ println!("unkeyed_crashes {}", grouping.unkeyed_crashes());++ for group in grouping.groups() {+ if let Some(crash) = group.representative() {+ println!(+ " {} x{} {}",+ short_hash(crash.stack_hash()),+ group.len(),+ crash_line(crash)+ );+ }+ }++ for crash in grouping.unkeyed() {+ println!(" {NO_STACK_HASH} {UNKEYED_MARKER} {}", crash_line(crash));+ }+}+fn check_persistent_mode(findings: &std::path::Path, target: &std::path::Path) -> bool {// A harness that also defines main links silently against the driver's weak main and// then fuzzes nothing at 1,597 execs/sec instead of 241,807.