# k4n3co/lab-rats architecture

> Architecture diagram of the GitHub repository k4n3co/lab-rats, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/k4n3co/lab-rats
- Repository: https://github.com/k4n3co/lab-rats

## Overview

This repository describes an Android remote-administration tool with an Android agent, a web C2 interface/relay, and an APK customization workflow. The README also documents direct IPv6 access, authenticated access, device monitoring/control, and decoy identities. The supplied excerpts are incomplete, so this is a high-level product map; it avoids inferring detailed command routes or execution chains not established by the evidence.

Main entry points: [`app/src/main/java/com/labs/labrats/WorkManager_Sync.java`](https://github.com/k4n3co/lab-rats/blob/main/app/src/main/java/com/labs/labrats/WorkManager_Sync.java) (Background agent), [`apk-builder`](https://github.com/k4n3co/lab-rats/tree/main/apk-builder) (APK builder), [`c2-server/server.js`](https://github.com/k4n3co/lab-rats/blob/main/c2-server/server.js) (C2 relay), [`app/src/main/java/com/labs/labrats/modules`](https://github.com/k4n3co/lab-rats/tree/main/app/src/main/java/com/labs/labrats/modules) (Device features)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_build["Payload setup"]
  node_builder["APK builder"]
end

subgraph group_agent["Android agent"]
  node_agent_core["Background agent"]
  node_device_features["Device features"]
  node_decoy["Decoy identity<br/>[DecoyActivity.java]"]
  node_direct_server["Direct device access"]
end

subgraph group_control["C2 access"]
  node_relay["C2 relay<br/>[server.js]"]
  node_dashboard["Web dashboard<br/>[script.js]"]
  node_auth["Relay authentication<br/>[auth.js]"]
end

node_operator(("Operator"))
node_device(("Android device"))

node_operator -->|"configures build"| node_builder
node_builder -->|"produces APK"| node_device
node_device -.->|"runs agent"| node_agent_core
node_agent_core -.->|"exposes capabilities"| node_device_features
node_agent_core -->|"starts service"| node_decoy
node_operator -->|"connects directly"| node_direct_server
node_operator -->|"uses hosted relay"| node_relay
node_operator -->|"uses dashboard"| node_dashboard
node_relay -->|"protects routes"| node_auth

click node_builder "https://github.com/k4n3co/lab-rats/tree/main/apk-builder"
click node_agent_core "https://github.com/k4n3co/lab-rats/blob/main/app/src/main/java/com/labs/labrats/WorkManager_Sync.java"
click node_device_features "https://github.com/k4n3co/lab-rats/tree/main/app/src/main/java/com/labs/labrats/modules"
click node_decoy "https://github.com/k4n3co/lab-rats/blob/main/app/src/main/java/com/labs/labrats/DecoyActivity.java"
click node_direct_server "https://github.com/k4n3co/lab-rats/blob/main/app/src/main/java/com/labs/labrats/FirebaseConfig.java"
click node_relay "https://github.com/k4n3co/lab-rats/blob/main/c2-server/server.js"
click node_dashboard "https://github.com/k4n3co/lab-rats/blob/main/c2-server/c2/script.js"
click node_auth "https://github.com/k4n3co/lab-rats/blob/main/c2-server/middleware/auth.js"

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_builder toneBlue
class node_agent_core,node_device_features,node_decoy,node_direct_server toneAmber
class node_relay,node_dashboard,node_auth toneMint
class node_operator,node_device toneIndigo
```

## Components

### Payload setup

- [APK builder](https://github.com/k4n3co/lab-rats/tree/main/apk-builder): `apk-builder`

### Android agent

- [Background agent](https://github.com/k4n3co/lab-rats/blob/main/app/src/main/java/com/labs/labrats/WorkManager_Sync.java): `app/src/main/java/com/labs/labrats/WorkManager_Sync.java`
- [Device features](https://github.com/k4n3co/lab-rats/tree/main/app/src/main/java/com/labs/labrats/modules): `app/src/main/java/com/labs/labrats/modules`
- [Decoy identity](https://github.com/k4n3co/lab-rats/blob/main/app/src/main/java/com/labs/labrats/DecoyActivity.java): `app/src/main/java/com/labs/labrats/DecoyActivity.java`
- [Direct device access](https://github.com/k4n3co/lab-rats/blob/main/app/src/main/java/com/labs/labrats/FirebaseConfig.java): `app/src/main/java/com/labs/labrats/FirebaseConfig.java`

### C2 access

- [C2 relay](https://github.com/k4n3co/lab-rats/blob/main/c2-server/server.js): `c2-server/server.js`
- [Web dashboard](https://github.com/k4n3co/lab-rats/blob/main/c2-server/c2/script.js): `c2-server/c2/script.js`
- [Relay authentication](https://github.com/k4n3co/lab-rats/blob/main/c2-server/middleware/auth.js): `c2-server/middleware/auth.js`

### Other components

- **Operator**
- **Android device**

## Connections

- Operator → APK builder: configures build
- APK builder → Android device: produces APK
- Android device → Background agent: runs agent
- Background agent → Device features: exposes capabilities
- Background agent → Decoy identity: starts service (evidence: `app/src/main/java/com/labs/labrats/DecoyActivity.java`)
- Operator → Direct device access: connects directly
- Operator → C2 relay: uses hosted relay
- Operator → Web dashboard: uses dashboard
- C2 relay → Relay authentication: protects routes (evidence: `c2-server/server.js`)
