# probiusofficial/pivothub architecture

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

- Interactive diagram: https://gitdiagram.com/probiusofficial/pivothub
- Repository: https://github.com/probiusofficial/pivothub

## Overview

PivotHub is a local FastAPI/SQLite control panel for authorized, multi-layer network labs. The operator’s main workflow is to register or discover hosts, manage shell sessions, probe reachability, deploy and verify proxy links, then track credentials, flags and activity or export a review. The graph also preserves the documented reconnaissance, database, plugin and privilege-escalation capabilities. Relationships are limited to those shown in excerpts or stated in the README; several broader API and service branches are represented by their existing directories because their implementation was not sampled.

Main entry points: [`pivothub/api/shells.py`](https://github.com/probiusofficial/pivothub/blob/main/pivothub/api/shells.py) (Shell API), [`pivothub/api`](https://github.com/probiusofficial/pivothub/tree/main/pivothub/api) (Domain APIs), [`pivothub/db.py`](https://github.com/probiusofficial/pivothub/blob/main/pivothub/db.py) (SQLite state), [`pivothub/api/links.py`](https://github.com/probiusofficial/pivothub/blob/main/pivothub/api/links.py) (Link API)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Application control"]
  node_app["HTTP app<br/>[app.py]"]
  node_api_shells["Shell API<br/>[shells.py]"]
  node_api_hosts["Host API<br/>[hosts.py]"]
  node_api_links["Link API<br/>[links.py]"]
  node_api_other["Domain APIs"]
  node_ws["Live updates<br/>[manager.py]"]
  node_schemas["API contracts<br/>[common.py]"]
end

subgraph group_sessions["Host sessions"]
  node_session_contract["Session contract<br/>[base.py]"]
  node_session_drivers["Session drivers"]
end

subgraph group_pivot["Pivot operations"]
  node_probe["Reachability probes<br/>[probe.py]"]
  node_stage["File staging<br/>[filestage.py]"]
  node_adapter["Proxy adapters<br/>[chisel.py]"]
  node_relay["Relay planning<br/>[relay.py]"]
  node_dbclient["Remote databases<br/>[dbclient.py]"]
  node_recon["Recon services<br/>[recon.py]"]
  node_domain_services["Domain services"]
end

subgraph group_state["Project state"]
  node_database[("SQLite state<br/>[db.py]")]
  node_models["Domain models"]
  node_localinfo["Local network info<br/>[localinfo.py]"]
end

node_operator(("Operator"))
node_target(("Lab hosts"))

node_operator -->|"uses panel"| node_app
node_app -->|"routes requests"| node_api_shells
node_app -->|"hosts updates"| node_ws
node_api_shells -->|"executes through"| node_session_contract
node_session_drivers -->|"implements"| node_session_contract
node_api_shells -->|"reads and writes"| node_database
node_api_shells -->|"pushes events"| node_ws
node_api_hosts -->|"reads and writes"| node_database
node_api_hosts -->|"pushes events"| node_ws
node_api_links -->|"deploys through"| node_adapter
node_api_links -->|"uses sessions"| node_session_contract
node_api_links -->|"plans relays"| node_relay
node_api_links -->|"records links"| node_database
node_api_shells -->|"runs probes"| node_probe
node_api_shells -->|"stages downloads"| node_stage
node_stage -->|"serves staged files"| node_target
node_adapter -->|"deploys tunnel client"| node_target
node_probe -->|"executes probes"| node_session_contract
node_api_other -.->|"uses services"| node_domain_services
node_api_other -.->|"persists project data"| node_database
node_api_other -.->|"uses contracts"| node_schemas
node_database -->|"maps records"| node_models
node_database -->|"seeds local host"| node_localinfo
node_api_shells -.->|"uses contracts"| node_schemas
node_api_links -.->|"uses contracts"| node_schemas
node_api_other -.->|"supports DB panel"| node_dbclient
node_api_other -.->|"supports reconnaissance"| node_recon
node_api_other -.->|"supports plugins and review"| node_domain_services

click node_app "https://github.com/probiusofficial/pivothub/blob/main/pivothub/app.py"
click node_api_shells "https://github.com/probiusofficial/pivothub/blob/main/pivothub/api/shells.py"
click node_api_hosts "https://github.com/probiusofficial/pivothub/blob/main/pivothub/api/hosts.py"
click node_api_links "https://github.com/probiusofficial/pivothub/blob/main/pivothub/api/links.py"
click node_api_other "https://github.com/probiusofficial/pivothub/tree/main/pivothub/api"
click node_ws "https://github.com/probiusofficial/pivothub/blob/main/pivothub/ws/manager.py"
click node_schemas "https://github.com/probiusofficial/pivothub/blob/main/pivothub/schemas/common.py"
click node_session_contract "https://github.com/probiusofficial/pivothub/blob/main/pivothub/session/base.py"
click node_session_drivers "https://github.com/probiusofficial/pivothub/tree/main/pivothub/session"
click node_probe "https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/probe.py"
click node_stage "https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/filestage.py"
click node_adapter "https://github.com/probiusofficial/pivothub/blob/main/pivothub/adapters/chisel.py"
click node_relay "https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/relay.py"
click node_dbclient "https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/dbclient.py"
click node_recon "https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/recon.py"
click node_domain_services "https://github.com/probiusofficial/pivothub/tree/main/pivothub/service"
click node_database "https://github.com/probiusofficial/pivothub/blob/main/pivothub/db.py"
click node_models "https://github.com/probiusofficial/pivothub/tree/main/pivothub/models"
click node_localinfo "https://github.com/probiusofficial/pivothub/blob/main/pivothub/localinfo.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_app,node_api_shells,node_api_hosts,node_api_links,node_api_other,node_ws,node_schemas toneBlue
class node_session_contract,node_session_drivers toneAmber
class node_probe,node_stage,node_adapter,node_relay,node_dbclient,node_recon,node_domain_services toneMint
class node_database,node_models,node_localinfo toneRose
class node_operator,node_target toneIndigo
```

## Components

### Application control

- [HTTP app](https://github.com/probiusofficial/pivothub/blob/main/pivothub/app.py): `pivothub/app.py`
- [Shell API](https://github.com/probiusofficial/pivothub/blob/main/pivothub/api/shells.py): `pivothub/api/shells.py`
- [Host API](https://github.com/probiusofficial/pivothub/blob/main/pivothub/api/hosts.py): `pivothub/api/hosts.py`
- [Link API](https://github.com/probiusofficial/pivothub/blob/main/pivothub/api/links.py): `pivothub/api/links.py`
- [Domain APIs](https://github.com/probiusofficial/pivothub/tree/main/pivothub/api): `pivothub/api`
- [Live updates](https://github.com/probiusofficial/pivothub/blob/main/pivothub/ws/manager.py): `pivothub/ws/manager.py`
- [API contracts](https://github.com/probiusofficial/pivothub/blob/main/pivothub/schemas/common.py): `pivothub/schemas/common.py`

### Host sessions

- [Session contract](https://github.com/probiusofficial/pivothub/blob/main/pivothub/session/base.py): `pivothub/session/base.py`
- [Session drivers](https://github.com/probiusofficial/pivothub/tree/main/pivothub/session): `pivothub/session`

### Pivot operations

- [Reachability probes](https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/probe.py): `pivothub/service/probe.py`
- [File staging](https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/filestage.py): `pivothub/service/filestage.py`
- [Proxy adapters](https://github.com/probiusofficial/pivothub/blob/main/pivothub/adapters/chisel.py): `pivothub/adapters/chisel.py`
- [Relay planning](https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/relay.py): `pivothub/service/relay.py`
- [Remote databases](https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/dbclient.py): `pivothub/service/dbclient.py`
- [Recon services](https://github.com/probiusofficial/pivothub/blob/main/pivothub/service/recon.py): `pivothub/service/recon.py`
- [Domain services](https://github.com/probiusofficial/pivothub/tree/main/pivothub/service): `pivothub/service`

### Project state

- [SQLite state](https://github.com/probiusofficial/pivothub/blob/main/pivothub/db.py): `pivothub/db.py`
- [Domain models](https://github.com/probiusofficial/pivothub/tree/main/pivothub/models): `pivothub/models`
- [Local network info](https://github.com/probiusofficial/pivothub/blob/main/pivothub/localinfo.py): `pivothub/localinfo.py`

### Other components

- **Operator**
- **Lab hosts**

## Connections

- Operator → HTTP app: uses panel (evidence: `README.md`)
- HTTP app → Shell API: routes requests (evidence: `pivothub/app.py`)
- HTTP app → Live updates: hosts updates (evidence: `pivothub/app.py`)
- Shell API → Session contract: executes through (evidence: `pivothub/api/shells.py`)
- Session drivers → Session contract: implements (evidence: `pivothub/session/__init__.py`)
- Shell API → SQLite state: reads and writes (evidence: `pivothub/api/shells.py`)
- Shell API → Live updates: pushes events (evidence: `pivothub/api/shells.py`)
- Host API → SQLite state: reads and writes (evidence: `pivothub/api/hosts.py`)
- Host API → Live updates: pushes events (evidence: `pivothub/api/hosts.py`)
- Link API → Proxy adapters: deploys through (evidence: `pivothub/api/links.py`)
- Link API → Session contract: uses sessions (evidence: `pivothub/api/links.py`)
- Link API → Relay planning: plans relays (evidence: `pivothub/api/links.py`)
- Link API → SQLite state: records links (evidence: `pivothub/api/links.py`)
- Shell API → Reachability probes: runs probes (evidence: `pivothub/api/shells.py`)
- Shell API → File staging: stages downloads (evidence: `pivothub/api/shells.py`)
- File staging → Lab hosts: serves staged files (evidence: `pivothub/service/filestage.py`)
- Proxy adapters → Lab hosts: deploys tunnel client (evidence: `pivothub/adapters/chisel.py`)
- Reachability probes → Session contract: executes probes (evidence: `pivothub/service/probe.py`)
- Domain APIs → Domain services: uses services (evidence: `pivothub/api/shells.py`)
- Domain APIs → SQLite state: persists project data (evidence: `pivothub/api/shells.py`)
- Domain APIs → API contracts: uses contracts (evidence: `pivothub/api/shells.py`)
- SQLite state → Domain models: maps records (evidence: `pivothub/db.py`)
- SQLite state → Local network info: seeds local host (evidence: `pivothub/db.py`)
- Shell API → API contracts: uses contracts (evidence: `pivothub/api/shells.py`)
- Link API → API contracts: uses contracts (evidence: `pivothub/api/links.py`)
- Domain APIs → Remote databases: supports DB panel (evidence: `README.md`)
- Domain APIs → Recon services: supports reconnaissance (evidence: `README.md`)
- Domain APIs → Domain services: supports plugins and review (evidence: `README.md`)
