Skip to content

Real-time network monitor + outbound firewall — see & block every connection. Privacy-first, local-first, Rust fleet agent, SIEM exports, 8 languages. / Moniteur réseau temps réel + pare-feu sortant, agent de flotte Rust, exports SIEM. 100 % local.

feat: SNITCH_DEMO synthetic traffic mode + animated demo GIF in README

MoneyLisa728c1ec699df
diff --git a/README.md b/README.md
index 1768702..115af5a 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,10 @@
[![Platform: Linux](https://img.shields.io/badge/Platform-Linux%20(Docker)-blue.svg)]()
[![Version](https://img.shields.io/badge/Version-1.0.0-green.svg)]()
+<!-- EN: Live capture of the demo mode (SNITCH_DEMO=1) — synthetic traffic only.
+ FR: Capture du mode démo (SNITCH_DEMO=1) — trafic synthétique uniquement. -->
+![Snitch live graph — LAN perimeter, geolocated hosts, alerts](docs/assets/demo.gif)
+
</div>
---
@@ -109,6 +113,12 @@ Requirements:
- [Npcap](https://npcap.com/) installed (Windows only)
- Administrator/root terminal for the backend (raw packet capture)
+> **Demo mode / Mode démo** — run the backend with `SNITCH_DEMO=1` to feed
+> synthetic traffic through the real pipeline: no root, no libpcap, no real
+> packets touched. Ideal for screenshots, tests and previews.
+> *Lancez le backend avec `SNITCH_DEMO=1` pour injecter un trafic synthétique
+> dans le pipeline réel — ni root ni libpcap ni paquets réels.*
+
```bash
# Backend (admin terminal) — API at http://127.0.0.1:8000
cd backend
diff --git a/backend/api/main.py b/backend/api/main.py
index 25b5dc5..2ff23d2 100644
--- a/backend/api/main.py
+++ b/backend/api/main.py
@@ -80,6 +80,7 @@ from pydantic import BaseModel, Field
from api.security import ALLOWED_ORIGIN_REGEX, require_token, ws_authorized
from capture.sniffer import Packet, PacketSniffer, get_local_ips
+import demo
from capture.media_monitor import MediaMonitor, MediaState
from classifier.traffic import classify
from resolver.dns_geo import (enrich_ip, is_private, learn_dns_answers,
@@ -939,11 +940,19 @@ def _cleanup_loop() -> None:
def _start_capture() -> None:
"""EN: (Re)start sniffer + ARP-table scanner in daemon threads.
- FR: (Re)démarrer sniffer + scanner de table ARP dans des threads daemon."""
+ With SNITCH_DEMO=1 the sniffer is replaced by the synthetic demo
+ feeder — no root, no libpcap, no real traffic touched.
+ FR: (Re)démarrer sniffer + scanner de table ARP dans des threads daemon.
+ Avec SNITCH_DEMO=1 le sniffer est remplacé par le générateur de démo
+ — ni root ni libpcap ni trafic réel."""
global _sniffer, _scanner, _capturing
- _sniffer = PacketSniffer(callback=on_packet, ports=_port_filter,
- iface=db.get_setting("interface"))
- threading.Thread(target=_sniffer.start, daemon=True).start()
+ if demo.enabled():
+ _sniffer = demo.start(on_packet)
+ logger.warning("DEMO MODE — synthetic traffic only")
+ else:
+ _sniffer = PacketSniffer(callback=on_packet, ports=_port_filter,
+ iface=db.get_setting("interface"))
+ threading.Thread(target=_sniffer.start, daemon=True).start()
_scanner = ARPScanner(callback=on_device, interval=30)
threading.Thread(target=_scanner.start, daemon=True).start()
_capturing = True
diff --git a/backend/demo.py b/backend/demo.py
new file mode 100644
index 0000000..12153e3
--- /dev/null
+++ b/backend/demo.py
@@ -0,0 +1,165 @@
+# EN: Demo mode — feeds synthetic packets into the normal pipeline so the UI
+# can be explored (and screenshotted) without root/libpcap and without
+# ever touching real traffic. Enable with SNITCH_DEMO=1.
+# Everything is fake: public IPs are well-known ranges so the bundled
+# DB-IP Lite GeoIP resolves real countries, LAN devices get mDNS names,
+# and a beaconing pattern demonstrates the anomaly alerts.
+# FR: Mode démo — injecte des paquets synthétiques dans le pipeline normal
+# pour explorer (et capturer) l'interface sans root/libpcap et sans
+# toucher au trafic réel. Activer avec SNITCH_DEMO=1.
+# Tout est fictif : les IP publiques sont des plages connues pour que le
+# GeoIP DB-IP Lite embarqué résolve de vrais pays, les appareils LAN
+# reçoivent des noms mDNS, et un pattern de balisage démontre les
+# alertes d'anomalies.
+
+import os
+import random
+import threading
+import time
+from datetime import datetime, timezone
+
+from capture.sniffer import Packet
+
+# EN: Well-known public IPs so offline GeoIP produces a varied map:
+# Google/Cloudflare (US), OVH (FR), Amazon AWS (IE), Apple (US), etc.
+# FR: IP publiques connues pour que le GeoIP hors ligne produise une carte
+# variée : Google/Cloudflare (US), OVH (FR), AWS (IE), Apple (US), etc.
+EXTERNAL_HOSTS = [
+ # (ip, port, sni, process)
+ ("142.250.179.142", 443, "www.google.com", "Google Chrome"),
+ ("142.251.36.14", 443, "mail.google.com", "Google Chrome"),
+ ("104.16.249.249", 443, "cloudflare.com", "Google Chrome"),
+ ("151.101.65.140", 443, "www.reddit.com", "Safari"),
+ ("157.240.239.35", 443, "www.facebook.com", "Google Chrome"),
+ ("20.190.160.17", 443, "login.microsoftonline.com", "Microsoft Edge"),
+ ("17.253.144.10", 443, "apple.com", "Safari"),
+ ("3.163.189.90", 443, "d3ag4hukkh62yn.cloudfront.net", "Docker"),
+ ("146.75.118.217", 443, "api.github.com", "node"),
+ ("52.94.234.117", 443, "s3.amazonaws.com", "aws"),
+ ("188.114.96.7", 443, "discord.com", "Discord"),
+ ("149.154.167.99", 443, "core.telegram.org", "Telegram"),
+ ("87.98.154.146", 443, "www.ovhcloud.com", "Safari"),
+ ("162.159.130.234", 443, "signal.org", "Signal"),
+]
+
+# EN: Fake LAN neighbours — mDNS name claims make the perimeter readable.
+# FR: Faux voisins LAN — les revendications de nom mDNS rendent le périmètre lisible.
+LAN_DEVICES = [
+ ("192.168.1.1", "router.local"),
+ ("192.168.1.42", "iPhone-MoneyLisa.local"),
+ ("192.168.1.33", "HomePod-Cuisine.local"),
+ ("192.168.1.57", "MacBook-Air.local"),
+ ("192.168.1.88", "TV-Salon.local"),
+]
+
+LOCAL_IP = "192.168.1.20"
+
+
+def _pkt(direction, remote_ip, remote_port, size, process=None,
+ sni=None, protocol="TCP", dns=None):
+ """EN: Build one normalized Packet exactly as the parser would emit it.
+ FR: Construit un Packet normalisé comme le parser l'émettrait."""
+ return Packet(
+ src_ip=LOCAL_IP if direction == "out" else remote_ip,
+ dst_ip=remote_ip if direction == "out" else LOCAL_IP,
+ src_port=random.randint(49152, 65535) if direction == "out" else remote_port,
+ dst_port=remote_port if direction == "out" else random.randint(49152, 65535),
+ remote_port=remote_port,
+ protocol=protocol,
+ size=size,
+ timestamp=datetime.now(timezone.utc).isoformat(),
+ direction=direction,
+ process_name=process,
+ sni=sni,
+ dns=dns or [],
+ )
+
+
+class DemoFeeder(threading.Thread):
+ """
+ EN: Daemon thread that emits believable traffic bursts to the packet
+ callback. Stops with the process (daemon), ~10-40 pkt/s — enough to
+ animate the graph, bandwidth sparkline and alerts.
+ FR: Thread daemon qui émet des rafales de trafic crédibles vers le
+ callback paquets. S'arrête avec le processus (daemon),
+ ~10-40 pkt/s — assez pour animer graphe, sparkline et alertes.
+ """
+
+ def __init__(self, callback):
+ super().__init__(daemon=True)
+ self._cb = callback
+ self._t0 = time.time()
+ self._stopped = threading.Event()
+
+ def stop(self):
+ """EN: Same interface as PacketSniffer.stop() — ends the loop.
+ FR: Même interface que PacketSniffer.stop() — termine la boucle."""
+ self._stopped.set()
+
+ def run(self): # noqa: D401 — long-lived loop
+ self._announce_lan()
+ beacon_ip = "185.220.101.4" # EN: Tor-exit range → suspicious / FR: plage Tor → suspect
+ while not self._stopped.is_set():
+ # EN: 3-8 external packets per tick, mostly HTTPS.
+ # FR: 3-8 paquets externes par tick, surtout du HTTPS.
+ for _ in range(random.randint(3, 8)):
+ ip, port, sni, proc = random.choice(EXTERNAL_HOSTS)
+ direction = "out" if random.random() < 0.6 else "in"
+ size = random.randint(60, 60000 if direction == "in" else 2500)
+ self._cb(_pkt(direction, ip, port, size, proc, sni))
+
+ # EN: Occasional DNS answers so hostnames learn organically.
+ # FR: Réponses DNS occasionnelles pour l'apprentissage des noms.
+ if random.random() < 0.3:
+ ip, _, sni, _ = random.choice(EXTERNAL_HOSTS)
+ self._cb(_pkt("in", "192.168.1.1", 53, 120,
+ protocol="UDP",
+ dns=[(sni, ip, 300)]))
+
+ # EN: Chatter between LAN devices (perimeter demo).
+ # FR: Bavardage entre appareils LAN (démo du périmètre).
+ if random.random() < 0.5:
+ ip, _ = random.choice(LAN_DEVICES[1:])
+ self._cb(_pkt("out" if random.random() < 0.5 else "in",
+ ip, random.choice([443, 80, 548, 62078]),
+ random.randint(80, 8000)))
+
+ # EN: Beaconing pattern — regular small packets to a suspicious
+ # host trigger the anomaly alerts after ~1 min.
+ # FR: Balisage — petits paquets réguliers vers un hôte suspect,
+ # déclenche les alertes d'anomalies après ~1 min.
+ if int(time.time() - self._t0) % 5 == 0:
+ self._cb(_pkt("out", beacon_ip, 4444, 88, "curl"))
+
+ # EN: Occasional tracker to show the Tracking filter.
+ # FR: Tracker occasionnel pour montrer le filtre Tracking.
+ if random.random() < 0.15:
+ self._cb(_pkt("out", "142.251.46.174", 443,
+ random.randint(200, 3000), "Google Chrome",
+ "google-analytics.com"))
+
+ time.sleep(random.uniform(0.15, 0.5))
+
+ def _announce_lan(self):
+ """EN: Seed the LAN with mDNS-style name claims (multicast dst, learned
+ by the DNS pipeline without creating noise nodes).
+ FR: Amorce le LAN avec des revendications de nom façon mDNS (destination
+ multicast, apprises par le pipeline DNS sans créer de nœuds bruit)."""
+ for ip, name in LAN_DEVICES:
+ self._cb(_pkt("out", "224.0.0.251", 5353, 140,
+ protocol="UDP", dns=[(name, ip, 120)]))
+ time.sleep(0.05)
+
+
+def enabled() -> bool:
+ """EN: SNITCH_DEMO=1 (truthy) → synthetic traffic instead of libpcap.
+ FR: SNITCH_DEMO=1 (valeur vraie) → trafic synthétique au lieu de libpcap."""
+ return os.environ.get("SNITCH_DEMO", "").lower() in ("1", "true", "yes")
+
+
+def start(callback) -> DemoFeeder:
+ """EN: Start the synthetic feeder — drop-in for PacketSniffer.
+ FR: Démarre le générateur synthétique — remplaçant de PacketSniffer."""
+ feeder = DemoFeeder(callback)
+ feeder.start()
+ return feeder
diff --git a/docs/assets/demo.gif b/docs/assets/demo.gif
new file mode 100644
index 0000000..b1f31fb
Binary files /dev/null and b/docs/assets/demo.gif differ