pySigma-backend-sqlite 1.2.0__tar.gz → 1.2.4__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {pysigma_backend_sqlite-1.2.0 → pysigma_backend_sqlite-1.2.4}/PKG-INFO +1 -1
- {pysigma_backend_sqlite-1.2.0 → pysigma_backend_sqlite-1.2.4}/pyproject.toml +1 -1
- {pysigma_backend_sqlite-1.2.0 → pysigma_backend_sqlite-1.2.4}/sigma/backends/sqlite/sqlite.py +17 -1
- {pysigma_backend_sqlite-1.2.0 → pysigma_backend_sqlite-1.2.4}/LICENSE +0 -0
- {pysigma_backend_sqlite-1.2.0 → pysigma_backend_sqlite-1.2.4}/README.md +0 -0
- {pysigma_backend_sqlite-1.2.0 → pysigma_backend_sqlite-1.2.4}/sigma/backends/sqlite/__init__.py +0 -0
{pysigma_backend_sqlite-1.2.0 → pysigma_backend_sqlite-1.2.4}/sigma/backends/sqlite/sqlite.py
RENAMED
|
@@ -13,6 +13,7 @@ from sigma.conditions import (
|
|
|
13
13
|
)
|
|
14
14
|
from sigma.types import (
|
|
15
15
|
SigmaCompareExpression,
|
|
16
|
+
SigmaRegularExpression,
|
|
16
17
|
SigmaString,
|
|
17
18
|
SpecialChars,
|
|
18
19
|
SigmaCIDRExpression,
|
|
@@ -413,6 +414,12 @@ class sqliteBackend(TextQueryBackend):
|
|
|
413
414
|
|
|
414
415
|
search = self.convert_correlation_search(rule)
|
|
415
416
|
|
|
417
|
+
# Correlation search templates hardcode "FROM logs"; honor a "table" state
|
|
418
|
+
# key set by a setState transformation, matching finalize_query_default.
|
|
419
|
+
table = self.last_processing_pipeline.state.get("table")
|
|
420
|
+
if table is not None:
|
|
421
|
+
search = search.replace("FROM logs", f"FROM {table}")
|
|
422
|
+
|
|
416
423
|
# Determine select_fields based on whether GROUP BY is used
|
|
417
424
|
if rule.group_by:
|
|
418
425
|
# When GROUP BY is used, only select the grouped fields
|
|
@@ -477,6 +484,12 @@ class sqliteBackend(TextQueryBackend):
|
|
|
477
484
|
else:
|
|
478
485
|
return converted
|
|
479
486
|
|
|
487
|
+
def convert_value_re(
|
|
488
|
+
self, r: SigmaRegularExpression, state: ConversionState
|
|
489
|
+
) -> str:
|
|
490
|
+
# Doubling single quotes is mandatory: the regex is embedded in a '...' SQL string literal.
|
|
491
|
+
return super().convert_value_re(r, state).replace("'", "''")
|
|
492
|
+
|
|
480
493
|
def convert_condition_field_eq_val_str(
|
|
481
494
|
self, cond: ConditionFieldEqualsValueExpression, state: ConversionState
|
|
482
495
|
) -> Union[str, DeferredQueryExpression]:
|
|
@@ -626,7 +639,10 @@ class sqliteBackend(TextQueryBackend):
|
|
|
626
639
|
# TODO : fields support will be handled with a backend option (all fields by default)
|
|
627
640
|
# fields = "*" if len(rule.fields) == 0 else f"*, {', '.join(rule.fields)}"
|
|
628
641
|
|
|
629
|
-
|
|
642
|
+
# Table name can be overridden per-pipeline via a setState transformation
|
|
643
|
+
# setting the "table" state key, else fall back to the backend default.
|
|
644
|
+
table = state.processing_state.get("table", self.table)
|
|
645
|
+
sqlite_query = f"SELECT * FROM {table} WHERE {query}"
|
|
630
646
|
|
|
631
647
|
return sqlite_query
|
|
632
648
|
|
|
File without changes
|
|
File without changes
|
{pysigma_backend_sqlite-1.2.0 → pysigma_backend_sqlite-1.2.4}/sigma/backends/sqlite/__init__.py
RENAMED
|
File without changes
|