Skip to content

Commit d60d02e

Browse files
committed
EventType value edit
1 parent 893c02d commit d60d02e

File tree

2 files changed

+17
-13
lines changed

2 files changed

+17
-13
lines changed

uncoder-core/app/translator/mappings/platforms/palo_alto_cortex/windows_registry_event.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,4 @@ field_mapping:
2929
ParentLogonId: causality_actor_process_logon_id
3030
ParentProduct: causality_actor_process_signature_product
3131
ParentCompany: causality_actor_process_signature_vendor
32-
EventType: event_sub_type
33-
SetValue: REGISTRY_SET_VALUE
34-
DeleteValue: REGISTRY_DELETE_VALUE
35-
CreateKey: REGISTRY_CREATE_KEY
32+
EventType: event_sub_type

uncoder-core/app/translator/platforms/palo_alto/renders/cortex_xsiam.py

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,8 @@
1616
limitations under the License.
1717
-----------------------------------------------------------------
1818
"""
19-
from typing import Optional, Union
19+
20+
from typing import ClassVar, Optional, Union
2021

2122
from app.translator.const import DEFAULT_VALUE_TYPE
2223
from app.translator.core.custom_types.values import ValueType
@@ -50,6 +51,12 @@ def _get_value_type(field_name: str, value: Union[int, str, StrValue], value_typ
5051

5152
@staticmethod
5253
def _wrap_str_value(value: str) -> str:
54+
if value == 'SetValue':
55+
return f'"REGISTRY_SET_VALUE"'
56+
if value == 'DeleteValue':
57+
return f'"REGISTRY_DELETE_VALUE"'
58+
if value == 'CreateKey':
59+
return f'"REGISTRY_CREATE_KEY"'
5360
return f'"{value}"'
5461

5562
def equal_modifier(self, field: str, value: DEFAULT_VALUE_TYPE) -> str:
@@ -136,12 +143,12 @@ class CortexXQLQueryRender(PlatformQueryRender):
136143
details: PlatformDetails = cortex_xql_query_details
137144
mappings: CortexXQLMappings = cortex_xql_mappings
138145
is_strict_mapping = True
139-
raw_log_field_pattern_map = {
140-
'regex': '| alter {field} = regextract(to_json_string(action_evtlog_data_fields)->{field}{{}}, "\\"(.*)\\"")',
141-
'object': '| alter {field_name} = json_extract_scalar({field_object} , "$.{field_path}")',
142-
'list': '| alter {field_name} = arraystring(json_extract_array({field_object} , "$.{field_path}")," ")'
146+
raw_log_field_pattern_map: ClassVar[dict[str, str]] = {
147+
"regex": '| alter {field} = regextract(to_json_string(action_evtlog_data_fields)->{field}{{}}, "\\"(.*)\\"")',
148+
"object": '| alter {field_name} = json_extract_scalar({field_object} , "$.{field_path}")',
149+
"list": '| alter {field_name} = arraystring(json_extract_array({field_object} , "$.{field_path}")," ")',
143150
}
144-
platform_functions: CortexXQLFunctions = cortex_xql_functions
151+
platform_functions: CortexXQLFunctions = None
145152

146153
or_token = "or"
147154
and_token = "and"
@@ -152,9 +159,9 @@ class CortexXQLQueryRender(PlatformQueryRender):
152159
comment_symbol = "//"
153160
is_single_line_comment = False
154161

155-
def __init__(self):
156-
super().__init__()
157-
self.platform_functions.manager.post_init_configure(self)
162+
def init_platform_functions(self) -> None:
163+
self.platform_functions = cortex_xql_functions
164+
self.platform_functions.platform_query_render = self
158165

159166
def process_raw_log_field(self, field: str, field_type: str) -> Optional[str]:
160167
raw_log_field_pattern = self.raw_log_field_pattern_map.get(field_type)

0 commit comments

Comments
 (0)