Merge branch 'main' into 651-organize-menu

This commit is contained in:
Yamato Security
2022-08-12 08:21:13 +09:00
committed by GitHub
3 changed files with 13 additions and 7 deletions

View File

@@ -12,7 +12,8 @@
- ルールのアップデート機能のルールパスの出力から./を削除した。 (#642) (@hitenkoku)
- MITRE ATT&CK関連のタグとその他タグを出力するための出力用のエイリアスを追加した。 (#637) (@hitenkoku)
- 結果概要の数値をカンマをつけて見やすくした。 (#649) (@hitenkoku)
- メニューを使いやすいようにグループ化した。 (#651) (@YamatoSecurity and @hitenkoku)
- `-h`オプションでメニューを使いやすいようにグループ化した。 (#651) (@YamatoSecurity and @hitenkoku)
- 結果概要内の検知数にパーセント表示を追加した。 (#658) (@hitenkoku)
**バグ修正:**

View File

@@ -13,6 +13,7 @@
- Added new output alias for MITRE ATT&CK tags and other tags. (#637) (@hitenkoku)
- Organized menu (#651) (@YamatoSecurity and @hitenkoku)
- Added commas to summary numbers to make them easier to read. (#649) (@hitenkoku)
- Added output percentage of detections in Result Summary. (#658) (@hitenkoku)
**Bug Fixes:**

View File

@@ -437,6 +437,7 @@ fn _print_unique_results(
// the order in which are registered and the order of levels to be displayed are reversed
counts_by_level.reverse();
let total_count = counts_by_level.iter().sum::<u128>();
// output total results
write_color_buffer(
&BufferWriter::stdout(ColorChoice::Always),
@@ -445,10 +446,7 @@ fn _print_unique_results(
"{} {}: {}",
head_word,
tail_word,
counts_by_level
.iter()
.sum::<u128>()
.to_formatted_string(&Locale::en),
total_count.to_formatted_string(&Locale::en),
),
true,
)
@@ -458,12 +456,18 @@ fn _print_unique_results(
if "undefined" == *level_name {
continue;
}
let percent = if total_count == 0 {
0 as f64
} else {
(counts_by_level[i] as f64) / (total_count as f64) * 100.0
};
let output_raw_str = format!(
"{} {} {}: {}",
"{} {} {}: {} ({:.2}%)",
head_word,
level_name,
tail_word,
counts_by_level[i].to_formatted_string(&Locale::en)
counts_by_level[i].to_formatted_string(&Locale::en),
percent
);
write_color_buffer(
&BufferWriter::stdout(ColorChoice::Always),