Skip to main content

attack-mapper 🎯

CI ATT&CK dataset PyPI License: MIT

Map your Sigma detection rules onto the MITRE ATT&CK matrix and find your coverage gaps — fast, offline, and CI-friendly.

Part of a detection-engineering toolkit that pairs perfectly with a Detection-as-Code pipeline (Sigma → CI → SIEM). It answers the question every blue team eventually asks: "Which ATT&CK techniques do my rules actually cover, and where are the blind spots?"

Features

  • 🔍 Extracts ATT&CK technique IDs from Sigma rules via:
    • canonical attack.<id> tags,
    • raw T1059 tags,
    • attack.mitre.org/techniques/... URLs in references:.
  • 📊 Per-tactic coverage bars + overall coverage ratio in the terminal.
  • 🎨 Four HTML styles to show off your coverage:
    • matrix (default) — tactic cards with technique chips,
    • rows — compact tactic progress bars,
    • heat — dense heatmap of every technique,
    • report — print-ready dossier with canonical vertical ATT&CK columns and sub-techniques nested under their parents (PDF it for audits/portfolio).
  • 🟢 Covered techniques (incl. parent techniques of covered sub-techniques) render green; gaps render red; explicitly ignored ones render grey.
  • 🔎 Scope filters — --include and --ignore narrow the analysis to the techniques/tactics you care about (or exclude the ones you don't). The active scope is shown in the report so readers know what was filtered.
  • 🏅 Portfolio badge (--badge) — a shields.io-style SVG coverage badge.
  • 🧾 JSON summary (--json) — machine-readable output for dashboards/CI.
  • 🧭 ATT&CK Navigator export — every HTML report embeds an "Export layer" button that downloads a ready-to-import Navigator layer.
  • 🧱 Uses the real MITRE ATT&CK enterprise dataset (v19 structure: Stealth + Defense Impairment). Revoked/deprecated techniques are filtered out so the coverage denominator matches the official matrix (15 tactics, 222 techniques, 475 sub-techniques). Shipped as a compact JSON, no network needed at runtime.
  • ✅ Pure Python stdlib + pyyaml; tiny dependency footprint.
  • 🤖 Non-zero exit when nothing maps → use it as a CI gate in your detection repo.

Screenshots

report (print-ready dossier) matrix (cards)
report style matrix style

Install

pip install attack-mapper

For development:

python -m venv .venv && source .venv/bin/activate
pip install -e ".[dev]"
pytest

Usage

# Map a folder of Sigma rules, print the terminal report, emit HTML (matrix)
attack-mapper rules/ --html sample/coverage_matrix.html

# Try the other HTML styles
attack-mapper rules/ --html sample/coverage_rows.html  --style rows
attack-mapper rules/ --html sample/coverage_heat.html  --style heat
attack-mapper rules/ --html sample/coverage_report.html --style report

# Scope the analysis: only Execution + T1053, ignore Reconnaissance
attack-mapper rules/ --include T1059 TA0002 --ignore Reconnaissance

# Portfolio artifacts: badge + JSON
attack-mapper rules/ --badge sample/coverage_badge.svg --json sample/coverage.json

Run against the bundled sample rules:

attack-mapper rules/ --html sample/coverage_matrix.html --badge sample/coverage_badge.svg

Why not sigma2attack or DeTT&CT?

Both are excellent and you should know they exist. sigma2attack (from the Sigma tooling) converts Sigma rules into an ATT&CK Navigator heatmap layer — if all you need is a layer file, it does the job. DeTT&CT is the heavyweight: it scores data-source visibility as well as detection coverage, and is the right tool for a mature SOC doing formal capability assessments.

attack-mapper sits in between, optimized for Detection-as-Code pipelines: it runs offline with a bundled dataset, produces self-contained HTML reports you can email or print (plus the Navigator layer, a badge, and JSON), gates CI with its exit code, and supports scope filters for counting only the techniques relevant to your environment. It is also ATT&CK v19-native (Stealth + Defense Impairment) with a scheduled workflow that flags future MITRE updates automatically.

How it works

Sigma rules ──▶ sigma_parser ──▶ technique IDs
                                    │
ATT&CK DB  ──▶ attack_loader       │
                                    ▼
            coverage.build_report (with --include/--ignore) ──▶ CoverageReport
                                    │
            renderers (terminal / HTML matrix|rows|heat)
            plugins  (badge SVG / JSON)

Scope filters

--include and --ignore accept technique IDs (e.g. T1059), sub-technique prefixes (e.g. T1059 also covers T1059.001), tactic shortnames (e.g. execution) or tactic IDs (e.g. TA0002). A covered technique is always recorded as covered even if it falls outside an --include scope, but only in-scope covered techniques count toward the coverage ratio (both numerator and denominator are scoped).

Updating the ATT&CK dataset

The shipped attack_mapper/data/attack_db.json is a snapshot (regenerated automatically by a monthly GitHub Action that fails when MITRE ships an update). To regenerate from the latest official STIX bundle:

curl -L -o enterprise-attack.json \
  https://raw.githubusercontent.com/mitre/cti/master/enterprise-attack/enterprise-attack.json
ATTACK_MAPPER_STIX=enterprise-attack.json python -m attack_mapper.build_db

You can also run directly off the STIX bundle at runtime by setting ATTACK_MAPPER_STIX.

Project layout

attack-mapper/
├── attack_mapper/
│   ├── cli.py            # argparse entry point
│   ├── sigma_parser.py   # Sigma → ATT&CK technique IDs
│   ├── attack_loader.py  # ATT&CK DB (compact JSON / STIX)
│   ├── coverage.py       # coverage + gaps + scope filters
│   ├── renderers.py      # terminal table + 4 HTML styles
│   ├── plugins.py        # badge SVG + JSON summary
│   ├── build_db.py       # regenerate the compact ATT&CK DB
│   └── data/attack_db.json  # real ATT&CK (compact, ships with the package)
├── rules/                # sample Sigma rules
├── sample/               # generated HTML / badge / JSON examples
├── tests/                # pytest suite
└── pyproject.toml

License

MIT

Metadata

Release files for attack-mapper 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for attack-mapper 0.4.1
File Size Uploaded Provenance Actions
attack_mapper-0.4.1.tar.gz 47.1 kB Without provenance Details for attack_mapper-0.4.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for attack-mapper 0.4.1
File Interpreter ABI Platform Actions
attack_mapper-0.4.1-py3-none-any.whl Python 3 none any Details for attack_mapper-0.4.1-py3-none-any.whl

Total release size: 90.1 kB

Release files / attack_mapper-0.4.1.tar.gz

Download URL attack_mapper-0.4.1.tar.gz
Size 47.1 kB
Tags Source
SHA-256 checksum
How to use checksums
e01e3a3a72b02bcc81995da771f1b8f8a9060f3e6bedb31b6490e81e41a8b298
BLAKE2b-256 checksum
How to use checksums
86c60e953c4f483d4de616141c8ee7862efa1f35ebbbc824bea2c3c166eaaa9b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Release files / attack_mapper-0.4.1-py3-none-any.whl

Download URL attack_mapper-0.4.1-py3-none-any.whl
Size 42.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b4d46af84e1c74e6e40d8439ed2d4631857b708b6aa1938cb54a565092429037
BLAKE2b-256 checksum
How to use checksums
5cdcd88f130b84882f86a8952cd0dbd3c0863ff5305d41181a888dbd07ca239e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.5

Security for attack-mapper 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.4.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page