JCreatesGH/sigma-translate

GitHub: JCreatesGH/sigma-translate

将 Sigma 检测规则一次性编译为 Splunk SPL、Microsoft KQL 和 Dynatrace DQL,解决跨 SIEM 平台规则重复编写的问题。

Stars: 0 | Forks: 0

# sigma-translate [![CI](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/f4b32be6d6231551.svg)](https://github.com/JCreatesGH/sigma-translate/actions) [![Python](https://img.shields.io/badge/python-3.8%2B-blue)](https://www.python.org/) [![License: MIT](https://img.shields.io/badge/license-MIT-green)](LICENSE) 只需在 [Sigma](https://github.com/SigmaHQ/sigma) 中编写一次检测,即可在每个平台上运行。`sigma-translate` 可将 Sigma 规则的检测逻辑编译为 **Splunk SPL**、**Microsoft KQL**(Sentinel/Defender)以及 **Dynatrace DQL**。 ![截图](https://static.pigsec.cn/wp-content/uploads/repos/2026/06/549a27a4d7231558.png) ## 安装 ``` pip install sigmatrans ``` ## 使用方法 ``` from sigmatrans import load_rule, translate rule = load_rule(open("rule.yml").read()) print(translate(rule, "spl")) # Splunk print(translate(rule, "kql")) # Microsoft Sentinel / Defender print(translate(rule, "dql")) # Dynatrace ``` ## 支持的 Sigma 语义 - **字段修饰符** — `contains`、`startswith`、`endswith`、`re`,已映射至各后端的特定语法(SPL 中为 `field="*x*"`,KQL 中为 `field contains "x"`,DQL 中为 `contains(field,"x")`)。 - **值列表** → OR;**映射选择** → AND;**列表选择** → OR。 - **条件** — `and` / `or` / `not`,具名选择引用,以及 `1 of sel_*` / `all of sel_*` 限定符。 ``` detection: selection: Image|endswith: '\powershell.exe' CommandLine|contains: ['DownloadString', 'Invoke-WebRequest'] filter: User: 'SYSTEM' condition: selection and not filter ``` → `search (Image="*\powershell.exe" AND (CommandLine="*DownloadString*" OR …)) AND NOT (User="SYSTEM")` ## 开发 ``` python -m pytest -q # 6 tests ``` ## 许可证 MIT
标签:KQL, Python, Sigma规则, 无后门, 查询语言转换, 目标导入, 逆向工具