Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Regex Escaping for EQL #71

Open
WildDogOne opened this issue Aug 10, 2024 · 0 comments
Open

Regex Escaping for EQL #71

WildDogOne opened this issue Aug 10, 2024 · 0 comments

Comments

@WildDogOne
Copy link
Contributor

According to the Elastic documentation since backslash () is also the escaping character for json it needs to be escaped itself.
For example if a Sigma rule is "username|re: '$'" is would have to translate to regex~ "\$"
Or at least that is my understanding of how it should work.

Imho this could mean it would be possible to just do a character replace around here:

re_expression: ClassVar[str] = '{field} regex~ "{regex}"'

re_expression: ClassVar[str] = '{field} regex~ "{regex.replace("\","\\")}"'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant