From 7ea44045c97d95b79da3dbcc6620e0a74c25f70f Mon Sep 17 00:00:00 2001 From: JOLIMAITRE Matthieu Date: Fri, 21 Jun 2024 04:05:16 +0200 Subject: [PATCH] dm secu --- securite/dm/pcap_analyzer/src/main.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/securite/dm/pcap_analyzer/src/main.rs b/securite/dm/pcap_analyzer/src/main.rs index db40d8d..43e646c 100644 --- a/securite/dm/pcap_analyzer/src/main.rs +++ b/securite/dm/pcap_analyzer/src/main.rs @@ -84,9 +84,17 @@ fn main() -> Result<(), Box> { println!("Unique sources: {unique_sources: >14.4}"); let unique_dests = destinations.len(); println!("Unique destinations: {unique_dests: >14.4}"); - let most_bytes = sources.iter().max_by_key(|(_, (_, bytes))| bytes).map(|(addr, _)| addr); + let most_bytes = sources + .iter() + .max_by_key(|(_, (_, bytes))| bytes) + .map(|(addr, _)| format!("{addr:?}")) + .unwrap_or_default(); println!("Source with most bytes: {most_bytes:?}"); - let most_packets = sources.iter().max_by_key(|(_, (packs, _))| packs).map(|(addr, _)| addr); + let most_packets = sources + .iter() + .max_by_key(|(_, (packs, _))| packs) + .map(|(addr, _)| format!("{addr:?}")) + .unwrap_or_default(); println!("Source with most packets: {most_packets:?}"); } }