added no detection when statistics option enabled. #341

This commit is contained in:
DustInDark
2021-12-23 11:33:10 +09:00
parent 88b7593ea9
commit 6b5283b28b
2 changed files with 17 additions and 5 deletions

View File

@@ -47,6 +47,11 @@ lazy_static! {
.args
.is_present("quiet-errors");
pub static ref ERROR_LOG_STACK: Mutex<Vec<String>> = Mutex::new(Vec::new());
pub static ref STATISTICS_FLAG: bool = configs::CONFIG
.read()
.unwrap()
.args
.is_present("statistics");
}
impl Message {

View File

@@ -9,6 +9,7 @@ use hayabusa::detections::print::AlertMessage;
use hayabusa::detections::print::ERROR_LOG_PATH;
use hayabusa::detections::print::ERROR_LOG_STACK;
use hayabusa::detections::print::QUIET_ERRORS_FLAG;
use hayabusa::detections::print::STATISTICS_FLAG;
use hayabusa::detections::rule::{get_detection_keys, RuleNode};
use hayabusa::filter;
use hayabusa::omikuji::Omikuji;
@@ -205,7 +206,9 @@ impl App {
pb.inc();
}
detection.add_aggcondition_msges(&self.rt);
after_fact();
if !*STATISTICS_FLAG {
after_fact();
}
}
// Windowsイベントログファイルを1ファイル分解析する。
@@ -223,7 +226,9 @@ impl App {
let mut tl = Timeline::new();
let mut parser = parser.unwrap();
let mut records = parser.records_json_value();
if !*STATISTICS_FLAG {
println!("Generating Event ID Statistics");
}
loop {
let mut records_per_detect = vec![];
while records_per_detect.len() < MAX_DETECT_RECORDS {
@@ -273,11 +278,13 @@ impl App {
self.rule_keys.clone(),
));
// // timeline機能の実行
// timeline機能の実行
tl.start(&records_per_detect);
// // ruleファイルの検知
detection = detection.start(&self.rt, records_per_detect);
if !*STATISTICS_FLAG {
// ruleファイルの検知
detection = detection.start(&self.rt, records_per_detect);
}
}
tl.tm_stats_dsp_msg();