Skip to content
4 min read

NetSentry: knowing what is on your network without pretending to be a firewall

On this page

Most home-network security tools want you to do one of two things: ship your LAN metadata to a vendor cloud, or stitch together five Kali command-line tools every time you wonder what an unfamiliar device is doing on Wi-Fi. NetSentry is the local-first alternative I built in Python, FastAPI, and SQLite.

It discovers LAN hosts from unprivileged OS state (ARP cache, sockets, routing tables, mDNS/Bonjour, SSDP), draws a live force-directed topology map without a frontend build step, profiles each device's normal active hours, and stores everything locally with zero telemetry and zero CDN assets.

The first rule of the design is printed at the top of the README: NetSentry is a passive observability tool, not a firewall. It does not drop packets, block traffic, or promise a clean bill of health. Once you take that boundary seriously, the engineering gets much more interesting.

Device identity is harder than scanning

Discovering an IP address on a home subnet is easy. Knowing whether today's device is the same machine you saw last Tuesday is not. Modern phones rotate randomized MAC addresses; routers recycle DHCP leases; a laptop shows up over Wi-Fi and Ethernet at once.

NetSentry separates raw observations from canonical identity. Only a stable, globally administered MAC address is strong enough for automatic continuity. Weak IP, hostname, or randomized-MAC matches never silently merge two records. When an operator does link aliases, the link is non-destructive and reversible — original observations, port histories, and alerts stay owned by their observed_device_id, and newly recorded alerts keep their event-time identity context so a later merge or undo never rewrites what was known when the alert fired.

Operator metadata (friendly names, notes, labels, trust flags) sits in its own audited layer with explicit inherit, set, and clear tombstones, optimistic revision checks, and idempotency keys. If a save hits an ambiguous failure after the request leaves the browser, the UI locks the exact body and idempotency key behind a Retry exact save control rather than risking a duplicate write or a silent rebase.

Never treat silence as "all clear"

The second trap in network monitoring is reporting absence of evidence as evidence of safety.

NetSentry's pure-Python concurrent TCP connect-scanner probes a fixed catalog of well-known ports on discovered, unambiguous private-LAN hosts — no nmap required, no public targets, and no application banner scraping. After every probe, it revalidates the device's canonical identity, address, and online state under the database lock; if an identity merge or DHCP change happened mid-scan, the whole result is discarded rather than attributed to the wrong host.

Each planned port records one bounded outcome: connected, refused, no_response, unreachable, or local_error. Only an explicit refused clears a previously observed open port. Timeouts and unreachable paths are inconclusive and retain the prior positive observation as retained_uncertain.

The Defensive Service Exposure Review queue applies the same discipline. An empty queue is only labeled none_current when every eligible private target has a fresh, completed, identity-matching scan session. Missing, stale, partial, or ambiguous coverage downgrades the state to limited or unavailable. Collector liveness by itself never counts as proof that nothing is open.

Deterministic briefs and a read-only ledger

A dashboard full of alerts is easy to ignore. NetSentry rolls retained local changes into a deterministic, non-AI Daily brief (also available from the terminal via netsentry brief against a stopped or live WAL database, with stable exit codes for scripting). It separates what needs review from what was already handled, explicitly lists every coverage gap, and labels a quiet period as quiet, but coverage was limited whenever a gap exists.

Behind it sits an append-only Network change ledger storing bounded daily and on-demand posture checkpoints. By design, the ledger never copies device names, IPs, MACs, DNS queries, banners, or alert text — only installation-keyed HMAC pseudonyms (pdc1_…) and positive open-port coordinates.

If you ever export an interoperability bundle (Evidence ZIP), every payload is SHA-256 indexed, CSV cells are guarded against spreadsheet formula injection, and identifiers are pseudonymized by default. A standalone verifier — netsentry evidence verify — runs using only the Python standard library before FastAPI or SQLite are ever imported, failing closed on unexpected archive members, path tricks, trailing bytes, row-count mismatches, or hash tampering. And the docs are blunt about what that proves: SHA-256 checks internal bundle integrity, not producer identity or router enforcement.

Local AI that stays in its lane

NetSentry includes an Assistant view and an Explain alert button that auto-detect local LM Studio or Ollama and ground every answer strictly on NetSentry's own snapshot so the model cannot invent devices or alerts. Any non-loopback AI endpoint is refused unless NETSENTRY_ALLOW_REMOTE_AI=1 is set explicitly, which also surfaces a persistent warning in the UI. Meanwhile, the core Explain alert dossier works entirely offline from local records with no model involved at all.

NetSentry stays a local prototype running on my own machines, and the part I am happiest with is not any single detector — it is the refusal to bluff when the network is messy, incomplete, or ambiguous.