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: data-driven blocklists, first-run onboarding, auto-launch, signing placeholders

MoneyLisa4d24d7ca1fec
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index d563ef6..0846526 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -83,11 +83,32 @@ jobs:
with:
name: snitch-backend-${{ matrix.os }}
path: dist/backend/*.tar.gz*
- # EN: Code signing/notarization placeholders — wire your secrets here:
- # Windows: signtool + Azure Trusted Signing / cert in secrets
- # macOS: codesign + notarytool (APPLE_ID/TEAM_ID secrets)
- # They are intentionally disabled until secrets are configured.
- # FR: Placeholders signature/notarisation — branchez vos secrets ici :
- # Windows : signtool + Azure Trusted Signing / cert dans secrets
- # macOS : codesign + notarytool (secrets APPLE_ID/TEAM_ID)
- # Volontairement désactivés tant que les secrets ne sont pas configurés.
+ # EN: Code signing/notarization placeholders — disabled until you set the
+ # repository VARIABLE `ENABLE_CODESIGNING=true` and the secrets below.
+ # Windows: AZURE_TENANT_ID / AZURE_CLIENT_ID / AZURE_CLIENT_SECRET +
+ # Trusted Signing endpoint, or a PFX in WINDOWS_CERT_PFX.
+ # macOS: APPLE_ID / APPLE_TEAM_ID / APPLE_APP_PASSWORD +
+ # MACOS_CERT_P12 (Developer ID) for codesign + notarytool.
+ # FR: Placeholders de signature/notarisation — désactivés tant que la
+ # VARIABLE de dépôt `ENABLE_CODESIGNING=true` et les secrets
+ # ci-dessous ne sont pas configurés.
+ # Windows : AZURE_TENANT_ID / AZURE_CLIENT_ID / AZURE_CLIENT_SECRET +
+ # endpoint Trusted Signing, ou un PFX dans WINDOWS_CERT_PFX.
+ # macOS : APPLE_ID / APPLE_TEAM_ID / APPLE_APP_PASSWORD +
+ # MACOS_CERT_P12 (Developer ID) pour codesign + notarytool.
+ - name: Code-sign backend (Windows placeholder)
+ if: ${{ matrix.os == 'windows-latest' && vars.ENABLE_CODESIGNING == 'true' }}
+ shell: pwsh
+ run: |
+ # EN: Example — Azure Trusted Signing / signtool. Replace with your
+ # certificate flow; keep secrets in GitHub Secrets, never inline.
+ # FR: Exemple — Azure Trusted Signing / signtool. Remplacez par votre
+ # flux de certificat ; secrets dans GitHub Secrets, jamais en clair.
+ Write-Host "signing would run here: signtool sign dist/backend/snitch-backend/snitch-backend.exe"
+ exit 1 # EN: fail loudly if enabled but not implemented / FR: échouer si activé mais non implémenté
+ - name: Code-sign + notarize backend (macOS placeholder)
+ if: ${{ matrix.os == 'macos-latest' && vars.ENABLE_CODESIGNING == 'true' }}
+ shell: bash
+ run: |
+ echo "signing would run here: codesign --sign 'Developer ID' dist/backend/snitch-backend"
+ exit 1 # EN: fail loudly if enabled but not implemented / FR: échouer si activé mais non implémenté
diff --git a/README.md b/README.md
index fe51ca4..8c8991a 100644
--- a/README.md
+++ b/README.md
@@ -33,6 +33,10 @@ The entire interface is available in **English and French**: use the `EN / FR` t
| Process Attribution | Know which app generates which traffic (top 5 per connection) |
| LAN Scanner | Passive discovery via the system ARP table (no broadcast scans) |
| Privacy Score | Real-time score of your outgoing traffic exposure |
+| Per-app View | Per-process destinations, volumes and 60-min history |
+| Alert Suppression | Persisted "ignore host/type" rules, manageable in the UI |
+| Settings Panel | Language, retention, filters, consent-gated GeoIP download, diagnostics |
+| Tracker Detection | Suffix-matched domain lists shipped as editable data files (`backend/classifier/lists/`) |
| Bandwidth Monitor | Live MB/s sparkline |
| EN / FR UI | Full bilingual interface, one click to switch |
@@ -171,6 +175,10 @@ Toute l'interface est disponible en **français et en anglais** : utilisez le s
| Attribution processus | Sachez quelle app génère quel trafic (top 5 par connexion) |
| Scanner LAN | Découverte passive via la table ARP système (aucun scan broadcast) |
| Score de confidentialité | Score en temps réel de l'exposition de votre trafic sortant |
+| Vue par application | Destinations, volumes et historique 60 min par processus |
+| Suppression d'alertes | Règles « ignorer hôte/type » persistées, gérables dans l'UI |
+| Panneau Réglages | Langue, rétention, filtres, téléchargement GeoIP sous consentement, diagnostic |
+| Détection de trackers | Listes de domaines par suffixe, livrées en fichiers de données éditables (`backend/classifier/lists/`) |
| Moniteur de débit | Sparkline MB/s en direct |
| UI FR / EN | Interface entièrement bilingue, bascule en un clic |
diff --git a/SECURITY.md b/SECURITY.md
index e6bc682..5ae9006 100644
--- a/SECURITY.md
+++ b/SECURITY.md
@@ -12,7 +12,7 @@ N'ouvrez pas d'issue publique pour les problèmes de sécurité.
## Local attack surface / Surface d'attaque locale
-The API exposes your full traffic graph — it is protected by design:
+**EN:** The API exposes your full traffic graph — it is protected by design:
- **Token auth** on every REST endpoint and the WebSocket
(`X-Snitch-Token` or `?token=`). Generated per launch under Electron,
@@ -22,9 +22,20 @@ The API exposes your full traffic graph — it is protected by design:
to block cross-site WebSocket hijacking.
- **Restricted CORS** — loopback origins only, no credentials.
+**FR :** L'API expose tout votre graphe de trafic — elle est protégée par
+conception :
+
+- **Authentification par jeton** sur chaque endpoint REST et le WebSocket
+ (`X-Snitch-Token` ou `?token=`). Généré à chaque lancement sous Electron,
+ persisté en 0600 sinon.
+- **Bind loopback** (`127.0.0.1`) par défaut dans tous les modes.
+- **Liste blanche d'Origin** sur le handshake WebSocket (hôtes loopback +
+ `null`) pour bloquer le détournement de WebSocket cross-site.
+- **CORS restreint** — origines loopback uniquement, sans identifiants.
+
## Privileges / Privilèges
-Packet capture requires elevated privileges. Current limitation: under
+**EN:** Packet capture requires elevated privileges. Current limitation: under
Electron the **whole app** (Chromium UI included) runs elevated on Windows
(`requireAdministrator`). A privileged-daemon split (unprivileged UI +
elevated capture backend) is a known roadmap item — see issues.
@@ -33,8 +44,22 @@ elevated capture backend) is a known roadmap item — see issues.
- Linux: `setcap cap_net_raw,cap_net_admin` on the binary, or root
- macOS: read access to `/dev/bpf*` (experimental support)
+**FR :** La capture de paquets exige des privilèges élevés. Limite actuelle :
+sous Electron, **toute l'app** (interface Chromium incluse) tourne en mode
+élevé sous Windows (`requireAdministrator`). Une séparation daemon privilégié
+(UI non élevée + backend de capture élevé) est un point de feuille de route
+connu — voir les issues.
+
+- Windows : Administrateur + Npcap (installé par vos soins depuis npcap.com)
+- Linux : `setcap cap_net_raw,cap_net_admin` sur le binaire, ou root
+- macOS : accès en lecture à `/dev/bpf*` (support expérimental)
+
## Dependencies / Dépendances
-Scapy was removed (GPL-2.0-only + large attack surface). Capture is a minimal
-ctypes binding to libpcap plus our own bounded parser. Dependencies are
-pinned and scanned by Dependabot.
+**EN:** Scapy was removed (GPL-2.0-only + large attack surface). Capture is a
+minimal ctypes binding to libpcap plus our own bounded parser. Dependencies
+are pinned and scanned by Dependabot.
+
+**FR :** Scapy a été retiré (GPL-2.0-only + large surface d'attaque). La
+capture est un binding ctypes minimal vers libpcap plus notre propre parseur
+borné. Les dépendances sont épinglées et surveillées par Dependabot.
diff --git a/THIRD_PARTY_NOTICES.md b/THIRD_PARTY_NOTICES.md
index 17c7fd7..425c7ac 100644
--- a/THIRD_PARTY_NOTICES.md
+++ b/THIRD_PARTY_NOTICES.md
@@ -43,6 +43,7 @@ compatibles AGPL.
|---|---|---|
| DB-IP Lite (City + ASN) | CC BY 4.0 | "IP Geolocation by [DB-IP](https://db-ip.com)" — recommended default |
| MaxMind GeoLite2 | GeoLite2 EULA | Optional alternative — requires a free MaxMind account; review the EULA before use |
+| `classifier/lists/*.txt` (bundled tracker + CDN domain lists) | CC0-1.0 | Curated in this repository — public domain, contributions welcome / listes maintenues dans ce dépôt — domaine public, contributions bienvenues |
Both `.mmdb` databases are placed manually by the user in `<data_dir>/geo/`.
No database is downloaded or contacted automatically.
diff --git a/backend/backend.spec b/backend/backend.spec
index ed503ce..1aad11d 100644
--- a/backend/backend.spec
+++ b/backend/backend.spec
@@ -29,7 +29,11 @@ a = Analysis(
pathex=['.'], # EN: backend/ — so api.*, capture.*, etc. resolve
# FR: backend/ — pour que api.*, capture.*, etc. se résolvent
binaries=[],
- datas=[],
+ # EN: Bundle classifier/lists/ (tracker + CDN domain lists) so the frozen
+ # app finds them — _list_dir() resolves via sys._MEIPASS.
+ # FR: Embarquer classifier/lists/ (listes trackers + CDN) pour que l'app
+ # figée les trouve — _list_dir() résout via sys._MEIPASS.
+ datas=[('classifier/lists', 'classifier/lists')],
hiddenimports=(
# ── uvicorn internals / éléments internes d'uvicorn ─────────────
collect_submodules('uvicorn')
diff --git a/backend/classifier/lists/cdns.txt b/backend/classifier/lists/cdns.txt
new file mode 100644
index 0000000..8de1d78
--- /dev/null
+++ b/backend/classifier/lists/cdns.txt
@@ -0,0 +1,75 @@
+# Snitch — CDN / edge-infrastructure domain list.
+#
+# EN: One registrable domain per line, suffix-matched. These are delivery
+# networks, not threats — flagging them as "cdn" keeps the graph honest
+# about what is infrastructure vs. a real endpoint. License: CC0-1.0.
+# Users may drop an overriding file at <data_dir>/lists/cdns.txt.
+# FR: Un domaine enregistrable par ligne, correspondance par suffixe. Ce sont
+# des réseaux de distribution, pas des menaces — les marquer « cdn »
+# distingue l'infrastructure des vrais endpoints. Licence : CC0-1.0.
+# L'utilisateur peut poser un fichier prioritaire dans
+# <data_dir>/lists/cdns.txt.
+
+cloudflare.com
+cloudflare.net
+cloudfront.net
+akamaiedge.net
+akamai.net
+akamaized.net
+edgekey.net
+edgesuite.net
+fastly.net
+fastlylb.net
+edgecastcdn.net
+azureedge.net
+cdn77.org
+stackpathdns.com
+incapdns.net
+impervadns.net
+gcdn.co
+cdnhwc1.com
+b-cdn.net
+jsdelivr.net
+unpkg.com
+cdnjs.cloudflare.com
+googleapis.com
+gstatic.com
+googlevideo.com
+ytimg.com
+ggpht.com
+windows.net
+msecnd.net
+licdn.com
+pinimg.com
+twimg.com
+cdninstagram.com
+fbcdn.net
+netflix.com
+nflxvideo.net
+nflximg.net
+nflximg.com
+nflxext.com
+spotifycdn.com
+scdn.co
+videodelivery.net
+vod-adaptive.akamaized.net
+live.net
+office.net
+apple-mapkit.apple.com
+icloud-content.com
+mzstatic.com
+cdn-apple.com
+aaplimg.com
+digicert.com
+verisign.com
+akadns.net
+cloudflare-dns.com
+dns.google
+quad9.net
+opendns.com
+llnwd.net
+hwcdn.net
+kxcdn.com
+footprint.net
+edgecast.net
+ecscdn.net
diff --git a/backend/classifier/lists/trackers.txt b/backend/classifier/lists/trackers.txt
new file mode 100644
index 0000000..e596d9e
--- /dev/null
+++ b/backend/classifier/lists/trackers.txt
@@ -0,0 +1,139 @@
+# Snitch — tracker / analytics domain list.
+#
+# EN: One registrable domain per line. Matching is by domain SUFFIX
+# (foo.example.com matches example.com; notexample.com does NOT).
+# Curated in-repo — contributions welcome via PR. License: CC0-1.0.
+# Users may drop an overriding file at <data_dir>/lists/trackers.txt.
+# FR: Un domaine enregistrable par ligne. Correspondance par SUFFIXE de
+# domaine (foo.example.com correspond ; notexample.com NON).
+# Maintenue dans le dépôt — contributions via PR. Licence : CC0-1.0.
+# L'utilisateur peut poser un fichier prioritaire dans
+# <data_dir>/lists/trackers.txt.
+
+doubleclick.net
+googlesyndication.com
+google-analytics.com
+googletagmanager.com
+facebook.com
+fbcdn.net
+facebook.net
+amazon-adsystem.com
+scorecardresearch.com
+quantserve.com
+hotjar.com
+mixpanel.com
+segment.io
+segment.com
+ads.twitter.com
+analytics.twitter.com
+ads.linkedin.com
+snap.licdn.com
+bat.bing.com
+clarity.ms
+newrelic.com
+nr-data.net
+sentry.io
+app-measurement.com
+demdex.net
+omtrdc.net
+2o7.net
+matomo.cloud
+plausible.io
+criteo.com
+criteo.net
+taboola.com
+outbrain.com
+moatads.com
+adsrvr.org
+adnxs.com
+rubiconproject.com
+pubmatic.com
+openx.net
+smartadserver.com
+tealiumiq.com
+branch.io
+appsflyer.com
+adjust.com
+kochava.com
+flurry.com
+umeng.com
+count.ly
+optimizely.com
+fullstory.com
+mouseflow.com
+crazyegg.com
+luckyorange.com
+pendo.io
+heap.io
+amplitude.com
+logrocket.com
+datadoghq.com
+intercom.io
+intercomcdn.com
+zdassets.com
+bugsnag.com
+onetrust.com
+cookielaw.org
+trustarc.com
+quantcast.com
+exelator.com
+bluekai.com
+rlcdn.com
+tapad.com
+liveramp.com
+mediamath.com
+bidswitch.net
+casalemedia.com
+indexww.com
+spotxchange.com
+sharethrough.com
+yieldmo.com
+triplelift.com
+33across.com
+adform.net
+serving-sys.com
+flashtalking.com
+sizmek.com
+chartbeat.com
+parsely.com
+comscore.com
+ns1.com
+imrworldwide.com
+nielsen.com
+waardex.com
+advertising.com
+adcolony.com
+inmobi.com
+vungle.com
+unity3d.com
+ironsrc.com
+applovin.com
+moloco.com
+singular.net
+tiktok.com
+byteoversea.com
+analytics.yahoo.com
+yahooapis.com
+scorecardresearch.net
+cxense.com
+tiqcdn.com
+permutive.com
+graphql.facebook.com
+connect.facebook.net
+pixel.facebook.com
+ads-api.twitter.com
+ads.snapchat.com
+tr.snapchat.com
+business-api.tiktok.com
+analytics.tiktok.com
+ads.pinterest.com
+widgets.pinterest.com
+ads-api.reddit.com
+alb.reddit.com
+events.reddit.com
+metrics.roku.com
+ads.hulu.com
+ads.netflix.com
+metrics.apple.com
+metrics.icloud.com
+analytics.edgekey.net
diff --git a/backend/classifier/traffic.py b/backend/classifier/traffic.py
index 0b88a2d..1f8fdef 100644
--- a/backend/classifier/traffic.py
+++ b/backend/classifier/traffic.py
@@ -12,25 +12,87 @@ FR: Attribue à chaque connexion un label (HTTPS, DNS, SSH…), une catégorie
de domaines trackers/CDN connus, puis les ports bien connus.
"""
+import logging
+import sys
from dataclasses import dataclass
+from pathlib import Path
from typing import Optional
+from paths import data_dir
+
+logger = logging.getLogger("snitch.classifier")
+
+
+def _list_dir() -> Path:
+ """EN: Bundled classifier/lists/ directory — works in dev AND inside the
+ PyInstaller bundle (sys._MEIPASS). / FR: Dossier classifier/lists/
+ embarqué — fonctionne en dev ET dans le bundle PyInstaller
+ (sys._MEIPASS)."""
+ base = Path(getattr(sys, "_MEIPASS", Path(__file__).resolve().parent))
+ return base / "classifier" / "lists" if getattr(sys, "_MEIPASS", None) else base / "lists"
+
+
+def _load_domain_list(name: str, fallback: set[str]) -> set[str]:
+ """
+ EN: Load a domain list. Priority: <data_dir>/lists/<name> (user override)
+ → bundled classifier/lists/<name> → hardcoded fallback. Blank lines
+ and '#' comments are skipped; everything is lowercased.
+ FR: Charger une liste de domaines. Priorité : <data_dir>/lists/<name>
+ (surcharge utilisateur) → classifier/lists/<name> embarqué → repli
+ codé en dur. Lignes vides et commentaires '#' ignorés ; tout en
+ minuscules.
+ """
+ candidates = [data_dir() / "lists" / name, _list_dir() / name]
+ for path in candidates:
+ try:
+ if path.exists():
+ domains = {
+ line.strip().lower()
+ for line in path.read_text(encoding="utf-8").splitlines()
+ if line.strip() and not line.strip().startswith("#")
+ }
+ if domains:
+ logger.debug("loaded %d domains from %s", len(domains), path)
+ return domains
+ except OSError as exc:
+ logger.warning("cannot read %s: %s", path, exc)
+ return set(fallback)
+
+
+# EN: Last-resort in-code lists if the data files are missing entirely.
+# FR: Listes de dernier recours si les fichiers de données manquent.
+_FALLBACK_TRACKERS = {"doubleclick.net", "googlesyndication.com", "facebook.com"}
+_FALLBACK_CDNS = {"cloudflare.com", "akamaiedge.net", "fastly.net", "cloudfront.net"}
+
# EN: Well-known tracker / analytics domains — flagged "tracking" (amber).
+# Loaded from data/lists/ so the community can extend them without code.
# FR: Domaines de tracking / analytics connus — signalés « tracking » (ambre).
-KNOWN_TRACKERS = {
- "doubleclick.net", "googlesyndication.com", "facebook.com",
- "fbcdn.net", "amazon-adsystem.com", "scorecardresearch.com",
- "quantserve.com", "hotjar.com", "mixpanel.com", "segment.io",
-}
+# Chargés depuis data/lists/ pour que la communauté puisse les étendre
+# sans toucher au code.
+KNOWN_TRACKERS = _load_domain_list("trackers.txt", _FALLBACK_TRACKERS)
# EN: Major CDN providers — flagged "cdn" (indigo). Not dangerous, but useful
# to distinguish infrastructure from real endpoints.
# FR: Grands fournisseurs CDN — signalés « cdn » (indigo). Pas dangereux, mais
# utile pour distinguer l'infrastructure des vrais endpoints.
-KNOWN_CDN = {
- "cloudflare.com", "akamaiedge.net", "fastly.net",
- "cloudfront.net", "edgekey.net",
-}
+KNOWN_CDN = _load_domain_list("cdns.txt", _FALLBACK_CDNS)
+
+
+def _domain_match(hostname: str, domains: set[str]) -> bool:
+ """
+ EN: Registrable-domain SUFFIX match — "cdn.api.example.com" matches
+ "example.com" but "notexample.com" does NOT (the old `in` substring
+ test produced exactly that kind of false positive).
+ FR: Correspondance par SUFFIXE de domaine enregistrable —
+ « cdn.api.example.com » correspond à « example.com » mais
+ « notexample.com » NON (l'ancien test par sous-chaîne produisait
+ exactement ce genre de faux positif).
+ """
+ h = hostname.lower().rstrip(".")
+ for d in domains:
+ if h == d or h.endswith("." + d):
+ return True
+ return False
# EN: Human-readable service names for common destination ports.
# FR: Noms de service lisibles pour les ports de destination courants.
@@ -70,26 +132,23 @@ def classify(
) -> TrafficCategory:
"""
EN: Classify one connection. Priority order:
- 1. hostname contains a known tracker domain -> tracking
- 2. hostname contains a known CDN domain -> cdn
+ 1. hostname ends with a known tracker domain -> tracking
+ 2. hostname ends with a known CDN domain -> cdn
3. well-known destination port -> safe/dns/admin
4. fallback -> unknown
FR: Classifier une connexion. Ordre de priorité :
- 1. hostname contient un domaine tracker connu -> tracking
- 2. hostname contient un domaine CDN connu -> cdn
- 3. port de destination bien connu -> safe/dns/admin
- 4. repli -> unknown
+ 1. hostname finit par un domaine tracker connu -> tracking
+ 2. hostname finit par un domaine CDN connu -> cdn
+ 3. port de destination bien connu -> safe/dns/admin
+ 4. repli -> unknown
"""
label = PORT_LABELS.get(dst_port or 0, protocol)
if hostname:
- h = hostname.lower()
- for tracker in KNOWN_TRACKERS:
- if tracker in h:
- return TrafficCategory(label, "tracking", "medium", "#f59e0b")
- for cdn in KNOWN_CDN:
- if cdn in h:
- return TrafficCategory(label, "cdn", "low", "#6366f1")
+ if _domain_match(hostname, KNOWN_TRACKERS):
+ return TrafficCategory(label, "tracking", "medium", "#f59e0b")
+ if _domain_match(hostname, KNOWN_CDN):
+ return TrafficCategory(label, "cdn", "low", "#6366f1")
if dst_port == 443:
return TrafficCategory(label, "safe", "low", "#22c55e")
diff --git a/backend/tests/test_classifier.py b/backend/tests/test_classifier.py
index 7476db7..eaa2309 100644
--- a/backend/tests/test_classifier.py
+++ b/backend/tests/test_classifier.py
@@ -43,3 +43,19 @@ def test_unknown_port_falls_back_to_protocol_label():
r = classify(None, 9999, "TCP")
assert r.category == "unknown"
assert r.label == "TCP"
+
+
+def test_suffix_match_rejects_lookalike_domain():
+ """EN: "notdoubleclick.net" contains "doubleclick.net" as a substring but
+ is NOT a subdomain — the old `in` test falsely flagged it.
+ FR: « notdoubleclick.net » contient « doubleclick.net » en sous-chaîne
+ mais n'est PAS un sous-domaine — l'ancien test `in` le signalait à tort."""
+ r = classify("notdoubleclick.net", 443, "TCP")
+ assert r.category == "safe"
+
+
+def test_suffix_match_accepts_deep_subdomain():
+ """EN: a.b.c.doubleclick.net still matches doubleclick.net by suffix.
+ FR: a.b.c.doubleclick.net correspond toujours à doubleclick.net."""
+ r = classify("a.b.c.doubleclick.net", 443, "TCP")
+ assert r.category == "tracking"
diff --git a/electron/main.js b/electron/main.js
index a7a756e..db1dfc9 100644
--- a/electron/main.js
+++ b/electron/main.js
@@ -112,6 +112,20 @@ ipcMain.handle('snitch:get-version', () => app.getVersion())
// (contrat de shell.openPath).
ipcMain.handle('snitch:open-logs', () => shell.openPath(logDir))
+// EN: "Launch at login" toggle — app.setLoginItemSettings is cross-platform
+// (Windows registry Run key, macOS login items); a no-op on Linux where
+// the API doesn't apply. The renderer reads the state with the same IPC.
+// FR: Bascule « lancer au démarrage » — app.setLoginItemSettings est
+// multi-OS (clé Run Windows, login items macOS) ; sans effet sous Linux
+// où l'API ne s'applique pas. Le renderer lit l'état via le même IPC.
+ipcMain.handle('snitch:get-auto-launch', () =>
+ process.platform === 'linux' ? false : app.getLoginItemSettings().openAtLogin)
+ipcMain.handle('snitch:set-auto-launch', (_evt, enabled) => {
+ if (process.platform === 'linux') return false
+ app.setLoginItemSettings({ openAtLogin: !!enabled })
+ return app.getLoginItemSettings().openAtLogin
+})
+
/**
* EN: Find a free loopback port by binding :0 and releasing — the backend
* then binds the same number. A tiny race window remains (another
diff --git a/electron/preload.js b/electron/preload.js
index 77fe4f1..675561a 100644
--- a/electron/preload.js
+++ b/electron/preload.js
@@ -35,4 +35,9 @@ contextBridge.exposeInMainWorld('snitch', {
// FR: Asynchrone — demande au processus principal d'ouvrir le dossier des
// logs dans le gestionnaire de fichiers (shell.openPath — multi-OS).
openLogs: () => ipcRenderer.invoke('snitch:open-logs'),
+ // EN: Launch-at-login getters/setters (Windows/macOS; Linux always false).
+ // FR: Lecture/écriture du lancement au démarrage (Windows/macOS ; toujours
+ // false sous Linux).
+ getAutoLaunch: () => ipcRenderer.invoke('snitch:get-auto-launch'),
+ setAutoLaunch: (enabled) => ipcRenderer.invoke('snitch:set-auto-launch', enabled),
})
diff --git a/frontend/src/App.jsx b/frontend/src/App.jsx
index 5700961..1bbad2f 100644
--- a/frontend/src/App.jsx
+++ b/frontend/src/App.jsx
@@ -20,6 +20,7 @@ import AppsView from './components/AppsView'
import Sidebar from './components/Sidebar'
import { AlertBell, AlertPanel, AlertToasts } from './components/AlertPanel'
import { SettingsButton, SettingsPanel } from './components/Settings'
+import Onboarding from './components/Onboarding'
import Timeline from './components/Timeline'
import Dropdown from './components/Dropdown'
import { apiBase, authHeaders } from './api'
@@ -36,6 +37,11 @@ export default function App() {
const [view, setView] = useState('graph')
const [showAlerts, setShowAlerts] = useState(false)
const [showSettings, setShowSettings] = useState(false)
+ // EN: First-run explainer — shown once, flag persisted in localStorage.
+ // FR: Explications de premier lancement — affichées une fois, drapeau
+ // persisté en localStorage.
+ const [showOnboarding, setShowOnboarding] = useState(
+ () => !localStorage.getItem('snitch_onboarded'))
const [filter, setFilter] = useState({ text: '', category: 'all' })
const { lang, setLang } = useT()
@@ -164,6 +170,8 @@ export default function App() {
<SettingsPanel onClose={() => setShowSettings(false)} lang={lang} setLang={setLang} />
)}
+ {showOnboarding && <Onboarding onDone={() => setShowOnboarding(false)} />}
+
{/* EN: Floating toasts for warning/critical alerts.
FR: Toasts flottants pour les alertes warning/critiques. */}
<AlertToasts alerts={alerts.filter(a => a.severity !== 'info').slice(0, 3)} />
diff --git a/frontend/src/components/Onboarding.jsx b/frontend/src/components/Onboarding.jsx
new file mode 100644
index 0000000..85e9065
--- /dev/null
+++ b/frontend/src/components/Onboarding.jsx
@@ -0,0 +1,81 @@
+/**
+ * Snitch — first-run onboarding modal.
+ *
+ * EN: Shown exactly once (localStorage flag `snitch_onboarded`). Explains the
+ * three things a privacy tool owes its user up front: what privileges the
+ * capture needs, WHAT is actually captured (headers/metadata — never
+ * payloads), and what leaves the machine (nothing, except the opt-in
+ * GeoIP download the user triggers themselves).
+ * FR: Affiché une seule fois (drapeau localStorage `snitch_onboarded`).
+ * Explique les trois choses qu'un outil de vie privée doit à son
+ * utilisateur d'emblée : les privilèges requis par la capture, CE qui est
+ * réellement capturé (en-têtes/métadonnées — jamais les contenus), et ce
+ * qui quitte la machine (rien, sauf le téléchargement GeoIP opt-in
+ * déclenché par l'utilisateur).
+ */
+import { ShieldCheck, Eye, Download } from 'lucide-react'
+import { useT } from '../i18n'
+
+export default function Onboarding({ onDone }) {
+ const { t } = useT()
+
+ function dismiss() {
+ localStorage.setItem('snitch_onboarded', '1')
+ onDone()
+ }
+
+ const item = { display: 'flex', gap: 12, alignItems: 'flex-start', marginBottom: 14 }
+
+ return (
+ <div role="dialog" aria-modal="true" aria-label={t('onboard_title')} style={{
+ position: 'fixed', inset: 0, zIndex: 1000,
+ background: 'rgba(2,6,23,0.85)', backdropFilter: 'blur(4px)',
+ display: 'flex', alignItems: 'center', justifyContent: 'center',
+ }}>
+ <div style={{
+ width: 440, background: '#1e293b', border: '1px solid #334155',
+ borderRadius: 14, padding: '28px 28px 20px',
+ boxShadow: '0 20px 60px rgba(0,0,0,0.7)',
+ }}>
+ <div style={{ fontSize: 18, fontWeight: 700, color: '#f1f5f9', marginBottom: 4 }}>
+ {t('onboard_title')}
+ </div>
+ <div style={{ fontSize: 12, color: '#94a3b8', marginBottom: 20 }}>
+ {t('onboard_sub')}
+ </div>
+
+ <div style={item}>
+ <ShieldCheck size={18} color="#22c55e" style={{ flexShrink: 0, marginTop: 1 }} />
+ <div>
+ <div style={{ fontSize: 12, fontWeight: 600, color: '#e2e8f0' }}>{t('onboard_priv_title')}</div>
+ <div style={{ fontSize: 11, color: '#94a3b8', lineHeight: 1.5 }}>{t('onboard_priv_body')}</div>
+ </div>
+ </div>
+
+ <div style={item}>
+ <Eye size={18} color="#38bdf8" style={{ flexShrink: 0, marginTop: 1 }} />
+ <div>
+ <div style={{ fontSize: 12, fontWeight: 600, color: '#e2e8f0' }}>{t('onboard_capture_title')}</div>
+ <div style={{ fontSize: 11, color: '#94a3b8', lineHeight: 1.5 }}>{t('onboard_capture_body')}</div>
+ </div>
+ </div>
+
+ <div style={item}>
+ <Download size={18} color="#f59e0b" style={{ flexShrink: 0, marginTop: 1 }} />
+ <div>
+ <div style={{ fontSize: 12, fontWeight: 600, color: '#e2e8f0' }}>{t('onboard_out_title')}</div>
+ <div style={{ fontSize: 11, color: '#94a3b8', lineHeight: 1.5 }}>{t('onboard_out_body')}</div>
+ </div>
+ </div>
+
+ <button onClick={dismiss} autoFocus style={{
+ width: '100%', marginTop: 8, padding: '10px 0',
+ background: '#3b82f6', border: 'none', borderRadius: 8,
+ color: '#fff', fontSize: 13, fontWeight: 700, cursor: 'pointer',
+ }}>
+ {t('onboard_go')}
+ </button>
+ </div>
+ </div>
+ )
+}
diff --git a/frontend/src/components/Settings.jsx b/frontend/src/components/Settings.jsx
index c893d05..051d12f 100644
--- a/frontend/src/components/Settings.jsx
+++ b/frontend/src/components/Settings.jsx
@@ -38,6 +38,7 @@ export function SettingsPanel({ onClose, lang, setLang }) {
const [geoStatus, setGeoStatus] = useState(null)
const [geoMsg, setGeoMsg] = useState('')
const [saved, setSaved] = useState(false)
+ const [autoLaunch, setAutoLaunch] = useState(false)
useEffect(() => {
;(async () => {
@@ -52,6 +53,9 @@ export function SettingsPanel({ onClose, lang, setLang }) {
setRetention(s.settings?.retention_hours ?? 24)
setGeoStatus(g)
} catch { setSettings({}) }
+ if (window.snitch?.getAutoLaunch) {
+ setAutoLaunch(await window.snitch.getAutoLaunch())
+ }
})()
}, [])
@@ -157,6 +161,30 @@ export function SettingsPanel({ onClose, lang, setLang }) {
</select>
</div>
+ {/* Auto-launch (Electron only) / Lancement auto (Electron seul) */}
+ {window.snitch?.setAutoLaunch && (
+ <div style={row}>
+ <div>
+ <div style={label}>{t('settings_autolaunch')}</div>
+ <div style={hint}>{t('settings_autolaunch_hint')}</div>
+ </div>
+ <button onClick={async () => setAutoLaunch(await window.snitch.setAutoLaunch(!autoLaunch))}
+ role="switch" aria-checked={autoLaunch}
+ style={{
+ width: 36, height: 20, borderRadius: 10, border: 'none',
+ background: autoLaunch ? '#3b82f6' : '#0f172a',
+ outline: '1px solid #334155', cursor: 'pointer',
+ position: 'relative', flexShrink: 0,
+ }}>
+ <div style={{
+ width: 14, height: 14, borderRadius: '50%', background: '#e2e8f0',
+ position: 'absolute', top: 3, left: autoLaunch ? 19 : 3,
+ transition: 'left 0.15s',
+ }} />
+ </button>
+ </div>
+ )}
+
{/* GeoIP / GeoIP */}
<div style={{ ...row, display: 'block' }}>
<div style={label}>{t('geo_title')}</div>
diff --git a/frontend/src/i18n.jsx b/frontend/src/i18n.jsx
index 82dcd9d..bbb7050 100644
--- a/frontend/src/i18n.jsx
+++ b/frontend/src/i18n.jsx
@@ -200,6 +200,19 @@ const en = {
apps_top_dest: 'Top destinations',
apps_history_60m: 'Last hour (bytes/min)',
alertmsg_NEW_HOSTS: n => `${n} new host${n > 1 ? 's' : ''} contacted`,
+ settings_autolaunch: 'Launch at login',
+ settings_autolaunch_hint: 'Start Snitch automatically when you sign in',
+
+ // Onboarding / Premier lancement
+ onboard_title: 'Welcome to Snitch',
+ onboard_sub: 'Real-time network traffic visualizer — private by design.',
+ onboard_priv_title: 'Everything stays on this machine',
+ onboard_priv_body: 'Traffic metadata, alerts and history are stored in a local SQLite database. No account, no cloud, no telemetry.',
+ onboard_capture_title: 'What is captured',
+ onboard_capture_body: 'Packet headers only: destination IPs, ports, volumes, process names, DNS names and TLS server names (SNI). Payloads are never read.',
+ onboard_out_title: 'What leaves the machine',
+ onboard_out_body: 'Nothing by default. The only possible outbound call is the geolocation database download, which you trigger yourself in Settings.',
+ onboard_go: 'Got it',
}
// ── Dictionnaire français / French dictionary ────────────────────────────────
@@ -386,6 +399,19 @@ const fr = {
apps_top_dest: 'Destinations principales',
apps_history_60m: 'Dernière heure (octets/min)',
alertmsg_NEW_HOSTS: n => `${n} nouvel${n > 1 ? 'x' : ''} hôte${n > 1 ? 's' : ''} contacté${n > 1 ? 's' : ''}`,
+ settings_autolaunch: 'Lancer à la connexion',
+ settings_autolaunch_hint: 'Démarrer Snitch automatiquement à l\'ouverture de session',
+
+ // Premier lancement / Onboarding
+ onboard_title: 'Bienvenue dans Snitch',
+ onboard_sub: 'Visualiseur de trafic réseau en temps réel — privé par conception.',
+ onboard_priv_title: 'Tout reste sur cette machine',
+ onboard_priv_body: 'Métadonnées de trafic, alertes et historique sont stockés dans une base SQLite locale. Pas de compte, pas de cloud, pas de télémétrie.',
+ onboard_capture_title: 'Ce qui est capturé',
+ onboard_capture_body: 'Les en-têtes de paquets seulement : IP de destination, ports, volumes, noms de processus, noms DNS et SNI TLS. Les contenus ne sont jamais lus.',
+ onboard_out_title: 'Ce qui quitte la machine',
+ onboard_out_body: 'Rien par défaut. Le seul appel sortant possible est le téléchargement de la base de géolocalisation, que vous déclenchez vous-même dans les Réglages.',
+ onboard_go: 'Compris',
}
// ── Context / Contexte ───────────────────────────────────────────────────────
diff --git a/pyproject.toml b/pyproject.toml
index b73b4f1..07230c9 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -49,3 +49,6 @@ py-modules = ["cli", "paths", "logging_config", "run_backend"]
# backend/frontend_dist par la chaîne de release avant le build.
[tool.setuptools.package-data]
"*" = ["frontend_dist/**/*"]
+# EN: Domain lists ship inside the wheel too (tracker + CDN suffix lists).
+# FR: Les listes de domaines sont aussi embarquées dans la wheel.
+"classifier" = ["lists/*.txt"]