From e4ae84a1e445143203e0981ef482af8db2219a56 Mon Sep 17 00:00:00 2001 From: DastInDark <2350416+hitenkoku@users.noreply.github.com> Date: Sun, 17 Mar 2024 10:37:07 +0900 Subject: [PATCH 1/3] fix(configs): fixed help option is being displayed multiple times #1309 --- src/detections/configs.rs | 33 ++++++++++++++++++++++----------- 1 file changed, 22 insertions(+), 11 deletions(-) diff --git a/src/detections/configs.rs b/src/detections/configs.rs index 399de7685..8a7a3b71f 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -776,7 +776,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n hayabusa.exe csv-timeline [OPTIONS]\n\n{all-args}", term_width = 400, - display_order = 290 + display_order = 290, + disable_help_flag = true )] /// Save the timeline in CSV format. CsvTimeline(CsvOutputOption), @@ -785,7 +786,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n hayabusa.exe json-timeline [OPTIONS]\n\n{all-args}", term_width = 400, - display_order = 360 + display_order = 360, + disable_help_flag = true )] /// Save the timeline in JSON/JSONL format. JsonTimeline(JSONOutputOption), @@ -794,7 +796,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n hayabusa.exe logon-summary [OPTIONS]\n\n{all-args}", term_width = 400, - display_order = 383 + display_order = 383, + disable_help_flag = true )] /// Print a summary of successful and failed logons LogonSummary(LogonSummaryOption), @@ -803,7 +806,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n hayabusa.exe eid-metrics [OPTIONS]\n\n{all-args}", term_width = 400, - display_order = 310 + display_order = 310, + disable_help_flag = true )] /// Print event ID metrics EidMetrics(EidMetricsOption), @@ -812,7 +816,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n hayabusa.exe pivot-keywords-list [OPTIONS]\n\n{all-args}", term_width = 400, - display_order = 420 + display_order = 420, + disable_help_flag = true )] /// Create a list of pivot keywords PivotKeywordsList(PivotKeywordOption), @@ -821,7 +826,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n hayabusa.exe search <--keywords \"\" OR --regex \"\"> [OPTIONS]\n\n{all-args}", term_width = 400, - display_order = 450 + display_order = 450, + disable_help_flag = true )] /// Search all events by keyword(s) or regular expression Search(SearchOption), @@ -830,7 +836,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n {usage}\n\n{all-args}", term_width = 400, - display_order = 470 + display_order = 470, + disable_help_flag = true )] /// Update to the latest rules in the hayabusa-rules github repository UpdateRules(UpdateOption), @@ -839,7 +846,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n {usage}\n\n{all-args}", term_width = 400, - display_order = 380 + display_order = 380, + disable_help_flag = true )] /// Tune alert levels (default: ./rules/config/level_tuning.txt) LevelTuning(LevelTuningOption), @@ -848,7 +856,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n {usage}\n\n{all-args}", term_width = 400, - display_order = 451 + display_order = 451, + disable_help_flag = true )] /// Set default output profile SetDefaultProfile(DefaultProfileOption), @@ -865,7 +874,8 @@ pub enum Action { author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n {usage}\n\n{all-args}", term_width = 400, - display_order = 290 + display_order = 290, + disable_help_flag = true )] /// Print computer name metrics ComputerMetrics(ComputerMetricsOption), @@ -1702,7 +1712,8 @@ pub struct ComputerMetricsOption { #[clap( author = "Yamato Security (https://github.com/Yamato-Security/hayabusa - @SecurityYamato)", help_template = "\nHayabusa v2.14.0 - Dev Build\n{author-with-newline}\n{usage-heading}\n hayabusa.exe [OPTIONS]\n hayabusa.exe help \n\n{all-args}{options}", - term_width = 400 + term_width = 400, + disable_help_flag = true )] pub struct Config { #[command(subcommand)] From fae1531a44dc5e6e7e0dc2bb599338543d49c690 Mon Sep 17 00:00:00 2001 From: DastInDark <2350416+hitenkoku@users.noreply.github.com> Date: Sun, 17 Mar 2024 10:39:20 +0900 Subject: [PATCH 2/3] docs(CHANGELOG): added #1309 --- CHANGELOG-Japanese.md | 1 + CHANGELOG.md | 1 + 2 files changed, 2 insertions(+) diff --git a/CHANGELOG-Japanese.md b/CHANGELOG-Japanese.md index aa085517f..aed682cfa 100644 --- a/CHANGELOG-Japanese.md +++ b/CHANGELOG-Japanese.md @@ -19,6 +19,7 @@ - `search` コマンドのJSON出力で`AllFieldInfo`フィールドの情報が出力されなくなっていたのを修正した。 (#1251) (@hitenkoku) - ウィザードのオプション選択の時間が処理時間の中に含まれていたため除外した。 (#1291) (@hitenkoku) +- `-h, --help`オプションが重複して複数回表示されていた問題を修正した。 (#1309) (@hitenkoku) ## 2.13.0 [2024/02/11] "Year Of The Dragon Release" diff --git a/CHANGELOG.md b/CHANGELOG.md index 9b2006617..f532b007b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -19,6 +19,7 @@ - JSON output of the `search` command was missing the `AllFieldInfo` field. (#1251) (@hitenkoku) - The time the user took to choose options in the scan wizard was included in elapsed time so we now exclude that. (#1291) (@hitenkoku) +- Fixed `-h, --help` option is being displayed multiple times. (#1309) (@hitenkoku) ## 2.13.0 [2024/02/11] "Year Of The Dragon Release" From c7f96d5f71a54301f8ed38a8328d8d7aac5e35f6 Mon Sep 17 00:00:00 2001 From: DastInDark <2350416+hitenkoku@users.noreply.github.com> Date: Sun, 17 Mar 2024 17:33:03 +0900 Subject: [PATCH 3/3] UI(configs): fixed out of alphabetical order #1309 --- src/detections/configs.rs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/detections/configs.rs b/src/detections/configs.rs index 8a7a3b71f..24b91483c 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -927,7 +927,7 @@ impl Action { #[derive(Args, Clone, Debug)] pub struct DetectCommonOption { /// Scan JSON formatted logs instead of .evtx (.json or .jsonl) - #[arg(help_heading = Some("General Options"), short = 'J', long = "JSON-input", conflicts_with = "live_analysis", display_order = 390)] + #[arg(help_heading = Some("General Options"), short = 'J', long = "JSON-input", conflicts_with = "live_analysis", display_order = 360)] pub json_input: bool, /// Specify additional evtx file extensions (ex: evtx_data) @@ -956,7 +956,7 @@ pub struct DetectCommonOption { default_value = "./rules/config", hide_default_value = true, value_name = "DIR", - display_order = 441 + display_order = 442 )] pub config: PathBuf, @@ -1081,7 +1081,7 @@ pub struct SearchOption { default_value = "./rules/config", hide_default_value = true, value_name = "DIR", - display_order = 441 + display_order = 442 )] pub config: PathBuf, @@ -1148,7 +1148,7 @@ pub struct UpdateOption { hide_default_value = true, value_name = "DIR/FILE", requires = "no_wizard", - display_order = 440 + display_order = 441 )] pub rules: PathBuf, } @@ -1518,7 +1518,7 @@ pub struct OutputOption { hide_default_value = true, value_name = "DIR/FILE", requires = "no_wizard", - display_order = 440 + display_order = 441 )] pub rules: PathBuf, @@ -1695,7 +1695,7 @@ pub struct ComputerMetricsOption { default_value = "./rules/config", hide_default_value = true, value_name = "DIR", - display_order = 441 + display_order = 442 )] pub config: PathBuf,