# adoemwanmei/darksword-prov2 architecture

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

- Interactive diagram: https://gitdiagram.com/adoemwanmei/darksword-prov2
- Repository: https://github.com/adoemwanmei/darksword-prov2

## Overview

DarkSword combines an iOS exploit-delivery server and payload chain with a separate web-based operations console. The documented device workflow runs from Safari delivery through RCE, sandbox escape, privilege escalation, and post-exploitation; the console manages devices, commands, and collected data. The CLI configures the delivery service, while the admin API exposes management functions backed by SQLite and a Vue interface. Several payload and admin subsystems are represented from README descriptions or the source index rather than inspected implementations, so those links are documented rather than inferred from names.

Main entry points: [`admin/main.py`](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/main.py) (Admin API app), [`darksword/server.py`](https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/server.py) (HTTP delivery server), [`admin/database.py`](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/database.py) (SQLite data store), [`admin/frontend/src/App.vue`](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/App.vue) (Admin web UI)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_delivery["Delivery service"]
  node_cli["CLI<br/>[cli.py]"]
  node_configuration["Server configuration<br/>[config.py]"]
  node_payload_catalog["Payload selection<br/>[payloads.py]"]
  node_delivery_server["HTTP delivery server<br/>[server.py]"]
end

subgraph group_payloads["Device payload stages"]
  node_rce_loader["RCE loader<br/>[rce_loader.js]"]
  node_rce_modules["RCE modules<br/>[rce_module.js]"]
  node_rce_workers["RCE workers<br/>[rce_worker.js]"]
  node_sandbox_escape["Sandbox escape<br/>[sbx1_main.js]"]
  node_privilege_escalation["Privilege escalation<br/>[pe_main.js]"]
  node_post_exploitation["Post-exploitation<br/>[post_exploit.js]"]
end

subgraph group_admin_api["Admin API"]
  node_admin_app["Admin API app<br/>[main.py]"]
  node_auth_routes["Authentication routes<br/>[auth.py]"]
  node_device_routes["Device routes<br/>[devices.py]"]
  node_command_routes["Command routes<br/>[commands.py]"]
  node_exfil_routes["Exfiltration routes<br/>[exfil.py]"]
  node_other_routes["Other API routes"]
  node_auth_logic["Authentication logic<br/>[auth.py]"]
end

subgraph group_admin_data["Admin data"]
  node_database[("SQLite data store<br/>[database.py]")]
  node_schemas["API schemas<br/>[schemas.py]"]
end

subgraph group_console["Admin console"]
  node_admin_ui["Admin web UI<br/>[App.vue]"]
  node_auth_store["UI authentication<br/>[auth.js]"]
  node_api_client["API client<br/>[axios.js]"]
  node_device_views["Device management<br/>[Devices.vue]"]
  node_dashboard["Dashboard<br/>[Dashboard.vue]"]
  node_data_views["Data and wallets<br/>[Wallets.vue]"]
end

node_operator(("Operator"))
node_ios_user(("iOS Safari user"))
node_c2["C2 service"]

node_operator -.->|"runs"| node_cli
node_cli -->|"starts"| node_delivery_server
node_cli -->|"loads"| node_configuration
node_cli -->|"uses"| node_payload_catalog
node_ios_user -->|"requests payload"| node_delivery_server
node_delivery_server -->|"serves"| node_rce_loader
node_rce_loader -->|"selects by version"| node_rce_modules
node_rce_loader -->|"creates worker"| node_rce_workers
node_rce_modules -->|"precedes"| node_sandbox_escape
node_sandbox_escape -->|"precedes"| node_privilege_escalation
node_privilege_escalation -->|"precedes"| node_post_exploitation
node_post_exploitation -->|"uploads data"| node_c2
node_post_exploitation -->|"polls commands"| node_c2
node_c2 -->|"receives uploads"| node_delivery_server
node_admin_app -->|"registers"| node_auth_routes
node_admin_app -->|"registers"| node_device_routes
node_admin_app -->|"registers"| node_command_routes
node_admin_app -->|"registers"| node_exfil_routes
node_admin_app -->|"registers"| node_other_routes
node_admin_app -->|"initializes"| node_database
node_auth_routes -->|"authenticates"| node_auth_logic
node_auth_routes -->|"reads and writes"| node_database
node_device_routes -->|"reads and writes"| node_database
node_command_routes -->|"reads and writes"| node_database
node_exfil_routes -->|"reads and writes"| node_database
node_delivery_server -->|"shares device state"| node_database
node_admin_ui -->|"uses"| node_auth_store
node_auth_store -->|"calls"| node_api_client
node_device_views -->|"calls"| node_api_client
node_dashboard -->|"calls"| node_api_client
node_data_views -->|"calls"| node_api_client
node_admin_ui -->|"routes to"| node_device_views
node_admin_ui -->|"routes to"| node_dashboard
node_admin_ui -->|"routes to"| node_data_views
node_device_routes -.->|"device commands"| node_command_routes
node_delivery_server -->|"registers devices"| node_admin_app

