# sameeralsahab/hydra-esp architecture

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

- Interactive diagram: https://gitdiagram.com/sameeralsahab/hydra-esp
- Repository: https://github.com/sameeralsahab/hydra-esp

## Overview

Hydra-ESP is an ESP32 Wi-Fi/Bluetooth security research tool operated through a device-hosted web UI, with optional OLED status. The documented user flow is to connect to its management AP, choose a network or attack in the UI, run a radio operation, and view status or captured results. The graph preserves the README’s major attack and capture capabilities, alongside the visible startup, web, Wi-Fi, BLE, and display layers. Several attack implementations were not sampled, so their links are documented or marked unverified rather than inferred as code calls.

Main entry points: [`main/main/attack.c`](https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c) (Attack coordinator), [`components/webserver/webserver.c`](https://github.com/sameeralsahab/hydra-esp/blob/main/components/webserver/webserver.c) (Web API and UI), [`main/main.c`](https://github.com/sameeralsahab/hydra-esp/blob/main/main/main.c) (Firmware startup), [`main/display/hydra_ssd1306_display.c`](https://github.com/sameeralsahab/hydra-esp/blob/main/main/display/hydra_ssd1306_display.c) (OLED status display)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_control["Device control"]
  node_startup["Firmware startup<br/>[main.c]"]
  node_web["Web API and UI<br/>[webserver.c]"]
  node_webui["Browser UI<br/>[app.js]"]
end

subgraph group_wifi["Wi-Fi operations"]
  node_wifi_ctl["Wi-Fi controller<br/>[wifi_controller.c]"]
  node_scan["Network scanning<br/>[wifi_controller.h]"]
  node_attack_ctrl["Attack coordinator<br/>[attack.c]"]
  node_deauth["Deauth and clone<br/>[attack.c]"]
  node_beacon["Beacon and Ghost spam<br/>[attack.c]"]
  node_evil_twin["Evil Twin<br/>[attack_eviltwin.c]"]
  node_passcheck["Password verification"]
  node_detector["Deauth detector"]
end

subgraph group_capture["Capture and analysis"]
  node_frame["Frame analysis"]
  node_handshake["Handshake capture<br/>[attack.c]"]
  node_pcap["PCAP serialization<br/>[pcap_serializer.c]"]
  node_hccapx["HCCAPX serialization"]
  node_pmkid["PMKID capture<br/>[frame_analyzer.c]"]
end

subgraph group_bluetooth["Bluetooth features"]
  node_ble_spam["BLE advertisement spam<br/>[attack_bt_spam.c]"]
  node_hid_payload["HID keystroke payloads"]
  node_keyboard["BLE keyboard<br/>[BleKeyboard.cpp]"]
  node_nimble["NimBLE device stack<br/>[NimBLEDevice.cpp]"]
end

subgraph group_display["Status display"]
  node_oled["OLED status display"]
  node_ssd1306["SSD1306 driver<br/>[ssd1306.c]"]
  node_u8g2["Graphics library<br/>[u8g2.h]"]
end

node_operator(("Operator"))

node_operator -->|"uses"| node_webui
node_webui -.->|"sends requests"| node_web
node_startup -->|"starts management AP"| node_wifi_ctl
node_startup -->|"initializes attacks"| node_attack_ctrl
node_startup -->|"starts server"| node_web
node_startup -.->|"initializes display"| node_oled
node_web -->|"scans networks"| node_wifi_ctl
node_web -->|"reads attack status"| node_attack_ctrl
node_web -->|"reads detector status"| node_detector
node_web -->|"sets and runs payload"| node_hid_payload
node_web -.->|"dispatches attack"| node_deauth
node_attack_ctrl -.->|"runs mode"| node_deauth
node_attack_ctrl -.->|"runs mode"| node_beacon
node_attack_ctrl -.->|"runs mode"| node_evil_twin
node_evil_twin -.->|"verifies password"| node_passcheck
node_attack_ctrl -.->|"captures handshake"| node_handshake
node_attack_ctrl -.->|"captures PMKID"| node_pmkid
node_handshake -.->|"analyzes frames"| node_frame
node_handshake -.->|"writes capture"| node_pcap
node_handshake -.->|"exports handshake"| node_hccapx
node_attack_ctrl -.->|"runs BLE spam"| node_ble_spam
node_hid_payload -.->|"sends keystrokes"| node_keyboard
node_keyboard -->|"uses BLE stack"| node_nimble
node_oled -.->|"renders status"| node_ssd1306
node_oled -.->|"draws display"| node_u8g2

click node_startup "https://github.com/sameeralsahab/hydra-esp/blob/main/main/main.c"
click node_web "https://github.com/sameeralsahab/hydra-esp/blob/main/components/webserver/webserver.c"
click node_webui "https://github.com/sameeralsahab/hydra-esp/blob/main/data/app.js"
click node_wifi_ctl "https://github.com/sameeralsahab/hydra-esp/blob/main/components/wifi_controller/wifi_controller.c"
click node_scan "https://github.com/sameeralsahab/hydra-esp/blob/main/components/wifi_controller/interface/wifi_controller.h"
click node_attack_ctrl "https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c"
click node_deauth "https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c"
click node_beacon "https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c"
click node_evil_twin "https://github.com/sameeralsahab/hydra-esp/blob/main/main/wifi/attack_eviltwin.c"
click node_passcheck "https://github.com/sameeralsahab/hydra-esp/blob/main/main/utils/wifi_pass_verifier.c"
click node_detector "https://github.com/sameeralsahab/hydra-esp/blob/main/main/wifi/attack_deauth_detector.c"
click node_frame "https://github.com/sameeralsahab/hydra-esp/blob/main/components/frame_analyzer/frame_analyzer_parser.c"
click node_handshake "https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c"
click node_pcap "https://github.com/sameeralsahab/hydra-esp/blob/main/components/pcap_serializer/pcap_serializer.c"
click node_hccapx "https://github.com/sameeralsahab/hydra-esp/blob/main/components/hccapx_serializer/hccapx_serializer.c"
click node_pmkid "https://github.com/sameeralsahab/hydra-esp/blob/main/components/frame_analyzer/frame_analyzer.c"
click node_ble_spam "https://github.com/sameeralsahab/hydra-esp/blob/main/main/bt/attack_bt_spam.c"
click node_hid_payload "https://github.com/sameeralsahab/hydra-esp/blob/main/main/bt/bt_payload_attack.cpp"
click node_keyboard "https://github.com/sameeralsahab/hydra-esp/blob/main/components/ESP32-NimBLE-Keyboard/BleKeyboard.cpp"
click node_nimble "https://github.com/sameeralsahab/hydra-esp/blob/main/components/esp-nimble-cpp/src/NimBLEDevice.cpp"
click node_oled "https://github.com/sameeralsahab/hydra-esp/blob/main/main/display/hydra_ssd1306_display.c"
click node_ssd1306 "https://github.com/sameeralsahab/hydra-esp/blob/main/components/ssd1306/ssd1306.c"
click node_u8g2 "https://github.com/sameeralsahab/hydra-esp/blob/main/components/u8g2/csrc/u8g2.h"

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_startup,node_web,node_webui toneBlue
class node_wifi_ctl,node_scan,node_attack_ctrl,node_deauth,node_beacon,node_evil_twin,node_passcheck,node_detector toneAmber
class node_frame,node_handshake,node_pcap,node_hccapx,node_pmkid toneMint
class node_ble_spam,node_hid_payload,node_keyboard,node_nimble toneRose
class node_oled,node_ssd1306,node_u8g2,node_operator toneIndigo
```

## Components

### Device control

- [Firmware startup](https://github.com/sameeralsahab/hydra-esp/blob/main/main/main.c): `main/main.c`
- [Web API and UI](https://github.com/sameeralsahab/hydra-esp/blob/main/components/webserver/webserver.c): `components/webserver/webserver.c`
- [Browser UI](https://github.com/sameeralsahab/hydra-esp/blob/main/data/app.js): `data/app.js`

### Wi-Fi operations

- [Wi-Fi controller](https://github.com/sameeralsahab/hydra-esp/blob/main/components/wifi_controller/wifi_controller.c): `components/wifi_controller/wifi_controller.c`
- [Network scanning](https://github.com/sameeralsahab/hydra-esp/blob/main/components/wifi_controller/interface/wifi_controller.h): `components/wifi_controller/interface/wifi_controller.h`
- [Attack coordinator](https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c): `main/main/attack.c`
- [Deauth and clone](https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c): `main/main/attack.c`
- [Beacon and Ghost spam](https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c): `main/main/attack.c`
- [Evil Twin](https://github.com/sameeralsahab/hydra-esp/blob/main/main/wifi/attack_eviltwin.c): `main/wifi/attack_eviltwin.c`
- [Password verification](https://github.com/sameeralsahab/hydra-esp/blob/main/main/utils/wifi_pass_verifier.c): `main/utils/wifi_pass_verifier.c`
- [Deauth detector](https://github.com/sameeralsahab/hydra-esp/blob/main/main/wifi/attack_deauth_detector.c): `main/wifi/attack_deauth_detector.c`

### Capture and analysis

- [Frame analysis](https://github.com/sameeralsahab/hydra-esp/blob/main/components/frame_analyzer/frame_analyzer_parser.c): `components/frame_analyzer/frame_analyzer_parser.c`
- [Handshake capture](https://github.com/sameeralsahab/hydra-esp/blob/main/main/main/attack.c): `main/main/attack.c`
- [PCAP serialization](https://github.com/sameeralsahab/hydra-esp/blob/main/components/pcap_serializer/pcap_serializer.c): `components/pcap_serializer/pcap_serializer.c`
- [HCCAPX serialization](https://github.com/sameeralsahab/hydra-esp/blob/main/components/hccapx_serializer/hccapx_serializer.c): `components/hccapx_serializer/hccapx_serializer.c`
- [PMKID capture](https://github.com/sameeralsahab/hydra-esp/blob/main/components/frame_analyzer/frame_analyzer.c): `components/frame_analyzer/frame_analyzer.c`

### Bluetooth features

- [BLE advertisement spam](https://github.com/sameeralsahab/hydra-esp/blob/main/main/bt/attack_bt_spam.c): `main/bt/attack_bt_spam.c`
- [HID keystroke payloads](https://github.com/sameeralsahab/hydra-esp/blob/main/main/bt/bt_payload_attack.cpp): `main/bt/bt_payload_attack.cpp`
- [BLE keyboard](https://github.com/sameeralsahab/hydra-esp/blob/main/components/ESP32-NimBLE-Keyboard/BleKeyboard.cpp): `components/ESP32-NimBLE-Keyboard/BleKeyboard.cpp`
- [NimBLE device stack](https://github.com/sameeralsahab/hydra-esp/blob/main/components/esp-nimble-cpp/src/NimBLEDevice.cpp): `components/esp-nimble-cpp/src/NimBLEDevice.cpp`

### Status display

- [OLED status display](https://github.com/sameeralsahab/hydra-esp/blob/main/main/display/hydra_ssd1306_display.c): `main/display/hydra_ssd1306_display.c`
- [SSD1306 driver](https://github.com/sameeralsahab/hydra-esp/blob/main/components/ssd1306/ssd1306.c): `components/ssd1306/ssd1306.c`
- [Graphics library](https://github.com/sameeralsahab/hydra-esp/blob/main/components/u8g2/csrc/u8g2.h): `components/u8g2/csrc/u8g2.h`

### Other components

- **Operator**

## Connections

- Operator → Browser UI: uses
- Browser UI → Web API and UI: sends requests
- Firmware startup → Wi-Fi controller: starts management AP (evidence: `main/main.c`)
- Firmware startup → Attack coordinator: initializes attacks (evidence: `main/main.c`)
- Firmware startup → Web API and UI: starts server (evidence: `main/main.c`)
- Firmware startup → OLED status display: initializes display
- Web API and UI → Wi-Fi controller: scans networks (evidence: `components/webserver/webserver.c`)
- Web API and UI → Attack coordinator: reads attack status (evidence: `components/webserver/webserver.c`)
- Web API and UI → Deauth detector: reads detector status (evidence: `components/webserver/webserver.c`)
- Web API and UI → HID keystroke payloads: sets and runs payload (evidence: `components/webserver/webserver.c`)
- Web API and UI → Deauth and clone: dispatches attack
- Attack coordinator → Deauth and clone: runs mode
- Attack coordinator → Beacon and Ghost spam: runs mode
- Attack coordinator → Evil Twin: runs mode
- Evil Twin → Password verification: verifies password
- Attack coordinator → Handshake capture: captures handshake
- Attack coordinator → PMKID capture: captures PMKID
- Handshake capture → Frame analysis: analyzes frames
- Handshake capture → PCAP serialization: writes capture
- Handshake capture → HCCAPX serialization: exports handshake
- Attack coordinator → BLE advertisement spam: runs BLE spam
- HID keystroke payloads → BLE keyboard: sends keystrokes
- BLE keyboard → NimBLE device stack: uses BLE stack (evidence: `components/ESP32-NimBLE-Keyboard/BleKeyboard.cpp`)
- OLED status display → SSD1306 driver: renders status
- OLED status display → Graphics library: draws display
