> For the complete documentation index, see [llms.txt](https://adaptix-framework.gitbook.io/adaptix-framework/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://adaptix-framework.gitbook.io/adaptix-framework/development/teamserver-interface.md).

# Teamserver Interface

Documentation for the `Teamserver` interface used in plugins (extenders) for interacting with the Adaptix C2 server.

## Architecture

### General Diagram

<figure><img src="https://2104178602-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FS8p8XLFtLmf0NkofQvoa%2Fuploads%2FjY1RPez8t19giU9nCXj5%2F01.png?alt=media&amp;token=0ca83a49-705f-4358-9984-66466475e73b" alt=""><figcaption></figcaption></figure>

```
┌──────────────────────────────────────────────────────────────────────────────────────┐
│                                    ADAPTIX SERVER                                    │
├──────────────────────────────────────────────────────────────────────────────────────┤
│                                                                                      │
│  ┌────────────────────────────────────────────────────────────────────────────────┐  │
│  │                                TEAMSERVER CORE                                 │  │
│  ├────────────────────────────────────────────────────────────────────────────────┤  │
│  │                                                                                │  │
│  │  ┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐           │  │
│  │  │   TsConnector   │     │  MessageBroker  │     │  EventManager   │           │  │
│  │  │  (HTTP/WS API)  │────>│   (WebSocket)   │     │   (Pre/Post)    │           │  │
│  │  │    gin-gonic    │     │    broadcast    │     │      Hooks      │           │  │
│  │  └────────┬────────┘     └────────┬────────┘     └────────┬────────┘           │  │
│  │           │                       │                       │                    │  │
│  │           V                       V                       V                    │  │
│  │  ┌──────────────────────────────────────────────────────────────────────────┐  │  │
│  │  │                           TEAMSERVER INTERFACE                           │  │  │
│  │  │                                                                          │  │  │
│  │  │ TsAgent*      TsTask*         TsTunnel*    TsTerminal*   TsListener*     │  │  │
│  │  │ TsFrame*      TsDownload*     TsUpload*    TsPayload*    TsScreenshot*   │  │  │
│  │  │ TsTarget*     TsCredential*   TsPivot*     TsGroup*      TsEvent*        │  │  │
│  │  │ TsAxScript*   TsPlugin*       TsChat*      TsLog*        TsConsole*      │  │  │
│  │  │ TsEndpoint*   TsExtenderData* TsClientGui* TsClient*                     │  │  │
│  │  │                                                                          │  │  │
│  │  └──────────────────────────────────────────────────────────────────────────┘  │  │
│  │           │                       │                       │                    │  │
│  │           V                       V                       V                    │  │
│  │  ┌─────────────────┐  ┌─────────────────┐  ┌────────────────────────────────┐  │  │
│  │  │   TaskManager   │  │  TunnelManager  │  │         DBMS (SQLite)          │  │  │
│  │  │                 │  │                 │  │                                │  │  │
│  │  │  - task/browser │  │ - Tunnels Map   │  │     - Agents, Listeners        │  │  │
│  │  │  - job/tunnel   │  │ - Channels Map  │  │     - Tasks, Downloads         │  │  │
│  │  │  - HostedQueue  │  │ - pause/resume  │  │     - Uploads, Payloads        │  │  │
│  │  │                 │  │  - BIND + pool  │  │     - Screenshots              │  │  │
│  │  └─────────────────┘  └─────────────────┘  │     - Credentials, Targets     │  │  │
│  │  ┌─────────────────┐  ┌─────────────────┐  │     - Console, Chat            │  │  │
│  │  │  FrameManager   │  │  ScriptManager  │  │     - Groups, Pivots           │  │  │
│  │  │                 │  │    (AxScript)   │  │     - Tunnels, Events          │  │  │
│  │  │  - offset/chunk │  │                 │  │     - ExtenderData             │  │  │
│  │  │  - stream       │  │ - Server hooks  │  │     - IdCounters               │  │  │
│  │  │  - sticky down  │  │ - Commands      │  └────────────────────────────────┘  │  │
│  │  └─────────────────┘  │ - Handlers      │                                      │  │
│  │  ┌─────────────────┐  └─────────────────┘                                      │  │
│  │  │   LogManager    │                                                           │  │
│  │  │                 │                                                           │  │
│  │  │   - 5000 ring   │                                                           │  │
│  │  │   - WS batch    │                                                           │  │
│  │  └─────────────────┘                                                           │  │
│  │                                                                                │  │
│  └────────────────────────────────────────────────────────────────────────────────┘  │
│                                          │                                           │
│                                          V                                           │
│  ┌────────────────────────────────────────────────────────────────────────────────┐  │
│  │                                EXTENDER MANAGER                                │  │
│  ├────────────────────────────────────────────────────────────────────────────────┤  │
│  │                                                                                │  │
│  │  LoadPlugins()                                                                 │  │
│  │                                                                                │  │
│  │  ├──> LoadPluginListener()  ->  PluginListener                                 │  │
│  │  ├──> LoadPluginAgent()     ->  PluginAgent                                    │  │
│  │  └──> LoadPluginService()   ->  PluginService                                  │  │
│  │                                                                                │  │
│  │  ┌─────────────┐       ┌─────────────┐       ┌─────────────┐                   │  │
│  │  │     .so     │       │   config    │       │   ax_file   │                   │  │
│  │  │   plugin    │       │   .yaml     │       │    .axs     │                   │  │
│  │  └─────────────┘       └─────────────┘       └─────────────┘                   │  │
│  │                                                                                │  │
│  │  Service: ax_file is optional. service_config goes to InitPlugin.              │  │
│  │                                                                                │  │
│  └────────────────────────────────────────────────────────────────────────────────┘  │
│                                          │                                           │
│                                          V                                           │
│  ┌────────────────────────────────────────────────────────────────────────────────┐  │
│  │                             IN-MEMORY DATA STORES                              │  │
│  ├────────────────────────────────────────────────────────────────────────────────┤  │
│  │                                                                                │  │
│  │  ┌───────────┐  ┌───────────┐  ┌───────────┐  ┌───────────┐  ┌───────────┐     │  │
│  │  │  Agents   │  │ Listeners │  │ Downloads │  │  Uploads  │  │ Terminals │     │  │
│  │  │   (Map)   │  │   (Map)   │  │   (Map)   │  │   (Map)   │  │   (Map)   │     │  │
│  │  └───────────┘  └───────────┘  └───────────┘  └───────────┘  └───────────┘     │  │
│  │                                                                                │  │
│  │  ┌───────────┐  ┌───────────┐  ┌───────────┐  ┌───────────┐                    │  │
│  │  │  Pivots   │  │  Groups   │  │ Builders  │  │   OTPs    │                    │  │
│  │  │  (Slice)  │  │   (Map)   │  │   (Map)   │  │   (Map)   │                    │  │
│  │  └───────────┘  └───────────┘  └───────────┘  └───────────┘                    │  │
│  │                                                                                │  │
│  └────────────────────────────────────────────────────────────────────────────────┘  │
│                                                                                      │
└──────────────────────────────────────────────────────────────────────────────────────┘
```

### Teamserver Components

<table data-search="false"><thead><tr><th width="171">Component</th><th width="171">File</th><th>Description</th></tr></thead><tbody><tr><td><strong>TsConnector</strong></td><td><code>connector.go</code></td><td>HTTP/WebSocket server (gin-gonic), routing</td></tr><tr><td><strong>MessageBroker</strong></td><td><code>mgr_broker.go</code></td><td>WebSocket client management, broadcast, category subscriptions</td></tr><tr><td><strong>TaskManager</strong></td><td><code>mgr_task.go</code></td><td>Handlers for task, browser, job, and tunnel. Each agent keeps its own priority queue</td></tr><tr><td><strong>TunnelManager</strong></td><td><code>mgr_tunnel.go</code></td><td>Tunnels and channels, pause/resume, BIND, buffer pool, stats</td></tr><tr><td><strong>FrameManager</strong></td><td><code>mgr_frame.go</code></td><td>Byte-offset, chunk-index, and stream reassembly</td></tr><tr><td><strong>LogManager</strong></td><td><code>mgr_logs.go</code></td><td>5000-entry ring buffer and a WebSocket batch</td></tr><tr><td><strong>EventManager</strong></td><td><code>eventing/</code></td><td>Pre/Post hooks, priority, mutes</td></tr><tr><td><strong>DBMS</strong></td><td><code>database/</code></td><td>SQLite. Agents, listeners, tasks, downloads, uploads, payloads, screenshots, credentials, targets, console, chat, pivots, tunnels, groups, event handlers, extender data</td></tr><tr><td><strong>Extender</strong></td><td><code>extender/</code></td><td><code>LoadPlugins</code> reads a yaml config and opens the <code>.so</code> + its <code>ax_file</code></td></tr><tr><td><strong>ScriptManager</strong></td><td><code>axscript/</code></td><td>Server-side AxScript: hooks, commands, event handlers</td></tr></tbody></table>

### Extender Types

<table><thead><tr><th width="125">Type</th><th width="458">Description</th><th>Interface</th></tr></thead><tbody><tr><td><strong>Listener</strong></td><td>Accepts connections from agents, establishes protocol</td><td><code>PluginListener</code></td></tr><tr><td><strong>Agent</strong></td><td>Agent logic: generation, parsing, commands</td><td><code>PluginAgent</code></td></tr><tr><td><strong>Service</strong></td><td>Service plugins: notifications, integrations</td><td><code>PluginService</code></td></tr></tbody></table>

***
