Hi @anurag.q.singh
This is likely as you haven't escaped the backslash in the last EventID call in brackets. Please see if the below works:
.*Windows.*<EventID>\\b(4624|4625)\\b<\\/EventID>.*
Kind Regards,
Ayman
Hi @anurag.q.singh
This is likely as you haven't escaped the backslash in the last EventID call in brackets. Please see if the below works:
.*Windows.*<EventID>\\b(4624|4625)\\b<\\/EventID>.*
Kind Regards,
Ayman
$cap = re.capture($var, .*Windows.*<EventID>\\b(4624|4623)\\b<\\/EventID>.*)
Error :
tokenizing: regex not terminated: /EventID>.*)
$cap = re.capture($var, .*Windows.*<EventID>\\b(4624|4623)\\b<\\/EventID>.*)
Error :
tokenizing: regex not terminated: /EventID>.*)
Hi @anurag.q.singh,
The below should work - essentially within a 're.capture'[1] (the function you're using) you can't pass a variable to the first argument. Secondly, the way you were initiating the regex pattern was incorrect, as there was no " or ", or / or / like the below. Hope this helps!
rule Regex_Example {
meta:
author = "Ayman C"
description = "Regex example"
events:
// $event.metadata.product_event_type = "1"
// $event.metadata.description = "4688"
$event.metadata.event_type = "PROCESS_LAUNCH"
$event.target.process.command_line = $Commandline
$capture = re.capture($event.target.process.command_line, /.*Windows.*<EventID>\\b(4624|4623)\\b<\\/EventID>.*/)
condition:
$event
}

[1] -
Kind Regards,
Ayman C