# devobass/grevshell architecture

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

- Interactive diagram: https://gitdiagram.com/devobass/grevshell
- Repository: https://github.com/devobass/grevshell

## Overview

grevshell is an educational TCP reverse-shell client/server with command execution and file transfer over a shared authenticated, encrypted protocol. The client connects and exchanges a key, then its prompt loop sends command or file directives; the server dispatches each request, runs commands or handles files, and returns responses. Shared framing serializes packets and encrypts them, while key exchange derives and confirms the session key. The README documents these capabilities; the graph’s implementation links are based on the shown source excerpts.

Main entry points: [`grevclient/client.go`](https://github.com/devobass/grevshell/blob/main/grevclient/client.go) (Client session), [`main.go`](https://github.com/devobass/grevshell/blob/main/main.go) (Request dispatcher), [`grevcore/processing.go`](https://github.com/devobass/grevshell/blob/main/grevcore/processing.go) (Packet framing), [`grevcore/encryption.go`](https://github.com/devobass/grevshell/blob/main/grevcore/encryption.go) (Key exchange)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_client["Client"]
  node_client_session["Client session<br/>[client.go]"]
  node_client_files["Client file I/O<br/>[client.go]"]
end

subgraph group_server["Server"]
  node_server_listener["TCP listener<br/>[main.go]"]
  node_server_dispatch["Request dispatcher<br/>[main.go]"]
  node_command_exec["Command execution<br/>[main.go]"]
  node_server_files["Server file I/O<br/>[main.go]"]
end

subgraph group_shared["Shared protocol"]
  node_key_exchange["Key exchange<br/>[encryption.go]"]
  node_crypto["AES-GCM<br/>[encryption.go]"]
  node_framing["Packet framing<br/>[processing.go]"]
  node_packet_model["Packet model<br/>[headers.go]"]
end

node_operator(("Operator"))

node_operator -->|"enters directives"| node_client_session
node_client_session -->|"exchanges key"| node_key_exchange
node_client_session -->|"sends and receives"| node_framing
node_client_session -->|"reads and writes"| node_client_files
node_client_session -->|"connects over TCP"| node_server_listener
node_server_listener -->|"exchanges key"| node_key_exchange
node_server_listener -->|"dispatches requests"| node_server_dispatch
node_server_dispatch -->|"receives and sends"| node_framing
node_server_dispatch -->|"runs command"| node_command_exec
node_server_dispatch -->|"handles transfers"| node_server_files
node_framing -->|"encrypts and decrypts"| node_crypto
node_framing -->|"assembles and parses"| node_packet_model

click node_client_session "https://github.com/devobass/grevshell/blob/main/grevclient/client.go"
click node_client_files "https://github.com/devobass/grevshell/blob/main/grevclient/client.go"
click node_server_listener "https://github.com/devobass/grevshell/blob/main/main.go"
click node_server_dispatch "https://github.com/devobass/grevshell/blob/main/main.go"
click node_command_exec "https://github.com/devobass/grevshell/blob/main/main.go"
click node_server_files "https://github.com/devobass/grevshell/blob/main/main.go"
click node_key_exchange "https://github.com/devobass/grevshell/blob/main/grevcore/encryption.go"
click node_crypto "https://github.com/devobass/grevshell/blob/main/grevcore/encryption.go"
click node_framing "https://github.com/devobass/grevshell/blob/main/grevcore/processing.go"
click node_packet_model "https://github.com/devobass/grevshell/blob/main/grevcore/headers.go"

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_client_session,node_client_files toneBlue
class node_server_listener,node_server_dispatch,node_command_exec,node_server_files toneAmber
class node_key_exchange,node_crypto,node_framing,node_packet_model toneMint
class node_operator toneIndigo
```

## Components

### Client

- [Client session](https://github.com/devobass/grevshell/blob/main/grevclient/client.go): `grevclient/client.go`
- [Client file I/O](https://github.com/devobass/grevshell/blob/main/grevclient/client.go): `grevclient/client.go`

### Server

- [TCP listener](https://github.com/devobass/grevshell/blob/main/main.go): `main.go`
- [Request dispatcher](https://github.com/devobass/grevshell/blob/main/main.go): `main.go`
- [Command execution](https://github.com/devobass/grevshell/blob/main/main.go): `main.go`
- [Server file I/O](https://github.com/devobass/grevshell/blob/main/main.go): `main.go`

### Shared protocol

- [Key exchange](https://github.com/devobass/grevshell/blob/main/grevcore/encryption.go): `grevcore/encryption.go`
- [AES-GCM](https://github.com/devobass/grevshell/blob/main/grevcore/encryption.go): `grevcore/encryption.go`
- [Packet framing](https://github.com/devobass/grevshell/blob/main/grevcore/processing.go): `grevcore/processing.go`
- [Packet model](https://github.com/devobass/grevshell/blob/main/grevcore/headers.go): `grevcore/headers.go`

### Other components

- **Operator**

## Connections

- Operator → Client session: enters directives (evidence: `README.md`)
- Client session → Key exchange: exchanges key (evidence: `grevclient/client.go`)
- Client session → Packet framing: sends and receives (evidence: `grevclient/client.go`)
- Client session → Client file I/O: reads and writes (evidence: `grevclient/client.go`)
- Client session → TCP listener: connects over TCP (evidence: `README.md`)
- TCP listener → Key exchange: exchanges key (evidence: `main.go`)
- TCP listener → Request dispatcher: dispatches requests (evidence: `main.go`)
- Request dispatcher → Packet framing: receives and sends (evidence: `main.go`)
- Request dispatcher → Command execution: runs command (evidence: `main.go`)
- Request dispatcher → Server file I/O: handles transfers (evidence: `main.go`)
- Packet framing → AES-GCM: encrypts and decrypts (evidence: `grevcore/processing.go`)
- Packet framing → Packet model: assembles and parses (evidence: `grevcore/processing.go`)
