# mbrg/power-pwn architecture

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

- Interactive diagram: https://gitdiagram.com/mbrg/power-pwn
- Repository: https://github.com/mbrg/power-pwn

## Overview

Power Pwn is a command-line security toolkit for Microsoft 365 Power Platform and AI services. The principal workflow is to select a command, parse its options, dispatch it, and run a tenant scan or targeted security assessment; results may be viewed through the PowerDump GUI. Separate capabilities cover Copilot testing, bot and agent discovery, exposed MCP probing, flow persistence, artifact abuse, phishing, and Power Pages checks. The sampled CLI confirms dispatch, and sampled Copilot and LLM Hound code confirms some internal calls. Runner implementations were not sampled, so links from runners to their feature modules are dashed and unverified.

Main entry points: [`src/powerpwn/cli/runners.py`](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/cli/runners.py) (Command Runners), [`src/powerpwn/llmhound/llmhound.py`](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/llmhound.py) (LLM Hound), [`src/powerpwn/copilot/copilot_connector/copilot_connector.py`](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/copilot_connector/copilot_connector.py) (Copilot Connector), [`src/powerpwn/cli/arguments.py`](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/cli/arguments.py) (CLI Arguments)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["Command Interface"]
  node_arguments["CLI Arguments<br/>[arguments.py]"]
  node_entry["Command Dispatcher<br/>[main.py]"]
  node_runners["Command Runners<br/>[runners.py]"]
end

subgraph group_tenant["Tenant Assessment"]
  node_dump["PowerDump"]
  node_gui["Results GUI<br/>[gui.py]"]
  node_recon["Tenant Recon"]
end

subgraph group_ai["AI Security"]
  node_copilot["M365 Copilot"]
  node_connector["Copilot Connector"]
  node_bearer["Bearer Retrieval"]
  node_chat["Chat Automation<br/>[chat_automator.py]"]
  node_message["WebSocket Parsing"]
  node_studio["Copilot Studio Hunter"]
  node_customgpt["Custom GPT Hunter"]
  node_agent["Agent Builder Hunter"]
  node_hound["LLM Hound<br/>[llmhound.py]"]
  node_shodan["Shodan Discovery"]
  node_registry["Registry Discovery"]
  node_probe["MCP Probe<br/>[server_probe.py]"]
end

subgraph group_actions["Power Platform Actions"]
  node_backdoor["BackDoor Flows<br/>[backdoor_flow.py]"]
  node_malware["NoCodeMalware<br/>[malware_runner.py]"]
  node_phishing["PowerPhishing<br/>[app_installer.py]"]
  node_pages["Power Pages<br/>[powerpages.py]"]
end

node_user(("Operator"))

node_user -->|"supplies options"| node_arguments
node_arguments -->|"returns parsed args"| node_entry
node_entry -->|"dispatches commands"| node_runners
node_runners -.->|"runs scan"| node_dump
node_runners -.->|"runs recon"| node_recon
node_runners -.->|"opens results"| node_gui
node_runners -.->|"runs tests"| node_copilot
node_runners -.->|"hunts bots"| node_studio
node_runners -.->|"hunts GPTs"| node_customgpt
node_runners -.->|"hunts agents"| node_agent
node_runners -.->|"discovers MCPs"| node_hound
node_runners -.->|"deploys flows"| node_backdoor
node_runners -.->|"runs artifacts"| node_malware
node_runners -.->|"installs phishing"| node_phishing
node_runners -.->|"checks pages"| node_pages
node_copilot -->|"starts connection"| node_connector
node_connector -->|"retrieves token"| node_bearer
node_connector -->|"parses messages"| node_message
node_chat -->|"uses connection"| node_connector
node_hound -->|"probes servers"| node_probe
node_hound -->|"discovers servers"| node_shodan
node_hound -->|"discovers registry"| node_registry