click node_cli "https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/cli.py"
click node_configuration "https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/config.py"
click node_payload_catalog "https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/payloads.py"
click node_delivery_server "https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/server.py"
click node_rce_loader "https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/rce_loader.js"
click node_rce_modules "https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/rce_module.js"
click node_rce_workers "https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/rce_worker.js"
click node_sandbox_escape "https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/sbx1_main.js"
click node_privilege_escalation "https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/pe_main.js"
click node_post_exploitation "https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/post_exploit.js"
click node_admin_ui "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/App.vue"
click node_auth_store "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/stores/auth.js"
click node_api_client "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/utils/axios.js"
click node_device_views "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/views/Devices.vue"
click node_dashboard "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/views/Dashboard.vue"
click node_data_views "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/views/Wallets.vue"
click node_admin_app "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/main.py"
click node_auth_routes "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/routers/auth.py"
click node_device_routes "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/routers/devices.py"
click node_command_routes "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/routers/commands.py"
click node_exfil_routes "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/routers/exfil.py"
click node_other_routes "https://github.com/adoemwanmei/darksword-prov2/tree/master/admin/routers"
click node_auth_logic "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/auth.py"
click node_database "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/database.py"
click node_schemas "https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/schemas.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_cli,node_configuration,node_payload_catalog,node_delivery_server,node_ios_user toneBlue
class node_rce_loader,node_rce_modules,node_rce_workers,node_sandbox_escape,node_privilege_escalation,node_post_exploitation toneAmber
class node_admin_app,node_auth_routes,node_device_routes,node_command_routes,node_exfil_routes,node_other_routes,node_auth_logic toneMint
class node_database,node_schemas toneRose
class node_admin_ui,node_auth_store,node_api_client,node_device_views,node_dashboard,node_data_views,node_operator,node_c2 toneIndigo
```

## Components

### Delivery service

- [CLI](https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/cli.py): `darksword/cli.py`
- [Server configuration](https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/config.py): `darksword/config.py`
- [Payload selection](https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/payloads.py): `darksword/payloads.py`
- [HTTP delivery server](https://github.com/adoemwanmei/darksword-prov2/blob/master/darksword/server.py): `darksword/server.py`

### Device payload stages

- [RCE loader](https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/rce_loader.js): `payloads/rce_loader.js`
- [RCE modules](https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/rce_module.js): `payloads/rce_module.js`
- [RCE workers](https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/rce_worker.js): `payloads/rce_worker.js`
- [Sandbox escape](https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/sbx1_main.js): `payloads/sbx1_main.js`
- [Privilege escalation](https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/pe_main.js): `payloads/pe_main.js`
- [Post-exploitation](https://github.com/adoemwanmei/darksword-prov2/blob/master/payloads/post_exploit.js): `payloads/post_exploit.js`

### Admin API

- [Admin API app](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/main.py): `admin/main.py`
- [Authentication routes](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/routers/auth.py): `admin/routers/auth.py`
- [Device routes](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/routers/devices.py): `admin/routers/devices.py`
- [Command routes](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/routers/commands.py): `admin/routers/commands.py`
- [Exfiltration routes](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/routers/exfil.py): `admin/routers/exfil.py`
- [Other API routes](https://github.com/adoemwanmei/darksword-prov2/tree/master/admin/routers): `admin/routers`
- [Authentication logic](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/auth.py): `admin/auth.py`

### Admin data

- [SQLite data store](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/database.py): `admin/database.py`
- [API schemas](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/schemas.py): `admin/schemas.py`

### Admin console

- [Admin web UI](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/App.vue): `admin/frontend/src/App.vue`
- [UI authentication](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/stores/auth.js): `admin/frontend/src/stores/auth.js`
- [API client](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/utils/axios.js): `admin/frontend/src/utils/axios.js`
- [Device management](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/views/Devices.vue): `admin/frontend/src/views/Devices.vue`
- [Dashboard](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/views/Dashboard.vue): `admin/frontend/src/views/Dashboard.vue`
- [Data and wallets](https://github.com/adoemwanmei/darksword-prov2/blob/master/admin/frontend/src/views/Wallets.vue): `admin/frontend/src/views/Wallets.vue`

### Other components

- **Operator**
- **iOS Safari user**
- **C2 service**

## Connections

- Operator → CLI: runs (evidence: `README.md`)
- CLI → HTTP delivery server: starts (evidence: `darksword/cli.py`)
- CLI → Server configuration: loads (evidence: `darksword/cli.py`)
- CLI → Payload selection: uses (evidence: `darksword/cli.py`)
- iOS Safari user → HTTP delivery server: requests payload (evidence: `README.md`)
- HTTP delivery server → RCE loader: serves (evidence: `README.md`)
- RCE loader → RCE modules: selects by version (evidence: `README.md`)
- RCE loader → RCE workers: creates worker (evidence: `README.md`)
- RCE modules → Sandbox escape: precedes (evidence: `README.md`)
- Sandbox escape → Privilege escalation: precedes (evidence: `README.md`)
- Privilege escalation → Post-exploitation: precedes (evidence: `README.md`)
- Post-exploitation → C2 service: uploads data (evidence: `README.md`)
- Post-exploitation → C2 service: polls commands (evidence: `README.md`)
- C2 service → HTTP delivery server: receives uploads (evidence: `README.md`)
- Admin API app → Authentication routes: registers (evidence: `admin/main.py`)
- Admin API app → Device routes: registers (evidence: `admin/main.py`)
- Admin API app → Command routes: registers (evidence: `admin/main.py`)
- Admin API app → Exfiltration routes: registers (evidence: `admin/main.py`)
- Admin API app → Other API routes: registers (evidence: `admin/main.py`)
- Admin API app → SQLite data store: initializes (evidence: `admin/main.py`)
- Authentication routes → Authentication logic: authenticates (evidence: `admin/routers/auth.py`)
- Authentication routes → SQLite data store: reads and writes (evidence: `admin/routers/auth.py`)
- Device routes → SQLite data store: reads and writes (evidence: `admin/routers/devices.py`)
- Command routes → SQLite data store: reads and writes (evidence: `admin/routers/commands.py`)
- Exfiltration routes → SQLite data store: reads and writes (evidence: `admin/routers/exfil.py`)
- HTTP delivery server → SQLite data store: shares device state (evidence: `darksword/server.py`)
- Admin web UI → UI authentication: uses (evidence: `admin/frontend/src/App.vue`)
- UI authentication → API client: calls (evidence: `admin/frontend/src/stores/auth.js`)
- Device management → API client: calls (evidence: `admin/frontend/src/views/Devices.vue`)
- Dashboard → API client: calls (evidence: `admin/frontend/src/views/Dashboard.vue`)
- Data and wallets → API client: calls (evidence: `admin/frontend/src/views/Wallets.vue`)
- Admin web UI → Device management: routes to
- Admin web UI → Dashboard: routes to
- Admin web UI → Data and wallets: routes to
- Device routes → Command routes: device commands
- HTTP delivery server → Admin API app: registers devices (evidence: `darksword/server.py`)
