# marven11/etherghost architecture

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

- Interactive diagram: https://gitdiagram.com/marven11/etherghost
- Repository: https://github.com/marven11/etherghost

## Overview

##### Main Components
- Backend (Python Server Side)
- Core Module: Represents the business logic that handles webshell operations, encryption/decryption (RSA + AES), custom encoders/decoders, session management, and overall command execution. This is spread across files in the ether_ghost/core, ether_ghost/session_manager.py, and utilities in ether_ghost/utils.
- Session & Webshell Handlers: The sessions folder (with multiple session types like PHP, JSP, Linux one-liners, etc.) indicates a well-structured approach to handling different webshell protocols and payloads. Also included are modules to manage TCP proxies and file transfer statuses.
- Auxiliary Components: The vessel_php sub-directory contains PHP client/server code that aids in communications with the PHP-based webshells. Additionally, there are modules for file transfers and encryption tools.
- Integration and Support: Scripts like run_ether_ghost.py, build.sh, and packaging files (pyinstaller_package.bat, pyproject.toml) point to deployment and integration tools.

- Frontend (Client-side SPA)
- Asset Management: Files like index.html and the various style/script assets used for the web UI are included to support a rich interactive environment.

- Test Environment:
- A dedicated test_environment folder provides sample webshells and test scripts (PHP, JSP, Java, etc.) to validate connection and behavior, ensuring that each webshell type is well-supported.

##### Relationships and Interactions
- The Core module (under ether_ghost/core) handles encryption, custom encoding/decoding, and overall logic. Indicate directional interactions from higher-level API endpoints to the “core” components.
- A note that the system has integration with external tools (like AntSword) – show the connection from the backend to “External Webshell Managers” if needed.

##### Architectural Patterns and Technologies
- Layered or Modular Architecture: The clear separation between core logic, session handling, utilities, and the frontend indicates a modular design.
- Secure Communication: Emphasize the RSA2048 and AES256-CBC encryption layers applied during handshake and data transmission.
- B/S Architecture for remote management: A backend API servicing a frontend SPA.
- Use of third-party tools and frameworks such as Flask/Django (if applicable in the actual Python API layer, though not explicitly visible in the file tree, the modular structure suggests a web framework usage) and Vue (for frontend).

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Frontend Layer
    subgraph "Frontend Layer"
        FE["Frontend (Vue SPA)"]:::frontend
    end

    %% Backend Layer
    subgraph "Backend Layer"
        API["Backend API Gateway"]:::backend
        CORE["Backend Core Module"]:::backend
        SM["Session Manager"]:::backend
        SESSIONS["Session Handlers"]:::backend
        UTILS["Supporting Utilities"]:::backend
        VESSEL["Vessel_PHP Integration"]:::aux
        EXTERNAL["External Webshell Managers"]:::external
    end

    %% Test & Deployment Layer
    subgraph "Test & Deployment"
        TEST["Test Environment"]:::test
        DEPLOY["Deployment Tools"]:::deploy
    end

    %% Connections from Frontend to Backend
    FE -->|"HTTP_Request"| API

    %% Connections within Backend
    API -->|"Process_Request"| CORE
    CORE -->|"Utilizes"| UTILS
    CORE -->|"Calls_SessionManager"| SM
    SM -->|"Manages_Sessions"| SESSIONS
    CORE -->|"Integrates_with"| VESSEL
    API -->|"Communicates_with"| EXTERNAL
    SM -->|"Uses_Utilities"| UTILS

    %% Connection to Test Environment and Deployment
    API -->|"Simulated_Tests"| TEST
    API -->|"Packaging"| DEPLOY

    %% Click Events
    click CORE "https://github.com/marven11/etherghost/tree/main/ether_ghost/core"
    click SM "https://github.com/marven11/etherghost/blob/main/ether_ghost/session_manager.py"
    click SESSIONS "https://github.com/marven11/etherghost/tree/main/ether_ghost/sessions"
    click VESSEL "https://github.com/marven11/etherghost/tree/main/ether_ghost/vessel_php"
    click UTILS "https://github.com/marven11/etherghost/tree/main/ether_ghost/utils"
    click FE "https://github.com/marven11/etherghost/tree/main/frontend"
    click TEST "https://github.com/marven11/etherghost/tree/main/test_environment"

    %% Styles
    classDef frontend fill:#F49AC2,stroke:#A2354D,stroke-width:2px;
    classDef backend fill:#AED6F1,stroke:#2471A3,stroke-width:2px;
    classDef aux fill:#F9E79F,stroke:#B7950B,stroke-width:2px;
    classDef external fill:#D7BDE2,stroke:#8E44AD,stroke-width:2px;
    classDef test fill:#D5F5E3,stroke:#27AE60,stroke-width:2px;
    classDef deploy fill:#D2B4DE,stroke:#6C3483,stroke-width:2px;
```
