Skip to content

Commit

Permalink
feat: adjusted multiple directory option #1335
Browse files Browse the repository at this point in the history
  • Loading branch information
hitenkoku committed May 2, 2024
1 parent d578a89 commit f571700
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/detections/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1607,7 +1607,7 @@ pub struct CommonOptions {
pub struct InputOption {
/// Directory of multiple .evtx files
#[arg(help_heading = Some("Input"), short = 'd', long, value_name = "DIR", conflicts_with_all = ["filepath", "live_analysis"], display_order = 300)]
pub directory: Option<PathBuf>,
pub directory: Option<Vec<PathBuf>>,

/// File path to one .evtx file
#[arg(help_heading = Some("Input"), short = 'f', long = "file", value_name = "FILE", conflicts_with_all = ["directory", "live_analysis"], display_order = 320)]
Expand Down
15 changes: 9 additions & 6 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -784,18 +784,21 @@ impl App {
time_filter,
stored_static.borrow_mut(),
);
} else if let Some(directory) = &stored_static
} else if let Some(directories) = &stored_static
.output_option
.as_ref()
.unwrap()
.input_args
.directory
{
let evtx_files = Self::collect_evtxfiles(
directory.as_os_str().to_str().unwrap(),
target_extensions,
stored_static,
);
let mut evtx_files = Vec::new();
for directory in directories {
evtx_files.extend(Self::collect_evtxfiles(
directory.as_os_str().to_str().unwrap(),
target_extensions,
stored_static,
));
}
if evtx_files.is_empty() {
AlertMessage::alert("No .evtx files were found.").ok();
return;
Expand Down

0 comments on commit f571700

Please sign in to comment.