# capture0x/adstrike architecture

> Architecture diagram of the GitHub repository capture0x/adstrike, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-05-29). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/capture0x/adstrike
- Repository: https://github.com/capture0x/adstrike

## Overview

1. **What this repository is**
   AdStrike is a terminal-driven Active Directory attack framework, not a single-purpose tool. Its architecture is organized around a shared interactive session, a large menu of attack/utility modules, and an output/reporting pipeline that preserves evidence and operator state across actions.

2. **Top-level control plane**
   `main.py` is the primary application entry point, with `run.sh` used as the launcher and `install.sh` handling local environment setup. The CLI supports running the full menu, individual modules, health checks, and loading a saved session, which makes the framework usable both interactively and in scripted workflows.

3. **Shared session and configuration boundary**
   `config/settings.py` plus the session manager behavior described in the README form the central state layer. This is where target identity, credentials, Kerberos settings, operator context, and engagement metadata are stored and reused by modules instead of being re-entered. `.env` and `output/session.json` are the key configuration/state artifacts.

4. **Module system as the main functional surface**
   The `modules/` directory is the core of the product. Each file is a domain-specific capability area, and the menu is grouped into phases: reconnaissance, initial access, enumeration, privilege escalation, lateral movement, credential access, persistence, cloud/hybrid, advanced operations, and utilities. For architecture diagrams, this is the largest subsystem and should be shown as a fan-out from the CLI into many specialized modules.

5. **Attack workflows and domain boundaries**
   The modules are intentionally separated by tradecraft boundary: AD enumeration, Kerberos operations, certificate abuse, ACL abuse, DCSync/DCShadow, coercion, GPO, RBCD, trust attacks, cloud identity attacks, and local privilege escalation. These modules are not independent apps; they share the same session context and typically hand off evidence or credentials to later stages.

6. **Kerberos-aware execution path**
   Kerberos is a first-class cross-cutting subsystem. `modules/kerberos_manager.py`, the Kerberos-focused attack modules, and the output/runtime files under `output/agent_runtime/` support TGT/PTT, ccache management, `krb5.conf` generation, and workflows for NTLM-disabled environments. This is a distinct data-flow boundary because many later modules depend on Kerberos state created earlier.

7. **Agent and AI-assisted orchestration**
   `modules/agent/` plus `modules/red_team_agent.py` implement the optional AI-assisted orchestration layer. The agent can run in planning or automated modes and has backend support for local Ollama or Claude. This subsystem sits beside the manual module menu rather than replacing it, and it consumes the same session data and findings to decide next actions.

8. **Analysis, parsing, and report generation**
   `modules/analyst.py`, `modules/loot_parser.py`, and `modules/reporting.py` form the evidence-processing pipeline. Raw tool output and loot are normalized, deduplicated, and scored, then exported into HTML, Markdown, and JSON reports. In a diagram, this is the downstream sink for data produced by enumeration and exploitation modules.

9. **Wrappers around external tooling**
   The framework is largely an orchestration layer over established AD tooling such as Impacket, NetExec, BloodHound, Certipy, Kerbrute, Rubeus, PowerView, and related utilities. The `tools/bin/` directory contains bundled helper scripts like `PetitPotam.py`, `dnstool.py`, `gMSADumper.py`, and `printerbug.py`, which are treated as executable dependencies for specific modules.

10. **Operational helpers and tooling validation**
   `modules/c2_integration.py`, `modules/bloodhound_helper.py`, `modules/netexec_suite.py`, `modules/powerview_enum.py`, and similar helpers provide curated access to common workflows rather than raw primitives. The `Tool Checker` utility and `scripts/repair_tools.sh` form a maintenance boundary that validates imports, checks installed binaries, and repairs missing external dependencies.

11. **Persistence of artifacts and outputs**
   Runtime data is written under `output/`, with separate buckets for session state, enumeration artifacts, BloodHound collections, agent logs, runtime Kerberos artifacts, audits, and reports. This clear output partitioning matters architecturally because it shows where evidence accumulates and which files become inputs to later modules or reporting.

12. **Knowledge base and technique mapping**
   The `ActiveDirectory-SAST/` folder contains YAML and JSON technique definitions plus a skills knowledge base. This looks like the repository’s internal domain knowledge layer, likely used to map AD behaviors and attack primitives to named techniques for analysis, scoring, or assistant guidance.

13. **Documentation and operator guidance**
   `docs/ADSTRIKE_AND_AGENT_GUIDE.md` and the README provide the operator-facing workflow model, while `SECURITY.md` and the license define boundaries for use. For an architecture diagram, these are supporting edges around the system rather than runtime components, but they clarify that the tool is intended for authorized offensive/security testing.

