Commit graph

105 commits

Author SHA1 Message Date
Andrew Pimenov
bc5b01ae58 add test coverage for refresh_netsets 2026-08-09 16:16:32 +03:00
Andrew Pimenov
15d4d745c4 improve test coverage for latency_changes 2026-08-09 16:15:18 +03:00
Andrew Pimenov
2a72bdb441 cover empty exception message branch in run_speed_cascade 2026-08-09 16:15:08 +03:00
Andrew Pimenov
8e7d5bba5b add tests for tier_cloudflare 2026-08-09 16:14:55 +03:00
Andrew Pimenov
24f08acd79 add test coverage for tier_ookla 2026-08-09 16:14:42 +03:00
Andrew Pimenov
d42a236d3a add test coverage for finding_changes 2026-08-09 16:14:16 +03:00
Andrew Pimenov
b3971375c2 add tests for speed_changes 2026-08-09 16:14:00 +03:00
Andrew Pimenov
be99c19cfd add async tests for query_dnsbl 2026-08-09 16:13:42 +03:00
Andrew Pimenov
2473822b93 add tests for finalize_hop 2026-08-09 16:13:29 +03:00
Andrew Pimenov
8aa806881e add test coverage for tier_fastcom 2026-08-09 16:13:19 +03:00
Andrew Pimenov
768490562c guard tier_fastcom against a falsy target url 2026-08-09 16:13:10 +03:00
Andrew Pimenov
52c0647e77 run refresh_netsets provider fetches concurrently with asyncio.gather 2026-08-09 16:12:15 +03:00
Andrew Pimenov
6810c0f753 optimize first_loss_jump with zip pairwise iteration 2026-08-09 16:11:43 +03:00
Andrew Pimenov
93c6ac526a use zip for pairwise hop iteration in path_findings 2026-08-09 16:11:29 +03:00
Andrew Pimenov
fb3c6ca77f optimize overall_verdict by combining severity iterations 2026-08-09 16:10:45 +03:00
Andrew Pimenov
ab39922bf6 cache dataclass_fields lookup in merge_geo 2026-08-09 16:10:29 +03:00
Andrew Pimenov
329ff15e74 make _resolve async to avoid blocking the event loop 2026-08-09 16:10:17 +03:00
Andrew Pimenov
e4c51546ba use list comprehension for _unix_probes 2026-08-09 16:09:29 +03:00
Andrew Pimenov
85da4aab1f optimize _unix_annotations dedup with dict.fromkeys 2026-08-09 16:09:05 +03:00
Andrew Pimenov
f59f860327 group build_trace_result arguments into TraceConfig dataclass 2026-08-09 16:08:52 +03:00
Andrew Pimenov
4c290ec309 refactor build_reputation to use ReputationContext dataclass 2026-08-09 16:08:29 +03:00
Andrew Pimenov
fc37ff369d extract NDT7 consent check into a helper function 2026-08-09 16:07:44 +03:00
Andrew Pimenov
d2ab0caafd refactor gather_vpn_signals to use VpnContext dataclass 2026-08-09 16:07:27 +03:00
Andrew Pimenov
5f51e70d5e extract BgpContext dataclass for build_bgp_intel 2026-08-09 16:06:55 +03:00
Andrew Pimenov
d88b1bd95a Revert "uncomment pypi publish job, gated on manual environment approval"
This reverts commit 46ced3da51.
2026-08-09 13:52:23 +03:00
Andrew Pimenov
46ced3da51 uncomment pypi publish job, gated on manual environment approval
netsleuth confirmed free on PyPI (pypi.org/pypi/netsleuth/json -> 404).
Publish still can't run until a PyPI Trusted Publisher is registered for
this project and the pypi GitHub environment exists with a reviewer rule -
both need account access this session doesn't have.
2026-08-09 13:43:55 +03:00
Andrew Pimenov
aefb41a463 fix dead icmplib traceroute tier importing a nonexistent symbol
probes/traceroute.py imported async_traceroute from icmplib, which doesn't
exist in icmplib 3.0.4 - only a sync traceroute(), no async variant, and no
privileged= kwarg (traceroute always needs a raw socket, unlike ping's
unprivileged datagram option). The tier raised ImportError on every call and
silently fell through to the next tier. Call the real traceroute() via
asyncio.to_thread instead, drop the nonexistent privileged param.
2026-08-09 13:39:35 +03:00
Andrew Pimenov
fd72604240 add --interface flag to force outbound probing through a specific adapter
Every probe used to follow whatever the OS default route picked, with no way
to point the tool at a specific adapter for comparison (VPN vs raw) or to
confirm which one actually carries traffic on a multi-adapter machine.

