fixed clippy error

This commit is contained in:
DustInDark
2022-06-07 19:42:41 +09:00
parent c3f31c4ac2
commit eded81e39b

View File

@@ -1,4 +1,4 @@
use crate::detections::{configs, detection::EvtxRecordInfo}; use crate::detections::{configs::CONFIG, detection::EvtxRecordInfo};
use prettytable::{Cell, Row, Table}; use prettytable::{Cell, Row, Table};
use super::statistics::EventStatistics; use super::statistics::EventStatistics;
@@ -35,11 +35,7 @@ impl Timeline {
} }
pub fn tm_stats_dsp_msg(&mut self) { pub fn tm_stats_dsp_msg(&mut self) {
let statics_flag = configs::CONFIG let statics_flag = CONFIG.read().unwrap().args.is_present("statistics");
.read()
.unwrap()
.args
.is_present("statistics");
if !statics_flag { if !statics_flag {
return; return;
} }
@@ -70,11 +66,7 @@ impl Timeline {
} }
pub fn tm_logon_stats_dsp_msg(&mut self) { pub fn tm_logon_stats_dsp_msg(&mut self) {
let logon_summary_flag = configs::CONFIG let logon_summary_flag = CONFIG.read().unwrap().args.is_present("logon-summary");
.read()
.unwrap()
.args
.is_present("logon-summary");
if !logon_summary_flag { if !logon_summary_flag {
return; return;
} }
@@ -102,31 +94,40 @@ impl Timeline {
let rate: f32 = **event_cnt as f32 / self.stats.total as f32; let rate: f32 = **event_cnt as f32 / self.stats.total as f32;
// イベント情報取得(eventtitleなど) // イベント情報取得(eventtitleなど)
let conf = configs::CONFIG.read().unwrap(); let conf = CONFIG
.read()
.unwrap()
.event_timeline_config
.get_event_id(*event_id)
.is_some();
// statistics_event_info.txtに登録あるものは情報設定 // statistics_event_info.txtに登録あるものは情報設定
match conf.event_timeline_config.get_event_id(*event_id) { if conf {
Some(e) => { // 出力メッセージ1行作成
// 出力メッセージ1行作成 msges.push(format!(
msges.push(format!( "{0} ({1:.1}%)\t{2}\t{3}",
"{0} ({1:.1}%)\t{2}\t{3}", event_cnt,
event_cnt, (rate * 1000.0).round() / 10.0,
(rate * 1000.0).round() / 10.0, event_id,
event_id, &CONFIG
e.evttitle, .read()
)); .unwrap()
} .event_timeline_config
None => { .get_event_id(*event_id)
// 出力メッセージ1行作成 .unwrap()
msges.push(format!( .evttitle,
"{0} ({1:.1}%)\t{2}\t{3}", ));
event_cnt, } else {
(rate * 1000.0).round() / 10.0, // 出力メッセージ1行作成
event_id, msges.push(format!(
"Unknown", "{0} ({1:.1}%)\t{2}\t{3}",
)); event_cnt,
} (rate * 1000.0).round() / 10.0,
event_id,
"Unknown",
));
} }
} }
msges.push("---------------------------------------".to_string()); msges.push("---------------------------------------".to_string());
msges msges
} }