# fodiyes/ghostload architecture

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

- Interactive diagram: https://gitdiagram.com/fodiyes/ghostload
- Repository: https://github.com/fodiyes/ghostload

## Overview

RustLoad is a Rust client and PHP server for retrieving deployment metadata and protected agent files. The documented workflow runs client-side environment checks, requests a profile from the API, then downloads and processes configured files. The README also describes traffic masking, authenticated requests, key derivation, and optional persistence. This is a high-level component map; unsampled modules and unverified connections are not expanded.

Main entry points: [`backend/public/api.php`](https://github.com/fodiyes/ghostload/blob/main/backend/public/api.php) (API endpoint), [`loader/src/main.rs`](https://github.com/fodiyes/ghostload/blob/main/loader/src/main.rs) (Client workflow), [`loader/src/downloader.rs`](https://github.com/fodiyes/ghostload/blob/main/loader/src/downloader.rs) (Metadata and download), [`loader/src/encrypted_container.rs`](https://github.com/fodiyes/ghostload/blob/main/loader/src/encrypted_container.rs) (Encrypted container)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Rust Client"]
  node_loader["Client workflow<br/>[main.rs]"]
  node_checks["Runtime checks"]
  node_anti_debug["Debug checks<br/>[anti_debug.rs]"]
  node_persistence["Optional persistence"]
  node_downloader["Metadata and download<br/>[downloader.rs]"]
  node_container["Encrypted container"]
  node_executor["Payload execution<br/>[executor.rs]"]
  node_transport["Traffic encoding<br/>[obfuscation.rs]"]
end

subgraph group_server["PHP Server"]
  node_api["API endpoint<br/>[api.php]"]
  node_bootstrap["Server services<br/>[Bootstrap.php]"]
  node_config["Server configuration<br/>[Config.php]"]
  node_security["Request security<br/>[Security.php]"]
  node_keyderivation["File key derivation<br/>[KeyDerivation.php]"]
  node_encoding["Response encoding<br/>[Obfuscator.php]"]
  node_fingerprint["Response masking"]
  node_state[("Security state")]
end

subgraph group_deployment["Deployment Inputs"]
  node_deployments["Deployment profiles<br/>[deployments.php]"]
  node_payload_tool["Payload preparation<br/>[encrypt_payload.py]"]
end

node_operator(("Authorized operator"))
node_file_host["Configured file host"]

node_operator -->|"starts"| node_loader
node_loader -->|"runs checks"| node_checks
node_loader -->|"runs checks"| node_anti_debug
node_loader -->|"installs optionally"| node_persistence
node_loader -->|"requests metadata"| node_downloader
node_downloader -->|"requests profile"| node_api
node_api -->|"initializes"| node_bootstrap
node_bootstrap -->|"loads"| node_config
node_api -->|"validates request"| node_security
node_security -->|"stores limits and nonces"| node_state
node_api -->|"looks up profile"| node_deployments
node_api -->|"derives file keys"| node_keyderivation
node_api -->|"encodes response"| node_encoding
node_api -->|"masks response"| node_fingerprint
node_downloader -->|"decodes metadata"| node_transport
node_downloader -->|"fetches configured files"| node_file_host
node_downloader -.->|"processes downloaded data"| node_container
node_container -.->|"provides payload"| node_executor
node_operator -->|"prepares deployment"| node_payload_tool
node_payload_tool -->|"supplies profile metadata"| node_deployments

click node_loader "https://github.com/fodiyes/ghostload/blob/main/loader/src/main.rs"
click node_checks "https://github.com/fodiyes/ghostload/tree/main/loader/src/anti_analysis"
click node_anti_debug "https://github.com/fodiyes/ghostload/blob/main/loader/src/anti_debug.rs"
click node_persistence "https://github.com/fodiyes/ghostload/blob/main/loader/src/persistence_advanced.rs"
click node_downloader "https://github.com/fodiyes/ghostload/blob/main/loader/src/downloader.rs"
click node_container "https://github.com/fodiyes/ghostload/blob/main/loader/src/encrypted_container.rs"
click node_executor "https://github.com/fodiyes/ghostload/blob/main/loader/src/executor.rs"
click node_transport "https://github.com/fodiyes/ghostload/blob/main/loader/src/obfuscation.rs"
click node_api "https://github.com/fodiyes/ghostload/blob/main/backend/public/api.php"
click node_bootstrap "https://github.com/fodiyes/ghostload/blob/main/backend/core/Bootstrap.php"
click node_config "https://github.com/fodiyes/ghostload/blob/main/backend/core/Config.php"
click node_security "https://github.com/fodiyes/ghostload/blob/main/backend/core/Security.php"
click node_keyderivation "https://github.com/fodiyes/ghostload/blob/main/backend/core/KeyDerivation.php"
click node_encoding "https://github.com/fodiyes/ghostload/blob/main/backend/core/Obfuscator.php"
click node_fingerprint "https://github.com/fodiyes/ghostload/blob/main/backend/core/AntiFingerprint.php"
click node_state "https://github.com/fodiyes/ghostload/tree/main/backend/data"
click node_deployments "https://github.com/fodiyes/ghostload/blob/main/backend/config/deployments.php"
click node_payload_tool "https://github.com/fodiyes/ghostload/blob/main/tools/encrypt_payload.py"

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_loader,node_checks,node_anti_debug,node_persistence,node_downloader,node_container,node_executor,node_transport toneBlue
class node_api,node_bootstrap,node_config,node_security,node_keyderivation,node_encoding,node_fingerprint,node_state toneAmber
class node_deployments,node_payload_tool toneMint
class node_operator,node_file_host toneIndigo
```

## Components

### Rust Client

- [Client workflow](https://github.com/fodiyes/ghostload/blob/main/loader/src/main.rs): `loader/src/main.rs`
- [Runtime checks](https://github.com/fodiyes/ghostload/tree/main/loader/src/anti_analysis): `loader/src/anti_analysis`
- [Debug checks](https://github.com/fodiyes/ghostload/blob/main/loader/src/anti_debug.rs): `loader/src/anti_debug.rs`
- [Optional persistence](https://github.com/fodiyes/ghostload/blob/main/loader/src/persistence_advanced.rs): `loader/src/persistence_advanced.rs`
- [Metadata and download](https://github.com/fodiyes/ghostload/blob/main/loader/src/downloader.rs): `loader/src/downloader.rs`
- [Encrypted container](https://github.com/fodiyes/ghostload/blob/main/loader/src/encrypted_container.rs): `loader/src/encrypted_container.rs`
- [Payload execution](https://github.com/fodiyes/ghostload/blob/main/loader/src/executor.rs): `loader/src/executor.rs`
- [Traffic encoding](https://github.com/fodiyes/ghostload/blob/main/loader/src/obfuscation.rs): `loader/src/obfuscation.rs`

### PHP Server

- [API endpoint](https://github.com/fodiyes/ghostload/blob/main/backend/public/api.php): `backend/public/api.php`
- [Server services](https://github.com/fodiyes/ghostload/blob/main/backend/core/Bootstrap.php): `backend/core/Bootstrap.php`
- [Server configuration](https://github.com/fodiyes/ghostload/blob/main/backend/core/Config.php): `backend/core/Config.php`
- [Request security](https://github.com/fodiyes/ghostload/blob/main/backend/core/Security.php): `backend/core/Security.php`
- [File key derivation](https://github.com/fodiyes/ghostload/blob/main/backend/core/KeyDerivation.php): `backend/core/KeyDerivation.php`
- [Response encoding](https://github.com/fodiyes/ghostload/blob/main/backend/core/Obfuscator.php): `backend/core/Obfuscator.php`
- [Response masking](https://github.com/fodiyes/ghostload/blob/main/backend/core/AntiFingerprint.php): `backend/core/AntiFingerprint.php`
- [Security state](https://github.com/fodiyes/ghostload/tree/main/backend/data): `backend/data`

### Deployment Inputs

- [Deployment profiles](https://github.com/fodiyes/ghostload/blob/main/backend/config/deployments.php): `backend/config/deployments.php`
- [Payload preparation](https://github.com/fodiyes/ghostload/blob/main/tools/encrypt_payload.py): `tools/encrypt_payload.py`

### Other components

- **Authorized operator**
- **Configured file host**

## Connections

- Authorized operator → Client workflow: starts (evidence: `README.md`)
- Client workflow → Runtime checks: runs checks (evidence: `loader/src/main.rs`)
- Client workflow → Debug checks: runs checks (evidence: `loader/src/main.rs`)
- Client workflow → Optional persistence: installs optionally (evidence: `loader/src/main.rs`)
- Client workflow → Metadata and download: requests metadata (evidence: `loader/src/main.rs`)
- Metadata and download → API endpoint: requests profile (evidence: `README.md`)
- API endpoint → Server services: initializes (evidence: `backend/public/api.php`)
- Server services → Server configuration: loads (evidence: `backend/core/Bootstrap.php`)
- API endpoint → Request security: validates request (evidence: `backend/public/api.php`)
- Request security → Security state: stores limits and nonces (evidence: `backend/core/Security.php`)
- API endpoint → Deployment profiles: looks up profile (evidence: `backend/public/api.php`)
- API endpoint → File key derivation: derives file keys (evidence: `backend/public/api.php`)
- API endpoint → Response encoding: encodes response (evidence: `backend/public/api.php`)
- API endpoint → Response masking: masks response (evidence: `backend/public/api.php`)
- Metadata and download → Traffic encoding: decodes metadata (evidence: `loader/src/downloader.rs`)
- Metadata and download → Configured file host: fetches configured files (evidence: `README.md`)
- Metadata and download → Encrypted container: processes downloaded data (evidence: `loader/src/downloader.rs`)
- Encrypted container → Payload execution: provides payload
- Authorized operator → Payload preparation: prepares deployment (evidence: `README.md`)
- Payload preparation → Deployment profiles: supplies profile metadata (evidence: `README.md`)
