From dc409681ca65e6d7e876a1503113a7ebc4c638f4 Mon Sep 17 00:00:00 2001 From: DustInDark Date: Thu, 23 Jun 2022 09:22:07 +0900 Subject: [PATCH] added execution path staic variable --- src/detections/configs.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/detections/configs.rs b/src/detections/configs.rs index 1a546774..2ba70ec3 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -3,6 +3,7 @@ use crate::detections::pivot::PIVOT_KEYWORD; use crate::detections::print::AlertMessage; use crate::detections::utils; use chrono::{DateTime, Utc}; +use std::env::current_exe; use clap::{App, CommandFactory, Parser}; use hashbrown::HashMap; use hashbrown::HashSet; @@ -32,6 +33,7 @@ lazy_static! { pub static ref TERM_SIZE: Option<(Width, Height)> = terminal_size(); pub static ref TARGET_EXTENSIONS: HashSet = get_target_extensions(CONFIG.read().unwrap().args.evtx_file_ext.as_ref()); + pub static ref CURRENT_EXE_PATH: PathBuf = current_exe().unwrap().parent().unwrap().to_path_buf(); } pub struct ConfigReader<'a> { @@ -228,8 +230,8 @@ impl ConfigReader<'_> { app: build_cmd, args: parse, headless_help: String::default(), - event_timeline_config: load_eventcode_info("config/statistics_event_info.txt"), - target_eventids: load_target_ids("config/target_eventids.txt"), + event_timeline_config: load_eventcode_info(CURRENT_EXE_PATH.join("config/statistics_event_info.txt").to_str().unwrap()), + target_eventids: load_target_ids(CURRENT_EXE_PATH.join("config/target_eventids.txt").to_str().unwrap()), } } }