Skip to content

Commit 04b02c2

Browse files
committed
Merge branch 'develop'
2 parents 7f4f377 + d1a9b21 commit 04b02c2

3 files changed

Lines changed: 21 additions & 8 deletions

File tree

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,8 @@
1+
# v1.4.6 - 3/25/2022
2+
## Improvements
3+
- Improved efficency of Excel generation capability
4+
5+
16
# v1.4.5 3/9/2022
27
## Fixes
38
- Patched core layer code to properly store 8-hex colors

mitreattack/attackToExcel/stixToDf.py

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import copy
22

33
import pandas as pd
4-
from stix2 import Filter
4+
from stix2 import Filter, MemoryStore
55
from itertools import chain
66
from tqdm import tqdm
77
import datetime
@@ -112,13 +112,17 @@ def techniquesToDf(src, domain):
112112
techniques = remove_revoked_deprecated(techniques)
113113
technique_rows = []
114114

115+
all_sub_techniques = src.query([
116+
Filter("type", "=", "relationship"),
117+
Filter("relationship_type", "=", "subtechnique-of"),
118+
])
119+
all_sub_techniques = MemoryStore(stix_data=all_sub_techniques)
120+
115121
for technique in tqdm(techniques, desc="parsing techniques"):
116122
# get parent technique if sub-technique
117123
subtechnique = "x_mitre_is_subtechnique" in technique and technique["x_mitre_is_subtechnique"]
118124
if subtechnique:
119-
subtechnique_of = src.query([
120-
Filter("type", "=", "relationship"),
121-
Filter("relationship_type", "=", "subtechnique-of"),
125+
subtechnique_of = all_sub_techniques.query([
122126
Filter("source_ref", "=", technique["id"])
123127
])[0]
124128
parent = src.get(subtechnique_of["target_ref"])
@@ -461,12 +465,16 @@ def build_technique_and_sub_columns(src, techniques, columns, merge_data_handle,
461465
techniques_column = []
462466
subtechniques_column = []
463467

468+
all_sub_techniques = src.query([
469+
Filter("type", "=", "relationship"),
470+
Filter("relationship_type", "=", "subtechnique-of"),
471+
])
472+
all_sub_techniques = MemoryStore(stix_data=all_sub_techniques)
473+
464474
for technique in techniques:
465475
techniques_column.append(technique["name"])
466476
# sub-technique relationships
467-
subtechnique_ofs = src.query([
468-
Filter("type", "=", "relationship"),
469-
Filter("relationship_type", "=", "subtechnique-of"),
477+
subtechnique_ofs = all_sub_techniques.query([
470478
Filter("target_ref", "=", technique["id"])
471479
])
472480
if len(subtechnique_ofs) > 0: # if there are sub-techniques on the tactic

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
setuptools.setup(
77
name="mitreattack-python",
8-
version="1.4.5",
8+
version="1.4.6",
99
author="MITRE ATT&CK, MITRE Corporation",
1010
author_email="attack@mitre.org",
1111
description="MITRE ATT&CK python library",

0 commit comments

Comments
 (0)