1616limitations under the License.
1717-----------------------------------------------------------------
1818"""
19- from typing import Optional , Union
19+
20+ from typing import ClassVar , Optional , Union
2021
2122from app .translator .const import DEFAULT_VALUE_TYPE
2223from 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