alexott/pySigma-backend-databricks
GitHub: alexott/pySigma-backend-databricks
pySigma 的 Databricks 后端插件,用于将 Sigma 检测规则转换为 Databricks/Spark SQL 查询语句。
Stars: 2 | Forks: 1



状态:**实验性**,正在进行中:
* 虽然 `cidrmatch` 已生成,但你仍需提供相应的函数作为 UDF(稍后我会添加示例)
* 需要更多测试
# pySigma Databricks Backend
这是 pySigma 的 Databricks backend。它提供了包含 `DatabricksBackend` 类的 `sigma.backends.databricks` 包。
此外,它在 `sigma.pipelines.databricks` 中包含以下处理管道:
* `snake_case`:将列名转换为 snake case 格式
它支持以下输出格式:
* default:普通的 Databricks/Apache Spark SQL 查询
* dbsql:Databricks SQL 查询,其中规则元数据(标题、状态)作为注释嵌入
* detection_yaml:用于我自己的检测框架的 Yaml 标记
## Unbound Keyword 搜索
该 backend 支持带有 unbound keywords(没有字段名的值)的 Sigma 规则。这些关键字搜索原始日志行。
### Configuration
默认情况下,backend 在名为 `raw` 的字段中查找关键字。你可以对此进行自定义:
**Command Line:**
```
sigma convert -t databricks -O raw_log_field=message rule.yml
```
**Programmatic:**
```
from sigma.backends.databricks import DatabricksBackend
backend = DatabricksBackend(raw_log_field="event_data")
```
### Examples
**Simple Keywords (OR logic):**
```
detection:
keywords:
- 'EVILSERVICE'
- 'svchost.exe -n evil'
condition: keywords
```
生成:`contains(lower(raw), lower('EVILSERVICE')) OR contains(lower(raw), lower('svchost.exe -n evil'))`
**Keywords with |all (AND logic):**
```
detection:
keywords:
'|all':
- 'Remove-MailboxExportRequest'
- ' -Identity '
condition: keywords
```
生成:`contains(lower(raw), lower('Remove-MailboxExportRequest')) AND contains(lower(raw), lower(' -Identity '))`
**Mixed with Field Conditions:**
```
detection:
selection:
EventID: 4688
keywords:
- 'mimikatz'
condition: selection and keywords
```
生成:`EventID = 4688 AND contains(lower(raw), lower('mimikatz'))`
**Wildcards in Keywords:**
```
detection:
keywords:
- '*malware*' # uses contains()
- 'cmd.exe*' # uses startswith()
- '*.dll' # uses endswith()
condition: keywords
```
**Regex Patterns:**
```
detection:
keywords:
- '|re': '.*evil(cmd|powershell).*'
condition: keywords
```
生成:`raw rlike '.*evil(cmd|powershell).*'`
## Maintainer
此 backend 目前由以下人员维护:
* [Alex Ott](https://github.com/alexott/)
标签:AMSI绕过, Apache Spark, Databricks, EDR, Kusto, pySigma, Python, Sigma Rule, Splunk替代, SQL, 后端转换, 大数据安全, 威胁检测, 安全运营, 扫描框架, 无后门, 查询生成, 系统审计, 网络安全, 脆弱性评估, 规则转换, 逆向工具, 隐私保护