diff --git a/src/afterfact.rs b/src/afterfact.rs index 1d9217b4..10b2272c 100644 --- a/src/afterfact.rs +++ b/src/afterfact.rs @@ -38,6 +38,7 @@ pub fn after_fact() { AlertMessage::alert( &mut std::io::stderr().lock(), format!("Failed to write CSV. {}", err), + true, ) .ok(); process::exit(1); @@ -56,6 +57,7 @@ pub fn after_fact() { AlertMessage::alert( &mut std::io::stderr().lock(), format!("Failed to open file. {}", err), + true, ) .ok(); process::exit(1); diff --git a/src/detections/configs.rs b/src/detections/configs.rs index c2fa589f..0e1281e8 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -141,6 +141,7 @@ impl TargetEventTime { AlertMessage::alert( &mut std::io::stderr().lock(), format!("starttimeline field: {}", err), + false ) .ok(); None @@ -158,6 +159,7 @@ impl TargetEventTime { AlertMessage::alert( &mut std::io::stderr().lock(), format!("endtimeline field: {}", err), + false ) .ok(); None diff --git a/src/detections/detection.rs b/src/detections/detection.rs index 103297d9..bd69d450 100644 --- a/src/detections/detection.rs +++ b/src/detections/detection.rs @@ -61,6 +61,7 @@ impl Detection { AlertMessage::alert( &mut std::io::stderr().lock(), format!("{}", result_readdir.unwrap_err()), + true, ) .ok(); return vec![]; diff --git a/src/detections/print.rs b/src/detections/print.rs index 56dbadfa..119010ea 100644 --- a/src/detections/print.rs +++ b/src/detections/print.rs @@ -380,7 +380,7 @@ mod tests { let input = "TEST!"; let stdout = std::io::stdout(); let mut stdout = stdout.lock(); - AlertMessage::alert(&mut stdout, input.to_string()).expect("[ERROR] TEST!"); + AlertMessage::alert(&mut stdout, input.to_string(), false).expect("[ERROR] TEST!"); } #[test] @@ -388,7 +388,7 @@ mod tests { let input = "TESTWarn!"; let stdout = std::io::stdout(); let mut stdout = stdout.lock(); - AlertMessage::alert(&mut stdout, input.to_string()).expect("[WARN] TESTWarn!"); + AlertMessage::alert(&mut stdout, input.to_string(), false).expect("[WARN] TESTWarn!"); } #[test] diff --git a/src/detections/rule/count.rs b/src/detections/rule/count.rs index d4152518..c0821416 100644 --- a/src/detections/rule/count.rs +++ b/src/detections/rule/count.rs @@ -59,6 +59,7 @@ pub fn create_count_key(rule: &RuleNode, record: &Value) -> String { AlertMessage::alert( &mut std::io::stderr().lock(), format!("field_value alias not found.value:{}", field_value), + true, ) .ok(); } @@ -75,6 +76,7 @@ pub fn create_count_key(rule: &RuleNode, record: &Value) -> String { AlertMessage::alert( &mut std::io::stderr().lock(), format!("by_field_value alias not found.value:{}", by_field_value), + true, ) .ok(); } @@ -157,6 +159,7 @@ impl TimeFrameInfo { AlertMessage::alert( &mut std::io::stderr().lock(), format!("Timeframe is invalid. Input value:{}", value), + true, ) .ok(); } @@ -189,6 +192,7 @@ pub fn get_sec_timeframe(timeframe: &Option) -> Option { AlertMessage::alert( &mut std::io::stderr().lock(), format!("Timeframe number is invalid. timeframe.{}", err), + true, ) .ok(); return Option::None; diff --git a/src/main.rs b/src/main.rs index 7347ca74..7b62df09 100644 --- a/src/main.rs +++ b/src/main.rs @@ -71,6 +71,7 @@ impl App { AlertMessage::alert( &mut std::io::stderr().lock(), "--filepath only accepts .evtx files.".to_owned(), + false, ) .ok(); return; @@ -82,6 +83,7 @@ impl App { AlertMessage::alert( &mut std::io::stderr().lock(), "No .evtx files were found.".to_owned(), + false, ) .ok(); return; @@ -107,7 +109,7 @@ impl App { if entries.is_err() { let stderr = std::io::stderr(); let mut stderr = stderr.lock(); - AlertMessage::alert(&mut stderr, format!("{}", entries.unwrap_err())).ok(); + AlertMessage::alert(&mut stderr, format!("{}", entries.unwrap_err()), true).ok(); return vec![]; } @@ -139,7 +141,7 @@ impl App { match fs::read_to_string("./contributors.txt") { Ok(contents) => println!("{}", contents), Err(err) => { - AlertMessage::alert(&mut std::io::stderr().lock(), format!("{}", err)).ok(); + AlertMessage::alert(&mut std::io::stderr().lock(), format!("{}", err), true).ok(); } } } @@ -207,7 +209,7 @@ impl App { evtx_filepath, record_result.unwrap_err() ); - AlertMessage::alert(&mut std::io::stderr().lock(), errmsg).ok(); + AlertMessage::alert(&mut std::io::stderr().lock(), errmsg, true).ok(); continue; }