14. **Overall data flow**
   The dominant flow is: launcher/CLI → session setup/config discovery → module execution against live AD targets and local helper tools → artifact collection in `output/` → analysis/reporting → optional AI-assisted planning or further module chaining. The important architectural feature is that state persists across all stages, so the framework behaves like a coordinated engagement workspace rather than isolated commands.

Main entry points: [`main.py`](https://github.com/capture0x/adstrike/blob/main/main.py) (CLI), [`modules/analyst.py`](https://github.com/capture0x/adstrike/blob/main/modules/analyst.py) (Analyst), [`tools/bin`](https://github.com/capture0x/adstrike/tree/main/tools/bin) (Bundled tools), [`modules/red_team_agent.py`](https://github.com/capture0x/adstrike/blob/main/modules/red_team_agent.py) (Red team agent)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_core["Core runtime"]
  node_main_py["CLI<br/>entrypoint<br/>[main.py]"]
  node_run_sh["Launcher<br/>[run.sh]"]
  node_install_sh["Installer<br/>setup script<br/>[install.sh]"]
  node_settings_py["Settings<br/>config/state<br/>[settings.py]"]
end

subgraph group_modules["Module surface"]
  node_enum_ad_py["Discovery<br/>recon module<br/>[enum_ad.py]"]
  node_initial_access_py["Initial access<br/>access module<br/>[initial_access.py]"]
  node_kerberos_manager_py["Kerberos mgr<br/>state runtime"]
  node_kerberos_attacks_py["Kerberos ops<br/>attack module"]
  node_trust_attacks_py["Trust attacks<br/>attack module<br/>[trust_attacks.py]"]
  node_lateral_movement_py["Lateral movement<br/>movement module"]
  node_credential_dump_py["Credential dump<br/>loot module<br/>[credential_dump.py]"]
  node_persistence_py["Persistence<br/>[persistence.py]"]
  node_local_privesc_py["Local privesc<br/>privilege module<br/>[local_privesc.py]"]
  node_red_team_agent_py["Red team agent<br/>ai orchestration<br/>[red_team_agent.py]"]
end

subgraph group_pipeline["Analysis pipeline"]
  node_analyst_py["Analyst<br/>analysis<br/>[analyst.py]"]
  node_loot_parser_py["Loot parser<br/>[loot_parser.py]"]
  node_reporting_py["Reporting<br/>export<br/>[reporting.py]"]
end

subgraph group_artifacts["Artifacts"]
  node_session_state["Session state<br/>saved state"]
  node_reports_dir[("Reports<br/>report artifacts")]
end

subgraph group_knowledge["Knowledge base"]
  node_ad_sast_dir[("Technique KB<br/>knowledge base")]
  node_guide_md["Operator guide<br/>documentation"]
end

subgraph group_tools["Bundled tools"]
  node_tool_bin_dir[("Bundled tools<br/>helper scripts")]
  node_repair_tools_sh["Tool repair<br/>maintenance script<br/>[repair_tools.sh]"]
end

node_run_sh -->|"launches"| node_main_py
node_install_sh -->|"prepares"| node_main_py
node_main_py -->|"loads"| node_settings_py
node_main_py -->|"restores"| node_session_state
node_main_py -->|"dispatches"| node_enum_ad_py
node_main_py -->|"dispatches"| node_initial_access_py
node_main_py -->|"dispatches"| node_kerberos_attacks_py
node_main_py -->|"dispatches"| node_lateral_movement_py
node_main_py -->|"dispatches"| node_persistence_py
node_main_py -.->|"optional path"| node_red_team_agent_py
node_settings_py -->|"configures"| node_kerberos_manager_py
node_enum_ad_py -->|"emits evidence"| node_loot_parser_py
node_initial_access_py -->|"uses"| node_tool_bin_dir
node_kerberos_attacks_py -->|"depends on"| node_kerberos_manager_py
node_kerberos_manager_py -->|"persists"| node_session_state
node_trust_attacks_py -->|"uses"| node_tool_bin_dir
node_credential_dump_py -->|"stores"| node_reports_dir
node_persistence_py -->|"stores"| node_reports_dir
node_local_privesc_py -->|"uses"| node_tool_bin_dir
node_red_team_agent_py -->|"consumes"| node_settings_py
node_red_team_agent_py -->|"consumes"| node_analyst_py
node_loot_parser_py -->|"feeds"| node_analyst_py
node_analyst_py -->|"publishes"| node_reporting_py
node_reporting_py -->|"writes"| node_reports_dir
node_ad_sast_dir -->|"informs"| node_analyst_py
node_guide_md -.->|"documents"| node_main_py
node_repair_tools_sh -->|"repairs"| node_tool_bin_dir

click node_main_py "https://github.com/capture0x/adstrike/blob/main/main.py"
click node_run_sh "https://github.com/capture0x/adstrike/blob/main/run.sh"
click node_install_sh "https://github.com/capture0x/adstrike/blob/main/install.sh"
click node_settings_py "https://github.com/capture0x/adstrike/blob/main/config/settings.py"
click node_enum_ad_py "https://github.com/capture0x/adstrike/blob/main/modules/enum_ad.py"
click node_initial_access_py "https://github.com/capture0x/adstrike/blob/main/modules/initial_access.py"
click node_kerberos_manager_py "https://github.com/capture0x/adstrike/blob/main/modules/kerberos_manager.py"
click node_kerberos_attacks_py "https://github.com/capture0x/adstrike/blob/main/modules/kerberos_attacks.py"
click node_trust_attacks_py "https://github.com/capture0x/adstrike/blob/main/modules/trust_attacks.py"
click node_lateral_movement_py "https://github.com/capture0x/adstrike/blob/main/modules/lateral_movement.py"
click node_credential_dump_py "https://github.com/capture0x/adstrike/blob/main/modules/credential_dump.py"
click node_persistence_py "https://github.com/capture0x/adstrike/blob/main/modules/persistence.py"
click node_local_privesc_py "https://github.com/capture0x/adstrike/blob/main/modules/local_privesc.py"
click node_red_team_agent_py "https://github.com/capture0x/adstrike/blob/main/modules/red_team_agent.py"
click node_analyst_py "https://github.com/capture0x/adstrike/blob/main/modules/analyst.py"
click node_loot_parser_py "https://github.com/capture0x/adstrike/blob/main/modules/loot_parser.py"
click node_reporting_py "https://github.com/capture0x/adstrike/blob/main/modules/reporting.py"
click node_reports_dir "https://github.com/capture0x/adstrike/tree/main/reports"
click node_ad_sast_dir "https://github.com/capture0x/adstrike/tree/main/ActiveDirectory-SAST"
click node_guide_md "https://github.com/capture0x/adstrike/blob/main/docs/ADSTRIKE_AND_AGENT_GUIDE.md"
click node_tool_bin_dir "https://github.com/capture0x/adstrike/tree/main/tools/bin"
click node_repair_tools_sh "https://github.com/capture0x/adstrike/blob/main/scripts/repair_tools.sh"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_main_py,node_run_sh,node_install_sh,node_settings_py toneBlue
class node_enum_ad_py,node_initial_access_py,node_kerberos_manager_py,node_kerberos_attacks_py,node_trust_attacks_py,node_lateral_movement_py,node_credential_dump_py,node_persistence_py,node_local_privesc_py,node_red_team_agent_py toneAmber
class node_analyst_py,node_loot_parser_py,node_reporting_py toneMint
class node_session_state,node_reports_dir toneRose
class node_ad_sast_dir,node_guide_md toneIndigo
class node_tool_bin_dir,node_repair_tools_sh toneTeal
```

## Components

### Core runtime

Entry points, shared settings, and session control.

- [CLI](https://github.com/capture0x/adstrike/blob/main/main.py): entrypoint · Main terminal entry point and mode dispatcher. · `main.py`
- [Launcher](https://github.com/capture0x/adstrike/blob/main/run.sh): shell launcher · Convenience wrapper for starting the framework. · `run.sh`
- [Installer](https://github.com/capture0x/adstrike/blob/main/install.sh): setup script · Local environment and dependency setup. · `install.sh`
- [Settings](https://github.com/capture0x/adstrike/blob/main/config/settings.py): config/state · Shared configuration, operator context, and session defaults. · `config/settings.py`

### Module surface

Primary AD tradecraft and workflow modules.

- [Discovery](https://github.com/capture0x/adstrike/blob/main/modules/enum_ad.py): recon module · Core AD enumeration and reconnaissance workflow. · `modules/enum_ad.py`
- [Initial access](https://github.com/capture0x/adstrike/blob/main/modules/initial_access.py): access module · Entry and credential-oriented access paths. · `modules/initial_access.py`
- [Kerberos mgr](https://github.com/capture0x/adstrike/blob/main/modules/kerberos_manager.py): state runtime · Kerberos ticket, ccache, and config management. · `modules/kerberos_manager.py`
- [Kerberos ops](https://github.com/capture0x/adstrike/blob/main/modules/kerberos_attacks.py): attack module · Kerberos-focused attack workflows and abuse paths. · `modules/kerberos_attacks.py`
- [Trust attacks](https://github.com/capture0x/adstrike/blob/main/modules/trust_attacks.py): attack module · Cross-domain trust abuse and escalation paths. · `modules/trust_attacks.py`
- [Lateral movement](https://github.com/capture0x/adstrike/blob/main/modules/lateral_movement.py): movement module · Remote execution and movement across hosts. · `modules/lateral_movement.py`
- [Credential dump](https://github.com/capture0x/adstrike/blob/main/modules/credential_dump.py): loot module · Secrets and credential access workflows. · `modules/credential_dump.py`
- [Persistence](https://github.com/capture0x/adstrike/blob/main/modules/persistence.py): persistence module · Domain persistence and long-lived access. · `modules/persistence.py`
- [Local privesc](https://github.com/capture0x/adstrike/blob/main/modules/local_privesc.py): privilege module · Host-level privilege escalation techniques. · `modules/local_privesc.py`
- [Red team agent](https://github.com/capture0x/adstrike/blob/main/modules/red_team_agent.py): ai orchestration · Operator-facing AI-assisted workflow controller. · `modules/red_team_agent.py`

### Analysis pipeline

Loot parsing, analysis, and reporting.

- [Analyst](https://github.com/capture0x/adstrike/blob/main/modules/analyst.py): analysis · Normalization, scoring, and findings analysis. · `modules/analyst.py`
- [Loot parser](https://github.com/capture0x/adstrike/blob/main/modules/loot_parser.py): parser · Parses raw output and loot into structured evidence. · `modules/loot_parser.py`
- [Reporting](https://github.com/capture0x/adstrike/blob/main/modules/reporting.py): export · Generates HTML, Markdown, and JSON reports. · `modules/reporting.py`

### Artifacts

Saved outputs and runtime state.

- **Session state**: saved state · Persistent engagement state restored across runs.
- [Reports](https://github.com/capture0x/adstrike/tree/main/reports): report artifacts · Exported engagement reports. · `reports`

### Knowledge base

Technique mappings and operator guidance.

- [Technique KB](https://github.com/capture0x/adstrike/tree/main/ActiveDirectory-SAST): knowledge base · YAML and JSON technique mappings for AD tradecraft. · `ActiveDirectory-SAST`
- [Operator guide](https://github.com/capture0x/adstrike/blob/main/docs/ADSTRIKE_AND_AGENT_GUIDE.md): documentation · Workflow and usage guidance for operators. · `docs/ADSTRIKE_AND_AGENT_GUIDE.md`

### Bundled tools

Helper scripts and maintenance utilities.

- [Bundled tools](https://github.com/capture0x/adstrike/tree/main/tools/bin): helper scripts · Executable dependencies and helper scripts. · `tools/bin`
- [Tool repair](https://github.com/capture0x/adstrike/blob/main/scripts/repair_tools.sh): maintenance script · Validates and repairs external tooling dependencies. · `scripts/repair_tools.sh`

## Connections

- Launcher → CLI: launches · Starts the main CLI application.
- Installer → CLI: prepares · Sets up the local environment for execution.
- CLI → Settings: loads · Reads shared configuration and defaults.
- CLI → Session state: restores · Loads a saved engagement session when present.
- CLI → Discovery: dispatches · Routes interactive or scripted execution to modules.
- CLI → Initial access: dispatches · Routes interactive or scripted execution to modules.
- CLI → Kerberos ops: dispatches · Routes interactive or scripted execution to modules.
- CLI → Lateral movement: dispatches · Routes interactive or scripted execution to modules.
- CLI → Persistence: dispatches · Routes interactive or scripted execution to modules.
- CLI → Red team agent: optional path · Can hand control to the AI-assisted orchestration layer.
- Settings → Kerberos mgr: configures · Supplies target and Kerberos-related settings.
- Discovery → Loot parser: emits evidence · Produces raw findings and command output for parsing.
- Initial access → Bundled tools: uses · Wraps bundled external helper tools.
- Kerberos ops → Kerberos mgr: depends on · Relies on ticket and cache management.
- Kerberos mgr → Session state: persists · Stores reusable Kerberos and operator state.
- Trust attacks → Bundled tools: uses · Leverages bundled tooling for trust workflows.
- Credential dump → Reports: stores · Writes collected secrets and artifacts for later review.
- Persistence → Reports: stores · Writes persistence-related artifacts and evidence.
- Local privesc → Bundled tools: uses · May invoke bundled helper tools and scripts.
- Red team agent → Settings: consumes · Uses shared session and operator context.
- Red team agent → Analyst: consumes · Uses findings and history to suggest next actions.
- Loot parser → Analyst: feeds · Parsed artifacts become structured analysis input.
- Analyst → Reporting: publishes · Produces scored findings for report generation.
- Reporting → Reports: writes · Exports HTML, Markdown, and JSON reports.
- Technique KB → Analyst: informs · Technique mappings support analysis and scoring.
- Operator guide → CLI: documents · Explains workflow and operational usage.
- Tool repair → Bundled tools: repairs · Validates and repairs external dependencies.
