Skip to content

Commit

Permalink
Merge pull request #1394 from Yamato-Security/1383-fix-display-author
Browse files Browse the repository at this point in the history
fix: Rule Author does not appear in the terminal
  • Loading branch information
YamatoSecurity authored Aug 12, 2024
2 parents 5afca22 + 8b39704 commit 2c69f9d
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions CHANGELOG-Japanese.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Sigmaの相関ルールのカウントが`Events with hits`に表示されていなかった。(#1373) (@fukusuket)
- 相関ルールのカウントが`Events with hits`に表示されていなかった。(#1374) (@fukusuket)
- 集計ルールのカウントが`Events with hits`に表示されていなかった。(#1375) (@fukusuket)
- まれに、ルール作成者の一覧が表示されないことがあった。 (#1383) (@fukusuket)

## 2.16.0 [2024/06/11]

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
- Sigma correlation rule count was not showing up in `Events with hits`. (#1373) (@fukusuket)
- Correlation rule count was not showing up in `Events with hits`. (#1374) (@fukusuket)
- Aggregation condition rule count was not showing up in `Events with hits`. (#1375) (@fukusuket)
- In rare cases, the list of rule authors would not be displayed to the terminal. (#1383) (@fukusuket)

## 2.16.0 [2024/06/11] "FIRSTCON24 Release"

Expand Down
10 changes: 6 additions & 4 deletions src/afterfact.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2109,12 +2109,14 @@ fn output_detected_rule_authors(
let mut sorted_authors: Vec<(&CompactString, &i128)> = rule_author_counter.iter().collect();

sorted_authors.sort_by(|a, b| (-a.1).cmp(&(-b.1)));
let div = if sorted_authors.len() % 4 != 0 {
sorted_authors.len() / table_column_num + 1
let authors_num = sorted_authors.len();
let div = if authors_num <= table_column_num {
1
} else if authors_num % 4 != 0 {
authors_num / table_column_num + 1
} else {
sorted_authors.len() / table_column_num
authors_num / table_column_num
};

let mut tb = Table::new();
tb.load_preset(UTF8_FULL)
.apply_modifier(UTF8_ROUND_CORNERS)
Expand Down

0 comments on commit 2c69f9d

Please sign in to comment.