Flask API backend for ESP32 sensor fleet: - App factory pattern with blueprints - SQLAlchemy 2.x models (Sensor, Device, Sighting, Alert, Event, Probe) - UDP collector for sensor data streams - REST API endpoints for sensors, devices, alerts, events, probes, stats - pytest setup with fixtures - Containerfile for podman deployment - Makefile for common tasks
58 lines
1.2 KiB
Markdown
58 lines
1.2 KiB
Markdown
# ESP32-Web
|
|
|
|
REST API backend for ESP32 sensor fleet (OPSEC/OSINT/Purple team).
|
|
|
|
## Quick Start
|
|
|
|
```bash
|
|
# Install
|
|
pip install -e ".[dev]"
|
|
|
|
# Initialize database
|
|
flask --app src/esp32_web db init
|
|
flask --app src/esp32_web db migrate -m "initial"
|
|
flask --app src/esp32_web db upgrade
|
|
|
|
# Run development server
|
|
make dev
|
|
```
|
|
|
|
## Ports
|
|
|
|
| Port | Protocol | Description |
|
|
|------|----------|-------------|
|
|
| 5500 | TCP | HTTP REST API |
|
|
| 5500 | UDP | Sensor data collector |
|
|
| 5501 | UDP | Sensor commands (outbound) |
|
|
|
|
## API Endpoints
|
|
|
|
| Method | Endpoint | Description |
|
|
|--------|----------|-------------|
|
|
| GET | `/health` | Health check |
|
|
| GET | `/api/v1/sensors` | List sensors |
|
|
| GET | `/api/v1/sensors/<hostname>` | Get sensor |
|
|
| POST | `/api/v1/sensors/<hostname>/command` | Send command |
|
|
| GET | `/api/v1/devices` | List devices |
|
|
| GET | `/api/v1/devices/<mac>` | Get device |
|
|
| GET | `/api/v1/alerts` | List alerts |
|
|
| GET | `/api/v1/events` | List events |
|
|
| GET | `/api/v1/probes` | List probe requests |
|
|
| GET | `/api/v1/probes/ssids` | List SSIDs |
|
|
| GET | `/api/v1/stats` | Statistics |
|
|
|
|
## Container
|
|
|
|
```bash
|
|
make build
|
|
make run
|
|
make logs
|
|
make stop
|
|
```
|
|
|
|
## Testing
|
|
|
|
```bash
|
|
make test
|
|
```
|