Skip to content

Commit 431ab54

Browse files
Malutthiasppcad
andauthored
Dev autoruletester refactoring (#594)
* Refactored: custom tests, presentation overview and dry vios * Small fix in init * Optimized refactoring to delete rule count bug and neglect on wrong rule filter * fixed bug: wrong handling if not the end test for group of tests for certain multirule index fails * tests are now successfull and partially adapted to new logic * Review ppcad done (Part 1) * Processed ppcads review * Added additional example tests for new target_rule_idx enforcing * Changed doc strings where still default * Solved last naming issues stated in review * Rewritten lass color prints, fixed error message to simple print when no target_rule_idx and deleted unused imports * Fixed diff print for each rule * Fixed index out of bounds when printing out problems * Fixed the last fix causing out of bounds and added colored diff * Add missing requirement * Refactor auto rule tester * refactored to linter score 9.81/10 * fixed black * fixed black * fixed black * fixed black * fixed black * fixed black * Improve code quality in auto rule tester --------- Co-authored-by: Piotr Pauksztelo <[email protected]>
1 parent 53d702f commit 431ab54

File tree

12 files changed

+652
-405
lines changed

12 files changed

+652
-405
lines changed
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
filter: "test_label: execute"
1+
filter: 'winlog.event_data.param2: "stop"'
22
labeler:
3-
id: labeler-1352bc0a-53ae-4740-bb9e-1e865f63375f
43
label:
54
action:
6-
- execute
5+
- terminate
76
description: "..."
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
1-
filter: "test_pre_detector"
1+
filter: 'tags: "1" AND inp.message: "1"'
22
pre_detector:
3-
id: RULE_ONE_ID
3+
id: RULE_ONE_ID_1
44
title: RULE_ONE
55
severity: critical
66
mitre:
77
- attack.test1
8-
- attack.test2
98
case_condition: directly
10-
description: "..."
9+

logprep/abc/processor.py

-3
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,6 @@ class Config(Component.Config):
120120

121121
__slots__ = [
122122
"rule_class",
123-
"has_custom_tests",
124123
"_event",
125124
"_specific_tree",
126125
"_generic_tree",
@@ -130,7 +129,6 @@ class Config(Component.Config):
130129
]
131130

132131
rule_class: "Rule"
133-
has_custom_tests: bool
134132
_event: dict
135133
_specific_tree: RuleTree
136134
_generic_tree: RuleTree
@@ -155,7 +153,6 @@ def __init__(self, name: str, configuration: "Processor.Config"):
155153
generic_rules_targets=self._config.generic_rules,
156154
specific_rules_targets=self._config.specific_rules,
157155
)
158-
self.has_custom_tests = False
159156
self.result = None
160157
self._bypass_rule_tree = False
161158
if os.environ.get("LOGPREP_BYPASS_RULE_TREE"):

logprep/processor/clusterer/processor.py

-1
Original file line numberDiff line numberDiff line change
@@ -75,7 +75,6 @@ class Config(Processor.Config):
7575
def __init__(self, name: str, configuration: Processor.Config):
7676
super().__init__(name=name, configuration=configuration)
7777
self.sps = SignaturePhaseStreaming()
78-
self.has_custom_tests = True
7978

8079
self._last_rule_id = math.inf
8180
self._last_non_extracted_signature = None

0 commit comments

Comments
 (0)