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: Pinokio 1-click launcher — install/start/update/reset at repo root

MoneyLisa61c1c5ef7487
diff --git a/.gitignore b/.gitignore
index 204767b..1a91508 100644
--- a/.gitignore
+++ b/.gitignore
@@ -27,6 +27,11 @@ data/
# EN: Electron generated files / FR: Fichiers générés Electron
electron/icon.png
+# EN: Pinokio launcher artifacts / FR: Artefacts du launcher Pinokio
+backend/env/
+frontend_dist/
+logs/
+
# EN: OS / editor noise / FR: Fichiers système et éditeur
.DS_Store
*.log
diff --git a/backend/cli.py b/backend/cli.py
index 3ffefa7..c3e378b 100644
--- a/backend/cli.py
+++ b/backend/cli.py
@@ -81,9 +81,15 @@ def main() -> int:
token = get_token()
url = f"http://127.0.0.1:{port}/?token={token}"
- print(f"\n Snitch is running / Snitch tourne :\n\n {url}\n")
+ # EN: flush=True — launchers (Pinokio, systemd) pipe stdout, so an
+ # unflushed print would never reach their URL watchers.
+ # FR: flush=True — les launchers (Pinokio, systemd) pipent stdout, donc un
+ # print non flushé n'atteindrait jamais leurs watchers d'URL.
+ print(f"\n Snitch is running / Snitch tourne :\n\n {url}\n",
+ flush=True)
print(" Keep this terminal open. Ctrl+C to stop. / "
- "Gardez ce terminal ouvert. Ctrl+C pour arrêter.\n")
+ "Gardez ce terminal ouvert. Ctrl+C pour arrêter.\n",
+ flush=True)
if not args.no_browser:
# EN: Open after a short delay so uvicorn is listening first.
diff --git a/icon.png b/icon.png
new file mode 100644
index 0000000..ba36ef6
Binary files /dev/null and b/icon.png differ
diff --git a/install.js b/install.js
new file mode 100644
index 0000000..7923b63
--- /dev/null
+++ b/install.js
@@ -0,0 +1,47 @@
+// EN: Snitch install — two halves:
+// 1. Python backend into backend/env (uv venv, managed by shell.run).
+// 2. Frontend build → frontend_dist/ at repo root, which the backend
+// then serves at http://127.0.0.1:<port>/ (single-port app).
+// Everything runs local-only; the only downloads are pip/npm deps.
+// FR: Installation de Snitch — deux moitiés :
+// 1. Backend Python dans backend/env (venv uv, géré par shell.run).
+// 2. Build frontend → frontend_dist/ à la racine, que le backend sert
+// ensuite sur http://127.0.0.1:<port>/ (appli mono-port).
+// Tout reste local ; seuls les paquets pip/npm sont téléchargés.
+module.exports = {
+ run: [
+ {
+ // EN: Python deps — venv auto-created at backend/env.
+ // FR: Dépendances Python — le venv est créé automatiquement dans backend/env.
+ method: "shell.run",
+ params: {
+ venv: "env",
+ path: "backend",
+ message: "uv pip install -r requirements.txt"
+ }
+ },
+ {
+ // EN: Frontend deps + production build into frontend/dist.
+ // FR: Dépendances frontend + build de production dans frontend/dist.
+ method: "shell.run",
+ params: {
+ path: "frontend",
+ message: [
+ "npm install",
+ "npm run build"
+ ]
+ }
+ },
+ {
+ // EN: Publish the build where the backend serves it (repo-root
+ // frontend_dist — see backend/api/main.py).
+ // FR: Publier le build là où le backend le sert (frontend_dist à la
+ // racine — voir backend/api/main.py).
+ method: "fs.copy",
+ params: {
+ src: "frontend/dist",
+ dest: "frontend_dist"
+ }
+ }
+ ]
+}
diff --git a/pinokio.js b/pinokio.js
new file mode 100644
index 0000000..443bd8d
--- /dev/null
+++ b/pinokio.js
@@ -0,0 +1,90 @@
+// EN: Snitch launcher UI — mirrors the standard Pinokio server pattern:
+// Install → Start (daemon) → "Open Web UI" once local.url is set.
+// install.js creates backend/env (uv venv) and frontend_dist, so the
+// presence of backend/env marks a completed install.
+// FR: UI du launcher Snitch — reprend le pattern serveur standard Pinokio :
+// Install → Start (daemon) → « Open Web UI » une fois local.url posée.
+// install.js crée backend/env (venv uv) et frontend_dist, donc la
+// présence de backend/env marque une installation terminée.
+module.exports = {
+ version: "7.0",
+ title: "Snitch",
+ description: "Real-time network traffic visualizer — see who your computer talks to. / Visualiseur de trafic réseau en temps réel — voyez à qui parle votre ordinateur.",
+ icon: "icon.png",
+ menu: async (kernel, info) => {
+ let installed = info.exists("backend/env")
+ let running = {
+ install: info.running("install.js"),
+ start: info.running("start.js"),
+ update: info.running("update.js"),
+ reset: info.running("reset.js")
+ }
+ if (running.install) {
+ return [{
+ default: true,
+ icon: "fa-solid fa-plug",
+ text: "Installing",
+ href: "install.js",
+ }]
+ } else if (installed) {
+ if (running.start) {
+ let local = info.local("start.js")
+ if (local && local.url) {
+ return [{
+ default: true,
+ icon: "fa-solid fa-rocket",
+ text: "Open Web UI",
+ href: local.url,
+ }, {
+ icon: 'fa-solid fa-terminal',
+ text: "Terminal",
+ href: "start.js",
+ }]
+ } else {
+ return [{
+ default: true,
+ icon: 'fa-solid fa-terminal',
+ text: "Terminal",
+ href: "start.js",
+ }]
+ }
+ } else if (running.update) {
+ return [{
+ default: true,
+ icon: 'fa-solid fa-terminal',
+ text: "Updating",
+ href: "update.js",
+ }]
+ } else if (running.reset) {
+ return [{
+ default: true,
+ icon: 'fa-solid fa-terminal',
+ text: "Resetting",
+ href: "reset.js",
+ }]
+ } else {
+ return [{
+ default: true,
+ icon: "fa-solid fa-power-off",
+ text: "Start",
+ href: "start.js",
+ }, {
+ icon: "fa-solid fa-plug",
+ text: "Update",
+ href: "update.js",
+ }, {
+ icon: "fa-regular fa-circle-xmark",
+ text: "Reset",
+ href: "reset.js",
+ }]
+ }
+ } else {
+ return [{
+ default: true,
+ icon: "fa-solid fa-plug",
+ text: "Install",
+ href: "install.js",
+ }]
+ }
+ }
+}
diff --git a/pinokio.json b/pinokio.json
new file mode 100644
index 0000000..e14eb62
--- /dev/null
+++ b/pinokio.json
@@ -0,0 +1,9 @@
+{
+ "title": "Snitch",
+ "description": "Real-time network traffic visualizer — privacy-first, all data stays local. / Visualiseur de trafic réseau en temps réel — vie privée d'abord, toutes les données restent locales.",
+ "icon": "icon.png",
+ "links": [{
+ "title": "GitHub",
+ "value": "https://github.com/aixisstudio/Snitch"
+ }]
+}
diff --git a/reset.js b/reset.js
new file mode 100644
index 0000000..dfd089d
--- /dev/null
+++ b/reset.js
@@ -0,0 +1,32 @@
+// EN: Reset — removes everything install.js created plus runtime state:
+// the uv venv, node_modules, frontend build outputs, the served bundle,
+// and the local data dir (SQLite DB, API token, extracted geo DBs, logs).
+// After reset, the menu falls back to "Install" automatically.
+// FR: Réinitialisation — supprime tout ce qu'install.js a créé plus l'état
+// d'exécution : le venv uv, node_modules, les builds frontend, le bundle
+// servi, et le dossier de données local (BDD SQLite, jeton API, bases
+// géo extraites, logs). Ensuite le menu repasse sur « Install ».
+module.exports = {
+ run: [
+ {
+ method: "fs.rm",
+ params: { path: "backend/env" }
+ },
+ {
+ method: "fs.rm",
+ params: { path: "frontend/node_modules" }
+ },
+ {
+ method: "fs.rm",
+ params: { path: "frontend/dist" }
+ },
+ {
+ method: "fs.rm",
+ params: { path: "frontend_dist" }
+ },
+ {
+ method: "fs.rm",
+ params: { path: "data" }
+ }
+ ]
+}
diff --git a/start.js b/start.js
new file mode 100644
index 0000000..e29bb75
--- /dev/null
+++ b/start.js
@@ -0,0 +1,61 @@
+// EN: Snitch start — launches backend/cli.py which picks the port given via
+// --port, prints the full token URL on one line
+// ("http://127.0.0.1:<port>/?token=<hex>"), then serves API + built UI.
+//
+// Packet capture needs elevated privileges, so on macOS/Linux the
+// interpreter runs through sudo (Pinokio's `sudo: true` prefixes the
+// command). argv flags are used instead of env vars because sudo strips
+// the environment. env/bin/python is called explicitly for the same
+// reason — sudo resets PATH and would lose the venv.
+// On Windows there is no sudo — run Pinokio as Administrator (Npcap
+// required) for capture; the UI still works without it.
+//
+// FR: Démarrage de Snitch — lance backend/cli.py qui prend le port via
+// --port, affiche l'URL complète avec jeton sur une ligne
+// (« http://127.0.0.1:<port>/?token=<hex> »), puis sert API + UI buildée.
+//
+// La capture de paquets exige des privilèges élevés : sur macOS/Linux
+// l'interpréteur passe par sudo (`sudo: true` préfixe la commande). On
+// utilise les flags argv plutôt que des variables d'env car sudo purge
+// l'environnement. env/bin/python est appelé explicitement pour la même
+// raison — sudo réinitialise PATH et perdrait le venv.
+// Sous Windows pas de sudo — lancer Pinokio en Administrateur (Npcap
+// requis) pour la capture ; l'UI fonctionne quand même sans.
+module.exports = {
+ daemon: true,
+ run: [
+ {
+ when: "{{platform !== 'win32'}}",
+ method: "shell.run",
+ params: {
+ sudo: true,
+ path: "backend",
+ message: "env/bin/python cli.py --port {{port}} --no-browser",
+ on: [{
+ // EN: cli.py prints the full authenticated URL on one line.
+ // FR: cli.py affiche l'URL authentifiée complète sur une ligne.
+ "event": "/(http:\\/\\/[0-9.:]+\\/\\?token=[0-9a-f]+)/",
+ "done": true
+ }]
+ }
+ },
+ {
+ when: "{{platform === 'win32'}}",
+ method: "shell.run",
+ params: {
+ path: "backend",
+ message: "env\\Scripts\\python.exe cli.py --port {{port}} --no-browser",
+ on: [{
+ "event": "/(http:\\/\\/[0-9.:]+\\/\\?token=[0-9a-f]+)/",
+ "done": true
+ }]
+ }
+ },
+ {
+ method: "local.set",
+ params: {
+ url: "{{input.event[1]}}"
+ }
+ }
+ ]
+}
diff --git a/update.js b/update.js
new file mode 100644
index 0000000..970e0dc
--- /dev/null
+++ b/update.js
@@ -0,0 +1,41 @@
+// EN: Update — pull the launcher+app (single repo), refresh Python and npm
+// deps in case they changed, rebuild the frontend and republish
+// frontend_dist so the backend serves the new UI.
+// FR: Mise à jour — pull du launcher+app (dépôt unique), rafraîchit les deps
+// Python et npm au cas où, rebuilde le frontend et republie
+// frontend_dist pour que le backend serve la nouvelle UI.
+module.exports = {
+ run: [
+ {
+ method: "shell.run",
+ params: {
+ message: "git pull"
+ }
+ },
+ {
+ method: "shell.run",
+ params: {
+ venv: "env",
+ path: "backend",
+ message: "uv pip install -r requirements.txt"
+ }
+ },
+ {
+ method: "shell.run",
+ params: {
+ path: "frontend",
+ message: [
+ "npm install",
+ "npm run build"
+ ]
+ }
+ },
+ {
+ method: "fs.copy",
+ params: {
+ src: "frontend/dist",
+ dest: "frontend_dist"
+ }
+ }
+ ]
+}