feature fillter no use rules

This commit is contained in:
kazuminn
2021-11-30 22:54:36 +09:00
parent bc230f7cd5
commit 341a5e4f86
8 changed files with 95 additions and 12 deletions
+22
View File
@@ -6,10 +6,12 @@ use evtx::{EvtxParser, ParserSettings};
use hayabusa::detections::detection;
use hayabusa::detections::detection::EvtxRecordInfo;
use hayabusa::detections::print::AlertMessage;
use hayabusa::fillter;
use hayabusa::omikuji::Omikuji;
use hayabusa::{afterfact::after_fact, detections::utils};
use hayabusa::{detections::configs, timeline::timeline::Timeline};
use hhmmss::Hhmmss;
use std::collections::HashMap;
use std::{
fs::{self, File},
path::PathBuf,
@@ -119,9 +121,29 @@ fn analysis_files(evtx_files: Vec<PathBuf>) {
.unwrap_or("INFO")
.to_uppercase();
println!("Analyzing event files: {:?}", evtx_files.len());
//除外ルール前処理
let mut ids = String::from_utf8(fs::read("config/exclude-rules.txt").unwrap()).unwrap();
if !configs::CONFIG
.read()
.unwrap()
.args
.is_present("show-noisyalerts")
{
ids += &String::from_utf8(fs::read("config/noisy-rules.txt").unwrap()).unwrap();
}
let mut fill_ids = fillter::RuleFill {
no_use_rule: HashMap::new(),
};
for v in ids.split_whitespace().next() {
fill_ids.no_use_rule.insert(v.to_string(), true);
}
let rule_files = detection::Detection::parse_rule_files(
level,
configs::CONFIG.read().unwrap().args.value_of("rules"),
fill_ids,
);
let mut detection = detection::Detection::new(rule_files);
for evtx_file in evtx_files {