added eventfile and filesize data to html summary #689

This commit is contained in:
DastInDark
2022-09-24 16:38:25 +09:00
parent 7303ef33ad
commit fb801dcbad
2 changed files with 17 additions and 1 deletions

View File

@@ -18,6 +18,7 @@ use hayabusa::detections::pivot::PivotKeyword;
use hayabusa::detections::pivot::PIVOT_KEYWORD;
use hayabusa::detections::rule::{get_detection_keys, RuleNode};
use hayabusa::omikuji::Omikuji;
use hayabusa::options::htmlreport::HTML_REPORTER;
use hayabusa::options::profile::PROFILES;
use hayabusa::options::{level_tuning::LevelTuning, update_rules::UpdateRules};
use hayabusa::{afterfact::after_fact, detections::utils};
@@ -525,11 +526,25 @@ impl App {
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));
let total_size_output = format!("Total file size: {}", total_file_size.to_string_as(false));
println!("{}", total_size_output);
println!();
println!("Loading detections rules. Please wait.");
println!();
if configs::CONFIG.read().unwrap().args.html_report.is_some() {
let mut html_report_data = HTML_REPORTER
.write()
.unwrap().md_datas.clone();
let entry = html_report_data
.entry("General Overview".to_string())
.or_insert(Vec::new());
entry.push(format!("- Analyzed event files: {:?}", evtx_files.len()));
entry.push("".to_string());
entry.push(format!("- {}", total_size_output));
HTML_REPORTER.write().unwrap().md_datas = html_report_data;
}
let rule_files = detection::Detection::parse_rule_files(
level,
&configs::CONFIG.read().unwrap().args.rules,

View File

@@ -1,3 +1,4 @@
pub mod htmlreport;
pub mod level_tuning;
pub mod profile;
pub mod update_rules;