diff --git a/README-Japanese.md b/README-Japanese.md index 335bb4cf..2818d91a 100644 --- a/README-Japanese.md +++ b/README-Japanese.md @@ -13,8 +13,11 @@ [tag-4]: https://img.shields.io/badge/Black%20Hat%20Arsenal-Asia%202022-blue [tag-5]: https://rust-reportcard.xuri.me/badge/github.com/Yamato-Security/hayabusa [tag-6]: https://img.shields.io/badge/Maintenance%20Level-Actively%20Developed-brightgreen.svg +[tag-7]: https://img.shields.io/badge/Twitter-00acee?logo=twitter&logoColor=white + +![tag-1] ![tag-2] ![tag-3] ![tag-4] +![tag-5] ![tag-6] ![tag-7] -![tag-1] ![tag-2] ![tag-3] ![tag-4] ![tag-5] ![tag-6] # Hayabusa について diff --git a/README.md b/README.md index 4278b1e3..47c8b374 100644 --- a/README.md +++ b/README.md @@ -13,8 +13,10 @@ [tag-4]: https://img.shields.io/badge/Black%20Hat%20Arsenal-Asia%202022-blue [tag-5]: https://rust-reportcard.xuri.me/badge/github.com/Yamato-Security/hayabusa [tag-6]: https://img.shields.io/badge/Maintenance%20Level-Actively%20Developed-brightgreen.svg +[tag-7]: https://img.shields.io/badge/Twitter-00acee?logo=twitter&logoColor=white -![tag-1] ![tag-2] ![tag-3] ![tag-4] ![tag-5] ![tag-6] +![tag-1] ![tag-2] ![tag-3] ![tag-4] +![tag-5] ![tag-6] ![tag-7] # About Hayabusa diff --git a/src/detections/detection.rs b/src/detections/detection.rs index b6b578d8..b453f3b6 100644 --- a/src/detections/detection.rs +++ b/src/detections/detection.rs @@ -19,6 +19,7 @@ use crate::yaml::ParseYaml; use hashbrown; use hashbrown::HashMap; use serde_json::Value; +use std::fmt::Write; use std::io::BufWriter; use std::sync::Arc; use tokio::{runtime::Runtime, spawn, task::JoinHandle}; @@ -290,28 +291,31 @@ impl Detection { ret.push_str(" in timeframe"); } - ret.push_str(&format!(" [result] count:{}", agg_result.data)); + let _ = write!(ret, " [result] count:{}", agg_result.data); if agg_condition._field_name.is_some() { - ret.push_str(&format!( + let _ = write!( + ret, " {}:{}", agg_condition._field_name.as_ref().unwrap(), agg_result.field_values.join("/") - )); + ); } if agg_condition._by_field_name.is_some() { - ret.push_str(&format!( + let _ = write!( + ret, " {}:{}", agg_condition._by_field_name.as_ref().unwrap(), agg_result.key - )); + ); } if exist_timeframe { - ret.push_str(&format!( + let _ = write!( + ret, " timeframe:{}", rule.yaml["detection"]["timeframe"].as_str().unwrap() - )); + ); } ret