diff --git a/src/mappings_explorer/site_builder.py b/src/mappings_explorer/site_builder.py index 76003144..df72642a 100644 --- a/src/mappings_explorer/site_builder.py +++ b/src/mappings_explorer/site_builder.py @@ -1364,7 +1364,25 @@ def build_attack_pages(projects: list, url_prefix: str, breadcrumbs: list): breadcrumbs=breadcrumbs, non_mappables=non_mappables, ) + # Build technique pages that don't have mappings to fix any linking errors + for technique in non_mappables: + external_dir = ( + PUBLIC_DIR + / "attack" + / ("attack-" + attack_version) + / ("domain-" + attack_domain.lower()) + / "techniques" + ) + if technique.id: + build_technique_page( + url_prefix=url_prefix, + parent_dir=external_dir, + attack_version=attack_version, + attack_domain=attack_domain, + technique=technique, + breadcrumbs=breadcrumbs, + ) for technique in all_techniques: external_dir = ( PUBLIC_DIR diff --git a/src/mappings_explorer/templates/macros.html.j2 b/src/mappings_explorer/templates/macros.html.j2 index 100ecf90..e8bfcb64 100644 --- a/src/mappings_explorer/templates/macros.html.j2 +++ b/src/mappings_explorer/templates/macros.html.j2 @@ -5,7 +5,7 @@ {% endmacro %} -{% macro table(headers, mappings, url_prefix, table_max_count, full_link, full_size) %} +{% macro table(headers, mappings, url_prefix, table_max_count, full_link, full_size, attack_version, attack_domain, previous_link) %}
{% if mappings | length > table_max_count %}

@@ -29,21 +29,30 @@ - {%- for mapping in mappings[:table_max_count] %} - - {% for header in headers -%} - {%- if header[2] and header[3] -%} - {{mapping[header[0]]}} - {% endif -%} - {%- if header[2] and not header[3] -%} - {{mapping[header[0]]}} - {% endif -%} - {%- if not header[2] -%} - {{mapping[header[0]]}} - {% endif -%} - {% endfor -%} - - {% endfor -%} + {% if mappings | length > 0 %} + {%- for mapping in mappings[:table_max_count] %} + + {% for header in headers -%} + {%- if header[2] and header[3] -%} + {{mapping[header[0]]}} + {% endif -%} + {%- if header[2] and not header[3] -%} + {{mapping[header[0]]}} + {% endif -%} + {%- if not header[2] -%} + {{mapping[header[0]]}} + {% endif -%} + {% endfor -%} + + {% endfor -%} + {% else %} + + + No mappings found for this technique in ATT&CK {{attack_domain}} version {{attack_version}}. Change versions + of ATT&CK or check out a different technique with Matrix View. + + + {% endif%}