-
Notifications
You must be signed in to change notification settings - Fork 166
Expand file tree
/
Copy pathgenerate_excel_files.py
More file actions
34 lines (28 loc) · 1.08 KB
/
generate_excel_files.py
File metadata and controls
34 lines (28 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
from mitreattack.attackToExcel import attackToExcel
from stix2 import MemoryStore
import os
def main():
# List of domains and version to process
domains = ["enterprise-attack", "mobile-attack", "ics-attack"]
output_dir = "output/"
# Path to the STIX bundles for each domain (assumes STIX files are downloaded)
stix_base_dir = os.environ.get("STIX_BASE_DIR", "attack-releases/stix-2.0/v18.0")
stix_files = {
"enterprise-attack": os.path.join(stix_base_dir, "enterprise-attack.json"),
"mobile-attack": os.path.join(stix_base_dir, "mobile-attack.json"),
"ics-attack": os.path.join(stix_base_dir, "ics-attack.json"),
}
for domain in domains:
stix_file = stix_files[domain]
print(f"Exporting {domain} to Excel...")
# Load STIX data into MemoryStore
mem_store = MemoryStore()
mem_store.load_from_file(stix_file)
# Export to Excel
attackToExcel.export(
domain=domain,
output_dir=output_dir,
mem_store=mem_store,
)
if __name__ == "__main__":
main()