16
16
limitations under the License.
17
17
-----------------------------------------------------------------
18
18
"""
19
-
20
19
import copy
21
20
import json
22
21
from typing import Optional
@@ -50,21 +49,6 @@ class LogRhythmAxonRuleRender(LogRhythmAxonQueryRender):
50
49
or_token = "or"
51
50
field_value_map = LogRhythmAxonRuleFieldValue (or_token = or_token )
52
51
53
- def __create_mitre_threat (self , meta_info : MetaInfoContainer ) -> tuple [list , list ]:
54
- tactics = set ()
55
- techniques = []
56
-
57
- for tactic in meta_info .mitre_attack .get ("tactics" ):
58
- tactics .add (tactic ["tactic" ])
59
-
60
- for technique in meta_info .mitre_attack .get ("techniques" ):
61
- if technique .get ("tactic" ):
62
- for tactic in technique ["tactic" ]:
63
- tactics .add (tactic )
64
- techniques .append (technique ["technique_id" ])
65
-
66
- return sorted (tactics ), sorted (techniques )
67
-
68
52
def finalize_query (
69
53
self ,
70
54
prefix : str ,
@@ -91,11 +75,11 @@ def finalize_query(
91
75
)
92
76
if tactics := meta_info .mitre_attack .get ("tactics" ):
93
77
rule ["observationPipeline" ]["metadataFields" ]["threat.mitre_tactic" ] = ", " .join (
94
- f"{ i ['external_id' ]} :{ i ['tactic' ]} " for i in tactics
78
+ f"{ i ['external_id' ]} :{ i ['tactic' ]} " for i in sorted ( tactics , key = lambda x : x [ "external_id" ])
95
79
)
96
80
if techniques := meta_info .mitre_attack .get ("techniques" ):
97
81
rule ["observationPipeline" ]["metadataFields" ]["threat.mitre_technique" ] = ", " .join (
98
- f"{ i ['technique_id' ]} :{ i ['technique' ]} " for i in techniques
82
+ f"{ i ['technique_id' ]} :{ i ['technique' ]} " for i in sorted ( techniques , key = lambda x : x [ "technique_id" ])
99
83
)
100
84
if meta_info .fields :
101
85
rule ["observationPipeline" ]["pattern" ]["operations" ][0 ]["logObserved" ]["groupByFields" ] = [
0 commit comments