Skip to content

Commit

Permalink
refactor(MAPEX-203): use unmapped to refer to techniques instead of n…
Browse files Browse the repository at this point in the history
…on-mappable
  • Loading branch information
allisonrobbins committed Jul 31, 2024
1 parent bcf48ee commit 0d2637f
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/mappings_explorer/site_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -1227,7 +1227,7 @@ def parse_techniques(
return techniques


def parse_non_mappable_techniques(attack_data: dict, techniques: list):
def parse_unmapped_techniques(attack_data: dict, techniques: list):
"""Create a list of non-mappable objects for all ATT&CK techniques in each version
Adds all technique objects that do not have mappings associated with them
Args:
Expand All @@ -1237,16 +1237,16 @@ def parse_non_mappable_techniques(attack_data: dict, techniques: list):
Returns:
List of technique objects
"""
non_mappables = []
unmapped = []
for technique in attack_data:
if technique["id"] not in [t.id for t in techniques]:
if technique.get("id")[:2] != "TA":
t = Technique()
t.id = technique["id"]
t.label = technique["name"]
t.description = technique["description"]
non_mappables.append(t)
return non_mappables
unmapped.append(t)
return unmapped


def parse_tactics(
Expand Down Expand Up @@ -1322,7 +1322,7 @@ def build_attack_pages(projects: list, url_prefix: str, breadcrumbs: list):
for attack_domain in list(attack_domains.keys()):
all_techniques = []
all_tactics = []
non_mappables = []
unmapped = []
for attack_version in attack_domains[attack_domain]:
logger.info(
f"Creating pages for ATT&CK {attack_version} {attack_domain}..."
Expand All @@ -1343,7 +1343,7 @@ def build_attack_pages(projects: list, url_prefix: str, breadcrumbs: list):
)
# non_mappable attack technique tables not currently shown
# in the website. Waiting for better solution to be worked out
non_mappables = parse_non_mappable_techniques(
unmapped = parse_unmapped_techniques(
attack_data=attack_data,
techniques=all_techniques,
)
Expand All @@ -1362,10 +1362,10 @@ def build_attack_pages(projects: list, url_prefix: str, breadcrumbs: list):
techniques=all_techniques,
tactics=all_tactics,
breadcrumbs=breadcrumbs,
non_mappables=non_mappables,
non_mappables=unmapped,
)
# Build technique pages that don't have mappings to fix any linking errors
for technique in non_mappables:
for technique in unmapped:
external_dir = (
PUBLIC_DIR
/ "attack"
Expand Down

0 comments on commit 0d2637f

Please sign in to comment.