# dr-karthikrajan/hotwire architecture

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

- Interactive diagram: https://gitdiagram.com/dr-karthikrajan/hotwire
- Repository: https://github.com/dr-karthikrajan/hotwire

## Overview

HotWire is a V2G security-research testbed that emulates either side of a DIN 70121 charging session, supports message overrides for attack scenarios, and provides GUI inspection and session-analysis tools. The principal workflow is to launch an EVSE or PEV, establish discovery and transport, run its protocol state machine, and inspect or export the resulting session. Edges reflect the supplied excerpts, SOURCE INDEX references, or README statements; unsampled implementations are represented only where the tree and documentation support them.

Main entry points: [`hotwire/core/worker.py`](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/worker.py) (Session orchestrator), [`hotwire/fsm/fsm_pev.py`](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/fsm_pev.py) (PEV state machine), [`hotwire/gui/widgets`](https://github.com/dr-karthikrajan/hotwire/tree/main/hotwire/gui/widgets) (Session panels), [`hotwire/gui/worker_thread.py`](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/worker_thread.py) (GUI worker thread)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ui["Operator interface"]
  node_gui["GUI application<br/>[app.py]"]
  node_window["Session window<br/>[main_window.py]"]
  node_gui_widgets["Session panels"]
  node_gui_thread["GUI worker thread<br/>[worker_thread.py]"]
  node_signals["GUI signals<br/>[signals.py]"]
end

subgraph group_runtime["Session runtime"]
  node_worker["Session orchestrator<br/>[worker.py]"]
  node_pev_fsm["PEV state machine<br/>[fsm_pev.py]"]
  node_evse_fsm["EVSE state machine<br/>[fsm_evse.py]"]
  node_override["Message overrides"]
  node_observer["Message observer"]
  node_session_log["Session logger<br/>[session_log.py]"]
end

subgraph group_protocol["V2G protocol and link"]
  node_exi["EXI codec connector<br/>[connector.py]"]
  node_sdp_client["SDP client<br/>[client.py]"]
  node_sdp_server["SDP responder<br/>[server.py]"]
  node_homeplug["HomePlug link<br/>[homeplug.py]"]
  node_slac["SLAC pairing<br/>[slac.py]"]
  node_l2["Layer-2 transport<br/>[l2_transport.py]"]
  node_tcp["V2G TCP transport<br/>[tcp_socket.py]"]
  node_hardware["Hardware interface"]
end

subgraph group_research["Attacks and analysis"]
  node_attacks["Attack playbooks<br/>[base.py]"]
  node_pcap["PCAP export<br/>[pcap_export.py]"]
  node_csv["CSV export<br/>[csv_export.py]"]
  node_diff["Session comparison<br/>[session_diff.py]"]
end

subgraph group_support["Configuration and readiness"]
  node_preflight["Preflight checks<br/>[checks.py]"]
  node_config["Runtime configuration<br/>[config.py]"]
  node_address["Address manager<br/>[address_manager.py]"]
  node_conn["Connection manager<br/>[conn_mgr.py]"]
end

node_operator(("Research operator"))

node_operator -->|"launches"| node_gui
node_gui -->|"creates"| node_window
node_window -->|"starts"| node_gui_thread
node_window -->|"presents"| node_gui_widgets
node_gui_thread -->|"runs"| node_worker
node_gui_thread -->|"persists messages"| node_session_log
node_gui_thread -->|"emits events"| node_signals
node_worker -->|"selects by mode"| node_pev_fsm
node_worker -->|"selects by mode"| node_evse_fsm
node_worker -->|"builds link"| node_homeplug
node_worker -->|"uses discovery"| node_sdp_client
node_worker -->|"starts responder"| node_sdp_server
node_worker -->|"uses addresses"| node_address
node_worker -->|"uses connections"| node_conn
node_worker -->|"creates interface"| node_hardware
node_pev_fsm -->|"intercepts messages"| node_override
node_operator -->|"selects scenario"| node_attacks
node_attacks -->|"installs overrides"| node_override
node_pev_fsm -->|"encodes messages"| node_exi
node_pev_fsm -->|"transmits messages"| node_tcp
node_pev_fsm -->|"notifies decoded messages"| node_observer
node_homeplug -->|"uses transport"| node_tcp
node_homeplug -->|"runs pairing"| node_slac
node_slac -->|"uses frames"| node_l2
node_operator -->|"checks readiness"| node_preflight
node_gui_widgets -->|"exports captures"| node_pcap
node_gui_widgets -->|"exports tables"| node_csv
node_gui_widgets -->|"compares sessions"| node_diff
node_session_log -.->|"provides session records"| node_pcap
node_worker -.->|"reads settings"| node_config

click node_gui "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/app.py"
click node_window "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/main_window.py"
click node_gui_widgets "https://github.com/dr-karthikrajan/hotwire/tree/main/hotwire/gui/widgets"
click node_gui_thread "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/worker_thread.py"
click node_signals "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/signals.py"
click node_worker "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/worker.py"
click node_pev_fsm "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/fsm_pev.py"
click node_evse_fsm "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/fsm_evse.py"
click node_override "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/pause_controller.py"
click node_observer "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/message_observer.py"
click node_session_log "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/session_log.py"
click node_exi "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/exi/connector.py"
click node_sdp_client "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/sdp/client.py"
click node_sdp_server "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/sdp/server.py"
click node_homeplug "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/plc/homeplug.py"
click node_slac "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/plc/slac.py"
click node_l2 "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/plc/l2_transport.py"
click node_tcp "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/plc/tcp_socket.py"
click node_hardware "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/hardware_interface.py"
click node_attacks "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/attacks/base.py"
click node_pcap "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/io/pcap_export.py"
click node_csv "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/io/csv_export.py"
click node_diff "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/io/session_diff.py"
click node_preflight "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/preflight/checks.py"
click node_config "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/config.py"
click node_address "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/address_manager.py"
click node_conn "https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/conn_mgr.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_gui,node_window,node_gui_widgets,node_gui_thread,node_signals toneBlue
class node_worker,node_pev_fsm,node_evse_fsm,node_override,node_observer,node_session_log toneAmber
class node_exi,node_sdp_client,node_sdp_server,node_homeplug,node_slac,node_l2,node_tcp,node_hardware toneMint
class node_attacks,node_pcap,node_csv,node_diff toneRose
class node_preflight,node_config,node_address,node_conn,node_operator toneIndigo
```

## Components

### Operator interface

- [GUI application](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/app.py): `hotwire/gui/app.py`
- [Session window](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/main_window.py): `hotwire/gui/main_window.py`
- [Session panels](https://github.com/dr-karthikrajan/hotwire/tree/main/hotwire/gui/widgets): `hotwire/gui/widgets`
- [GUI worker thread](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/worker_thread.py): `hotwire/gui/worker_thread.py`
- [GUI signals](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/gui/signals.py): `hotwire/gui/signals.py`

### Session runtime

- [Session orchestrator](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/worker.py): `hotwire/core/worker.py`
- [PEV state machine](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/fsm_pev.py): `hotwire/fsm/fsm_pev.py`
- [EVSE state machine](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/fsm_evse.py): `hotwire/fsm/fsm_evse.py`
- [Message overrides](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/pause_controller.py): `hotwire/fsm/pause_controller.py`
- [Message observer](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/fsm/message_observer.py): `hotwire/fsm/message_observer.py`
- [Session logger](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/session_log.py): `hotwire/core/session_log.py`

### V2G protocol and link

- [EXI codec connector](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/exi/connector.py): `hotwire/exi/connector.py`
- [SDP client](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/sdp/client.py): `hotwire/sdp/client.py`
- [SDP responder](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/sdp/server.py): `hotwire/sdp/server.py`
- [HomePlug link](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/plc/homeplug.py): `hotwire/plc/homeplug.py`
- [SLAC pairing](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/plc/slac.py): `hotwire/plc/slac.py`
- [Layer-2 transport](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/plc/l2_transport.py): `hotwire/plc/l2_transport.py`
- [V2G TCP transport](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/plc/tcp_socket.py): `hotwire/plc/tcp_socket.py`
- [Hardware interface](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/hardware_interface.py): `hotwire/core/hardware_interface.py`

### Attacks and analysis

- [Attack playbooks](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/attacks/base.py): `hotwire/attacks/base.py`
- [PCAP export](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/io/pcap_export.py): `hotwire/io/pcap_export.py`
- [CSV export](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/io/csv_export.py): `hotwire/io/csv_export.py`
- [Session comparison](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/io/session_diff.py): `hotwire/io/session_diff.py`

### Configuration and readiness

- [Preflight checks](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/preflight/checks.py): `hotwire/preflight/checks.py`
- [Runtime configuration](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/config.py): `hotwire/core/config.py`
- [Address manager](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/address_manager.py): `hotwire/core/address_manager.py`
- [Connection manager](https://github.com/dr-karthikrajan/hotwire/blob/main/hotwire/core/conn_mgr.py): `hotwire/core/conn_mgr.py`

### Other components

- **Research operator**

## Connections

- Research operator → GUI application: launches (evidence: `README.md`)
- GUI application → Session window: creates (evidence: `hotwire/gui/app.py`)
- Session window → GUI worker thread: starts (evidence: `hotwire/gui/main_window.py`)
- Session window → Session panels: presents (evidence: `README.md`)
- GUI worker thread → Session orchestrator: runs (evidence: `hotwire/gui/worker_thread.py`)
- GUI worker thread → Session logger: persists messages (evidence: `hotwire/gui/worker_thread.py`)
- GUI worker thread → GUI signals: emits events (evidence: `hotwire/gui/worker_thread.py`)
- Session orchestrator → PEV state machine: selects by mode (evidence: `hotwire/core/worker.py`)
- Session orchestrator → EVSE state machine: selects by mode (evidence: `hotwire/core/worker.py`)
- Session orchestrator → HomePlug link: builds link (evidence: `hotwire/core/worker.py`)
- Session orchestrator → SDP client: uses discovery (evidence: `hotwire/core/worker.py`)
- Session orchestrator → SDP responder: starts responder (evidence: `hotwire/core/worker.py`)
- Session orchestrator → Address manager: uses addresses (evidence: `hotwire/core/worker.py`)
- Session orchestrator → Connection manager: uses connections (evidence: `hotwire/core/worker.py`)
- Session orchestrator → Hardware interface: creates interface (evidence: `hotwire/core/worker.py`)
- PEV state machine → Message overrides: intercepts messages (evidence: `hotwire/fsm/pause_controller.py`)
- Research operator → Attack playbooks: selects scenario (evidence: `README.md`)
- Attack playbooks → Message overrides: installs overrides (evidence: `hotwire/attacks/base.py`)
- PEV state machine → EXI codec connector: encodes messages (evidence: `hotwire/fsm/fsm_pev.py`)
- PEV state machine → V2G TCP transport: transmits messages (evidence: `hotwire/fsm/fsm_pev.py`)
- PEV state machine → Message observer: notifies decoded messages (evidence: `hotwire/fsm/fsm_pev.py`)
- HomePlug link → V2G TCP transport: uses transport (evidence: `hotwire/plc/homeplug.py`)
- HomePlug link → SLAC pairing: runs pairing (evidence: `hotwire/plc/homeplug.py`)
- SLAC pairing → Layer-2 transport: uses frames (evidence: `hotwire/plc/slac.py`)
- Research operator → Preflight checks: checks readiness (evidence: `README.md`)
- Session panels → PCAP export: exports captures (evidence: `hotwire/gui/widgets/session_tools_panel.py`)
- Session panels → CSV export: exports tables (evidence: `hotwire/gui/widgets/session_tools_panel.py`)
- Session panels → Session comparison: compares sessions (evidence: `hotwire/gui/widgets/session_compare_panel.py`)
- Session logger → PCAP export: provides session records
- Session orchestrator → Runtime configuration: reads settings
