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
i18n/UX: translated node labels, device types, and "unidentified" hints
MoneyLisa392f605e17d2
diff --git a/backend/api/main.py b/backend/api/main.pyindex ccca63a..1623319 100644--- a/backend/api/main.py+++ b/backend/api/main.py@@ -653,7 +653,13 @@ async def _startup() -> None:_loop = asyncio.get_running_loop()nodes["local"] = {- "id": "local", "label": "This Device", "ip": "local",+ # EN: "local" node = this machine. The label is a translation key —+ # the frontend renders t("node_local") so it follows the UI+ # language instead of being hard-English in the payload.+ # FR: Le nœud « local » = cette machine. Le label est une clé de+ # traduction — le frontend affiche t("node_local") pour suivre+ # la langue de l'UI au lieu d'un anglais codé en dur.+ "id": "local", "label_key": "node_local", "ip": "local","category": "local", "color": "#3b82f6","bytes": 0, "packets": 0, "alerted": False,}diff --git a/backend/scanner/arp_scanner.py b/backend/scanner/arp_scanner.pyindex 9369644..192efc3 100644--- a/backend/scanner/arp_scanner.py+++ b/backend/scanner/arp_scanner.py@@ -60,7 +60,7 @@ class Device:"""ip: strmac: str- vendor: str = "Unknown"+ vendor: str = ""device_type: str = "unknown" # phone / pc / router / iot / tv / unknownhostname: Optional[str] = Noneonline: bool = Truediff --git a/backend/scanner/oui.py b/backend/scanner/oui.pyindex 8933ce9..245d846 100644--- a/backend/scanner/oui.py+++ b/backend/scanner/oui.py@@ -76,4 +76,4 @@ def lookup(mac: str) -> tuple[str, str]:inconnus renvoient ("Unknown", "unknown")."""key = mac.upper().replace(":", "").replace("-", "")[:6]- return OUI_TABLE.get(key, ("Unknown", "unknown"))+ return OUI_TABLE.get(key, ("", "unknown"))diff --git a/backend/tests/test_oui.py b/backend/tests/test_oui.pyindex acf444d..7484a55 100644--- a/backend/tests/test_oui.py+++ b/backend/tests/test_oui.py@@ -27,5 +27,8 @@ def test_short_prefix_input():def test_unknown_prefix():vendor, dev_type = lookup("ZZ:ZZ:ZZ:00:11:22")- assert vendor == "Unknown"+ assert vendor == "" # EN: empty — UI falls back to the IP and+ # shows an "unidentified" badge instead+ # FR: vide — l'UI retombe sur l'IP et+ # affiche un badge « non identifié »assert dev_type == "unknown"diff --git a/frontend/src/components/Sidebar.jsx b/frontend/src/components/Sidebar.jsxindex ed8a08d..71c568b 100644--- a/frontend/src/components/Sidebar.jsx+++ b/frontend/src/components/Sidebar.jsx@@ -32,6 +32,25 @@ const CATEGORY_COLORS = {dns: '#38bdf8', admin: '#fb923c', unknown: '#94a3b8', local: '#3b82f6',}+/**+ * EN: Display name for a node — `label_key` is a translation key resolved+ * through t() (e.g. the "local" node), then label, then IP fallback.+ * FR: Nom d'affichage d'un nœud — `label_key` est une clé de traduction+ * résolue via t() (ex. le nœud « local »), puis label, puis l'IP.+ */+const nodeName = (n, t) => (n.label_key ? t(n.label_key) : n.label) || n.ip++/**+ * EN: Translate a raw backend enum value (device_type, category) through a+ * key prefix — falls back to the raw value when no key exists.+ * FR: Traduit une valeur brute du backend (device_type, catégorie) via un+ * préfixe de clé — retombe sur la valeur brute si la clé n'existe pas.+ */+const enumName = (t, prefix, v) => {+ const s = t(prefix + v)+ return s === prefix + v ? v : s+}+/** EN: Human-readable byte size. / FR: Taille en octets lisible. */function fmt(bytes) {if (!bytes) return '0 B'@@ -110,7 +129,7 @@ export default function Sidebar({ nodes, lanDevices, packets, selected, onClose,<div style={{ padding: '12px 20px', borderBottom: '1px solid #334155', background: '#0f172a' }}><div style={{ display: 'flex', justifyContent: 'space-between', alignItems: 'center', marginBottom: 6 }}><span style={{ fontSize: 12, fontWeight: 600, color: '#f1f5f9' }}>- {selected.label || selected.ip}+ {nodeName(selected, t)}</span><button onClick={onClose} style={{ background: 'none', border: 'none', color: '#64748b', cursor: 'pointer', fontSize: 16 }}>x</button></div>@@ -129,6 +148,11 @@ export default function Sidebar({ nodes, lanDevices, packets, selected, onClose,)}<SectionTitle label={t('section_ext', filteredNodes.length, hiddenCount)} />+ {filteredNodes.length === 0 && (+ <div style={{ padding: '10px 20px', fontSize: 10, color: '#475569', fontStyle: 'italic' }}>+ {t('ext_empty')}+ </div>+ )}{filteredNodes.sort((a, b) => (b.bytes || 0) - (a.bytes || 0)).map(n => <NodeRow key={n.id} node={n} />)}@@ -175,6 +199,9 @@ function DeviceRow({ device }) {<div style={{ flex: 1, minWidth: 0 }}><div style={{ fontSize: 11, fontWeight: 600, color: '#e2e8f0', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>{device.hostname || device.vendor || device.ip}+ {!device.hostname && !device.vendor && (+ <span style={{ fontSize: 9, color: '#475569', fontWeight: 400 }}> · {t('unidentified')}</span>+ )}</div><div style={{ fontSize: 9, color: '#64748b', fontFamily: 'monospace' }}>{device.ip} · {device.mac}@@ -189,12 +216,13 @@ function DeviceRow({ device }) {/** EN: One row of the external-host list. / FR: Une ligne de la liste d'hôtes externes. */function NodeRow({ node }) {+ const { t } = useT()return (<div style={{ padding: '6px 20px', display: 'flex', alignItems: 'center', gap: 8, borderBottom: '1px solid #1e293b' }}><div style={{ width: 7, height: 7, borderRadius: '50%', background: CATEGORY_COLORS[node.category] || '#94a3b8', flexShrink: 0 }} /><div style={{ flex: 1, minWidth: 0 }}><div style={{ fontSize: 11, color: '#e2e8f0', overflow: 'hidden', textOverflow: 'ellipsis', whiteSpace: 'nowrap' }}>- {node.label || node.ip}+ {nodeName(node, t)}</div><div style={{ fontSize: 9, color: '#64748b' }}>{node.country || '-'} · {node.packets || 0} pkt</div></div>@@ -212,15 +240,25 @@ function NodeDetail({ node, onWhitelist }) {[t('field_mac'), node.mac],[t('field_hostname'), node.hostname],[t('field_vendor'), node.vendor],- [t('field_type'), node.device_type],+ [t('field_type'), node.device_type ? enumName(t, 'devtype_', node.device_type) : null],[t('field_country'), node.country],[t('field_city'), node.city],[t('field_org'), node.org],- [t('field_category'), node.category],+ [t('field_category'), node.category ? enumName(t, 'cat_', node.category) : null],[t('field_traffic'), fmt(node.bytes || 0)],[t('field_packets'), node.packets],]+ // EN: Is this node still anonymous? No name resolution has produced a+ // label beyond the bare IP — shown to the user as an explanatory hint+ // so "Unknown" nodes don't read as errors or threats.+ // FR: Ce nœud est-il encore anonyme ? Aucune résolution de nom n'a produit+ // de label au-delà de l'IP — affiché comme indice explicatif pour que+ // les nœuds « Inconnu » ne soient pas lus comme des erreurs ou menaces.+ const isLan = node.category === 'lan_device'+ const anonymous = node.id !== 'local' && !node.hostname && !node.vendor+ && (!node.label || node.label === node.ip)+// EN: Top-5 processes by bytes on this node.// FR: Top 5 des processus par octets sur ce nœud.const processes = node.processes@@ -236,6 +274,21 @@ function NodeDetail({ node, onWhitelist }) {</div>))}+ {/* EN: "What's happening" hint — an anonymous node is normal, not a+ threat: identification may simply not have resolved yet.+ FR: Indice « qu'est-ce qui se passe » — un nœud anonyme est normal,+ pas une menace : l'identification n'est simplement pas encore+ résolue. */}+ {anonymous && (+ <div style={{+ marginTop: 8, padding: '6px 8px', fontSize: 9, lineHeight: 1.5,+ color: '#64748b', background: '#1e293b', borderRadius: 6,+ borderLeft: '2px solid #334155',+ }}>+ {t(isLan ? 'hint_unidentified' : 'hint_unresolved')}+ </div>+ )}+{processes.length > 0 && (<><div style={{ fontSize: 9, color: '#475569', textTransform: 'uppercase', letterSpacing: 0.5, marginTop: 8, marginBottom: 4 }}>diff --git a/frontend/src/graph/ForceGraph.jsx b/frontend/src/graph/ForceGraph.jsxindex c55db95..486617d 100644--- a/frontend/src/graph/ForceGraph.jsx+++ b/frontend/src/graph/ForceGraph.jsx@@ -30,19 +30,20 @@import { useEffect, useMemo, useRef } from 'react'import * as d3 from 'd3'import { nodeIconURI } from './icons'+import { useT } from '../i18n'/** EN: Edge stroke width scales with logged traffic volume.* FR: La largeur d'arête suit le volume de trafic en échelle log. */const edgeWidth = d => d.dashed ? 1 : Math.min(1 + Math.log1p((d.bytes || 0) / 1024), 6)/** EN: Native tooltip text for a node datum. / FR: Texte d'infobulle native d'un nœud. */-const nodeTitle = d =>- [d.label || d.ip, d.vendor, d.mac, d.country, d.org, `${d.packets || 0} pkts`]+const nodeTitle = (d, disp) =>+ [disp(d), d.vendor, d.mac, d.country, d.org, `${d.packets || 0} pkts`].filter(Boolean).join('\n')/** EN: Truncated label under a node. / FR: Étiquette tronquée sous un nœud. */-const nodeLabel = d => {- const label = d.label || d.ip || ''+const nodeLabel = (d, disp) => {+ const label = disp(d) || ''return label.length > 20 ? label.slice(0, 18) + '…' : label}@@ -56,6 +57,15 @@ export default function ForceGraph({ nodes, edges, lanDevices, alertedNodes = neconst posCache = useRef({}) // EN: { id: {x,y,fx,fy} } / FR: positions persistéesconst dataRef = useRef({ nodes: {}, edges: {}, lanDevices: {} })+ const { t } = useT()+ // EN: Display name — `label_key` resolves through i18n (e.g. the "local"+ // node shows "This Device"/"Cet appareil"), then label, then IP.+ // FR: Nom d'affichage — `label_key` passe par l'i18n (ex. le nœud « local »+ // affiche « This Device »/« Cet appareil »), puis label, puis l'IP.+ const displayName = d => (d.label_key ? t(d.label_key) : d.label) || d.ip+ const displayNameRef = useRef(displayName)+ displayNameRef.current = displayName+// EN: Always-latest data for effects that don't rebuild the sim.// FR: Données toujours à jour pour les effets qui ne reconstruisent pas la sim.dataRef.current = { nodes, edges, lanDevices }@@ -210,13 +220,13 @@ export default function ForceGraph({ nodes, edges, lanDevices, alertedNodes = ne.attr('fill', d => d.category === 'lan_device' ? '#e2e8f0' : '#94a3b8').attr('font-size', d => d.category === 'lan_device' ? 10 : 9).attr('font-weight', d => d.category === 'lan_device' ? '600' : '400')- .text(nodeLabel)+ .text(d => nodeLabel(d, displayNameRef.current))// EN: Native tooltip with full detail on hover — kept fresh by the// metrics effect below.// FR: Infobulle native avec le détail complet au survol — maintenue à jour// par l'effet métriques ci-dessous.- node.append('title').text(nodeTitle)+ node.append('title').text(d => nodeTitle(d, displayNameRef.current))sim.on('tick', () => {link@@ -259,8 +269,8 @@ export default function ForceGraph({ nodes, edges, lanDevices, alertedNodes = ne)link.attr('stroke-width', d => edgeWidth(edgeById.get(d.id) || d))- node.select('title').text(d => nodeTitle(nodeById.get(d.id) || d))- node.select('text').text(d => nodeLabel(nodeById.get(d.id) || d))+ node.select('title').text(d => nodeTitle(nodeById.get(d.id) || d, displayNameRef.current))+ node.select('text').text(d => nodeLabel(nodeById.get(d.id) || d, displayNameRef.current))paintAlertRings(node, alertedNodes)}, [nodes, edges, lanDevices, alertedNodes])diff --git a/frontend/src/hooks/useWebSocket.js b/frontend/src/hooks/useWebSocket.jsindex 299baf6..206247a 100644--- a/frontend/src/hooks/useWebSocket.js+++ b/frontend/src/hooks/useWebSocket.js@@ -86,6 +86,7 @@ export function useWebSocket(url) {let attempts = 0let timer = nulllet heartbeat = null // EN: 20 s app-level keepalive / FR: keepalive applicatif de 20 s+ let connectTimer = null // EN: CONNECTING-state watchdog / FR: chien de garde de l'état CONNECTINGasync function connect() {// EN: Resolve the token BEFORE opening the socket.@@ -95,7 +96,20 @@ export function useWebSocket(url) {ws.current = new WebSocket(wsUrl)+ // EN: Watchdog — a proxy that accepts TCP but never completes the WS+ // upgrade leaves the socket stuck in CONNECTING forever (no open,+ // no error, no close → UI stuck on "connecting"). Close it after+ // 8 s so onclose triggers the normal backoff retry.+ // FR: Chien de garde — un proxy qui accepte le TCP sans terminer+ // l'upgrade WS laisse le socket CONNECTING indéfiniment (ni open,+ // ni error, ni close → UI bloquée sur « connexion »). On le ferme+ // au bout de 8 s pour que onclose déclenche la réessai normale.+ connectTimer = setTimeout(() => {+ if (ws.current?.readyState === WebSocket.CONNECTING) ws.current.close()+ }, 8000)+ws.current.onopen = () => {+ clearTimeout(connectTimer)attempts = 0setStatus('connected')// EN: send a cheap JSON ping every 20 s so idle sockets aren't dropped@@ -107,6 +121,7 @@ export function useWebSocket(url) {}, 20000)}ws.current.onclose = () => {+ clearTimeout(connectTimer)clearInterval(heartbeat)if (stopped) returnsetStatus('disconnected')@@ -280,6 +295,7 @@ export function useWebSocket(url) {// FR: Arrêter les reconnexions et libérer le timer en attente au démontage.stopped = trueif (timer) clearTimeout(timer)+ clearTimeout(connectTimer)clearInterval(heartbeat)ws.current?.close()}diff --git a/frontend/src/i18n.jsx b/frontend/src/i18n.jsxindex bbb7050..1e69644 100644--- a/frontend/src/i18n.jsx+++ b/frontend/src/i18n.jsx@@ -69,6 +69,28 @@ const en = {search_placeholder: 'Search host, IP, country…',cat_all: 'All',cat_unknown: 'Unknown',+ cat_safe: 'Safe',+ cat_tracking: 'Tracking',+ cat_cdn: 'CDN',+ cat_dns: 'DNS',+ cat_admin: 'Admin',+ cat_local: 'Local',+ cat_lan_device: 'LAN device',+ cat_other: 'Other',++ // EN: Node names + identification hints shown to the user.+ // FR: Noms de nœuds + indices d'identification affichés à l'utilisateur.+ node_local: 'This Device',+ unidentified: 'unidentified',+ devtype_router: 'Router',+ devtype_phone: 'Phone',+ devtype_pc: 'Computer',+ devtype_tv: 'TV',+ devtype_iot: 'IoT device',+ devtype_unknown: 'Unknown type',+ hint_unidentified: "Not identified yet — its name appears when it announces itself (DNS/mDNS) or its MAC vendor is known. If you don't recognize it, check your router's client list.",+ hint_unresolved: 'Not yet named — the domain appears when a DNS answer or TLS handshake reveals it.',+ ext_empty: "No external connections yet — anything your machine talks to will appear here.",// Alert panel / Panneau d'alertesalerts_title: 'Alerts',@@ -236,7 +258,7 @@ const fr = {legend_pc: 'PC',legend_iot: 'IoT',legend_https: 'HTTPS',- legend_tracking: 'Tracking',+ legend_tracking: 'Pistage',legend_cdn: 'CDN',legend_dns: 'DNS',@@ -272,6 +294,28 @@ const fr = {search_placeholder: 'Rechercher hôte, IP, pays…',cat_all: 'Tout',cat_unknown: 'Inconnu',+ cat_safe: 'Sûr',+ cat_tracking: 'Pistage',+ cat_cdn: 'CDN',+ cat_dns: 'DNS',+ cat_admin: 'Admin',+ cat_local: 'Local',+ cat_lan_device: 'Appareil LAN',+ cat_other: 'Autre',++ // FR: Noms de nœuds + indices d'identification affichés à l'utilisateur.+ // EN: Node names + identification hints shown to the user.+ node_local: 'Cet appareil',+ unidentified: 'non identifié',+ devtype_router: 'Routeur',+ devtype_phone: 'Téléphone',+ devtype_pc: 'Ordinateur',+ devtype_tv: 'TV',+ devtype_iot: 'Objet connecté',+ devtype_unknown: 'Type inconnu',+ hint_unidentified: "Pas encore identifié — son nom apparaîtra s'il s'annonce (DNS/mDNS) ou si son fabricant est connu. Si vous ne le reconnaissez pas, vérifiez la liste des clients de votre box/routeur.",+ hint_unresolved: "Pas encore nommé — le domaine apparaîtra quand une réponse DNS ou un handshake TLS le révélera.",+ ext_empty: "Aucune connexion externe pour l'instant — tout hôte contacté par votre machine apparaîtra ici.",// Panneau d'alertes / Alert panelalerts_title: 'Alertes',diff --git a/frontend/src/map/MapView.jsx b/frontend/src/map/MapView.jsxindex e951846..49b83e1 100644--- a/frontend/src/map/MapView.jsx+++ b/frontend/src/map/MapView.jsx@@ -378,7 +378,7 @@ export default function MapView({ nodes, onNodeClick }) {.attr('font-size', Math.max(9 / k, 5)).attr('y', vr + 10 / k).text(() => {- const lbl = d.label || d.ip || ''+ const lbl = (d.label_key ? t(d.label_key) : d.label) || d.ip || ''return lbl.length > 18 ? lbl.slice(0, 16) + '…' : lbl})})@@ -419,7 +419,7 @@ export default function MapView({ nodes, onNodeClick }) {boxShadow: '0 4px 20px rgba(0,0,0,0.5)',}}><div style={{ fontWeight: 700, fontSize: 12, color: '#f1f5f9', marginBottom: 3 }}>- {tooltip.node.label || tooltip.node.ip}+ {(tooltip.node.label_key ? t(tooltip.node.label_key) : tooltip.node.label) || tooltip.node.ip}</div>{tooltip.node.country && (<div style={{ fontSize: 10, color: '#94a3b8' }}>diff --git a/frontend/vite.config.js b/frontend/vite.config.jsindex 2636fe6..8a135a8 100644--- a/frontend/vite.config.js+++ b/frontend/vite.config.js@@ -22,13 +22,18 @@ export default defineConfig({server: {port: 5173,proxy: {- '/ws': { target: 'ws://localhost:8000', ws: true },- '/graph': { target: 'http://localhost:8000' },- '/devices': { target: 'http://localhost:8000' },- '/alerts': { target: 'http://localhost:8000' },- '/timeline': { target: 'http://localhost:8000' },- '/capture': { target: 'http://localhost:8000' },- '/media': { target: 'http://localhost:8000' },+ '/ws': { target: 'ws://localhost:8000', ws: true },+ '/graph': { target: 'http://localhost:8000' },+ '/devices': { target: 'http://localhost:8000' },+ '/alerts': { target: 'http://localhost:8000' },+ '/timeline': { target: 'http://localhost:8000' },+ '/capture': { target: 'http://localhost:8000' },+ '/media': { target: 'http://localhost:8000' },+ '/settings': { target: 'http://localhost:8000' },+ '/history': { target: 'http://localhost:8000' },+ '/diagnostics': { target: 'http://localhost:8000' },+ '/geo': { target: 'http://localhost:8000' },+ '/shutdown': { target: 'http://localhost:8000' },},},})