Repository navigation
Implement sigma.matching module for runtime event matching - #608
Draft
thomaspatzke with Copilot wants to merge 5 commits into
Draft
thomaspatzke with Copilot wants to merge 5 commits into
thomaspatzke with Copilot wants to merge 5 commits into
Conversation
Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
…namespace, remove .mypy_cache Co-authored-by: thomaspatzke <1845601+thomaspatzke@users.noreply.github.com>
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New module that evaluates parsed log events against Sigma rules (and correlation rules) at runtime, producing
SigmaMatchobjects. No new dependencies — uses only stdlib.Architecture
MatchCompilerwalks the parsed condition tree and emits a Python callable viacompile()/exec()with restricted builtins — all regex patterns and comparison values are bound at init timeSigmaCorrelationRuleMatcherimplements sliding-window correlation for all 8 types (event_count, value_count, temporal, temporal_ordered, value_sum/avg/median/percentile)MessageChannelabstraction (queue-basedInProcessChannel) designed for future ZMQ/network adapter drop-inModule structure (
sigma/matching/)event.py—Event,EventLogSourcedataclassesmatch.py—SigmaMatchresultchannel.py— transport abstractioncompiler.py— detection tree → compiled Python callablerule_matcher.py— per-rule evaluator using precompiled matcherstate.py—SlidingWindowState(time-sorted deques, size + time eviction)correlation_matcher.py— correlation logic with group-by and field alias resolutionmatcher.py—SigmaMatcherorchestrator (context manager, pipeline application, dispatch)Usage