From a64f9c8da2a7e9c54ddffc1ce6e755a37516e728 Mon Sep 17 00:00:00 2001 From: DastInDark <2350416+hitenkoku@users.noreply.github.com> Date: Mon, 26 Sep 2022 20:27:41 +0900 Subject: [PATCH] changed alert title to rule file path --- src/afterfact.rs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/afterfact.rs b/src/afterfact.rs index 242bfbe2..9c4f60ed 100644 --- a/src/afterfact.rs +++ b/src/afterfact.rs @@ -241,7 +241,7 @@ fn emit_csv( HashMap::new(); let mut detect_counts_by_rule_and_level: HashMap> = HashMap::new(); - + let mut rule_title_path_map:HashMap = HashMap::new(); let levels = Vec::from(["crit", "high", "med ", "low ", "info", "undefined"]); // レベル別、日ごとの集計用変数の初期化 for level_init in levels { @@ -375,6 +375,7 @@ fn emit_csv( .unwrap() }) .clone(); + rule_title_path_map.insert(detect_info.ruletitle.clone(), detect_info.rulepath.clone()); *detect_counts_by_rules .entry(Clone::clone(&detect_info.ruletitle)) .or_insert(0) += 1; @@ -536,6 +537,7 @@ fn emit_csv( _print_detection_summary_tables( detect_counts_by_rule_and_level, &color_map, + rule_title_path_map, &mut html_output_stock, ); println!(); @@ -789,6 +791,7 @@ fn _print_detection_summary_by_computer( fn _print_detection_summary_tables( detect_counts_by_rule_and_level: HashMap>, color_map: &HashMap, + rule_title_path_map: HashMap, html_output_stock: &mut Vec, ) { let buf_wtr = BufferWriter::stdout(ColorChoice::Always); @@ -818,7 +821,7 @@ fn _print_detection_summary_tables( for x in sorted_detections.iter() { html_output_stock.push(format!( "- {} ({})", - x.0, + rule_title_path_map.get(x.0).unwrap_or(&"".to_string()), x.1.to_formatted_string(&Locale::en) )); }