Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sort search timeline order #1034

Merged
merged 2 commits into from
May 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG-Japanese.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- `search`コマンドの出力での不要な改行やタブを削除した。 (#1003) (@hitenkoku)
- 正規表現の不要なエスケープを許容し、パースエラーを減らす`regex`クレートを1.8に更新した。(#1018) (@YamatoSecurity)
- `update-rules`コマンド使用時にハヤブサのバージョン番号の詳細を確認するようにした (#1028) (@hitenkoku)
- `search`コマンドの結果を時刻順にソートした。 (#1033) (@hitenkoku)

**バグ修正:**

Expand Down
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
- Deleted return characters in the output of the `search` command. (#1003) (@hitenkoku)
- `regex` crate updated to 1.8 which allows unnecessary escapes in regular expressions reducing parsing errors. (#1018) (@YamatoSecurity)
- Don't show new version information with the `update-rules` command when building a newer dev build. (#1028) (@hitenkoku)
- Sorted `search` timeline order. (#1033) (@hitenkoku)

**Bug Fixes:**

Expand Down
6 changes: 4 additions & 2 deletions src/timeline/search.rs
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ fn extract_search_event_info(

/// 検索結果を標準出力もしくはcsvファイルに出力する関数
pub fn search_result_dsp_msg(
result_list: &HashSet<(
result_list: &mut HashSet<(
CompactString,
CompactString,
CompactString,
Expand Down Expand Up @@ -357,7 +357,9 @@ pub fn search_result_dsp_msg(

// Write contents
for (timestamp, hostname, channel, event_id, record_id, all_field_info, evtx_file) in
result_list.iter()
result_list
.iter()
.sorted_unstable_by(|a, b| Ord::cmp(&a.0, &b.0))
{
let event_title = if let Some(event_info) =
event_timeline_config.get_event_id(&channel.to_ascii_lowercase(), event_id)
Expand Down
2 changes: 1 addition & 1 deletion src/timeline/timelines.rs
Original file line number Diff line number Diff line change
Expand Up @@ -386,7 +386,7 @@ impl Timeline {
));
}
search_result_dsp_msg(
&self.event_search.search_result,
&mut self.event_search.search_result,
event_timeline_config,
&search_summary_option.output,
stored_static,
Expand Down