Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3f24987

Browse files
authored
Merge pull request#191 from UncoderIO/gis-8503
Gis 8503
2 parents2c82341 +51cdf69 commit3f24987

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
fromapp.translator.platforms.splunk.parsers.splunkimportSplunkQueryParser# noqa: F401
2-
fromapp.translator.platforms.splunk.parsers.splunk_alertimportSplunkAlertParser# noqa: F401
2+
fromapp.translator.platforms.splunk.parsers.splunk_alertimportSplunkAlertParser,SplunkAlertYMLParser# noqa: F401
33
fromapp.translator.platforms.splunk.renders.splunkimportSplunkQueryRender# noqa: F401
44
fromapp.translator.platforms.splunk.renders.splunk_alertimportSplunkAlertRender# noqa: F401
55
fromapp.translator.platforms.splunk.renders.splunk_ctiimportSplunkCTI# noqa: F401

‎uncoder-core/app/translator/platforms/splunk/const.py‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,5 +42,14 @@
4242
**PLATFORM_DETAILS,
4343
}
4444

45+
SPLUNK_ALERT_YML_DETAILS= {
46+
"platform_id":"splunk-spl-rule-yml",
47+
"name":"Splunk Alert YML",
48+
"platform_name":"Alert (SPL) YML",
49+
"first_choice":0,
50+
**PLATFORM_DETAILS,
51+
}
52+
4553
splunk_query_details=PlatformDetails(**SPLUNK_QUERY_DETAILS)
4654
splunk_alert_details=PlatformDetails(**SPLUNK_ALERT_DETAILS)
55+
splunk_alert_yml_details=PlatformDetails(**SPLUNK_ALERT_YML_DETAILS)

‎uncoder-core/app/translator/platforms/splunk/parsers/splunk_alert.py‎

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,11 @@
2020

2121
fromapp.translator.core.custom_types.meta_infoimportSeverityType
2222
fromapp.translator.core.mitreimportMitreConfig
23+
fromapp.translator.core.mixins.ruleimportYamlRuleMixin
2324
fromapp.translator.core.models.platform_detailsimportPlatformDetails
2425
fromapp.translator.core.models.query_containerimportMetaInfoContainer,MitreInfoContainer,RawQueryContainer
2526
fromapp.translator.managersimportparser_manager
26-
fromapp.translator.platforms.splunk.constimportsplunk_alert_details
27+
fromapp.translator.platforms.splunk.constimportsplunk_alert_details,splunk_alert_yml_details
2728
fromapp.translator.platforms.splunk.mappingimportSplunkMappings,splunk_alert_mappings
2829
fromapp.translator.platforms.splunk.parsers.splunkimportSplunkQueryParser
2930

@@ -73,3 +74,45 @@ def parse_raw_query(self, text: str, language: str) -> RawQueryContainer:
7374
mitre_attack=mitre_attack_container,
7475
),
7576
)
77+
78+
79+
@parser_manager.register
80+
classSplunkAlertYMLParser(SplunkQueryParser,YamlRuleMixin):
81+
details:PlatformDetails=splunk_alert_yml_details
82+
mappings:SplunkMappings=splunk_alert_mappings
83+
mitre_config:MitreConfig=MitreConfig()
84+
85+
defparse_raw_query(self,text:str,language:str)->RawQueryContainer:
86+
rule=self.load_rule(text)
87+
mitre_attack_container=self.mitre_config.get_mitre_info(
88+
techniques=rule.get("tags", {}).get("mitre_attack_id", [])
89+
)
90+
description=rule.get("description","")
91+
ifrule.get("how_to_implement",""):
92+
description=f'{description}{rule.get("how_to_implement","")}'
93+
tags=rule.get("tags", {}).get("analytic_story", [])
94+
ifrule.get("type"):
95+
tags.append(rule.get("type"))
96+
false_positives=None
97+
ifrule.get("known_false_positives"):
98+
false_positives= (
99+
rule["known_false_positives"]
100+
ifisinstance(rule["known_false_positives"],list)
101+
else [rule["known_false_positives"]]
102+
)
103+
returnRawQueryContainer(
104+
query=rule.get("search"),
105+
language=language,
106+
meta_info=MetaInfoContainer(
107+
id_=rule.get("id"),
108+
title=rule.get("name"),
109+
date=rule.get("date"),
110+
author=rule.get("author").split(", "),
111+
status=rule.get("status"),
112+
description=description,
113+
false_positives=false_positives,
114+
references=rule.get("references"),
115+
mitre_attack=mitre_attack_container,
116+
tags=tags,
117+
),
118+
)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp