1
+ # Standard library imports
1
2
import json
2
3
import pathlib
3
4
from datetime import datetime
4
- from typing import Any , Dict , List , Set , TypedDict , Union
5
+ from typing import Any , TypedDict , Union
5
6
7
+ # Third-party imports
6
8
from contentctl .objects .detection import Detection
7
9
8
10
9
11
class TechniqueData (TypedDict ):
10
12
score : int
11
- file_paths : List [str ]
12
- links : List [ Dict [str , str ]]
13
+ file_paths : list [str ]
14
+ links : list [ dict [str , str ]]
13
15
14
16
15
17
class LayerData (TypedDict ):
16
18
name : str
17
- versions : Dict [str , str ]
19
+ versions : dict [str , str ]
18
20
domain : str
19
21
description : str
20
- filters : Dict [str , List [str ]]
22
+ filters : dict [str , list [str ]]
21
23
sorting : int
22
- layout : Dict [str , Union [str , bool ]]
24
+ layout : dict [str , Union [str , bool ]]
23
25
hideDisabled : bool
24
- techniques : List [ Dict [str , Any ]]
25
- gradient : Dict [str , Union [List [str ], int ]]
26
- legendItems : List [ Dict [str , str ]]
26
+ techniques : list [ dict [str , Any ]]
27
+ gradient : dict [str , Union [list [str ], int ]]
28
+ legendItems : list [ dict [str , str ]]
27
29
showTacticRowBackground : bool
28
30
tacticRowBackground : str
29
31
selectTechniquesAcrossTactics : bool
30
32
selectSubtechniquesWithParent : bool
31
33
selectVisibleTechniques : bool
32
- metadata : List [ Dict [str , str ]]
34
+ metadata : list [ dict [str , str ]]
33
35
34
36
35
37
class AttackNavOutput :
@@ -44,16 +46,16 @@ def __init__(
44
46
self .layer_domain = layer_domain
45
47
46
48
def writeObjects (
47
- self , detections : List [Detection ], output_path : pathlib .Path
49
+ self , detections : list [Detection ], output_path : pathlib .Path
48
50
) -> None :
49
51
"""
50
52
Generate MITRE ATT&CK Navigator layer file from detections
51
53
Args:
52
54
detections: List of Detection objects
53
55
output_path: Path to write the layer file
54
56
"""
55
- techniques : Dict [str , TechniqueData ] = {}
56
- tactic_coverage : Dict [str , Set [str ]] = {}
57
+ techniques : dict [str , TechniqueData ] = {}
58
+ tactic_coverage : dict [str , set [str ]] = {}
57
59
58
60
# Process each detection
59
61
for detection in detections :
0 commit comments