Same look as the GitHub Pages demo, but with live host metrics (and optional ML scores). Works in a PC browser and as a Telegram Mini App on your phone.
Fake demo (no install): https://lifeqsoll.github.io/SysSpectogram/demo/
TELEGRAM_BOT_TOKEN=… # BotFather
TELEGRAM_CHAT_ID=… # your private chat id (= user id)
TELEGRAM_TOKEN_SECRET=… # stable HMAC for TG inline buttons (optional but recommended)
WEBAPP_URL=https://…. # HTTPS tunnel URL for Mini App (phone only)Copy from .env.example. Never commit .env.
Only TELEGRAM_CHAT_ID can use the bot and Mini App actions. Everyone else is ignored.
# metrics only
python -m sysspectogram web
# with model scoring
python -m sysspectogram web --model artifacts/real_v3
# guard + Telegram + web in one process
python -m sysspectogram guard --model artifacts/real_v3 --telegram --web --dry-runOpen: http://127.0.0.1:8765/
- Theme: dark by default (Light/Dark toggle in the header).
- Loopback (
127.0.0.1) can view metrics only whenWEBAPP_URLis empty. If a public Mini App URL is set, loopback is not trusted (tunnels terminate on localhost) — auth via TelegraminitDatais required. - With
guard --telegram, SOAR actions also need console unlock (/unlockfrom the host code). Header showscontrol LOCKED|unlocked. - Through a public tunnel you must open the app from Telegram so
initDatavalidates, and your user id must matchTELEGRAM_CHAT_ID.
Port/host: web: in configs/default.yaml (keep host: 127.0.0.1).
| Area | Behavior |
|---|---|
| Live charts | CPU / mem / net / disk (+ scores when a model is loaded) |
| Alerts | Recent events; IP cards get Ban / Allow / Mute / Recon |
| SOAR controls | Ban 1h/24h/perm, Unban, Allowlist, Mute, Quiet, Lockdown, Shield port, Kill PID, OSINT recon |
| Top processes | List + Kill; Refresh button |
| Settings | Toggle dry_run (no real nft/SIGKILL when on) |
Confirm dialogs before destructive actions. With --dry-run (or Settings → dry_run) responses are logged only.
Telegram Mini Apps need HTTPS. http://127.0.0.1 on the PC is not reachable from the phone.
Keep three things running:
guard … --web(orweb) on port 8765- A tunnel process (see options below)
WEBAPP_URLin.env= that tunnel’s HTTPS URL → restart guard/web after changing it
Quick-tunnel hostnames change every restart → update WEBAPP_URL each time (or use a named tunnel / own domain).
# terminal: tunnel (leave running)
npx --yes localtunnel --port 8765
# → your url is: https://something.loca.lt.env:
WEBAPP_URL=https://something.loca.ltRestart guard/web. First visit in a browser may show a security reminder: enter the tunnel host public IP (shown on that page, e.g. 94.x.x.x) → Continue. Telegram WebView may also show it once.
Bypass tip (automation only): header bypass-tunnel-reminder: 1.
# Arch: sudo pacman -S cloudflared
# or use ./tools/bin/cloudflared if present
cloudflared tunnel --protocol http2 --url http://127.0.0.1:8765Copy https://….trycloudflare.com into WEBAPP_URL.
If you see TLS handshake with edge error: EOF / page 530, your network blocks Cloudflare edge — use localtunnel or ngrok instead (VPN sometimes fixes CF).
ngrok http 8765
# WEBAPP_URL=https://xxxx.ngrok-free.appOptional but nice for the side menu / Mini App menu button:
- @BotFather →
/mybots→ your bot → Bot Settings → Menu Button / Configure Mini App (wording varies), or/newapp//editapp. - When asked for Web App URL, paste the same HTTPS URL as
WEBAPP_URL(e.g.https://….loca.lt). - Title e.g.
Dashboard. Skip GIF if you want.
SysSpectogram also sets a menu button via API when WEBAPP_URL is present, and exposes /dashboard in the bot.
.envhas token, chat id,WEBAPP_URL.- Tunnel +
guard --telegram --web [--dry-run]running. - In the bot: menu Dashboard, or
/dashboard, or/menu→ Open Dashboard. - Open only from your allowlisted account.
| Symptom | Fix |
|---|---|
| Mini App blank / old URL | Restart tunnel → new URL → update WEBAPP_URL → restart guard |
| localtunnel password page | Enter host public IP shown on the page |
| Cloudflare 530 / TLS EOF | Network blocks CF → localtunnel/ngrok/VPN |
| Actions 401 / ignored | Wrong chat; only TELEGRAM_CHAT_ID |
| Port in use | Another web/guard --web; kill stale process or change web.port |
| Ban/kill “did nothing” | dry_run still on — turn off in Settings or drop --dry-run (careful) |
- Bind web to
127.0.0.1; expose only via HTTPS tunnel. - Mini App: Telegram
initDataHMAC + allowlistTELEGRAM_CHAT_ID. - No arbitrary shell from the UI; actions are the same SOAR-lite set as Telegram.
- Prefer
--dry-rununtil you trust the setup.
web: in configs/default.yaml — host, port, public_url (optional override for WEBAPP_URL).