# rasta-mouse/sharpc2 architecture

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

- Interactive diagram: https://gitdiagram.com/rasta-mouse/sharpc2
- Repository: https://github.com/rasta-mouse/sharpc2

## Overview

SharpC2 is a command-and-control framework whose principal workflow runs from an operator using the MAUI client, through the Team Server’s authenticated API and tasking services, to deployed Drone implants and back with task output and events. The server also manages handlers, payloads, hosted files, profiles, pivots, webhooks, and persistent state. The graph reflects documented capabilities and sampled call ownership; several subsystem links use exact tree paths but are not wired further where implementation excerpts were unavailable.

Main entry points: [`Client/Services/SharpC2Api.cs`](https://github.com/rasta-mouse/sharpc2/blob/main/Client/Services/SharpC2Api.cs) (API client), [`Drone/Drone.cs`](https://github.com/rasta-mouse/sharpc2/blob/main/Drone/Drone.cs) (Command runtime), [`Client/MainPage.xaml.cs`](https://github.com/rasta-mouse/sharpc2/blob/main/Client/MainPage.xaml.cs) (MAUI client), [`TeamServer/Controllers/HandlersController.cs`](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/HandlersController.cs) (Handler API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Operator client"]
  node_maui["MAUI client<br/>[MainPage.xaml.cs]"]
  node_api_client["API client<br/>[SharpC2Api.cs]"]
  node_client_models["UI models<br/>[Drone.cs]"]
end

subgraph group_server["Team Server"]
  node_auth_controller["Authentication API"]
  node_handlers_controller["Handler API"]
  node_tasks_controller["Task API<br/>[TasksController.cs]"]
  node_drones_controller["Drone API"]
  node_payloads_controller["Payload API"]
  node_pivots_controller["Pivot API"]
  node_other_apis["Management APIs"]
  node_server_services["Server services<br/>[ServerService.cs]"]
  node_task_service["Task service<br/>[TaskService.cs]"]
  node_drone_service["Drone service<br/>[DroneService.cs]"]
  node_handler_service["Handler service<br/>[HandlerService.cs]"]
  node_payload_service["Payload service<br/>[PayloadService.cs]"]
  node_pivot_services["Pivot services"]
  node_auth_service["Authentication service"]
  node_database[("Persistent state<br/>[DatabaseService.cs]")]
  node_http_transport["HTTP transport"]
  node_notifications["Live notifications<br/>[NotificationHub.cs]"]
  node_events_webhooks["Events and webhooks<br/>[EventService.cs]"]
end

subgraph group_drone["Drone runtime"]
  node_drone_entry["Drone entry<br/>[Program.cs]"]
  node_drone_runtime["Command runtime<br/>[Drone.cs]"]
  node_drone_commands["Command set<br/>[DroneCommand.cs]"]
  node_comm_modules["Communications<br/>[CommModule.cs]"]
  node_stagers["Stagers<br/>[Program.cs]"]
end

subgraph group_integrations["External links"]
  node_external_controller["External C2 controller"]
  node_external_drone["External drone bridge<br/>[DroneController.cs]"]
end

node_operator(("Operator"))
node_operator_network(("Network peers"))

node_operator -->|"operates"| node_maui
node_maui -->|"requests"| node_api_client
node_api_client -->|"authenticates"| node_auth_controller
node_auth_controller -->|"verifies credentials"| node_auth_service
node_api_client -->|"manages handlers"| node_handlers_controller
node_api_client -->|"submits tasks"| node_tasks_controller
node_api_client -->|"views drones"| node_drones_controller
node_api_client -->|"requests payloads"| node_payloads_controller
node_api_client -->|"manages pivots"| node_pivots_controller
node_api_client -->|"manages resources"| node_other_apis
node_maui -->|"presents data"| node_client_models
node_handlers_controller -->|"manages handlers"| node_handler_service
node_handlers_controller -->|"announces changes"| node_notifications
node_tasks_controller -->|"queues tasks"| node_task_service
node_drones_controller -->|"manages drones"| node_drone_service
node_payloads_controller -->|"generates payloads"| node_payload_service
node_pivots_controller -->|"manages pivots"| node_pivot_services
node_pivots_controller -->|"caches drone frames"| node_task_service
node_server_services -->|"persists state"| node_database
node_http_transport -->|"handles frames"| node_server_services
node_http_transport -->|"receives implant traffic"| node_operator_network
node_server_services -->|"publishes events"| node_events_webhooks
node_drone_entry -->|"starts"| node_drone_runtime
node_drone_runtime -->|"uses transport"| node_comm_modules
node_drone_runtime -->|"executes commands"| node_drone_commands
node_stagers -->|"launches"| node_drone_entry
node_operator_network -.->|"deploys"| node_drone_entry
node_external_controller -.->|"relays frames"| node_operator_network
node_external_drone -.->|"loads payload"| node_drone_runtime

click node_maui "https://github.com/rasta-mouse/sharpc2/blob/main/Client/MainPage.xaml.cs"
click node_api_client "https://github.com/rasta-mouse/sharpc2/blob/main/Client/Services/SharpC2Api.cs"
click node_client_models "https://github.com/rasta-mouse/sharpc2/blob/main/Client/Models/Drones/Drone.cs"
click node_auth_controller "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/AuthenticationController.cs"
click node_handlers_controller "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/HandlersController.cs"
click node_tasks_controller "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/TasksController.cs"
click node_drones_controller "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/DronesController.cs"
click node_payloads_controller "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/PayloadsController.cs"
click node_pivots_controller "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/PivotsController.cs"
click node_other_apis "https://github.com/rasta-mouse/sharpc2/tree/main/TeamServer/Controllers"
click node_server_services "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/ServerService.cs"
click node_task_service "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/TaskService.cs"
click node_drone_service "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/DroneService.cs"
click node_handler_service "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/HandlerService.cs"
click node_payload_service "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/PayloadService.cs"
click node_pivot_services "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/ReversePortForwardService.cs"
click node_auth_service "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/AuthenticationService.cs"
click node_database "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/DatabaseService.cs"
click node_http_transport "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Handlers/HttpHandlerController.cs"
click node_notifications "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Hubs/NotificationHub.cs"
click node_events_webhooks "https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/EventService.cs"
click node_drone_entry "https://github.com/rasta-mouse/sharpc2/blob/main/Drone/Program.cs"
click node_drone_runtime "https://github.com/rasta-mouse/sharpc2/blob/main/Drone/Drone.cs"
click node_drone_commands "https://github.com/rasta-mouse/sharpc2/blob/main/Drone/Commands/DroneCommand.cs"
click node_comm_modules "https://github.com/rasta-mouse/sharpc2/blob/main/Drone/CommModules/CommModule.cs"
click node_stagers "https://github.com/rasta-mouse/sharpc2/blob/main/Stagers/ExeStager/Program.cs"
click node_external_controller "https://github.com/rasta-mouse/sharpc2/blob/main/ExternalC2/ExternalC2.Net/Server/ServerController.cs"
click node_external_drone "https://github.com/rasta-mouse/sharpc2/blob/main/ExternalC2/ExternalC2.Net/Client/DroneController.cs"

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_maui,node_api_client,node_client_models toneBlue
class node_auth_controller,node_handlers_controller,node_tasks_controller,node_drones_controller,node_payloads_controller,node_pivots_controller,node_other_apis,node_server_services,node_task_service,node_drone_service,node_handler_service,node_payload_service,node_pivot_services,node_auth_service,node_database,node_http_transport,node_notifications,node_events_webhooks toneAmber
class node_drone_entry,node_drone_runtime,node_drone_commands,node_comm_modules,node_stagers toneMint
class node_external_controller,node_external_drone toneRose
class node_operator,node_operator_network toneIndigo
```

## Components

### Operator client

- [MAUI client](https://github.com/rasta-mouse/sharpc2/blob/main/Client/MainPage.xaml.cs): `Client/MainPage.xaml.cs`
- [API client](https://github.com/rasta-mouse/sharpc2/blob/main/Client/Services/SharpC2Api.cs): `Client/Services/SharpC2Api.cs`
- [UI models](https://github.com/rasta-mouse/sharpc2/blob/main/Client/Models/Drones/Drone.cs): `Client/Models/Drones/Drone.cs`

### Team Server

- [Authentication API](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/AuthenticationController.cs): `TeamServer/Controllers/AuthenticationController.cs`
- [Handler API](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/HandlersController.cs): `TeamServer/Controllers/HandlersController.cs`
- [Task API](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/TasksController.cs): `TeamServer/Controllers/TasksController.cs`
- [Drone API](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/DronesController.cs): `TeamServer/Controllers/DronesController.cs`
- [Payload API](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/PayloadsController.cs): `TeamServer/Controllers/PayloadsController.cs`
- [Pivot API](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Controllers/PivotsController.cs): `TeamServer/Controllers/PivotsController.cs`
- [Management APIs](https://github.com/rasta-mouse/sharpc2/tree/main/TeamServer/Controllers): `TeamServer/Controllers`
- [Server services](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/ServerService.cs): `TeamServer/Services/ServerService.cs`
- [Task service](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/TaskService.cs): `TeamServer/Services/TaskService.cs`
- [Drone service](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/DroneService.cs): `TeamServer/Services/DroneService.cs`
- [Handler service](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/HandlerService.cs): `TeamServer/Services/HandlerService.cs`
- [Payload service](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/PayloadService.cs): `TeamServer/Services/PayloadService.cs`
- [Pivot services](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/ReversePortForwardService.cs): `TeamServer/Services/ReversePortForwardService.cs`
- [Authentication service](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/AuthenticationService.cs): `TeamServer/Services/AuthenticationService.cs`
- [Persistent state](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/DatabaseService.cs): `TeamServer/Services/DatabaseService.cs`
- [HTTP transport](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Handlers/HttpHandlerController.cs): `TeamServer/Handlers/HttpHandlerController.cs`
- [Live notifications](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Hubs/NotificationHub.cs): `TeamServer/Hubs/NotificationHub.cs`
- [Events and webhooks](https://github.com/rasta-mouse/sharpc2/blob/main/TeamServer/Services/EventService.cs): `TeamServer/Services/EventService.cs`

### Drone runtime

- [Drone entry](https://github.com/rasta-mouse/sharpc2/blob/main/Drone/Program.cs): `Drone/Program.cs`
- [Command runtime](https://github.com/rasta-mouse/sharpc2/blob/main/Drone/Drone.cs): `Drone/Drone.cs`
- [Command set](https://github.com/rasta-mouse/sharpc2/blob/main/Drone/Commands/DroneCommand.cs): `Drone/Commands/DroneCommand.cs`
- [Communications](https://github.com/rasta-mouse/sharpc2/blob/main/Drone/CommModules/CommModule.cs): `Drone/CommModules/CommModule.cs`
- [Stagers](https://github.com/rasta-mouse/sharpc2/blob/main/Stagers/ExeStager/Program.cs): `Stagers/ExeStager/Program.cs`

### External links

- [External C2 controller](https://github.com/rasta-mouse/sharpc2/blob/main/ExternalC2/ExternalC2.Net/Server/ServerController.cs): `ExternalC2/ExternalC2.Net/Server/ServerController.cs`
- [External drone bridge](https://github.com/rasta-mouse/sharpc2/blob/main/ExternalC2/ExternalC2.Net/Client/DroneController.cs): `ExternalC2/ExternalC2.Net/Client/DroneController.cs`

### Other components

- **Operator**
- **Network peers**

## Connections

- Operator → MAUI client: operates
- MAUI client → API client: requests
- API client → Authentication API: authenticates
- Authentication API → Authentication service: verifies credentials
- API client → Handler API: manages handlers
- API client → Task API: submits tasks
- API client → Drone API: views drones
- API client → Payload API: requests payloads
- API client → Pivot API: manages pivots
- API client → Management APIs: manages resources
- MAUI client → UI models: presents data
- Handler API → Handler service: manages handlers
- Handler API → Live notifications: announces changes
- Task API → Task service: queues tasks
- Drone API → Drone service: manages drones
- Payload API → Payload service: generates payloads
- Pivot API → Pivot services: manages pivots
- Pivot API → Task service: caches drone frames
- Server services → Persistent state: persists state
- HTTP transport → Server services: handles frames
- HTTP transport → Network peers: receives implant traffic
- Server services → Events and webhooks: publishes events
- Drone entry → Command runtime: starts
- Command runtime → Communications: uses transport
- Command runtime → Command set: executes commands
- Stagers → Drone entry: launches
- Network peers → Drone entry: deploys
- External C2 controller → Network peers: relays frames
- External drone bridge → Command runtime: loads payload
