pySigma is a Python library for processing and converting Sigma rules, a generic and open signature format that allows security analysts to describe relevant log events in a structured way. It serves as the core engine for Sigma rule management and transformation into various SIEM or EDR query languages. The current version is 1.3.2, with minor releases and bug fixes occurring frequently.
pip install pysigmaVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to load Sigma rules from a local directory, initialize a generic Sigma detection backend, and convert the rules into a textual representation suitable for a SIEM/EDR system. To convert to specific SIEM formats (e.g., Splunk, Elasticsearch), you need to install the corresponding `pysigma-plugin-<backend>` package and import the specific backend class.
Review the official 'Breaking Changes' documentation for pySigma v1.0.0 on GitHub. Update import paths and API calls to align with the new structure. Specifically, use `from pysigma import PySigmaCollection` and refer to updated backend initialization patterns.
Upgrade to pySigma v1.3.0 or later. Exercise extreme caution when using custom template variables and processing pipelines from untrusted sources, as they may contain malicious code. Only use pipelines from trusted origins.
Upgrade to pySigma v1.3.2 or later to benefit from deferred MITRE data loading, which resolves offline environment issues. If unable to upgrade, ensure internet connectivity for initial tag validation or disable MITRE tag validation if not critical.
For custom plugins, ensure their packaging metadata explicitly declares compatibility with `pysigma` using `pysigma_compatibility` to avoid unexpected compatibility errors when `pysigma` performs its checks. Consult plugin development guidelines for details.