# letho1608/c2c_botnet architecture

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

- Interactive diagram: https://gitdiagram.com/letho1608/c2c_botnet
- Repository: https://github.com/letho1608/c2c_botnet

## Overview

##### Project Type & Purpose
- Type: Full-stack C2 (Command-and-Control) Botnet framework, split into server and client (bot) sides.
- Purpose: Research and defensive training—implements C2 server, multi-bot management, client payload modules, GUI consoles, network exploitation and persistence features.

##### Top-Level Components
A. User Interfaces (UI Layer)
– Console UI (core/console.py) – CLI for issuing commands
– Desktop GUI (gui/interface.py) – Local GUI app
– Web GUI (gui/web_interface.py + templates/dashboard.html) – HTTP interface
B. Core Server Logic (Application Layer)
– server.py / core/server.py – Listens for bot connections over encrypted channels (SSH/tls)
– core/console.py – Command parser & dispatcher
– core/host_manager.py – Tracks live bots and metadata
– core/exploit_builder.py – Builds payloads/exploits on demand
– core/multiple_servers.py – Supports multi-server orchestration
– core/plugin_system.py – Dynamically loads and manages plugins (commands, payloads)
– core/reporting.py – Aggregates and formats collected data
C. Bot Manager (botnet/manager.py)
– Higher-level orchestration of connected bots: grouping, scheduling, pipelines
D. Client/Bot Side (Client Layer)
– client.py – Entry point; negotiates encrypted channel back to C2
– payload/modules/*.py – Modular payloads (keylogging, screenshot, persistence, lateral movement, etc.)
– network/*.py – Client-side network discovery, scanning, lateral movement, spreading
E. Utilities & Security (Infrastructure Layer)
– utils/*.py – Crypto, code-obfuscation, anti-VM, cert-pinning, memory/network protection, logging, integrity checks

##### Data Stores & External Services
– (Optional) A persistent store for logs / historical bot data (not explicitly in file tree; could be a flat-file or embedded DB)
– SSH / TLS channel (external) for secure C2 communications

##### Relationships & Data Flows
- Admin user → (via Console UI or GUI/Web UI) → Core Server (command dispatcher)
- Core Server → Plugin System → Appropriate Handler (exploit builder, host manager, reporting)
- Core Server → Encrypted Channel → Bots
- Bots → Payload Modules & Network Modules → Execute on Endpoint → Return data back via encrypted channel
- Core Server → Reporting → UI for visualization
- Bot Manager → Coordinates multi-bot tasks (spreading, scheduling)

##### Key Architectural Patterns & Design Principles
– Layered Architecture: UI / Application Logic / Bot/Network Modules / Utils
– Plugin Pattern: core/plugin_system dynamically loads modules for new commands or payloads
– Modular Payloads: each client-side capability is its own module under payload/modules
– MVC (for Web UI): gui/web_interface.py (Controller) + templates/dashboard.html (View)
– Single-Process Multi-Threading or Async I/O (likely in core/server.py and client.py)

##### Final Checklist
– Clearly separate Server vs. Client domains
– Show dynamic plugin extension point in core/plugin_system

## Diagram (Mermaid)

```mermaid
graph TB
    subgraph "UI Layer"
        Console["Console UI\n(core/console.py)"]:::ui
        DesktopGUI["Desktop GUI\n(gui/interface.py)"]:::ui
        WebController["Web GUI Controller\n(gui/web_interface.py)"]:::ui
        WebView["Web View Template\n(gui/templates/dashboard.html)"]:::ui
    end

    subgraph "Core Logic Layer"
        Server["Core Server\n(core/server.py)"]:::core
        CommandParser["Command Parser\n(core/console.py)"]:::core
        HostManager["Host Manager\n(core/host_manager.py)"]:::core
        ExploitBuilder["Exploit Builder\n(core/exploit_builder.py)"]:::core
        MultiServer["Multi-Server Orchestration\n(core/multiple_servers.py)"]:::core
        PluginSystem["Plugin System\n(core/plugin_system.py)"]:::core
        Reporting["Reporting\n(core/reporting.py)"]:::core
    end

    BotManager["Bot Manager\n(botnet/manager.py)"]:::bot

    subgraph "Client Layer"
        ClientEntry["Client Entry Point\n(client.py)"]:::client
        PayloadModules["Payload Modules\n(payload/modules/*.py)"]:::client
        NetworkModules["Network Modules\n(network/*.py)"]:::client
    end

    subgraph "Utilities Layer"
        Crypto["Cryptography\n(utils/crypto.py\nutils/advanced_crypto.py)"]:::util
        Obfuscation["Code Obfuscation\n(utils/code_obfuscation.py)"]:::util
        AntiVM["Anti-VM & Protection\n(utils/anti_vm.py\nutils/advanced_protection.py)"]:::util
        CertPin["Certificate Pinning\n(utils/cert_pinning.py)"]:::util
        MemNetProt["Memory/Network Protection\n(utils/memory_protection.py\nutils/network_protection.py)"]:::util
        Integrity["Integrity Checks\n(utils/integrity.py)"]:::util
        Logger["Logging\n(utils/logger.py)"]:::util
        SecManager["Security Management\n(utils/security_manager.py)"]:::util
    end

    ExternalCloud["C2 Network / Internet"]:::cloud

    %% Control and Data Flows
    Console -->|commands| CommandParser
    DesktopGUI -->|commands| CommandParser
    WebController -->|REST API| Server
    WebController -->|commands| CommandParser
    WebView -->|views| WebController

    CommandParser -->|dispatch| PluginSystem
    Server -->|register/load| PluginSystem
    PluginSystem -->|build/exploit| ExploitBuilder
    PluginSystem -->|manage hosts| HostManager
    PluginSystem -->|aggregate data| Reporting

    Server -->|SSH/TLS| ExternalCloud
    ExternalCloud -->|encrypted channel| ClientEntry
    ClientEntry -->|load| PayloadModules
    ClientEntry -->|load| NetworkModules

    ClientEntry -->|exec modules| PayloadModules
    ClientEntry -->|exec modules| NetworkModules
    PayloadModules -->|data| ExternalCloud
    NetworkModules -->|data| ExternalCloud

    ExternalCloud -->|encrypted data| Server
    Server -->|format reports| Reporting
    Reporting -->|display| WebView

    Server -->|orchestrate| BotManager
    BotManager -->|coordinate| PluginSystem

    %% Utility Dependencies
    Server --> Crypto
    Server --> Obfuscation
    Server --> AntiVM
    Server --> CertPin
    Server --> MemNetProt
    Server --> Integrity
    Server --> Logger
    Server --> SecManager

    ClientEntry --> Crypto
    ClientEntry --> Obfuscation
    ClientEntry --> AntiVM
    ClientEntry --> CertPin
    ClientEntry --> MemNetProt
    ClientEntry --> Integrity
    ClientEntry --> Logger
    ClientEntry --> SecManager

    %% Click Events
    click Console "https://github.com/letho1608/c2c_botnet/blob/main/core/console.py"
    click DesktopGUI "https://github.com/letho1608/c2c_botnet/blob/main/gui/interface.py"
    click WebController "https://github.com/letho1608/c2c_botnet/blob/main/gui/web_interface.py"
    click WebView "https://github.com/letho1608/c2c_botnet/blob/main/gui/templates/dashboard.html"
    click Server "https://github.com/letho1608/c2c_botnet/blob/main/core/server.py"
    click CommandParser "https://github.com/letho1608/c2c_botnet/blob/main/core/console.py"
    click HostManager "https://github.com/letho1608/c2c_botnet/blob/main/core/host_manager.py"
    click ExploitBuilder "https://github.com/letho1608/c2c_botnet/blob/main/core/exploit_builder.py"
    click MultiServer "https://github.com/letho1608/c2c_botnet/blob/main/core/multiple_servers.py"
    click PluginSystem "https://github.com/letho1608/c2c_botnet/blob/main/core/plugin_system.py"
    click Reporting "https://github.com/letho1608/c2c_botnet/blob/main/core/reporting.py"
    click BotManager "https://github.com/letho1608/c2c_botnet/blob/main/botnet/manager.py"
    click ClientEntry "https://github.com/letho1608/c2c_botnet/blob/main/client.py"
    click PayloadModules "https://github.com/letho1608/c2c_botnet/tree/main/payload/modules/"
    click NetworkModules "https://github.com/letho1608/c2c_botnet/tree/main/network/"
    click Crypto "https://github.com/letho1608/c2c_botnet/blob/main/utils/crypto.py"
    click Obfuscation "https://github.com/letho1608/c2c_botnet/blob/main/utils/code_obfuscation.py"
    click AntiVM "https://github.com/letho1608/c2c_botnet/blob/main/utils/anti_vm.py"
    click CertPin "https://github.com/letho1608/c2c_botnet/blob/main/utils/cert_pinning.py"
    click MemNetProt "https://github.com/letho1608/c2c_botnet/blob/main/utils/memory_protection.py"
    click Integrity "https://github.com/letho1608/c2c_botnet/blob/main/utils/integrity.py"
    click Logger "https://github.com/letho1608/c2c_botnet/blob/main/utils/logger.py"
    click SecManager "https://github.com/letho1608/c2c_botnet/blob/main/utils/security_manager.py"

    %% Styles
    classDef ui fill:#ADD8E6,stroke:#000
    classDef core fill:#90EE90,stroke:#000
    classDef bot fill:#FFA500,stroke:#000
    classDef client fill:#FFA500,stroke:#000
    classDef util fill:#D3D3D3,stroke:#000
    classDef cloud fill:#87CEEB,stroke:#000,stroke-dasharray: 5 5
```
