diff --git a/src/afterfact.rs b/src/afterfact.rs index c251fe13..703e8fb8 100644 --- a/src/afterfact.rs +++ b/src/afterfact.rs @@ -848,19 +848,26 @@ fn output_json_str( tmp = String::default(); } } - } else if output_value_fmt.contains("%MitreTags%") || output_value_fmt.contains("%MitreTactics%") || output_value_fmt.contains("%OtherTags%") { + } else if output_value_fmt.contains("%MitreTags%") + || output_value_fmt.contains("%MitreTactics%") + || output_value_fmt.contains("%OtherTags%") + { println!("k dbg | {} | v dbg | {:?}", k, v); let tmp_val: Vec<&str> = v.split(": ").collect(); - println!("tmp_val dbg | {:?} | len dbg | {:?}", tmp_val, tmp_val.len()); + println!( + "tmp_val dbg | {:?} | len dbg | {:?}", + tmp_val, + tmp_val.len() + ); let key = _convert_valid_json_str(&[k.as_str()]); let values = &tmp_val; - let mut value:Vec = vec![]; - let mut valid_data_cnt =0; + let mut value: Vec = vec![]; + let mut valid_data_cnt = 0; if tmp_val.is_empty() { value.push("[]".to_string()); - } + } for (idx, tag_val) in values.iter().enumerate() { if idx == 0 { value.push("[".to_string()); @@ -870,19 +877,24 @@ fn output_json_str( } let insert_val = format!(" \"{}\"", tag_val.trim()); value.push(insert_val); - if idx != values.len() - 1 { + if idx != values.len() - 1 { value.push(",\n".to_string()); } valid_data_cnt += 1; } if valid_data_cnt > 0 { value.push(" ]".to_string()); - } else { + } else { value.push("]".to_string()); } let fmted_val = value.join(""); - target.push(_create_json_output_format(&key, &fmted_val, key.starts_with('\"'), true)); + target.push(_create_json_output_format( + &key, + &fmted_val, + key.starts_with('\"'), + true, + )); } } target.join(",\n") diff --git a/src/detections/configs.rs b/src/detections/configs.rs index f3d1a5e3..cbd7c412 100644 --- a/src/detections/configs.rs +++ b/src/detections/configs.rs @@ -224,7 +224,6 @@ pub struct Config { #[clap(help_heading = Some("OTHER-ACTIONS"), long = "set-default-profile", value_name = "PROFILE")] pub set_default_profile: Option, - /// Save the timeline in JSON format (ex: -j -o results.json) #[clap(help_heading = Some("OUTPUT"), short = 'j', long = "json", requires = "output")] pub json_timeline: bool,