diff --git a/src/afterfact.rs b/src/afterfact.rs index 0949c5d4..a4a7a761 100644 --- a/src/afterfact.rs +++ b/src/afterfact.rs @@ -13,8 +13,8 @@ use krapslog::{build_sparkline, build_time_markers}; use lazy_static::lazy_static; use linked_hash_map::LinkedHashMap; -use std::cmp::min; use hashbrown::{HashMap, HashSet}; +use std::cmp::min; use std::error::Error; use std::fs::File; @@ -588,9 +588,9 @@ mod tests { use crate::detections::message::DetectInfo; use crate::options::profile::load_profile; use chrono::{Local, TimeZone, Utc}; + use hashbrown::HashMap; use linked_hash_map::LinkedHashMap; use serde_json::Value; - use hashbrown::HashMap; use std::fs::File; use std::fs::{read_to_string, remove_file}; use std::io; diff --git a/src/detections/configs.rs b/src/detections/configs.rs index 4d84102d..ab343d9f 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -4,9 +4,9 @@ use crate::detections::pivot::PIVOT_KEYWORD; use crate::detections::utils; use chrono::{DateTime, Utc}; use clap::{App, CommandFactory, Parser}; +use hashbrown::{HashMap, HashSet}; use lazy_static::lazy_static; use regex::Regex; -use hashbrown::{HashMap, HashSet}; use std::env::current_exe; use std::path::PathBuf; use std::sync::RwLock; diff --git a/src/detections/detection.rs b/src/detections/detection.rs index 746441bd..131d5cf6 100644 --- a/src/detections/detection.rs +++ b/src/detections/detection.rs @@ -2,7 +2,9 @@ extern crate csv; use crate::detections::configs; use crate::detections::utils::{format_time, write_color_buffer}; -use crate::options::profile::{LOAEDED_PROFILE_ALIAS, PRELOAD_PROFILE, PRELOAD_PROFILE_REGEX, PROFILES}; +use crate::options::profile::{ + LOAEDED_PROFILE_ALIAS, PRELOAD_PROFILE, PRELOAD_PROFILE_REGEX, PROFILES, +}; use chrono::{TimeZone, Utc}; use termcolor::{BufferWriter, Color, ColorChoice}; @@ -20,8 +22,8 @@ use crate::detections::rule::RuleNode; use crate::detections::utils::{get_serde_number_to_string, make_ascii_titlecase}; use crate::filter; use crate::yaml::ParseYaml; -use serde_json::Value; use hashbrown::HashMap; +use serde_json::Value; use std::fmt::Write; use std::path::Path; diff --git a/src/detections/message.rs b/src/detections/message.rs index 0a7a6938..d4bd447e 100644 --- a/src/detections/message.rs +++ b/src/detections/message.rs @@ -7,11 +7,11 @@ use crate::detections::utils::write_color_buffer; use crate::options::profile::PROFILES; use chrono::{DateTime, Local, Utc}; use dashmap::DashMap; +use hashbrown::HashMap; use lazy_static::lazy_static; use linked_hash_map::LinkedHashMap; use regex::Regex; use serde_json::Value; -use hashbrown::HashMap; use std::env; use std::fs::create_dir; use std::fs::File; @@ -158,11 +158,13 @@ pub fn insert( if exist_detail { profile_converter.insert("%Details%".to_string(), detect_info.detail.to_owned()); } - let mut tmp_converted_info : HashMap = HashMap::new(); + let mut tmp_converted_info: HashMap = HashMap::new(); for (k, v) in detect_info.ext_field.iter() { let converted_reserve_info = convert_profile_reserved_info(v, profile_converter); - tmp_converted_info.insert(k.to_owned(), - parse_message(event_record, &converted_reserve_info)); + tmp_converted_info.insert( + k.to_owned(), + parse_message(event_record, &converted_reserve_info), + ); } for (k, v) in tmp_converted_info { detect_info.ext_field.insert(k, v); @@ -376,8 +378,8 @@ impl AlertMessage { mod tests { use crate::detections::message::AlertMessage; use crate::detections::message::{parse_message, MESSAGES}; - use serde_json::Value; use hashbrown::HashMap; + use serde_json::Value; use super::{create_output_filter_config, get_default_details}; diff --git a/src/detections/pivot.rs b/src/detections/pivot.rs index d25b9871..af2b0f59 100644 --- a/src/detections/pivot.rs +++ b/src/detections/pivot.rs @@ -1,6 +1,6 @@ +use hashbrown::{HashMap, HashSet}; use lazy_static::lazy_static; use serde_json::Value; -use hashbrown::{HashMap, HashSet}; use std::sync::RwLock; use crate::detections::configs; diff --git a/src/detections/rule/count.rs b/src/detections/rule/count.rs index df72dd17..aa0a244d 100644 --- a/src/detections/rule/count.rs +++ b/src/detections/rule/count.rs @@ -6,8 +6,8 @@ use crate::detections::message::QUIET_ERRORS_FLAG; use crate::detections::rule::AggResult; use crate::detections::rule::RuleNode; use chrono::{DateTime, TimeZone, Utc}; -use serde_json::Value; use hashbrown::HashMap; +use serde_json::Value; use std::num::ParseIntError; use std::path::Path; diff --git a/src/filter.rs b/src/filter.rs index 1f88ad3e..c78b7880 100644 --- a/src/filter.rs +++ b/src/filter.rs @@ -2,8 +2,8 @@ use crate::detections::configs; use crate::detections::message::AlertMessage; use crate::detections::message::ERROR_LOG_STACK; use crate::detections::message::QUIET_ERRORS_FLAG; -use regex::Regex; use hashbrown::HashMap; +use regex::Regex; use std::fs::File; use std::io::{BufRead, BufReader}; diff --git a/src/main.rs b/src/main.rs index 27d4335a..e4199355 100644 --- a/src/main.rs +++ b/src/main.rs @@ -9,6 +9,7 @@ extern crate static_vcruntime; use bytesize::ByteSize; use chrono::{DateTime, Datelike, Local}; use evtx::{EvtxParser, ParserSettings}; +use hashbrown::{HashMap, HashSet}; use hayabusa::detections::configs::CURRENT_EXE_PATH; use hayabusa::detections::configs::{load_pivot_keywords, TargetEventTime, TARGET_EXTENSIONS}; use hayabusa::detections::detection::{self, EvtxRecordInfo}; @@ -27,7 +28,6 @@ use hayabusa::{detections::utils::write_color_buffer, filter}; use hhmmss::Hhmmss; use pbr::ProgressBar; use serde_json::Value; -use hashbrown::{HashMap, HashSet}; use std::ffi::{OsStr, OsString}; use std::fmt::Display; use std::fmt::Write as _; diff --git a/src/options/profile.rs b/src/options/profile.rs index 8f9558a7..d8f3571e 100644 --- a/src/options/profile.rs +++ b/src/options/profile.rs @@ -2,10 +2,10 @@ use crate::detections::configs::{self, CURRENT_EXE_PATH}; use crate::detections::message::AlertMessage; use crate::detections::utils::check_setting_path; use crate::yaml; +use hashbrown::HashSet; use lazy_static::lazy_static; use linked_hash_map::LinkedHashMap; use regex::RegexSet; -use hashbrown::HashSet; use std::fs::OpenOptions; use std::io::{BufWriter, Write}; use std::path::Path; diff --git a/src/options/update_rules.rs b/src/options/update_rules.rs index 240599eb..be3ca5db 100644 --- a/src/options/update_rules.rs +++ b/src/options/update_rules.rs @@ -7,8 +7,8 @@ use git2::Repository; use std::fs::{self}; use std::path::Path; -use std::cmp::Ordering; use hashbrown::{HashMap, HashSet}; +use std::cmp::Ordering; use std::time::SystemTime;