New iface.py resolves an adapter name or IP to a BindTarget (pure, tested):
exact/case-insensitive/unique-substring name match, rejects APIPA-only,
link-local-only and down adapters. Wired through every httpx provider client,
the Ookla binary tier, ndt7, and the whole ping/traceroute cascade (icmplib,
mtr, unix traceroute, TCP connect, scapy) plus --watch. Windows icmp_win now
uses IcmpSendEcho2Ex (adds SourceAddress) only when a bind is forced, so the
unforced path is unchanged. Windows tracert has no IPv4 source-address option
(verified from its own usage text) so that tier is dropped when forced,
noted in the report rather than silently measuring the wrong path.

An unresolvable/down adapter aborts with every adapter listed; a resolvable
adapter with no route to the internet degrades gracefully instead of
aborting - that's a real diagnostic answer, not an error. netinfo's
observation of the OS's actual default route stays untouched, so the report
can show the forced adapter and the OS default side by side.

Verified live: forcing Tailscale (no internet route on this box) triggered
the preflight warning and degraded correctly; forcing Ethernet ran clean
end-to-end including a full speedtest+MTR cycle.

Also noted, not fixed: probes/traceroute.py's icmplib tier imports
async_traceroute, which doesn't exist in icmplib 3.0.4 - that tier has
always raised ImportError and silently fallen through. Found while
verifying the icmplib source-binding wiring live.
2026-08-09 13:36:06 +03:00
Andrew Pimenov
51c01bd8c3 fix default gateway detection picking wrong route with multiple adapters
_default_gateway() took whichever 0.0.0.0 line route print printed first,
not the one Windows actually uses (lowest metric). With a VPN adapter
installed (Radmin VPN, Tailscale, ...) its default-ish route can print
before the real one. Verified live: was reporting Radmin VPN's 26.0.0.1
while Ethernet (the interface actually carrying traffic, confirmed via
primary_interface_ip()) has gateway 192.168.3.1; now reports that correctly.
Parsing extracted into pure _parse_windows_default_gateway(), tested against
a captured multi-adapter route print sample.
2026-08-09 13:00:24 +03:00
Andrew Pimenov
4888862305 fix false-positive sustained-loss verdict on long runs of silent hops
path_findings() flagged ICMP rate limiting as real loss whenever two
consecutive traceroute hops both went silent, but real transit paths
routinely have long runs of silent hops (10 in a row, confirmed on a live
--full run) while the destination itself answers cleanly. Only flag loss
that persists all the way to the last hop in the trace; a run that clears
before the end is now ignored regardless of how many hops it spans.
2026-08-09 13:00:19 +03:00
Andrew Pimenov
4ffc39906b add --format/--ru/--json flags to control which report artifacts get written
Every run used to write all three files (en.md, ru.md, json) unconditionally.
Default is now English Markdown only, sourced from output.formats in
config.yaml; --format/--ru/--json pick exactly what a run writes, and any
explicit --format replaces the default rather than adding to it (all/none
supported). write_report() moved from a fixed 3-positional-arg signature to
a {format: text} mapping so writes are conditional instead of always-three.
The en/ru Markdown cross-link header is now only set when both languages are
actually being written.
2026-08-09 13:00:13 +03:00
Andrew Pimenov
29b3fb1bb4 fill in real github url in readmes and license notice 2026-08-09 11:49:11 +03:00
Andrew Pimenov
031f85df5e netsleuth in docs, license, env example and release workflow 2026-08-09 11:43:03 +03:00
Andrew Pimenov
483989c1bc rename package netcheck to netsleuth (name taken on pypi) 2026-08-09 11:43:00 +03:00
Andrew Pimenov
0336be4080 gitignore agent process docs: tasks.md and specs/plans stay local only 2026-08-09 11:37:36 +03:00
Andrew Pimenov
f031a0b48f ci: add release build workflow, gate pypi publish on name conflict 2026-08-09 11:29:38 +03:00
Andrew Pimenov
286e684d41 cli: remember ndt7 consent in a cache marker so repeat runs stop re-prompting 2026-08-09 11:28:18 +03:00
Andrew Pimenov
168cd14f51 ip_geo: russian dual-stack mismatch note alongside english 2026-08-09 11:27:20 +03:00
Andrew Pimenov
ce97958cc9 netinfo: relay powershell adapter names as base64 to dodge codepage corruption 2026-08-09 11:25:29 +03:00
Andrew Pimenov
b4c541aecf docs: sync readme, architecture and tasks with the russian report feature 2026-08-09 11:14:56 +03:00
Andrew Pimenov
2e84c434c0 exporter: translate module skip/warning reasons into russian 2026-08-09 11:11:08 +03:00
Andrew Pimenov
1821674376 cli: write and print the russian sibling report
diagnose() now computes both filenames up front so each markdown
render can link to its sibling, calls render_markdown twice (en/ru),
and passes both strings to write_report. run() prints all three
report paths.
2026-08-09 11:07:19 +03:00
Andrew Pimenov
d53ab9a0d6 exporter: render russian markdown report alongside english
Thread a lang parameter through render_markdown and every section
helper so the same report dict can render an English or Russian
report; inline _t() calls carry the strings, findings fall back from
_ru fields to their English siblings. write_report now emits a third
.ru.md file alongside .json and .md, and render_markdown can stamp a
sibling cross-link line right after the H1.
2026-08-09 11:06:24 +03:00
Andrew Pimenov
4c2da2e831 dns_leak: russian note alongside english 2026-08-09 04:10:44 +03:00
Andrew Pimenov
9e5ea923aa reputation: russian rationale alongside english 2026-08-09 04:10:08 +03:00
Andrew Pimenov
db407595d6 interpret: russian title/detail/advice alongside english findings 2026-08-09 04:09:01 +03:00
Andrew Pimenov
04cf37ef7e models: add optional russian translation fields to finding, reputation, dns leak 2026-08-09 04:07:34 +03:00
Andrew Pimenov
6f47ea7736 license: finalize as PolyForm Noncommercial 1.0.0 2026-08-09 04:05:11 +03:00
Andrew Pimenov
21d38d7acb add TASKS.md tracking outstanding work 2026-08-09 03:59:21 +03:00
Andrew Pimenov
4497e2a871 docs: sync readme and architecture with the final module and flag set
readme's sample console output showed a multi-line summary table
(connection/egress/vpn/latency) the tool has never printed; the real
stdout is three lines (banner, verdict, file paths). also documented:
the tcptrace/ndt7 extras install command, bare-asn --target syntax,
ndt7's interactive consent prompt, tcp-trace's cascade fallback, and
that --watch writes one artifact per session rather than per tick.

architecture's storage section had the peeringdb cache path wrong
(.cache/peeringdb/*.json vs the real .cache/pdb-net-*.json) and never
mentioned the watch_*.json artifact from task 39. the file-size
exceptions note only covered exporter.py; interpret.py, cli.py,
models.py, bgp.py, ip_geo.py, netinfo.py, speed.py, reputation.py and
probes/traceroute.py all cleared ~200 lines too and are now listed
with the reason each stayed one file. test count updated from ~120
(written before a single module existed) to the real ~385.
2026-08-09 03:58:54 +03:00