540 enhancement print total evtx file size (#545)

* added ByteSize crate  #540

* displayed total evtx file size #540

* updated CHANGELOG #540

* cargo fmt

* added blank like, updated cargo

Co-authored-by: Tanaka Zakku <71482215+YamatoSecurity@users.noreply.github.com>
This commit is contained in:
DustInDark
2022-05-27 11:11:44 +09:00
committed by GitHub
parent 7be79efc21
commit 69c41c4859
5 changed files with 48 additions and 14 deletions
+10
View File
@@ -1,3 +1,4 @@
extern crate bytesize;
extern crate downcast_rs;
extern crate serde;
extern crate serde_derive;
@@ -5,6 +6,7 @@ extern crate serde_derive;
#[cfg(target_os = "windows")]
extern crate static_vcruntime;
use bytesize::ByteSize;
use chrono::{DateTime, Datelike, Local, TimeZone};
use evtx::{EvtxParser, ParserSettings};
use git2::Repository;
@@ -438,6 +440,14 @@ impl App {
.to_uppercase();
println!("Analyzing event files: {:?}", evtx_files.len());
let mut total_file_size = ByteSize::b(0);
for file_path in &evtx_files {
let meta = fs::metadata(file_path).ok();
total_file_size += ByteSize::b(meta.unwrap().len());
}
println!("Total file size: {}", total_file_size.to_string_as(false));
println!();
let rule_files = detection::Detection::parse_rule_files(
level,
configs::CONFIG.read().unwrap().args.value_of("rules"),