pySigma Clickhouse Backend
This is the Clickhouse backend for pySigma. It provides the package sigma.backends.clickhouse with the ClickhouseBackend class.
It supports the following output formats for Sigma rules:
default: plain clickhouse SQL querieclickdetect: rule format for clickdetect
Thanks
To implement this Clickhouse backend I have leanerd a lot of code, and this is my thanks to most helpful to me.
- Thanks for SQLite implementation
- Thanks for the incredible blog post Creating a Sigma Backend for Fun (and no profit)
How To
Converting sigma to clickhouse
from sigma.backends.clickhouse.clickhouse import ClickhouseBackend
from sigma.collection import SigmaCollection
rule = """
title: Run Whoami Showing Privileges
id: 97a80ec7-0e2f-4d05-9ef4-65760e634f6b
status: experimental
description: Detects a whoami.exe executed with the /priv command line flag instructing the tool to show all current user privieleges. This is often used after a privilege escalation attempt.
references:
- https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/whoami
author: Florian Roth
date: 2021/05/05
modified: 2022/05/13
tags:
- attack.privilege_escalation
- attack.discovery
- attack.t1033
logsource:
category: process_creation
product: windows
detection:
selection_img:
- Image|endswith: '\whoami.exe'
- OriginalFileName: 'whoami.exe'
selection_cli:
CommandLine|contains: '/priv'
condition: all of selection*
falsepositives:
- Administrative activity (rare lookups on current privileges)
level: high
"""
backend = ClickhouseBackend()
rule_sigma = SigmaCollection.from_yaml(rule)
print(backend.convert(rule_sigma)[0])
Maintainer
Created an maintaned by souzo
Dev
Setup your dev environment
uv sync
source .venv/bin/activate
Metadata
Release files for pysigma-backend-clickhouse 1.1.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| pysigma_backend_clickhouse-1.1.1.tar.gz | 45.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| pysigma_backend_clickhouse-1.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 56.5 kB
Release files / pysigma_backend_clickhouse-1.1.1.tar.gz
| Download URL | pysigma_backend_clickhouse-1.1.1.tar.gz |
|---|---|
| Size | 45.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
48dc662f63a69ab7202ceccc2ca06b3f3bb5e1039812be3312ba06c3dd2171b5
|
|
BLAKE2b-256 checksum How to use checksums |
b69bac228ccabe57bff6b31cde9f540723bb3efb8933398b79825ee319d54eea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / pysigma_backend_clickhouse-1.1.1-py3-none-any.whl
| Download URL | pysigma_backend_clickhouse-1.1.1-py3-none-any.whl |
|---|---|
| Size | 11.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
aaef75b07f7bce01aef1d6806490ecf39cddf6b1f0e0eb5930c140f54a47ce94
|
|
BLAKE2b-256 checksum How to use checksums |
84e92aed20705e38f6a163fe35c28a70d94f6f394f0fe8f6fbeb9400d5e84223
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.12.3 {"installer":{"name":"uv","version":"0.12.3","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|