cargo fmt

This commit is contained in:
DastInDark
2022-08-08 10:09:37 +09:00
parent 9684a11d37
commit 7cc0217cb1
3 changed files with 8 additions and 17 deletions

View File

@@ -579,9 +579,8 @@ mod tests {
#[test] #[test]
fn test_emit_csv_output() { fn test_emit_csv_output() {
let mock_ch_filter = message::create_output_filter_config( let mock_ch_filter =
"test_files/config/channel_abbreviations.txt", message::create_output_filter_config("test_files/config/channel_abbreviations.txt");
);
let test_filepath: &str = "test.evtx"; let test_filepath: &str = "test.evtx";
let test_rulepath: &str = "test-rule.yml"; let test_rulepath: &str = "test-rule.yml";
let test_title = "test_title"; let test_title = "test_title";

View File

@@ -339,8 +339,7 @@ impl Detection {
make_ascii_titlecase(&mut replaced_tag) make_ascii_titlecase(&mut replaced_tag)
}) })
.collect(); .collect();
profile_converter profile_converter.insert("%MitreTags%".to_string(), techniques.join(" : "));
.insert("%MitreTags%".to_string(), techniques.join(" : "));
} }
"%OtherTags%" => { "%OtherTags%" => {
let tags: &Vec<String> = &tag_info let tags: &Vec<String> = &tag_info
@@ -471,8 +470,7 @@ impl Detection {
make_ascii_titlecase(&mut replaced_tag) make_ascii_titlecase(&mut replaced_tag)
}) })
.collect(); .collect();
profile_converter profile_converter.insert("%MitreTags%".to_string(), techniques.join(" : "));
.insert("%MitreTags%".to_string(), techniques.join(" : "));
} }
"%OtherTags%" => { "%OtherTags%" => {
let tags: &Vec<String> = &tag_info let tags: &Vec<String> = &tag_info

View File

@@ -90,9 +90,7 @@ lazy_static! {
/// ファイルパスで記載されたtagでのフル名、表示の際に置き換えられる文字列のHashMapを作成する関数。 /// ファイルパスで記載されたtagでのフル名、表示の際に置き換えられる文字列のHashMapを作成する関数。
/// ex. attack.impact,Impact /// ex. attack.impact,Impact
pub fn create_output_filter_config( pub fn create_output_filter_config(path: &str) -> HashMap<String, String> {
path: &str,
) -> HashMap<String, String> {
let mut ret: HashMap<String, String> = HashMap::new(); let mut ret: HashMap<String, String> = HashMap::new();
let read_result = utils::read_csv(path); let read_result = utils::read_csv(path);
if read_result.is_err() { if read_result.is_err() {
@@ -584,8 +582,7 @@ mod tests {
#[test] #[test]
/// test of loading output filter config by mitre_tactics.txt /// test of loading output filter config by mitre_tactics.txt
fn test_load_mitre_tactics_log() { fn test_load_mitre_tactics_log() {
let actual = let actual = create_output_filter_config("test_files/config/mitre_tactics.txt");
create_output_filter_config("test_files/config/mitre_tactics.txt");
let expected: HashMap<String, String> = HashMap::from([ let expected: HashMap<String, String> = HashMap::from([
("attack.impact".to_string(), "Impact".to_string()), ("attack.impact".to_string(), "Impact".to_string()),
("xxx".to_string(), "yyy".to_string()), ("xxx".to_string(), "yyy".to_string()),
@@ -596,11 +593,8 @@ mod tests {
#[test] #[test]
/// loading test to channel_abbrevations.txt /// loading test to channel_abbrevations.txt
fn test_load_abbrevations() { fn test_load_abbrevations() {
let actual = let actual = create_output_filter_config("test_files/config/channel_abbreviations.txt");
create_output_filter_config("test_files/config/channel_abbreviations.txt"); let actual2 = create_output_filter_config("test_files/config/channel_abbreviations.txt");
let actual2 = create_output_filter_config(
"test_files/config/channel_abbreviations.txt",
);
let expected: HashMap<String, String> = HashMap::from([ let expected: HashMap<String, String> = HashMap::from([
("Security".to_string(), "Sec".to_string()), ("Security".to_string(), "Sec".to_string()),
("xxx".to_string(), "yyy".to_string()), ("xxx".to_string(), "yyy".to_string()),