Audit Your Home Network with Claude Code¶
| Category | Creative & Real-World AI Builds |
| Status | ๐ก Partially completed |
| Repo | nextwork-audit-your-home-network-with-claude-code |
| Original NextWork guide | nextwork.ai |
Learning project
Practice work following a NextWork guide, separate from my production projects.
๐ NextWork learning project. This is a practice project I built while working through NextWork's Audit Your Home Network with Claude Code guide. It is part of my Learning portfolio and is fully separate from my production projects.
Category: Learning โบ Creative & Real-World AI Builds
Status: ๐ก Partially completed
Overview¶
A home network check is only safe if it can't be pointed at someone else. This one has no target option at all, checks the gateway is RFC 1918, only connects and reads, and saves counts and states rather than names and addresses.
Summary¶
I wrote my own read-only checker (netcheck.py, standard library only) and ran it in a two-namespace lab home network against a mock router I wrote: telnet, http, SSDP and a UPnP IGD that answers only GetGenericPortMappingEntry. It finds the default gateway itself and refuses any target argument or any gateway outside RFC 1918. The first boundary test caught a real bug, where Python's is_private accepted 203.0.113.1; that's fixed and both tests now refuse. It checks five ports, UPnP mappings (counted only), Wi-Fi security and channel crowding, and reports DNS encryption as unknown. The saved reports hold no SSIDs, MACs or client IPs. Before โ after: 11 โ 72 (+61). Watch mode reported only the one changed check. Partial because there's no real router or Wi-Fi, and Claude Code wasn't used.
The checks behind this are in docs/verification.txt.
Skills & tools¶
Python sockets, SSDP / UPnP IGD (read-only SOAP), NetworkManager (nmcli), Linux network namespaces, Privacy-preserving reporting
What I built¶
netcheck.py: gateway fromip -j route, an RFC 1918 check, connect-only probes on 22/23/80/443/7547, an SSDP search plus read-only mapping count, Wi-Fi security level and same-channel APs from nmcli, and DNS encryption (unknown unless told). It produces a score with my own weights, evidence coverage, up to three fixes, a saved report and a comparison with the last one.--watch SECONDS --runs Nprints only changed checks.lab/:lab.sh(namespaces nwrouter 192.168.50.1 / nwclient .23),mock_router.py,fakebin/nmcli(invented SSIDs/BSSIDs) androuter_state.{before,after}.json.docs/01-before.txt(score 11),docs/02-boundary-tests.txt(target argument refused; non-RFC-1918 gateway refused; the is_private bug and fix),docs/03-after.txt(11 โ 72, three changed checks),docs/04-watch-run.txt(onlyCHANGED tcp_23reported),docs/05-what-changed.md, anddocs/upnp-actions-seen-by-router.txt(only GetGenericPortMappingEntry).netcheck-report.json/.previous.json: the sanitized reports, holding states and counts only.
How to run¶
lab/lab.sh up # needs sudo for ip netns
lab/lab.sh run python3 netcheck.py # before
cp lab/router_state.after.json lab/router_state.json && lab/lab.sh restart
lab/lab.sh run python3 netcheck.py # after, compared with the saved report
lab/lab.sh run python3 netcheck.py --watch 1800 # every 30 minutes, changes only
lab/lab.sh down
Verification¶
I ran the verification command on 2026-12-03. The full output is in docs/verification.txt.
python3 -m py_compile netcheck.py lab/mock_router.py && python3 netcheck.py 10.0.0.1 2>&1 | grep -q 'never takes a target' && python3 -c "import json,re;a=json.load(open('netcheck-report.json'));b=json.load(open('netcheck-report.previous.json'));assert (b['score'],a['score'])==(11,72);t=open('docs/02-boundary-tests.txt').read();assert t.count('exit=1')==2;w=open('docs/04-watch-run.txt').read();assert w.count('CHANGED')==1 and 'baseline' in w;assert open('docs/upnp-actions-seen-by-router.txt').read().split()[-1]=='GetGenericPortMappingEntry';bad=re.compile(r'LabHome|Neighbour|02:11:22|02:aa:|192\\.168\\.50\\.');assert not any(bad.search(open(f).read()) for f in ['netcheck-report.json','netcheck-report.previous.json','docs/01-before.txt','docs/03-after.txt']);print('NETCHECK OK')"
Notes¶
The lab network, SSIDs, BSSIDs and mappings are invented; no real network or router was scanned. An earlier version of this repo used the guide's scanner; it was removed on 3 Dec 2026 and every result was regenerated with netcheck.py. The watch demo used a 5 s interval instead of 30 minutes.
What isn't done, and why¶
No real home router and no Wi-Fi hardware: the router is a namespace mock and Wi-Fi comes from a fake nmcli. The 'router changes' are lab state edits, and I made three at once rather than one. Encrypted DNS is reported as unknown, not measured. Claude Code wasn't used to build or explain the audit.
Original project: https://nextwork.ai/projects/a5e026da-ccaa-4458-b593-21e99b5e61d9 ยท Part of my NextWork Learning portfolio (hub).
Verification output¶
From docs/verification.txt:
$ python3 -m py_compile netcheck.py lab/mock_router.py && python3 netcheck.py 10.0.0.1 2>&1 | grep -q 'never takes a target' && python3 -c "import json,re;a=json.load(open('netcheck-report.json'));b=json.load(open('netcheck-report.previous.json'));assert (b['score'],a['score'])==(11,72);t=open('docs/02-boundary-tests.txt').read();assert t.count('exit=1')==2;w=open('docs/04-watch-run.txt').read();assert w.count('CHANGED')==1 and 'baseline' in w;assert open('docs/upnp-actions-seen-by-router.txt').read().split()[-1]=='GetGenericPortMappingEntry';bad=re.compile(r'LabHome|Neighbour|02:11:22|02:aa:|192\\.168\\.50\\.');assert not any(bad.search(open(f).read()) for f in ['netcheck-report.json','netcheck-report.previous.json','docs/01-before.txt','docs/03-after.txt']);print('NETCHECK OK')"
NETCHECK OK
[exit code 0]