add statistics template

This commit is contained in:
HajimeTakai
2021-05-15 01:12:36 +09:00
parent 0064ccb4f8
commit bf1e57945b
4 changed files with 49 additions and 2 deletions

View File

@@ -51,7 +51,6 @@ fn build_app<'a>() -> ArgMatches<'a> {
.arg(Arg::from_usage("-d --directory=[DIRECTORY] 'event log files directory'"))
.arg(Arg::from_usage("-s --statistics 'event statistics'"))
.arg(Arg::from_usage("-t --threadnum=[NUM] 'thread number'"))
.arg(Arg::from_usage("-tl --timeline 'show event log timeline'"))
.arg(Arg::from_usage("--credits 'Zachary Mathis, Akira Nishikawa'"))
.get_matches()
}

View File

@@ -7,7 +7,7 @@ use std::{
path::PathBuf,
};
use tokio::{spawn, task::JoinHandle};
use yamato_event_analyzer::detections::configs;
use yamato_event_analyzer::{detections::configs, timeline::timeline::Timeline};
use yamato_event_analyzer::detections::detection;
use yamato_event_analyzer::detections::detection::EvtxRecordInfo;
use yamato_event_analyzer::detections::print::AlertMessage;
@@ -72,6 +72,9 @@ fn print_credits() {
fn detect_files(evtx_files: Vec<PathBuf>) {
let evnt_records = evtx_to_jsons(&evtx_files);
let mut tl = Timeline::new();
tl.start(&evnt_records);
let mut detection = detection::Detection::new();
&detection.start(evnt_records);

View File

@@ -1 +1,28 @@
use crate::detections::{configs, detection::EvtxRecordInfo};
#[derive(Debug)]
pub struct EventStatistics {
}
/**
* Windows Event Logの統計情報を出力する
*/
impl EventStatistics {
pub fn new() -> EventStatistics {
return EventStatistics {};
}
// この関数の戻り値として、コンソールに出力する内容をStringの可変配列(Vec)として返却してください。
// 可変配列にしているのは改行を表すためで、可変配列にコンソールに出力する内容を1行ずつ追加してください。
// 現状では、この関数の戻り値として返すVec<String>を表示するコードは実装していません。
pub fn start(&mut self, _records: &Vec<EvtxRecordInfo> ) -> Vec<String> {
// 引数でstatisticsオプションが指定されている時だけ、
if configs::CONFIG.read().unwrap().args.value_of("statistics").is_none() {
return vec![];
}
// TODO ここから下を書いて欲しいです!!
return vec![];
}
}

View File

@@ -1 +1,19 @@
use crate::detections::detection::EvtxRecordInfo;
use super::statistics::EventStatistics;
#[derive(Debug)]
pub struct Timeline {
}
impl Timeline {
pub fn new() -> Timeline {
return Timeline {};
}
pub fn start(&mut self, records: &Vec<EvtxRecordInfo> ) {
let mut statistic = EventStatistics::new();
statistic.start(records);
}
}