Skip to content

Commit

Permalink
WIP(config): added include-category and exclude-category option and r…
Browse files Browse the repository at this point in the history
…eorder option #1119
  • Loading branch information
hitenkoku committed Jul 3, 2023
1 parent c41b6e8 commit 1888062
Showing 1 changed file with 22 additions and 2 deletions.
24 changes: 22 additions & 2 deletions src/detections/configs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -896,7 +896,7 @@ pub struct PivotKeywordOption {
pub enable_unsupported_rules: bool,

/// Ignore rules according to status (ex: experimental) (ex: stable,test)
#[arg(help_heading = Some("Filtering"), long = "exclude-status", value_name = "STATUS", use_value_delimiter = true, value_delimiter = ',', display_order = 314)]
#[arg(help_heading = Some("Filtering"), long = "exclude-status", value_name = "STATUS", use_value_delimiter = true, value_delimiter = ',', display_order = 315)]
pub exclude_status: Option<Vec<String>>,

/// Minimum level for rules (default: informational)
Expand Down Expand Up @@ -1014,13 +1014,21 @@ pub struct OutputOption {
pub enable_unsupported_rules: bool,

/// Ignore rules according to status (ex: experimental) (ex: stable,test)
#[arg(help_heading = Some("Filtering"), long = "exclude-status", value_name = "STATUS", use_value_delimiter = true, value_delimiter = ',', display_order = 314)]
#[arg(help_heading = Some("Filtering"), long = "exclude-status", value_name = "STATUS", use_value_delimiter = true, value_delimiter = ',', display_order = 315)]
pub exclude_status: Option<Vec<String>>,

/// Only load rules with specific tags (ex: attack.execution,attack.discovery)
#[arg(help_heading = Some("Filtering"), long = "tags", value_name = "TAGS", use_value_delimiter = true, value_delimiter = ',', display_order = 460)]
pub tags: Option<Vec<String>>,

/// Only load rules with certain logsource categories (ex: process_creation,pipe_created)
#[arg(help_heading = Some("Filtering"), long = "include-category", value_name = "CATEGORY", conflicts_with = "exclude-category", use_value_delimiter = true, value_delimiter = ',', display_order = 351)]
pub include_category: Option<Vec<String>>,

/// Do not load rules with certain logsource categories (ex: process_creation,pipe_created)
#[arg(help_heading = Some("Filtering"), long = "exclude-category", value_name = "CATEGORY", conflicts_with = "include_category",use_value_delimiter = true, value_delimiter = ',', display_order = 314)]
pub exclude_category: Option<Vec<String>>,

/// Minimum level for rules (default: informational)
#[arg(
help_heading = Some("Filtering"),
Expand Down Expand Up @@ -1544,6 +1552,8 @@ fn extract_output_options(config: &Config) -> Option<OutputOption> {
enable_unsupported_rules: option.enable_unsupported_rules,
clobber: false,
tags: None,
include_category: None,
exclude_category: None,
}),
Action::Metrics(option) => Some(OutputOption {
input_args: option.input_args.clone(),
Expand Down Expand Up @@ -1572,6 +1582,8 @@ fn extract_output_options(config: &Config) -> Option<OutputOption> {
enable_unsupported_rules: false,
clobber: option.clobber,
tags: None,
include_category: None,
exclude_category: None,
}),
Action::LogonSummary(option) => Some(OutputOption {
input_args: option.input_args.clone(),
Expand Down Expand Up @@ -1600,6 +1612,8 @@ fn extract_output_options(config: &Config) -> Option<OutputOption> {
enable_unsupported_rules: false,
clobber: option.clobber,
tags: None,
include_category: None,
exclude_category: None,
}),
Action::Search(option) => Some(OutputOption {
input_args: option.input_args.clone(),
Expand Down Expand Up @@ -1635,6 +1649,8 @@ fn extract_output_options(config: &Config) -> Option<OutputOption> {
enable_unsupported_rules: false,
clobber: option.clobber,
tags: None,
include_category: None,
exclude_category: None,
}),
Action::SetDefaultProfile(option) => Some(OutputOption {
input_args: InputOption {
Expand Down Expand Up @@ -1674,6 +1690,8 @@ fn extract_output_options(config: &Config) -> Option<OutputOption> {
enable_unsupported_rules: false,
clobber: false,
tags: None,
include_category: None,
exclude_category: None,
}),
Action::UpdateRules(option) => Some(OutputOption {
input_args: InputOption {
Expand Down Expand Up @@ -1713,6 +1731,8 @@ fn extract_output_options(config: &Config) -> Option<OutputOption> {
enable_unsupported_rules: true,
clobber: false,
tags: None,
include_category: None,
exclude_category: None,
}),
_ => None,
}
Expand Down

0 comments on commit 1888062

Please sign in to comment.