cargo fmt

This commit is contained in:
DastInDark
2022-07-29 10:35:45 +09:00
parent 2822dfa120
commit 23257f798a
10 changed files with 20 additions and 16 deletions

View File

@@ -13,8 +13,8 @@ use krapslog::{build_sparkline, build_time_markers};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use linked_hash_map::LinkedHashMap; use linked_hash_map::LinkedHashMap;
use std::cmp::min;
use hashbrown::{HashMap, HashSet}; use hashbrown::{HashMap, HashSet};
use std::cmp::min;
use std::error::Error; use std::error::Error;
use std::fs::File; use std::fs::File;
@@ -588,9 +588,9 @@ mod tests {
use crate::detections::message::DetectInfo; use crate::detections::message::DetectInfo;
use crate::options::profile::load_profile; use crate::options::profile::load_profile;
use chrono::{Local, TimeZone, Utc}; use chrono::{Local, TimeZone, Utc};
use hashbrown::HashMap;
use linked_hash_map::LinkedHashMap; use linked_hash_map::LinkedHashMap;
use serde_json::Value; use serde_json::Value;
use hashbrown::HashMap;
use std::fs::File; use std::fs::File;
use std::fs::{read_to_string, remove_file}; use std::fs::{read_to_string, remove_file};
use std::io; use std::io;

View File

@@ -4,9 +4,9 @@ use crate::detections::pivot::PIVOT_KEYWORD;
use crate::detections::utils; use crate::detections::utils;
use chrono::{DateTime, Utc}; use chrono::{DateTime, Utc};
use clap::{App, CommandFactory, Parser}; use clap::{App, CommandFactory, Parser};
use hashbrown::{HashMap, HashSet};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use regex::Regex; use regex::Regex;
use hashbrown::{HashMap, HashSet};
use std::env::current_exe; use std::env::current_exe;
use std::path::PathBuf; use std::path::PathBuf;
use std::sync::RwLock; use std::sync::RwLock;

View File

@@ -2,7 +2,9 @@ extern crate csv;
use crate::detections::configs; use crate::detections::configs;
use crate::detections::utils::{format_time, write_color_buffer}; 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 chrono::{TimeZone, Utc};
use termcolor::{BufferWriter, Color, ColorChoice}; 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::detections::utils::{get_serde_number_to_string, make_ascii_titlecase};
use crate::filter; use crate::filter;
use crate::yaml::ParseYaml; use crate::yaml::ParseYaml;
use serde_json::Value;
use hashbrown::HashMap; use hashbrown::HashMap;
use serde_json::Value;
use std::fmt::Write; use std::fmt::Write;
use std::path::Path; use std::path::Path;

View File

@@ -7,11 +7,11 @@ use crate::detections::utils::write_color_buffer;
use crate::options::profile::PROFILES; use crate::options::profile::PROFILES;
use chrono::{DateTime, Local, Utc}; use chrono::{DateTime, Local, Utc};
use dashmap::DashMap; use dashmap::DashMap;
use hashbrown::HashMap;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use linked_hash_map::LinkedHashMap; use linked_hash_map::LinkedHashMap;
use regex::Regex; use regex::Regex;
use serde_json::Value; use serde_json::Value;
use hashbrown::HashMap;
use std::env; use std::env;
use std::fs::create_dir; use std::fs::create_dir;
use std::fs::File; use std::fs::File;
@@ -158,11 +158,13 @@ pub fn insert(
if exist_detail { if exist_detail {
profile_converter.insert("%Details%".to_string(), detect_info.detail.to_owned()); profile_converter.insert("%Details%".to_string(), detect_info.detail.to_owned());
} }
let mut tmp_converted_info : HashMap<String, String> = HashMap::new(); let mut tmp_converted_info: HashMap<String, String> = HashMap::new();
for (k, v) in detect_info.ext_field.iter() { for (k, v) in detect_info.ext_field.iter() {
let converted_reserve_info = convert_profile_reserved_info(v, profile_converter); let converted_reserve_info = convert_profile_reserved_info(v, profile_converter);
tmp_converted_info.insert(k.to_owned(), tmp_converted_info.insert(
parse_message(event_record, &converted_reserve_info)); k.to_owned(),
parse_message(event_record, &converted_reserve_info),
);
} }
for (k, v) in tmp_converted_info { for (k, v) in tmp_converted_info {
detect_info.ext_field.insert(k, v); detect_info.ext_field.insert(k, v);
@@ -376,8 +378,8 @@ impl AlertMessage {
mod tests { mod tests {
use crate::detections::message::AlertMessage; use crate::detections::message::AlertMessage;
use crate::detections::message::{parse_message, MESSAGES}; use crate::detections::message::{parse_message, MESSAGES};
use serde_json::Value;
use hashbrown::HashMap; use hashbrown::HashMap;
use serde_json::Value;
use super::{create_output_filter_config, get_default_details}; use super::{create_output_filter_config, get_default_details};

View File

@@ -1,6 +1,6 @@
use hashbrown::{HashMap, HashSet};
use lazy_static::lazy_static; use lazy_static::lazy_static;
use serde_json::Value; use serde_json::Value;
use hashbrown::{HashMap, HashSet};
use std::sync::RwLock; use std::sync::RwLock;
use crate::detections::configs; use crate::detections::configs;

View File

@@ -6,8 +6,8 @@ use crate::detections::message::QUIET_ERRORS_FLAG;
use crate::detections::rule::AggResult; use crate::detections::rule::AggResult;
use crate::detections::rule::RuleNode; use crate::detections::rule::RuleNode;
use chrono::{DateTime, TimeZone, Utc}; use chrono::{DateTime, TimeZone, Utc};
use serde_json::Value;
use hashbrown::HashMap; use hashbrown::HashMap;
use serde_json::Value;
use std::num::ParseIntError; use std::num::ParseIntError;
use std::path::Path; use std::path::Path;

View File

@@ -2,8 +2,8 @@ use crate::detections::configs;
use crate::detections::message::AlertMessage; use crate::detections::message::AlertMessage;
use crate::detections::message::ERROR_LOG_STACK; use crate::detections::message::ERROR_LOG_STACK;
use crate::detections::message::QUIET_ERRORS_FLAG; use crate::detections::message::QUIET_ERRORS_FLAG;
use regex::Regex;
use hashbrown::HashMap; use hashbrown::HashMap;
use regex::Regex;
use std::fs::File; use std::fs::File;
use std::io::{BufRead, BufReader}; use std::io::{BufRead, BufReader};

View File

@@ -9,6 +9,7 @@ extern crate static_vcruntime;
use bytesize::ByteSize; use bytesize::ByteSize;
use chrono::{DateTime, Datelike, Local}; use chrono::{DateTime, Datelike, Local};
use evtx::{EvtxParser, ParserSettings}; use evtx::{EvtxParser, ParserSettings};
use hashbrown::{HashMap, HashSet};
use hayabusa::detections::configs::CURRENT_EXE_PATH; use hayabusa::detections::configs::CURRENT_EXE_PATH;
use hayabusa::detections::configs::{load_pivot_keywords, TargetEventTime, TARGET_EXTENSIONS}; use hayabusa::detections::configs::{load_pivot_keywords, TargetEventTime, TARGET_EXTENSIONS};
use hayabusa::detections::detection::{self, EvtxRecordInfo}; use hayabusa::detections::detection::{self, EvtxRecordInfo};
@@ -27,7 +28,6 @@ use hayabusa::{detections::utils::write_color_buffer, filter};
use hhmmss::Hhmmss; use hhmmss::Hhmmss;
use pbr::ProgressBar; use pbr::ProgressBar;
use serde_json::Value; use serde_json::Value;
use hashbrown::{HashMap, HashSet};
use std::ffi::{OsStr, OsString}; use std::ffi::{OsStr, OsString};
use std::fmt::Display; use std::fmt::Display;
use std::fmt::Write as _; use std::fmt::Write as _;

View File

@@ -2,10 +2,10 @@ use crate::detections::configs::{self, CURRENT_EXE_PATH};
use crate::detections::message::AlertMessage; use crate::detections::message::AlertMessage;
use crate::detections::utils::check_setting_path; use crate::detections::utils::check_setting_path;
use crate::yaml; use crate::yaml;
use hashbrown::HashSet;
use lazy_static::lazy_static; use lazy_static::lazy_static;
use linked_hash_map::LinkedHashMap; use linked_hash_map::LinkedHashMap;
use regex::RegexSet; use regex::RegexSet;
use hashbrown::HashSet;
use std::fs::OpenOptions; use std::fs::OpenOptions;
use std::io::{BufWriter, Write}; use std::io::{BufWriter, Write};
use std::path::Path; use std::path::Path;

View File

@@ -7,8 +7,8 @@ use git2::Repository;
use std::fs::{self}; use std::fs::{self};
use std::path::Path; use std::path::Path;
use std::cmp::Ordering;
use hashbrown::{HashMap, HashSet}; use hashbrown::{HashMap, HashSet};
use std::cmp::Ordering;
use std::time::SystemTime; use std::time::SystemTime;