From 7933b2027127da6f174bf5c6074301ae4cc0e49d Mon Sep 17 00:00:00 2001 From: kazuminn Date: Wed, 25 Nov 2020 21:37:34 +0900 Subject: [PATCH 1/2] add credits template --- credits.txt | 1 + src/main.rs | 14 +++++++++++++- 2 files changed, 14 insertions(+), 1 deletion(-) create mode 100644 credits.txt diff --git a/credits.txt b/credits.txt new file mode 100644 index 00000000..553b4928 --- /dev/null +++ b/credits.txt @@ -0,0 +1 @@ +Zach Mathis (田中ザック)Yamato Security Yea! Project Leader \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index 96239b23..ffd95f31 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,6 +4,7 @@ extern crate serde; use clap::{App, AppSettings, Arg}; use evtx::EvtxParser; use quick_xml::de::DeError; +use std::fs; use std::{path::PathBuf, process}; use yamato_event_analyzer::detections::detection; use yamato_event_analyzer::toml; @@ -32,7 +33,7 @@ fn build_app() -> clap::App<'static, 'static> { .arg(Arg::from_usage("-d --directory 'event log files directory'")) .arg(Arg::from_usage("-s --statistics 'event statistics'")) .arg(Arg::from_usage("-u --update 'signature update'")) - .arg(Arg::from_usage("--credits 'Zachary Mathis, Akira Nishikawa'")) + .arg(Arg::from_usage("-c --credits 'print credits infomation'")) } fn main() -> Result<(), DeError> { @@ -43,9 +44,20 @@ fn main() -> Result<(), DeError> { parse_file(filepath); } + if args.is_present("credits") { + print_credits(); + } + Ok(()) } +fn print_credits() { + match fs::read_to_string("./credits.txt") { + Ok(contents) => println!("{}", contents), + Err(err) => println!("{}", err), + } +} + fn parse_file(filepath: &str) { let fp = PathBuf::from(filepath); let parser = match EvtxParser::from_path(fp) { From acd226edc6f219378fa5d1b06e15f8da18bfbab5 Mon Sep 17 00:00:00 2001 From: kazuminn Date: Wed, 25 Nov 2020 21:42:30 +0900 Subject: [PATCH 2/2] refactor --- src/main.rs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/main.rs b/src/main.rs index ffd95f31..f1bd2b63 100644 --- a/src/main.rs +++ b/src/main.rs @@ -4,8 +4,7 @@ extern crate serde; use clap::{App, AppSettings, Arg}; use evtx::EvtxParser; use quick_xml::de::DeError; -use std::fs; -use std::{path::PathBuf, process}; +use std::{fs, path::PathBuf, process}; use yamato_event_analyzer::detections::detection; use yamato_event_analyzer::toml;