@@ -1,3 +1,4 @@
|
||||
pub mod detections;
|
||||
pub mod models;
|
||||
pub mod omikuji;
|
||||
pub mod toml;
|
||||
|
||||
10
src/main.rs
10
src/main.rs
@@ -4,8 +4,9 @@ extern crate serde;
|
||||
use clap::{App, AppSettings, Arg};
|
||||
use evtx::EvtxParser;
|
||||
use quick_xml::de::DeError;
|
||||
use std::{path::PathBuf, process};
|
||||
use std::{fs, path::PathBuf, process};
|
||||
use yamato_event_analyzer::detections::detection;
|
||||
use yamato_event_analyzer::omikuji::Omikuji;
|
||||
use yamato_event_analyzer::toml;
|
||||
|
||||
fn build_app() -> clap::App<'static, 'static> {
|
||||
@@ -32,6 +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("-o --omikuji 'output with omikuji'"))
|
||||
.arg(Arg::from_usage("--credits 'Zachary Mathis, Akira Nishikawa'"))
|
||||
}
|
||||
|
||||
@@ -59,3 +61,9 @@ fn parse_file(filepath: &str) {
|
||||
let mut detection = detection::Detection::new();
|
||||
&detection.start(parser);
|
||||
}
|
||||
|
||||
fn output_with_omikuji(omikuji: Omikuji) {
|
||||
let fp = &format!("art/omikuji/{}", omikuji);
|
||||
let content = fs::read_to_string(fp).unwrap();
|
||||
println!("{}", content);
|
||||
}
|
||||
|
||||
28
src/omikuji.rs
Normal file
28
src/omikuji.rs
Normal file
@@ -0,0 +1,28 @@
|
||||
use std::fmt;
|
||||
|
||||
pub enum Omikuji {
|
||||
DAIKICHI,
|
||||
KICHI,
|
||||
CHUKICHI,
|
||||
SHOUKICHI,
|
||||
SUEKICHI,
|
||||
KYOU,
|
||||
}
|
||||
|
||||
impl fmt::Display for Omikuji {
|
||||
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
|
||||
match *self {
|
||||
Omikuji::DAIKICHI => write!(f, "DAIKICHI.txt"),
|
||||
Omikuji::KICHI => write!(f, "KICHI.txt"),
|
||||
Omikuji::CHUKICHI => write!(f, "CHUKICHI.txt"),
|
||||
Omikuji::SHOUKICHI => write!(f, "SHOUKICHI.txt"),
|
||||
Omikuji::SUEKICHI => write!(f, "SUEKICHI.txt"),
|
||||
Omikuji::KYOU => write!(f, "KYOU.txt"),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn test_display() {
|
||||
assert_eq!(Omikuji::DAIKICHI.to_string(), "DAIKICHI.txt",);
|
||||
}
|
||||
Reference in New Issue
Block a user