Skip to content

Commit

Permalink
Fixed transformation tests and issues
Browse files Browse the repository at this point in the history
  • Loading branch information
thomaspatzke committed Oct 25, 2024
1 parent bbee6f6 commit 039de54
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 44 deletions.
4 changes: 2 additions & 2 deletions sigma/processing/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
from sigma.correlations import SigmaCorrelationRule
from sigma.processing.finalization import Finalizer, finalizers
from sigma.processing.tracking import FieldMappingTracking
from sigma.processing import transformations
from sigma.processing.transformations import transformations
from sigma.rule import SigmaDetectionItem, SigmaRule
from sigma.processing.transformations import Transformation
from sigma.processing.transformations.base import Transformation
from sigma.processing.postprocessing import query_postprocessing_transformations
from sigma.processing.conditions import (
rule_conditions,
Expand Down
10 changes: 6 additions & 4 deletions tests/test_processing_pipeline.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import pytest
from dataclasses import dataclass
import re
from textwrap import dedent
from sigma.processing.finalization import ConcatenateQueriesFinalizer, JSONFinalizer
from sigma.processing.pipeline import ProcessingPipeline, ProcessingItem, QueryPostprocessingItem
from sigma.processing.pipeline import (
ProcessingPipeline,
ProcessingItem,
QueryPostprocessingItem,
)
from sigma.processing.transformations import transformations
from sigma.processing.conditions import (
DetectionItemProcessingItemAppliedCondition,
IncludeFieldCondition,
Expand All @@ -22,7 +25,6 @@
AddFieldnamePrefixTransformation,
FieldFunctionTransformation,
)
from sigma.processing import transformations
from sigma.rule import SigmaRule, SigmaDetectionItem
from sigma.exceptions import SigmaConfigurationError, SigmaTypeError
from sigma.types import SigmaString
Expand Down
76 changes: 38 additions & 38 deletions tests/test_processing_transformations.py
Original file line number Diff line number Diff line change
@@ -1,54 +1,61 @@
from dataclasses import dataclass
from copy import deepcopy
import inspect
from sigma.conditions import ConditionOR, SigmaCondition
from copy import deepcopy
from dataclasses import dataclass

import pytest

import sigma.processing.transformations as transformations_module
from sigma.conditions import ConditionOR, SigmaCondition
from sigma.correlations import (
SigmaCorrelationFieldAlias,
SigmaCorrelationFieldAliases,
SigmaCorrelationRule,
SigmaRuleReference,
)
from sigma.processing.transformations import (
AddFieldTransformation,
ConvertTypeTransformation,
NestedProcessingTransformation,
RemoveFieldTransformation,
SetCustomAttributeTransformation,
SetFieldTransformation,
SetValueTransformation,
from sigma.exceptions import (
SigmaConfigurationError,
SigmaRegularExpressionError,
SigmaTransformationError,
SigmaValueError,
)
import sigma.processing.transformations as transformations_module
from sigma.modifiers import SigmaExpandModifier
from sigma.processing.conditions import (
FieldNameProcessingItemAppliedCondition,
IncludeFieldCondition,
RuleContainsDetectionItemCondition,
RuleProcessingItemAppliedCondition,
)
from sigma.processing.pipeline import ProcessingItem, ProcessingPipeline
from sigma.processing.transformations import (
AddConditionTransformation,
RegexTransformation,
AddFieldnamePrefixTransformation,
AddFieldnameSuffixTransformation,
AddFieldTransformation,
ChangeLogsourceTransformation,
ConditionTransformation,
ConvertTypeTransformation,
DetectionItemFailureTransformation,
DropDetectionItemTransformation,
MapStringTransformation,
RuleFailureTransformation,
FieldMappingTransformation,
FieldPrefixMappingTransformation,
AddFieldnameSuffixTransformation,
AddFieldnamePrefixTransformation,
HashesFieldsDetectionItemTransformation,
MapStringTransformation,
NestedProcessingTransformation,
QueryExpressionPlaceholderTransformation,
RegexTransformation,
RemoveFieldTransformation,
ReplaceStringTransformation,
RuleFailureTransformation,
SetCustomAttributeTransformation,
SetFieldTransformation,
SetStateTransformation,
SetValueTransformation,
Transformation,
WildcardPlaceholderTransformation,
ValueListPlaceholderTransformation,
QueryExpressionPlaceholderTransformation,
ReplaceStringTransformation,
HashesFieldsDetectionItemTransformation,
)
from sigma.processing.pipeline import ProcessingPipeline, ProcessingItem
from sigma.processing.conditions import (
FieldNameProcessingItemAppliedCondition,
IncludeFieldCondition,
RuleContainsDetectionItemCondition,
RuleProcessingItemAppliedCondition,
WildcardPlaceholderTransformation,
transformations,
)
from sigma.processing import transformations
from sigma.rule import SigmaLogSource, SigmaRule, SigmaDetection, SigmaDetectionItem
from sigma.processing.transformations.base import ConditionTransformation
from sigma.rule import SigmaDetection, SigmaDetectionItem, SigmaLogSource, SigmaRule
from sigma.types import (
Placeholder,
SigmaBool,
Expand All @@ -60,13 +67,6 @@
SigmaString,
SpecialChars,
)
from sigma.modifiers import SigmaExpandModifier
from sigma.exceptions import (
SigmaConfigurationError,
SigmaRegularExpressionError,
SigmaTransformationError,
SigmaValueError,
)
from tests.test_processing_pipeline import (
RuleConditionFalse,
RuleConditionTrue,
Expand Down

0 comments on commit 039de54

Please sign in to comment.