removed full-data option due to can set by profile #165
This commit is contained in:
@@ -69,10 +69,6 @@ pub struct Config {
|
|||||||
#[clap(short = 'f', long, value_name = "FILE_PATH")]
|
#[clap(short = 'f', long, value_name = "FILE_PATH")]
|
||||||
pub filepath: Option<PathBuf>,
|
pub filepath: Option<PathBuf>,
|
||||||
|
|
||||||
/// Print all field information
|
|
||||||
#[clap(short = 'F', long = "full-data")]
|
|
||||||
pub full_data: bool,
|
|
||||||
|
|
||||||
/// Specify a rule directory or file (default: ./rules)
|
/// Specify a rule directory or file (default: ./rules)
|
||||||
#[clap(
|
#[clap(
|
||||||
short = 'r',
|
short = 'r',
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ extern crate csv;
|
|||||||
|
|
||||||
use crate::detections::configs;
|
use crate::detections::configs;
|
||||||
use crate::detections::utils::write_color_buffer;
|
use crate::detections::utils::write_color_buffer;
|
||||||
|
use crate::options::profile::LOAEDED_PROFILE_ALIAS;
|
||||||
use crate::options::profile::PROFILES;
|
use crate::options::profile::PROFILES;
|
||||||
use termcolor::{BufferWriter, Color, ColorChoice};
|
use termcolor::{BufferWriter, Color, ColorChoice};
|
||||||
|
|
||||||
@@ -205,17 +206,6 @@ impl Detection {
|
|||||||
|
|
||||||
/// 条件に合致したレコードを格納するための関数
|
/// 条件に合致したレコードを格納するための関数
|
||||||
fn insert_message(rule: &RuleNode, record_info: &EvtxRecordInfo) {
|
fn insert_message(rule: &RuleNode, record_info: &EvtxRecordInfo) {
|
||||||
let profile_all_alias = if PROFILES.is_some() {
|
|
||||||
PROFILES
|
|
||||||
.as_ref()
|
|
||||||
.unwrap()
|
|
||||||
.values()
|
|
||||||
.cloned()
|
|
||||||
.collect::<Vec<_>>()
|
|
||||||
.join("|")
|
|
||||||
} else {
|
|
||||||
String::default()
|
|
||||||
};
|
|
||||||
let tag_info: Vec<String> = match TAGS_CONFIG.is_empty() {
|
let tag_info: Vec<String> = match TAGS_CONFIG.is_empty() {
|
||||||
false => rule.yaml["tags"]
|
false => rule.yaml["tags"]
|
||||||
.as_vec()
|
.as_vec()
|
||||||
@@ -241,7 +231,7 @@ impl Detection {
|
|||||||
.record_information
|
.record_information
|
||||||
.as_ref()
|
.as_ref()
|
||||||
.map(|recinfo| recinfo.to_string());
|
.map(|recinfo| recinfo.to_string());
|
||||||
let rec_id = if !profile_all_alias.contains("%RecordID%") {
|
let rec_id = if !LOAEDED_PROFILE_ALIAS.contains("%RecordID%") {
|
||||||
Some(
|
Some(
|
||||||
get_serde_number_to_string(&record_info.record["Event"]["System"]["EventRecordID"])
|
get_serde_number_to_string(&record_info.record["Event"]["System"]["EventRecordID"])
|
||||||
.unwrap_or_default(),
|
.unwrap_or_default(),
|
||||||
@@ -261,7 +251,7 @@ impl Detection {
|
|||||||
Some(str) => str.to_owned(),
|
Some(str) => str.to_owned(),
|
||||||
None => recinfo.as_ref().unwrap_or(&"-".to_string()).to_string(),
|
None => recinfo.as_ref().unwrap_or(&"-".to_string()).to_string(),
|
||||||
};
|
};
|
||||||
let opt_record_info = if profile_all_alias.contains("%RecordInformation%") {
|
let opt_record_info = if LOAEDED_PROFILE_ALIAS.contains("%RecordInformation%") {
|
||||||
recinfo
|
recinfo
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
@@ -303,7 +293,7 @@ impl Detection {
|
|||||||
.map(|str| str.to_owned())
|
.map(|str| str.to_owned())
|
||||||
.collect();
|
.collect();
|
||||||
let output = Detection::create_count_output(rule, &agg_result);
|
let output = Detection::create_count_output(rule, &agg_result);
|
||||||
let rec_info = if configs::CONFIG.read().unwrap().args.full_data {
|
let rec_info = if LOAEDED_PROFILE_ALIAS.contains("%RecordInformation%") {
|
||||||
Option::Some(String::default())
|
Option::Some(String::default())
|
||||||
} else {
|
} else {
|
||||||
Option::None
|
Option::None
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ use crate::detections::utils::check_setting_path;
|
|||||||
use crate::yaml;
|
use crate::yaml;
|
||||||
use lazy_static::lazy_static;
|
use lazy_static::lazy_static;
|
||||||
use linked_hash_map::LinkedHashMap;
|
use linked_hash_map::LinkedHashMap;
|
||||||
|
use std::collections::HashSet;
|
||||||
use std::fs::File;
|
use std::fs::File;
|
||||||
use std::io::{BufWriter, Write};
|
use std::io::{BufWriter, Write};
|
||||||
use std::path::Path;
|
use std::path::Path;
|
||||||
@@ -21,6 +22,13 @@ lazy_static! {
|
|||||||
.to_str()
|
.to_str()
|
||||||
.unwrap()
|
.unwrap()
|
||||||
);
|
);
|
||||||
|
pub static ref LOAEDED_PROFILE_ALIAS: HashSet<String> = HashSet::from_iter(
|
||||||
|
PROFILES
|
||||||
|
.as_ref()
|
||||||
|
.unwrap_or(&LinkedHashMap::default())
|
||||||
|
.values()
|
||||||
|
.cloned()
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 指定されたパスのprofileを読み込む処理
|
// 指定されたパスのprofileを読み込む処理
|
||||||
|
|||||||
Reference in New Issue
Block a user