changed rule path to rule file name #623

This commit is contained in:
DastInDark
2022-07-19 22:19:58 +09:00
parent 286737d5bb
commit 591e7f18f1
2 changed files with 6 additions and 17 deletions

View File

@@ -256,10 +256,7 @@ impl Detection {
};
let detect_info = DetectInfo {
filepath: record_info.evtx_filepath.to_string(),
rulepath: get_output_str_path(
&configs::CONFIG.read().unwrap().args.rules,
Path::new(&rule.rulepath),
),
rulepath: (&rule.rulepath).to_owned(),
level: rule.yaml["level"].as_str().unwrap_or("-").to_string(),
computername: record_info.record["Event"]["System"]["Computer"]
.to_string()
@@ -302,19 +299,10 @@ impl Detection {
} else {
None
};
// canonicalizeを行った際に、windows環境で\\?\が必ず文字列として入ってしまう問題があったため先頭の4文字を除外している
let abs_rule_path = &PathBuf::from(&rule.rulepath)
.canonicalize()
.unwrap()
.display()
.to_string()[4..];
let detect_info = DetectInfo {
filepath: "-".to_owned(),
rulepath: get_output_str_path(
&configs::CONFIG.read().unwrap().args.rules,
Path::new(abs_rule_path),
),
rulepath: (&rule.rulepath).to_owned(),
level: rule.yaml["level"].as_str().unwrap_or("").to_owned(),
computername: "-".to_owned(),
eventid: "-".to_owned(),