added default_profile and cargo fmt

This commit is contained in:
DastInDark
2022-07-24 23:15:54 +09:00
parent a6f791acbf
commit 548f8f065a
2 changed files with 21 additions and 2 deletions

View File

@@ -0,0 +1,14 @@
---
Timestamp: '%Timestamp%'
Computer: '%Computer%'
Channel: '%Channel%'
Level: '%Level%'
EventID: '%EventID%'
MitreAttack: '%MitreAttack%'
RecordID: '%RecordID%'
RuleTitle: '%RuleTitle%'
Details: '%Details%'
RecordInformation: '%RecordInformation%'
RuleFile: '%RuleFile%'
EvtxFile: '%EvtxFile%'
Tags: '%MitreAttack%'

View File

@@ -136,7 +136,12 @@ pub fn set_default_profile(default_profile_path: &str, profile_path: &str) -> Re
// デフォルトプロファイルを設定する処理
if let Some(profile_name) = &configs::CONFIG.read().unwrap().args.set_default_profile {
if let Ok(mut buf_wtr) = OpenOptions::new().write(true).truncate(true).open(default_profile_path).map(BufWriter::new) {
if let Ok(mut buf_wtr) = OpenOptions::new()
.write(true)
.truncate(true)
.open(default_profile_path)
.map(BufWriter::new)
{
let prof_all_data = &profile_data[0];
let overwrite_default_data = &prof_all_data[profile_name.as_str()];
if !overwrite_default_data.is_null() {
@@ -152,7 +157,7 @@ pub fn set_default_profile(default_profile_path: &str, profile_path: &str) -> Re
_ => {
buf_wtr.flush().ok();
Ok(())
},
}
},
Err(e) => Err(format!(
"Failed set profile to default profile file({}). {}",