click node_arguments "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/cli/arguments.py"
click node_entry "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/main.py"
click node_runners "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/cli/runners.py"
click node_dump "https://github.com/mbrg/power-pwn/tree/main/src/powerpwn/powerdump/collect"
click node_gui "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerdump/gui/gui.py"
click node_recon "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerdump/collect/resources_collectors/resources_collector.py"
click node_copilot "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/interactive_chat/interactive_chat.py"
click node_connector "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/copilot_connector/copilot_connector.py"
click node_bearer "https://github.com/mbrg/power-pwn/blob/main/puppeteer_get_substrate_bearer/get_substrate_bearer_office.js"
click node_chat "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/chat_automator/chat_automator.py"
click node_message "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/websocket_message/websocket_message.py"
click node_studio "https://github.com/mbrg/power-pwn/tree/main/src/powerpwn/copilot_studio/modules"
click node_customgpt "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/custom_gpt_hunter/custom_gpt_hunter.js"
click node_agent "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/agent_builder/agent_builder_scan.py"
click node_hound "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/llmhound.py"
click node_shodan "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/shodan_discovery.py"
click node_registry "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/registry_discovery.py"
click node_probe "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/server_probe.py"
click node_backdoor "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerdoor/backdoor_flow.py"
click node_malware "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/nocodemalware/malware_runner.py"
click node_phishing "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerphishing/app_installer.py"
click node_pages "https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerpages/powerpages.py"

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_arguments,node_entry,node_runners toneBlue
class node_dump,node_gui,node_recon toneAmber
class node_copilot,node_connector,node_bearer,node_chat,node_message,node_studio,node_customgpt,node_agent,node_hound,node_shodan,node_registry,node_probe toneMint
class node_backdoor,node_malware,node_phishing,node_pages toneRose
class node_user toneIndigo
```

## Components

### Command Interface

- [CLI Arguments](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/cli/arguments.py): `src/powerpwn/cli/arguments.py`
- [Command Dispatcher](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/main.py): `src/powerpwn/main.py`
- [Command Runners](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/cli/runners.py): `src/powerpwn/cli/runners.py`

### Tenant Assessment

- [PowerDump](https://github.com/mbrg/power-pwn/tree/main/src/powerpwn/powerdump/collect): `src/powerpwn/powerdump/collect`
- [Results GUI](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerdump/gui/gui.py): `src/powerpwn/powerdump/gui/gui.py`
- [Tenant Recon](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerdump/collect/resources_collectors/resources_collector.py): `src/powerpwn/powerdump/collect/resources_collectors/resources_collector.py`

### AI Security

- [M365 Copilot](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/interactive_chat/interactive_chat.py): `src/powerpwn/copilot/interactive_chat/interactive_chat.py`
- [Copilot Connector](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/copilot_connector/copilot_connector.py): `src/powerpwn/copilot/copilot_connector/copilot_connector.py`
- [Bearer Retrieval](https://github.com/mbrg/power-pwn/blob/main/puppeteer_get_substrate_bearer/get_substrate_bearer_office.js): `puppeteer_get_substrate_bearer/get_substrate_bearer_office.js`
- [Chat Automation](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/chat_automator/chat_automator.py): `src/powerpwn/copilot/chat_automator/chat_automator.py`
- [WebSocket Parsing](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/copilot/websocket_message/websocket_message.py): `src/powerpwn/copilot/websocket_message/websocket_message.py`
- [Copilot Studio Hunter](https://github.com/mbrg/power-pwn/tree/main/src/powerpwn/copilot_studio/modules): `src/powerpwn/copilot_studio/modules`
- [Custom GPT Hunter](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/custom_gpt_hunter/custom_gpt_hunter.js): `src/powerpwn/custom_gpt_hunter/custom_gpt_hunter.js`
- [Agent Builder Hunter](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/agent_builder/agent_builder_scan.py): `src/powerpwn/agent_builder/agent_builder_scan.py`
- [LLM Hound](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/llmhound.py): `src/powerpwn/llmhound/llmhound.py`
- [Shodan Discovery](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/shodan_discovery.py): `src/powerpwn/llmhound/shodan_discovery.py`
- [Registry Discovery](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/registry_discovery.py): `src/powerpwn/llmhound/registry_discovery.py`
- [MCP Probe](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/llmhound/server_probe.py): `src/powerpwn/llmhound/server_probe.py`

### Power Platform Actions

- [BackDoor Flows](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerdoor/backdoor_flow.py): `src/powerpwn/powerdoor/backdoor_flow.py`
- [NoCodeMalware](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/nocodemalware/malware_runner.py): `src/powerpwn/nocodemalware/malware_runner.py`
- [PowerPhishing](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerphishing/app_installer.py): `src/powerpwn/powerphishing/app_installer.py`
- [Power Pages](https://github.com/mbrg/power-pwn/blob/main/src/powerpwn/powerpages/powerpages.py): `src/powerpwn/powerpages/powerpages.py`

### Other components

- **Operator**

## Connections

- Operator → CLI Arguments: supplies options (evidence: `src/powerpwn/cli/arguments.py`)
- CLI Arguments → Command Dispatcher: returns parsed args (evidence: `src/powerpwn/main.py`)
- Command Dispatcher → Command Runners: dispatches commands (evidence: `src/powerpwn/main.py`)
- Command Runners → PowerDump: runs scan
- Command Runners → Tenant Recon: runs recon
- Command Runners → Results GUI: opens results
- Command Runners → M365 Copilot: runs tests
- Command Runners → Copilot Studio Hunter: hunts bots
- Command Runners → Custom GPT Hunter: hunts GPTs
- Command Runners → Agent Builder Hunter: hunts agents
- Command Runners → LLM Hound: discovers MCPs
- Command Runners → BackDoor Flows: deploys flows
- Command Runners → NoCodeMalware: runs artifacts
- Command Runners → PowerPhishing: installs phishing
- Command Runners → Power Pages: checks pages
- M365 Copilot → Copilot Connector: starts connection (evidence: `src/powerpwn/copilot/interactive_chat/interactive_chat.py`)
- Copilot Connector → Bearer Retrieval: retrieves token (evidence: `src/powerpwn/copilot/copilot_connector/copilot_connector.py`)
- Copilot Connector → WebSocket Parsing: parses messages (evidence: `src/powerpwn/copilot/copilot_connector/copilot_connector.py`)
- Chat Automation → Copilot Connector: uses connection (evidence: `src/powerpwn/copilot/chat_automator/chat_automator.py`)
- LLM Hound → MCP Probe: probes servers (evidence: `src/powerpwn/llmhound/llmhound.py`)
- LLM Hound → Shodan Discovery: discovers servers (evidence: `src/powerpwn/llmhound/llmhound.py`)
- LLM Hound → Registry Discovery: discovers registry (evidence: `src/powerpwn/llmhound/llmhound.py`)
