# Teamserver Interface

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

## Architecture

### General Diagram

<figure><img src="/files/egHU4XBFA1x7BE3QZ0sL" 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*       │    │  │
│  │  │   TsDownload* TsScreenshot* TsTarget* TsCredential*  TsEndpoint*       │    │  │
│  │  │   TsEventHook* TsExtenderData* TsClientGui* TsPivot* TsService*        │    │  │
│  │  │   TsAxScript*                                                          │    │  │
│  │  │                                                                        │    │  │
│  │  └────────────────────────────────────────────────────────────────────────┘    │  │
│  │           │                       │                       │                    │  │
│  │           V                       V                       V                    │  │
│  │  ┌─────────────────┐     ┌─────────────────┐     ┌─────────────────┐           │  │
│  │  │   TaskManager   │     │  TunnelManager  │     │      DBMS       │           │  │
│  │  │                 │     │                 │     │    (SQLite)     │           │  │
│  │  │  - Task Queue   │     │  - Tunnels Map  │     │                 │           │  │
│  │  │  - Job Handler  │     │  - Channels Map │     │  - Listeners    │           │  │
│  │  │  - Tunnel Task  │     │  - Buffer Pool  │     │  - Agents       │           │  │
│  │  │  - Browser Task │     │  - Stats        │     │  - Tasks        │           │  │
│  │  └─────────────────┘     └─────────────────┘     │  - Downloads    │           │  │
│  │                                                  │  - Screenshots  │           │  │
│  │  ┌─────────────────┐                             │  - Credentials  │           │  │
│  │  │  ScriptManager  │                             │  - Targets      │           │  │
│  │  │  (AxScript)     │                             │  - Console      │           │  │
│  │  │  - Server hooks │                             │  - Chat         │           │  │
│  │  │  - Commands     │                             └─────────────────┘           │  │
│  │  └─────────────────┘                                                           │  │
│  │                                                                                │  │
│  └────────────────────────────────────────────────────────────────────────────────┘  │
│                                         │                                            │
│                                         V                                            │
│  ┌────────────────────────────────────────────────────────────────────────────────┐  │
│  │                            EXTENDER MANAGER                                    │  │
│  ├────────────────────────────────────────────────────────────────────────────────┤  │
│  │                                                                                │  │
│  │   LoadPlugins() ───┬──> LoadPluginListener() ──> PluginListener Interface      │  │
│  │                    ├──> LoadPluginAgent()    ──> PluginAgent Interface         │  │
│  │                    └──> LoadPluginService()  ──> PluginService Interface       │  │
│  │                                                                                │  │
│  │   ┌─────────────┐       ┌─────────────┐       ┌─────────────┐                  │  │
│  │   │   .so       │       │  config     │       │   .axs      │                  │  │
│  │   │   plugin    │       │  .yaml      │       │   UI file   │                  │  │
│  │   └─────────────┘       └─────────────┘       └─────────────┘                  │  │
│  │                                                                                │  │
│  └────────────────────────────────────────────────────────────────────────────────┘  │
│                                         │                                            │
│                                         V                                            │
│  ┌────────────────────────────────────────────────────────────────────────────────┐  │
│  │                          IN-MEMORY DATA STORES                                 │  │
│  ├────────────────────────────────────────────────────────────────────────────────┤  │
│  │                                                                                │  │
│  │   ┌───────────┐  ┌───────────┐  ┌───────────┐  ┌───────────┐  ┌───────────┐    │  │
│  │   │  Agents   │  │ Listeners │  │ Downloads │  │ Terminals │  │  Pivots   │    │  │
│  │   │  (Map)    │  │  (Map)    │  │   (Map)   │  │  (Map)    │  │  (Slice)  │    │  │
│  │   └───────────┘  └───────────┘  └───────────┘  └───────────┘  └───────────┘    │  │
│  │                                                                                │  │
│  │   ┌───────────┐  ┌───────────┐                                                 │  │
│  │   │  Builders │  │   OTPs    │                                                 │  │
│  │   │   (Map)   │  │   (Map)   │                                                 │  │
│  │   └───────────┘  └───────────┘                                                 │  │
│  │                                                                                │  │
│  └────────────────────────────────────────────────────────────────────────────────┘  │
│                                                                                      │
└──────────────────────────────────────────────────────────────────────────────────────┘
```

### Teamserver Components

<table><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</td></tr><tr><td><strong>TaskManager</strong></td><td><code>mgr_task.go</code></td><td>Task queue, task type handlers</td></tr><tr><td><strong>TunnelManager</strong></td><td><code>mgr_tunnel.go</code></td><td>SOCKS/PortFwd tunnels, channels, buffer pool</td></tr><tr><td><strong>EventManager</strong></td><td><code>eventing/</code></td><td>Pre/Post hooks, async events</td></tr><tr><td><strong>DBMS</strong></td><td><code>database/</code></td><td>SQLite, WAL mode, persistent storage</td></tr><tr><td><strong>Extender</strong></td><td><code>extender/</code></td><td>.so plugin loading, interface registration</td></tr><tr><td><strong>ScriptManager</strong></td><td><code>axscript/</code></td><td>Server-side AxScript engine, hooks and commands</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>

***


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://adaptix-framework.gitbook.io/adaptix-framework/development/teamserver-interface.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
