Files
thePlug/README.md
T
2026-05-04 23:59:48 +02:00

85 lines
1.5 KiB
Markdown

# thePlug
Wrapper web per gestire proxy `mitmdump` davanti ai servizi di una competizione
CTF attack/defense.
## Struttura
```text
backend/ FastAPI, MongoDB, Redis, mitmdump manager
frontend/ Vue 3, Vite, Monaco editor
```
## Setup rapido
```bash
./setup.sh
```
Lo script crea `backend/.env`, genera le credenziali mancanti e avvia lo stack
Docker completo:
```text
Frontend http://localhost:5173
Backend http://localhost:3671
```
Per installare anche il servizio systemd user:
```bash
./setup.sh service
```
## Dev backend
```bash
cp backend/.env.example backend/.env
docker compose --env-file backend/.env up -d mongodb redis
npm run dev:backend
```
Docs FastAPI in dev: `http://localhost:3671/docs`.
## Dev frontend
```bash
cd frontend
npm install
npm run dev
```
Il dev server usa `/api` come proxy verso `http://127.0.0.1:3671`.
## Test
```bash
npm run test
```
Equivalente a:
```bash
cd backend && uv run ruff check . && uv run pytest
cd frontend && npm run build
```
## API principali
- `POST /auth/login`
- `POST /auth/logout`
- `GET /proxy`
- `POST /proxy`
- `POST /proxy/{port}/start`
- `POST /proxy/{port}/stop`
- `POST /proxy/{port}/restart`
- `GET /proxy/{port}/health`
- `GET /proxy/{port}/logs`
- `GET /proxy/mitmproxy/options`
- `GET /proxy/mitmproxy/examples`
## Riferimenti
- Mitmproxy addons: https://docs.mitmproxy.org/stable/addons/examples/
- Mitmproxy modes: https://docs.mitmproxy.org/stable/concepts/modes/
- Mitmproxy options: https://docs.mitmproxy.org/stable/concepts/options/