netsleuth/tests
Andrew Pimenov 99876103f8 verify TLS certificates and fingerprint them for MITM detection
tls_context() now defaults to real certificate verification instead of the
tool's original always-CERT_NONE posture; measure_tls() only falls back to
unverified on ssl.SSLCertVerificationError, retiming the retry since the
failed attempt's duration isn't representative. This is also the only way
to get subject/issuer/notAfter at all - getpeercert() returns {} for a
chain that never validated.

Every TLS result now carries cert_sha256 (SHA-256 of the full DER cert, not
the SPKI - that would need the cryptography package, a dependency this
doesn't need), cert_issuer, cert_days_remaining, and the long-dead
cert_verified field finally gets written. New tls.pinned_fingerprints
config (host -> expected hash, capped and hex-validated) drives three new
findings: a pin mismatch is crit, an unpinned validation failure is warn,
an expiring cert is warn.

Live-tested with --tls against real Cloudflare/Google endpoints - verified
handshake, correct issuer and expiry both times.

Part of plans/zesty-zooming-wilkinson.md (gitignored).
2026-08-12 21:48:36 +03:00
..
fixtures add system DNS vs DoH comparison and transparent proxy detection 2026-08-09 17:45:33 +03:00
conftest.py project scaffold: uv packaging, config.yaml, package skeleton 2026-08-08 21:12:41 +03:00
test_bgp.py extract NDT7 consent check into a helper function 2026-08-09 16:07:44 +03:00
test_bgp_path.py fix international-loop detection: drop dead ip_country parameter 2026-08-10 21:18:28 +03:00
test_captive_portal.py detect captive portals up front, flag off-country speedtest servers 2026-08-12 21:36:54 +03:00
test_cgnat_nat64.py detect CGNAT, NAT64, and first-hop-vs-path issues separately 2026-08-12 21:06:01 +03:00
test_cli_formats.py add --format/--ru/--json flags to control which report artifacts get written 2026-08-09 13:00:13 +03:00
test_compare.py add tests for identity_changes 2026-08-09 16:20:11 +03:00
test_config.py verify TLS certificates and fingerprint them for MITM detection 2026-08-12 21:48:36 +03:00
test_dns_advanced.py add system DNS vs DoH comparison and transparent proxy detection 2026-08-09 17:45:33 +03:00
test_dns_leak.py rename package netcheck to netsleuth (name taken on pypi) 2026-08-09 11:43:00 +03:00
test_dnsbl_decode.py add tests for decode_dnsbl fallback and mixed responses 2026-08-09 16:18:57 +03:00
test_dpi_check.py add single-host DPI/TCP-RST self-diagnostic probe 2026-08-09 17:45:27 +03:00
test_exporter.py detect captive portals up front, flag off-country speedtest servers 2026-08-12 21:36:54 +03:00
test_exporter_l7.py render TLS, DNS advanced, path diversity, prefix bench, DPI sections in reports 2026-08-09 17:56:07 +03:00
test_hop_asn.py enrich traceroute hops with ASN, AS name, country and PTR fallback 2026-08-12 21:17:00 +03:00
test_icmp_win_parse.py rename package netcheck to netsleuth (name taken on pypi) 2026-08-09 11:43:00 +03:00
test_icmp_win_trace.py add --interface flag to force outbound probing through a specific adapter 2026-08-09 13:36:06 +03:00
test_iface.py add --interface flag to force outbound probing through a specific adapter 2026-08-09 13:36:06 +03:00
test_interpret.py detect captive portals up front, flag off-country speedtest servers 2026-08-12 21:36:54 +03:00
test_interpret_l7.py verify TLS certificates and fingerprint them for MITM detection 2026-08-12 21:48:36 +03:00
test_ip_geo_normalize.py expand classify_ip_type test coverage 2026-08-09 16:17:49 +03:00
test_models.py add L4-L7 diagnostic models (TLS, DPI, DNS, anycast, prefix bench) 2026-08-09 17:35:37 +03:00
test_netinfo.py fix default gateway detection picking wrong route with multiple adapters 2026-08-09 13:00:24 +03:00
test_orchestration.py rename package netcheck to netsleuth (name taken on pypi) 2026-08-09 11:43:00 +03:00
test_prefix_benchmark.py add AS prefix latency benchmark probe 2026-08-09 17:43:10 +03:00
test_prober_stats.py add jitter matrix (p95/p99/cv) to ping stats 2026-08-09 17:34:06 +03:00
test_reputation.py add test coverage for fetch_internetdb 2026-08-09 16:19:59 +03:00
test_speed_cloudflare.py add tests for tier_cloudflare 2026-08-09 16:14:55 +03:00
test_speed_fastcom.py detect captive portals up front, flag off-country speedtest servers 2026-08-12 21:36:54 +03:00
test_speed_math.py add test coverage for throughput_from_samples 2026-08-09 16:20:50 +03:00
test_stats.py add jitter matrix (p95/p99/cv) to ping stats 2026-08-09 17:34:06 +03:00
test_tls_rtt.py verify TLS certificates and fingerprint them for MITM detection 2026-08-12 21:48:36 +03:00
test_traceparse.py add specific unit tests for parse_traceroute 2026-08-09 16:21:23 +03:00
test_traceroute_cascade.py add --interface flag to force outbound probing through a specific adapter 2026-08-09 13:36:06 +03:00
test_watch.py rename package netcheck to netsleuth (name taken on pypi) 2026-08-09 11:43:00 +03:00