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.
Python cybersecurityd3jsebpfedrelectronfastapifirewallfleet-managementlinuxlittle-snitch-alternativemacosnetwork-monitornetwork-securitypacket-captureprivacyreactrustself-hostedsiemwindows
Fix Windows console flash: hide backend subprocess windows (#62)
MoneyLisa6cb83aedc027
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 9b46f2e..e8427ae 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -20,6 +20,17 @@ The format follows [Keep a Changelog](https://keepachangelog.com/) — EN/FR.### Fixed / Corrigé+- EN: **Windows console-window flash fixed** — backend console tools+ (`netsh` SSID poll every 60 s, firewall rules, `route`/`arp` lookups)+ now spawn with `CREATE_NO_WINDOW`/`SW_HIDE`; no more transient popup+ storm on Windows (issue #62, reported by @minghao999, confirmed by+ @iactor).+ FR: **Clignotement de console Windows corrigé** — les outils console+ du backend (`netsh` pour le SSID toutes les 60 s, règles pare-feu,+ `route`/`arp`) se lancent désormais avec `CREATE_NO_WINDOW`/`SW_HIDE` ;+ plus de rafale de popups sous Windows (issue #62, signalée par+ @minghao999, confirmée par @iactor).+- EN: **Dark-mode legibility** — `--text-muted`/`--text-faint` (and thelight-theme equivalents) were ~2.5–4:1 contrast at the 9–10px sizesused in lists; bumped to ≈4.5–5.5:1, and the packet feed microtextdiff --git a/backend/api/main.py b/backend/api/main.pyindex 20fb82e..9a49e53 100644--- a/backend/api/main.py+++ b/backend/api/main.py@@ -117,6 +117,7 @@ from api.notify import notifierfrom paths import data_dir, chown_treeimport storage.db as dbfrom version import __version__+from procutils import spawn_kwargslogger = logging.getLogger("snitch.api")@@ -623,7 +624,7 @@ def _local_hostname() -> str:if sys.platform == "darwin":out = subprocess.run(["scutil", "--get", "ComputerName"],capture_output=True, text=True,- timeout=3).stdout.strip()+ timeout=3, **spawn_kwargs()).stdout.strip()if out:return outelif sys.platform.startswith("win"):@@ -634,7 +635,7 @@ def _local_hostname() -> str:try:out = subprocess.run(["hostnamectl", "--pretty"],capture_output=True, text=True,- timeout=3).stdout.strip()+ timeout=3, **spawn_kwargs()).stdout.strip()if out:return outexcept (OSError, subprocess.TimeoutExpired):@@ -1967,21 +1968,22 @@ def _current_ssid() -> str:iface = (_sniffer.iface if _sniffer else None) or "en0"out = subprocess.run(["ipconfig", "getsummary", iface],- capture_output=True, text=True, timeout=3).stdout+ capture_output=True, text=True, timeout=3, **spawn_kwargs()).stdoutfor line in out.splitlines():if "SSID :" in line:ssid = line.split("SSID :", 1)[1].strip()breakelif sys.platform.startswith("linux"):out = subprocess.run(- ["iwgetid", "-r"], capture_output=True, text=True, timeout=3+ ["iwgetid", "-r"], capture_output=True, text=True, timeout=3,+ **spawn_kwargs()).stdout.strip()if out:ssid = outelif sys.platform == "win32":out = subprocess.run(["netsh", "wlan", "show", "interfaces"],- capture_output=True, text=True, timeout=3).stdout+ capture_output=True, text=True, timeout=3, **spawn_kwargs()).stdoutfor line in out.splitlines():if line.strip().startswith("SSID"):ssid = line.split(":", 1)[1].strip()diff --git a/backend/detection/askmode.py b/backend/detection/askmode.pyindex fa61cf6..c6b42c0 100644--- a/backend/detection/askmode.py+++ b/backend/detection/askmode.py@@ -51,6 +51,7 @@ import platformimport threadingimport timefrom typing import Callable, Optional+from procutils import spawn_kwargslogger = logging.getLogger(__name__)@@ -210,7 +211,7 @@ class AskMode:for c in cmds:try:subprocess.run(c, timeout=10, check=False,- capture_output=True)+ capture_output=True, **spawn_kwargs())inserted.append(c)except OSError as e:self._rollback_rules(inserted)@@ -262,7 +263,7 @@ class AskMode:rm = ["-D" if a == "-I" else a for a in c]try:subprocess.run(rm, timeout=10, check=False,- capture_output=True)+ capture_output=True, **spawn_kwargs())except OSError:passdiff --git a/backend/detection/contain.py b/backend/detection/contain.pyindex cf80fc8..b1c19fb 100644--- a/backend/detection/contain.py+++ b/backend/detection/contain.py@@ -38,6 +38,7 @@ import platformimport shutilimport subprocessimport time+from procutils import spawn_kwargs_SYSTEM = platform.system().lower()_MAX_SECONDS = 30@@ -118,6 +119,7 @@ def run_sandboxed(path: str, args: list[str],try:t0 = time.monotonic()proc = subprocess.run(cmd, timeout=seconds, capture_output=True,+ **spawn_kwargs(),text=False, cwd="/", check=False)dur = round(time.monotonic() - t0, 2)return {"ok": True, "command": cmd, "seconds": dur,diff --git a/backend/detection/firewall.py b/backend/detection/firewall.pyindex ed2cdbe..0b88b59 100644--- a/backend/detection/firewall.py+++ b/backend/detection/firewall.py@@ -60,6 +60,7 @@ import timeimport uuidfrom pathlib import Pathfrom typing import Optional+from procutils import spawn_kwargs# EN: RFC-1034/1123 hostname — labels of ≤63 alnum/dash chars joined by# dots, total ≤253. Anchored so no whitespace/newline can slip through.@@ -428,7 +429,7 @@ class FirewallManager:"""EN: Run one firewall command, never through a shell. Returns(success, stderr). / FR: Exécute une commande pare-feu sans shell."""try:- p = subprocess.run(args, capture_output=True, text=True, timeout=15)+ p = subprocess.run(args, capture_output=True, text=True, timeout=15, **spawn_kwargs())err = (p.stderr or p.stdout or "").strip()return p.returncode == 0, err[:300]except Exception as e: # noqa: BLE001 — report, don't crashdiff --git a/backend/procutils.py b/backend/procutils.pynew file mode 100644index 0000000..02875a7--- /dev/null+++ b/backend/procutils.py@@ -0,0 +1,36 @@+"""EN: Windows-safe subprocess helpers.++ Console tools spawned from the windowed (non-console) backend each+ flash a transient console window on Windows unless told otherwise —+ e.g. the 60 s Wi-Fi-SSID poll via ``netsh`` produced a visible popup+ storm (issue #62). Every backend subprocess call must funnel through+ ``spawn_kwargs()`` so console children stay invisible.++FR: Helpers subprocess sûrs sous Windows.++ Les outils console lancés depuis le backend fenêtré font clignoter une+ fenêtre console à chaque appel sauf indication contraire — ex. le+ sondage SSID Wi-Fi via ``netsh`` toutes les 60 s produisait une rafale+ de popups (issue #62). Tout appel subprocess du backend doit passer+ par ``spawn_kwargs()`` pour que les enfants restent invisibles.+"""+import subprocess+import sys++__all__ = ["spawn_kwargs"]+++def spawn_kwargs() -> dict:+ """EN: Extra kwargs for subprocess.run/Popen hiding the child console+ on Windows; empty dict elsewhere so call sites stay portable.+ FR: kwargs supplémentaires pour subprocess.run/Popen cachant la console+ enfant sous Windows ; dict vide ailleurs pour rester portable."""+ if sys.platform != "win32":+ return {}+ si = subprocess.STARTUPINFO()+ si.dwFlags |= subprocess.STARTF_USESHOWWINDOW+ si.wShowWindow = subprocess.SW_HIDE+ return {+ "startupinfo": si,+ "creationflags": getattr(subprocess, "CREATE_NO_WINDOW", 0x08000000),+ }diff --git a/backend/scanner/arp_scanner.py b/backend/scanner/arp_scanner.pyindex 89d57ff..37e831a 100644--- a/backend/scanner/arp_scanner.py+++ b/backend/scanner/arp_scanner.py@@ -43,6 +43,7 @@ from typing import Callable, Optionalimport psutilfrom scanner.oui import lookup, is_local_mac, DEVICE_TYPE_COLORS+from procutils import spawn_kwargslogger = logging.getLogger("snitch.scanner")@@ -184,6 +185,7 @@ def _read_arp_cmd() -> list[tuple[str, str]]:« - ») et macOS (IP entre parenthèses)."""try:proc = subprocess.run(["arp", "-a"], capture_output=True, text=True,+ **spawn_kwargs(),timeout=10)out_text = proc.stdoutexcept (OSError, subprocess.TimeoutExpired) as exc:@@ -248,12 +250,14 @@ def default_gateway() -> Optional[str]:return socket.inet_ntoa(bytes.fromhex(raw)[::-1])elif sys.platform == "darwin":proc = subprocess.run(["route", "-n", "get", "default"],+ **spawn_kwargs(),capture_output=True, text=True, timeout=5)m = re.search(r"gateway:\s*(\S+)", proc.stdout)if m:return m.group(1)elif sys.platform.startswith("win"):proc = subprocess.run(["route", "print", "-4", "0.0.0.0"],+ **spawn_kwargs(),capture_output=True, text=True, timeout=10)for line in proc.stdout.splitlines():cols = line.split()