Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix compat with pyparsing 3.2 #289

Merged
merged 4 commits into from
Oct 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 15 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,10 @@ pyyaml = "^6.0"
requests = "^2.31"
jinja2 = "^3.1"

[tool.poetry.dev-dependencies]
[tool.poetry.group.dev.dependencies]
black = "^24.4.2"
mypy = "^1.8"
pip = "^24.2"
pre-commit = "^3.5"
pylint = "^3.0"
pytest = "^8.0"
Expand Down
1 change: 0 additions & 1 deletion sigma/conversion/base.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from collections import ChainMap, defaultdict
import re

from pyparsing import Set
from sigma.correlations import (
SigmaCorrelationCondition,
SigmaCorrelationConditionOperator,
Expand Down
1 change: 0 additions & 1 deletion sigma/exceptions.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
from pathlib import Path
from typing import Optional

from pyparsing import List
import sigma


Expand Down
7 changes: 2 additions & 5 deletions tests/test_processing_transformations.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,7 @@
from dataclasses import dataclass
from copy import deepcopy
import inspect
from re import template
import re
from sigma.conditions import ConditionOR, SigmaCondition
from _pytest.fixtures import fixture
import pytest
from sigma.correlations import (
SigmaCorrelationFieldAlias,
Expand Down Expand Up @@ -1543,15 +1540,15 @@ def test_regex_transformation_plain_method(dummy_pipeline):
detection_item = SigmaDetectionItem("field", [], [SigmaString("\\te.st*va?ue")])
transformation = RegexTransformation(method="plain")
transformation.apply_detection_item(detection_item)
assert detection_item.value[0] == SigmaRegularExpression("\\\\te\.st.*va.ue")
assert detection_item.value[0] == SigmaRegularExpression("\\\\te\\.st.*va.ue")


def test_regex_transformation_case_insensitive_bracket_method(dummy_pipeline):
detection_item = SigmaDetectionItem("field", [], [SigmaString("\\tE.sT*val?ue")])
transformation = RegexTransformation(method="ignore_case_brackets")
transformation.apply_detection_item(detection_item)
assert detection_item.value[0] == SigmaRegularExpression(
"\\\\[tT][eE]\.[sS][tT].*[vV][aA][lL].[uU][eE]"
"\\\\[tT][eE]\\.[sS][tT].*[vV][aA][lL].[uU][eE]"
)


Expand Down
4 changes: 2 additions & 2 deletions tests/test_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_strings_escaping_end():


def test_strings_from_str():
assert SigmaString.from_str("test*string\\\\") == SigmaString("test\*string\\\\\\\\")
assert SigmaString.from_str("test*string\\\\") == SigmaString("test\\*string\\\\\\\\")


def test_string_placeholders_single():
Expand Down Expand Up @@ -321,7 +321,7 @@ def test_strings_to_string():


def test_strings_with_plain_wildcards_to_string():
plain_s = "value\*with\?plain*wild?cards"
plain_s = r"value\*with\?plain*wild?cards"
s = SigmaString(plain_s)
assert s.s == (
"value*with?plain",
Expand Down
Loading