to exclude record from detection target when channel in record is null

This commit is contained in:
DastInDark
2022-10-09 15:15:42 +09:00
parent f740f61279
commit de2161a314

View File

@@ -738,9 +738,9 @@ impl App {
continue;
}
// target_eventids.txtでイベントIDベースでフィルタする。
let data = record_result.as_ref().unwrap().data.clone();
if !self._is_target_event_id(&data)
// channelがnullである場合もしくは、target_eventids.txtでイベントIDベースでフィルタする。
if !self._is_valid_channel(&data) | !self._is_target_event_id(&data)
&& !configs::CONFIG.read().unwrap().args.deep_scan
{
continue;
@@ -829,6 +829,18 @@ impl App {
}
}
/// レコードのチャンネルの値が正しい(Stringの形でありnullでないもの)ことを判定する関数
fn _is_valid_channel(&self, data: &Value) -> bool {
let channel = utils::get_event_value("Event.System.Channel", data);
if channel.is_none() {
return false;
}
match channel.unwrap() {
Value::String(s) => s != "null",
_ => false, // channelの値は文字列を想定しているため、それ以外のデータが来た場合はfalseを返す
}
}
fn evtx_to_jsons(&self, evtx_filepath: PathBuf) -> Option<EvtxParser<File>> {
match EvtxParser::from_path(evtx_filepath) {
Ok(evtx_parser) => {