chg: update security_rules.json

This commit is contained in:
fukusuket
2025-04-14 08:42:31 +09:00
parent 438af15776
commit 10bbac2097
2 changed files with 26199 additions and 23386 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -11,6 +11,7 @@ use yaml_rust2::{Yaml, YamlLoader};
enum Channel { enum Channel {
Security, Security,
PowerShell, PowerShell,
Other(String),
} }
impl Display for Channel { impl Display for Channel {
@@ -18,6 +19,7 @@ impl Display for Channel {
match self { match self {
Channel::Security => write!(f, "sec"), Channel::Security => write!(f, "sec"),
Channel::PowerShell => write!(f, "pwsh"), Channel::PowerShell => write!(f, "pwsh"),
Channel::Other(name) => write!(f, "{}", name),
} }
} }
} }
@@ -80,7 +82,7 @@ fn contains_builtin_channel(yaml: &Yaml) -> Option<Channel> {
Some("Microsoft-Windows-PowerShell/Operational") Some("Microsoft-Windows-PowerShell/Operational")
| Some("PowerShellCore/Operational") | Some("PowerShellCore/Operational")
| Some("Windows PowerShell") => Some(Channel::PowerShell), | Some("Windows PowerShell") => Some(Channel::PowerShell),
_ => None, val => Some(Channel::Other(val?.to_string())),
} }
} }
@@ -117,6 +119,10 @@ fn contains_builtin_channel(yaml: &Yaml) -> Option<Channel> {
} }
fn parse_yaml(doc: Yaml, eid_subcategory_pair: &Vec<(String, String)>) -> Option<Value> { fn parse_yaml(doc: Yaml, eid_subcategory_pair: &Vec<(String, String)>) -> Option<Value> {
let sysmon_tag = doc["tags"].as_vec().map_or(false, |tags| tags.iter().any(|tag| tag.as_str() == Some("sysmon")));
if sysmon_tag {
return None;
}
if let Some(ch) = contains_builtin_channel(&doc["detection"]) { if let Some(ch) = contains_builtin_channel(&doc["detection"]) {
let uuid = doc["id"].as_str().unwrap_or(""); let uuid = doc["id"].as_str().unwrap_or("");
let title = doc["title"].as_str().unwrap_or(""); let title = doc["title"].as_str().unwrap_or("");