netscope 0.19.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- netscope-0.19.0/LICENSE +21 -0
- netscope-0.19.0/NOTICE +43 -0
- netscope-0.19.0/PKG-INFO +320 -0
- netscope-0.19.0/README.md +277 -0
- netscope-0.19.0/pyproject.toml +126 -0
- netscope-0.19.0/setup.cfg +4 -0
- netscope-0.19.0/src/netscope/__init__.py +0 -0
- netscope-0.19.0/src/netscope/adapters/__init__.py +19 -0
- netscope-0.19.0/src/netscope/adapters/discovery/__init__.py +8 -0
- netscope-0.19.0/src/netscope/adapters/discovery/gateway_detector.py +143 -0
- netscope-0.19.0/src/netscope/adapters/discovery/hostname_resolver.py +78 -0
- netscope-0.19.0/src/netscope/adapters/discovery/network_discovery.py +85 -0
- netscope-0.19.0/src/netscope/adapters/discovery/network_type_classifier.py +74 -0
- netscope-0.19.0/src/netscope/adapters/geoip.py +630 -0
- netscope-0.19.0/src/netscope/adapters/lookups.py +205 -0
- netscope-0.19.0/src/netscope/adapters/probes/__init__.py +11 -0
- netscope-0.19.0/src/netscope/adapters/probes/bandwidth_adapter.py +28 -0
- netscope-0.19.0/src/netscope/adapters/probes/dns_adapter.py +78 -0
- netscope-0.19.0/src/netscope/adapters/probes/http_adapter.py +36 -0
- netscope-0.19.0/src/netscope/adapters/probes/icmp_adapter.py +70 -0
- netscope-0.19.0/src/netscope/adapters/probes/registry.py +100 -0
- netscope-0.19.0/src/netscope/adapters/probes/tcp_adapter.py +47 -0
- netscope-0.19.0/src/netscope/adapters/probes/tls_adapter.py +31 -0
- netscope-0.19.0/src/netscope/adapters/probes/traceroute_adapter.py +30 -0
- netscope-0.19.0/src/netscope/app/__init__.py +23 -0
- netscope-0.19.0/src/netscope/app/config.py +144 -0
- netscope-0.19.0/src/netscope/app/container.py +235 -0
- netscope-0.19.0/src/netscope/app/gateway.py +58 -0
- netscope-0.19.0/src/netscope/app/monitoring.py +120 -0
- netscope-0.19.0/src/netscope/app/reports.py +1079 -0
- netscope-0.19.0/src/netscope/app/use_cases.py +1208 -0
- netscope-0.19.0/src/netscope/core/__init__.py +0 -0
- netscope-0.19.0/src/netscope/core/asn.py +122 -0
- netscope-0.19.0/src/netscope/core/baseline.py +186 -0
- netscope-0.19.0/src/netscope/core/diagnosis.py +467 -0
- netscope-0.19.0/src/netscope/core/discovery.py +42 -0
- netscope-0.19.0/src/netscope/core/drift.py +562 -0
- netscope-0.19.0/src/netscope/core/geo.py +166 -0
- netscope-0.19.0/src/netscope/core/incidents.py +241 -0
- netscope-0.19.0/src/netscope/core/loss.py +152 -0
- netscope-0.19.0/src/netscope/core/models.py +476 -0
- netscope-0.19.0/src/netscope/core/ports.py +348 -0
- netscope-0.19.0/src/netscope/core/routing.py +197 -0
- netscope-0.19.0/src/netscope/core/scoring.py +223 -0
- netscope-0.19.0/src/netscope/explanation/__init__.py +0 -0
- netscope-0.19.0/src/netscope/explanation/explainer.py +61 -0
- netscope-0.19.0/src/netscope/persistence/__init__.py +0 -0
- netscope-0.19.0/src/netscope/persistence/baseline_repository.py +152 -0
- netscope-0.19.0/src/netscope/persistence/measurement_repository.py +265 -0
- netscope-0.19.0/src/netscope/persistence/route_repository.py +198 -0
- netscope-0.19.0/src/netscope/persistence/schema.py +364 -0
- netscope-0.19.0/src/netscope/persistence/service_repository.py +166 -0
- netscope-0.19.0/src/netscope/probes/__init__.py +0 -0
- netscope-0.19.0/src/netscope/probes/bandwidth_probe.py +243 -0
- netscope-0.19.0/src/netscope/probes/dns_probe.py +72 -0
- netscope-0.19.0/src/netscope/probes/http_probe.py +127 -0
- netscope-0.19.0/src/netscope/probes/icmp_probe.py +69 -0
- netscope-0.19.0/src/netscope/probes/tcp_probe.py +143 -0
- netscope-0.19.0/src/netscope/probes/tls_probe.py +160 -0
- netscope-0.19.0/src/netscope/probes/traceroute_probe.py +124 -0
- netscope-0.19.0/src/netscope/py.typed +0 -0
- netscope-0.19.0/src/netscope/ui/__init__.py +0 -0
- netscope-0.19.0/src/netscope/ui/cli.py +1211 -0
- netscope-0.19.0/src/netscope/ui/completions.py +341 -0
- netscope-0.19.0/src/netscope/ui/man.py +160 -0
- netscope-0.19.0/src/netscope/ui/render.py +438 -0
- netscope-0.19.0/src/netscope/ui/tui/__init__.py +0 -0
- netscope-0.19.0/src/netscope/ui/tui/app.py +250 -0
- netscope-0.19.0/src/netscope/ui/tui/screens/__init__.py +31 -0
- netscope-0.19.0/src/netscope/ui/tui/screens/dashboard.py +291 -0
- netscope-0.19.0/src/netscope/ui/tui/screens/diagnostics.py +170 -0
- netscope-0.19.0/src/netscope/ui/tui/screens/history.py +171 -0
- netscope-0.19.0/src/netscope/ui/tui/screens/network.py +256 -0
- netscope-0.19.0/src/netscope/ui/tui/screens/route.py +189 -0
- netscope-0.19.0/src/netscope/ui/tui/screens/services.py +293 -0
- netscope-0.19.0/src/netscope.egg-info/PKG-INFO +320 -0
- netscope-0.19.0/src/netscope.egg-info/SOURCES.txt +114 -0
- netscope-0.19.0/src/netscope.egg-info/dependency_links.txt +1 -0
- netscope-0.19.0/src/netscope.egg-info/entry_points.txt +2 -0
- netscope-0.19.0/src/netscope.egg-info/requires.txt +16 -0
- netscope-0.19.0/src/netscope.egg-info/top_level.txt +1 -0
- netscope-0.19.0/tests/test_adapters_v02.py +138 -0
- netscope-0.19.0/tests/test_app_v02.py +551 -0
- netscope-0.19.0/tests/test_asn.py +107 -0
- netscope-0.19.0/tests/test_bandwidth_probe.py +217 -0
- netscope-0.19.0/tests/test_baseline.py +262 -0
- netscope-0.19.0/tests/test_baseline_repository.py +189 -0
- netscope-0.19.0/tests/test_cli.py +1343 -0
- netscope-0.19.0/tests/test_completions.py +191 -0
- netscope-0.19.0/tests/test_config.py +146 -0
- netscope-0.19.0/tests/test_container.py +90 -0
- netscope-0.19.0/tests/test_diagnosis.py +599 -0
- netscope-0.19.0/tests/test_drift.py +529 -0
- netscope-0.19.0/tests/test_explanation.py +105 -0
- netscope-0.19.0/tests/test_geo.py +152 -0
- netscope-0.19.0/tests/test_geo_enrichment.py +707 -0
- netscope-0.19.0/tests/test_geoip_adapter.py +421 -0
- netscope-0.19.0/tests/test_incidents.py +292 -0
- netscope-0.19.0/tests/test_lookups.py +271 -0
- netscope-0.19.0/tests/test_loss.py +187 -0
- netscope-0.19.0/tests/test_man_page.py +135 -0
- netscope-0.19.0/tests/test_measurement_repository.py +639 -0
- netscope-0.19.0/tests/test_models.py +467 -0
- netscope-0.19.0/tests/test_network_discovery.py +474 -0
- netscope-0.19.0/tests/test_ports.py +473 -0
- netscope-0.19.0/tests/test_probe_adapters.py +1250 -0
- netscope-0.19.0/tests/test_probe_registry.py +258 -0
- netscope-0.19.0/tests/test_render.py +308 -0
- netscope-0.19.0/tests/test_reports.py +920 -0
- netscope-0.19.0/tests/test_route_repository.py +241 -0
- netscope-0.19.0/tests/test_routing.py +329 -0
- netscope-0.19.0/tests/test_schema.py +463 -0
- netscope-0.19.0/tests/test_scoring.py +394 -0
- netscope-0.19.0/tests/test_service_repository.py +259 -0
- netscope-0.19.0/tests/test_tui.py +930 -0
- netscope-0.19.0/tests/test_use_cases.py +1172 -0
netscope-0.19.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 NetScope Contributors
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
netscope-0.19.0/NOTICE
ADDED
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
NetScope — Third-Party Notices
|
|
2
|
+
|
|
3
|
+
NetScope's own source code is licensed under the MIT License (see LICENSE).
|
|
4
|
+
It depends on the following third-party open-source libraries, used as
|
|
5
|
+
normal package dependencies (via pip), never vendored or modified:
|
|
6
|
+
|
|
7
|
+
- icmplib (LGPL-3.0-or-later)
|
|
8
|
+
https://github.com/ValentinBELYN/icmplib
|
|
9
|
+
Used unmodified as an installed dependency. LGPL permits this kind of
|
|
10
|
+
dynamic use in a differently-licensed project; if icmplib's own source
|
|
11
|
+
is ever modified, those modifications must be released under LGPL-3.0.
|
|
12
|
+
|
|
13
|
+
- dnspython (ISC License)
|
|
14
|
+
https://github.com/rthalley/dnspython
|
|
15
|
+
|
|
16
|
+
- httpx (BSD-3-Clause)
|
|
17
|
+
https://github.com/encode/httpx
|
|
18
|
+
|
|
19
|
+
- psutil (BSD-3-Clause)
|
|
20
|
+
https://github.com/giampaolo/psutil
|
|
21
|
+
|
|
22
|
+
- textual (MIT License) [optional UI dependency]
|
|
23
|
+
https://github.com/Textualize/textual
|
|
24
|
+
|
|
25
|
+
None of the following projects' source code was copied into NetScope; they
|
|
26
|
+
were studied for research/design purposes only (see NetScope-Research-Phase1.md):
|
|
27
|
+
MTR (GPL-2.0), WinMTR (GPL-2.0), SmokePing (GPL), Netdata (GPL-3.0+),
|
|
28
|
+
Scapy (GPL-2.0), ntopng (GPL-3.0), LibreNMS (GPL-3.0), Nmap (NPSL).
|
|
29
|
+
|
|
30
|
+
GeoLite2 data (v0.12, optional at runtime; ASN edition since v0.14)
|
|
31
|
+
------------------------------------------
|
|
32
|
+
NetScope's GeoIP feature reads MaxMind's GeoLite2 database files (the
|
|
33
|
+
City edition for geography, the ASN edition for network ownership),
|
|
34
|
+
which the USER downloads under their own free MaxMind account. NetScope
|
|
35
|
+
never ships, downloads, or redistributes GeoLite2 data; the file is read
|
|
36
|
+
from local disk only. This product includes GeoLite2 data created by
|
|
37
|
+
MaxMind, available from https://www.maxmind.com -- as the GeoLite2 EULA
|
|
38
|
+
requires. GeoLite2 data is not an open-source license; its terms
|
|
39
|
+
(attribution, no redistribution, refresh expectations) are the user's to
|
|
40
|
+
accept when they create the account. NetScope discloses the database's
|
|
41
|
+
build age at run time and surfaces an aging notice past 30 days (the
|
|
42
|
+
EULA's refresh rhythm) -- see docs/usage/geoip.md and
|
|
43
|
+
adr-011-geoip-strategy.md / adr-013-asn-strategy.md.
|
netscope-0.19.0/PKG-INFO
ADDED
|
@@ -0,0 +1,320 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: netscope
|
|
3
|
+
Version: 0.19.0
|
|
4
|
+
Summary: Internet Experience Intelligence & Network Diagnostics Platform — from raw measurements to 'what's wrong, and where', with evidence.
|
|
5
|
+
Author: NetScope Contributors
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
Project-URL: Homepage, https://github.com/Abolfazlrwm/netscope
|
|
8
|
+
Project-URL: Documentation, https://github.com/Abolfazlrwm/netscope/tree/main/docs
|
|
9
|
+
Project-URL: Issues, https://github.com/Abolfazlrwm/netscope/issues
|
|
10
|
+
Project-URL: Changelog, https://github.com/Abolfazlrwm/netscope/blob/main/CHANGELOG.md
|
|
11
|
+
Keywords: network,diagnostics,traceroute,ping,isp,monitoring,tui
|
|
12
|
+
Classifier: Development Status :: 4 - Beta
|
|
13
|
+
Classifier: Environment :: Console
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: Intended Audience :: System Administrators
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Python :: 3
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: System :: Networking :: Monitoring
|
|
22
|
+
Classifier: Topic :: Utilities
|
|
23
|
+
Classifier: Typing :: Typed
|
|
24
|
+
Requires-Python: >=3.11
|
|
25
|
+
Description-Content-Type: text/markdown
|
|
26
|
+
License-File: LICENSE
|
|
27
|
+
License-File: NOTICE
|
|
28
|
+
Requires-Dist: icmplib>=3.0.4
|
|
29
|
+
Requires-Dist: dnspython>=2.8.0
|
|
30
|
+
Requires-Dist: httpx>=0.28.1
|
|
31
|
+
Requires-Dist: psutil>=6.0.0
|
|
32
|
+
Requires-Dist: rich>=13.0.0
|
|
33
|
+
Provides-Extra: tui
|
|
34
|
+
Requires-Dist: textual>=1.0.0; extra == "tui"
|
|
35
|
+
Provides-Extra: dev
|
|
36
|
+
Requires-Dist: pytest>=8.0.0; extra == "dev"
|
|
37
|
+
Requires-Dist: pytest-cov>=5.0.0; extra == "dev"
|
|
38
|
+
Requires-Dist: pytest-asyncio>=0.24.0; extra == "dev"
|
|
39
|
+
Requires-Dist: ruff>=0.6.0; extra == "dev"
|
|
40
|
+
Requires-Dist: mypy>=1.11.0; extra == "dev"
|
|
41
|
+
Requires-Dist: textual>=1.0.0; extra == "dev"
|
|
42
|
+
Dynamic: license-file
|
|
43
|
+
|
|
44
|
+
# NetScope
|
|
45
|
+
|
|
46
|
+
<p align="center"><img src="assets/banner.png" alt="netscope banner" width="100%"></p>
|
|
47
|
+
|
|
48
|
+
**Internet Experience Intelligence & Network Diagnostics — from raw measurements to "what's wrong, and where", with evidence.**
|
|
49
|
+
|
|
50
|
+
[](https://github.com/Abolfazlrwm/netscope/actions/workflows/ci.yml)
|
|
51
|
+
[](https://github.com/Abolfazlrwm/netscope/actions/workflows/codeql.yml)
|
|
52
|
+
[](https://github.com/Abolfazlrwm/netscope)
|
|
53
|
+
[](LICENSE)
|
|
54
|
+
[](https://github.com/astral-sh/ruff)
|
|
55
|
+
|
|
56
|
+
<p align="center"><img src="assets/tui-demo.png" alt="netscope TUI dashboard" width="88%"></p>
|
|
57
|
+
[](#development)
|
|
58
|
+
|
|
59
|
+
> **Try it without installing** — [open a live sample evidence report](https://abolfazlrwm.github.io/netscope/), a real `netscope report --html` artifact generated on a locked-down VM. Half the probes genuinely fail there, and the report keeps them as evidence and scores them honestly — the core rule ("missing" is never "healthy") doing exactly what it promises. Same page links back to the source, so the product and the code are one click apart.
|
|
60
|
+
|
|
61
|
+
NetScope doesn't just show you a latency number — it tells you whether the problem is **your Wi-Fi/router**, **your ISP**, or **the destination service**, and shows you the evidence chain behind that claim.
|
|
62
|
+
|
|
63
|
+
```mermaid
|
|
64
|
+
flowchart LR
|
|
65
|
+
P[Probes<br/>icmp · dns · tcp · tls · http · traceroute · bandwidth] --> S[Experience Score<br/>0–100, vs. your personal baseline]
|
|
66
|
+
P --> E[Evidence<br/>tested · observed · expected · σ]
|
|
67
|
+
E --> D[Diagnosis<br/>local vs. ISP vs. destination]
|
|
68
|
+
D --> X[Explanation<br/>human-readable]
|
|
69
|
+
D --> I[Incidents<br/>sustained-problem detection]
|
|
70
|
+
S & E & D --> DB[(SQLite<br/>100% local)]
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
## Why NetScope is different
|
|
74
|
+
|
|
75
|
+
| | Classic tools (ping / Zabbix-style) | NetScope |
|
|
76
|
+
|---|---|---|
|
|
77
|
+
| Thresholds | Fixed, global ("alert if > 100 ms") | **Learned per user, per target** (Welford online statistics) |
|
|
78
|
+
| Verdict | A number or a boolean | **Evidence-based classification** with confidence and ruled-out list |
|
|
79
|
+
| "Missing data" | Silently treated as healthy | A first-class **untested** state — never a fabricated verdict |
|
|
80
|
+
| Incidents | One bad sample alerts | Only **sustained** deviations (3+ consecutive rounds) open an incident |
|
|
81
|
+
| Storage | Cloud dashboards | **Local-first SQLite** — no data leaves your machine |
|
|
82
|
+
|
|
83
|
+
The untested-evidence principle is NetScope's core honesty rule: *"missing" is never reported as "healthy"* — a gateway that wasn't probed blocks confident upstream attribution instead of silently enabling it.
|
|
84
|
+
|
|
85
|
+
## Install
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# From source (the supported path today — not yet on PyPI)
|
|
89
|
+
git clone https://github.com/Abolfazlrwm/netscope
|
|
90
|
+
cd netscope && pip install -e .
|
|
91
|
+
|
|
92
|
+
# With the live TUI dashboard
|
|
93
|
+
pip install -e ".[tui]"
|
|
94
|
+
|
|
95
|
+
# Dev tools + editable install (tests, lint)
|
|
96
|
+
make install
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
> **Windows note:** ICMP works out of the box. On **Linux/macOS**, raw-socket permission is optional — NetScope automatically falls back to unprivileged UDP ping; for the most reliable ICMP results use `sudo` or set the socket capability (`sudo setcap cap_net_raw+ep $(which python)`).
|
|
100
|
+
|
|
101
|
+
## Quickstart
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
netscope # diagnose (gateway auto-detected) — the default command
|
|
105
|
+
netscope --version # confirm what you're running
|
|
106
|
+
netscope tui # live terminal dashboard
|
|
107
|
+
netscope speed # download throughput, judged against your usual
|
|
108
|
+
```
|
|
109
|
+
|
|
110
|
+
### The dashboard
|
|
111
|
+
|
|
112
|
+

|
|
113
|
+
|
|
114
|
+
The TUI is six screens under one shell (v0.6) — all sharing one round pipeline, one incident session, one log:
|
|
115
|
+
|
|
116
|
+
| Key | Screen | What it shows |
|
|
117
|
+
|---|---|---|
|
|
118
|
+
| `d` | Dashboard | Live score, trend, per-probe results with where each target lives and whose network it sits on (v0.16), diagnosis, incidents |
|
|
119
|
+
| `n` | Network | Interfaces, their types/addresses, the detected gateway — plus your own line's place and network from the same GeoLite2 sources (v0.16) |
|
|
120
|
+
| `p` | Route | Traceroute with hostname/ASN/organization/country enrichment and the cross-run churn verdict |
|
|
121
|
+
| `e` | Evidence | The full evidence table, ruled-out list, plain-language explanation |
|
|
122
|
+
| `h` | History | Recent rounds from the local log, with per-round detail |
|
|
123
|
+
| `s` | Services | Status board of every measured target + on-demand host checks |
|
|
124
|
+
|
|
125
|
+
### The CLI
|
|
126
|
+
|
|
127
|
+

|
|
128
|
+
|
|
129
|
+
### Route intelligence
|
|
130
|
+
|
|
131
|
+

|
|
132
|
+
|
|
133
|
+
### Download speed
|
|
134
|
+
|
|
135
|
+
```bash
|
|
136
|
+
netscope speed # 6-second window, endpoint from config
|
|
137
|
+
netscope speed --seconds 10 # longer window, steadier median
|
|
138
|
+
netscope speed --url <any-url> # measure against a different endpoint
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+

|
|
142
|
+
|
|
143
|
+
Streams the endpoint for a bounded window, samples Mbps at fixed
|
|
144
|
+
intervals, and reports the **median** sample (robust against the TCP
|
|
145
|
+
slow-start ramp), with the peak and bytes moved as evidence. It is a
|
|
146
|
+
standalone command on purpose — a speed test is slow and data-hungry,
|
|
147
|
+
so it never runs inside `diagnose` rounds, and its result is evidence
|
|
148
|
+
only: it does not feed the 0–100 score.
|
|
149
|
+
|
|
150
|
+
Since v0.4, every successful run is also learned into a **personal
|
|
151
|
+
throughput baseline** (its own store, its own table — never the
|
|
152
|
+
latency/loss metrics a download must not pose as). Once the baseline
|
|
153
|
+
has a few runs behind it, each new test is judged against your usual:
|
|
154
|
+
±15% counts as *as usual*, beyond that you get *slower/faster than
|
|
155
|
+
usual* — in the panel and in `--json` (`baseline_mean_mbps`,
|
|
156
|
+
`baseline_samples`, `deviation_pct`, `verdict`). The first runs only
|
|
157
|
+
learn; NetScope stays silent until it has something honest to say. The
|
|
158
|
+
endpoint and window are configurable via the `bandwidth_url` /
|
|
159
|
+
`bandwidth_seconds` config keys.
|
|
160
|
+
|
|
161
|
+
### Evidence reports
|
|
162
|
+
|
|
163
|
+
```bash
|
|
164
|
+
netscope report # last 7 days, every target
|
|
165
|
+
netscope report --days 30 --target api.example.com # one target, one month
|
|
166
|
+
netscope report --days 7 --out week.md # a file to attach to the ticket
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Rebuilds the persisted measurement log into one self-contained
|
|
170
|
+
markdown document: the window's rounds with recomputed scores,
|
|
171
|
+
per-target evidence tables, every failure with its error taxonomy, and
|
|
172
|
+
the notes that keep the numbers honest. Disclosure over truncation:
|
|
173
|
+
tables show the newest 40 rows per target and state exactly how many
|
|
174
|
+
older rows were omitted — the aggregates always cover the full window.
|
|
175
|
+
|
|
176
|
+
## Commands
|
|
177
|
+
|
|
178
|
+
| Command | What it does |
|
|
179
|
+
|---|---|
|
|
180
|
+
| `netscope diagnose` | One measurement round (gateway / public DNS / DNS lookup / CDN), experience score, evidence-based diagnosis |
|
|
181
|
+
| `netscope check <host> [--checks icmp,dns,tcp,tls,http]` | Probe any target with any subset of checks and score it |
|
|
182
|
+
| `netscope service add/list/remove/check` | Your curated service list, persisted locally: save, list, remove, and run a saved service's own checks (v0.7) |
|
|
183
|
+
| `netscope route <target> [--no-resolve]` | Traceroute with reverse-DNS hostnames, AS numbers (see below) and route-stability analysis **across your stored history** — "unchanged across the last N runs" / "changed vs <date>: hop K: old → new" (v0.8) |
|
|
184
|
+
| `netscope history [--limit N] [--csv FILE]` | Recent measurement rounds from the local log (CSV export v0.17) |
|
|
185
|
+
| `netscope drift <target> [--days N]` | The drift watch: your recent history window vs. the one before it, vital by vital — catches the slow leak no single check can flag (v0.15) |
|
|
186
|
+
| `netscope monitor [--interval S] [--rounds N]` | Continuous rounds with sustained-problem incident detection |
|
|
187
|
+
| `netscope speed [--url URL] [--seconds S]` | Download throughput: median Mbps, peak sample, bytes moved (v0.3) |
|
|
188
|
+
| `netscope report [--days N] [--target T] [--out FILE] [--html FILE] [--csv FILE] [--prometheus FILE]` | Export the log as a self-contained evidence report — markdown, a dark HTML page with inline SVG trends (v0.5; HTML v0.10), a flat CSV table (v0.17), or Prometheus text-exposition metrics for the textfile collector (v0.17) |
|
|
189
|
+
| `netscope completions bash\|zsh\|fish` | Print a ready-to-install shell completion script, verbatim (v0.11) |
|
|
190
|
+
| `netscope tui` | The six-screen live dashboard (requires `[tui]` extra) |
|
|
191
|
+
|
|
192
|
+
Every read command accepts `--json` for machine-readable output:
|
|
193
|
+
|
|
194
|
+
```bash
|
|
195
|
+
netscope diagnose --json | jq '.experience'
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
```json
|
|
199
|
+
{
|
|
200
|
+
"tool": "netscope",
|
|
201
|
+
"report": "diagnose",
|
|
202
|
+
"experience": {"score": 91.0, "level": "good"},
|
|
203
|
+
"diagnosis": null,
|
|
204
|
+
"measurements": [
|
|
205
|
+
{"probe_type": "icmp", "target": "1.1.1.1", "success": true, "latency_ms": 8.4, "...": "..."}
|
|
206
|
+
]
|
|
207
|
+
}
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
### Shell completions and a man page
|
|
211
|
+
|
|
212
|
+
Tab completion ships inside the package — three hand-written scripts (bash, zsh, fish), no third-party generator, no runtime TAB lag:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
netscope completions bash > ~/.local/share/bash-completion/completions/netscope
|
|
216
|
+
netscope completions zsh > ~/.zfunc/_netscope # then: fpath=(~/.zfunc $fpath) before compinit
|
|
217
|
+
netscope completions fish > ~/.config/fish/completions/netscope.fish
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
`docs/netscope.1` is a man page rendered from the live argparse parser (`make man`) — it cannot drift from the CLI because it *is* the CLI, read back:
|
|
221
|
+
|
|
222
|
+
```bash
|
|
223
|
+
man docs/netscope.1
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
### Gateway localization, automatically
|
|
227
|
+
|
|
228
|
+
`netscope diagnose` probes your **default gateway** by default (`--gateway auto`) — detected from the OS (Linux `/proc/net/route`, macOS `route -n get default`, Windows `route print`) with no configuration. That's what lets the diagnosis separate "your Wi-Fi/router" from "your ISP":
|
|
229
|
+
|
|
230
|
+
```bash
|
|
231
|
+
netscope diagnose --gateway 192.168.1.1 # pin it explicitly
|
|
232
|
+
netscope diagnose --gateway none # skip the gateway check
|
|
233
|
+
```
|
|
234
|
+
|
|
235
|
+
### Network ownership: ASN + organization (optional, offline, license-clean)
|
|
236
|
+
|
|
237
|
+
Two offline sources, one enrichment (`adr-013`). The rich one: download GeoLite2-ASN (same free MaxMind account, [`docs/usage/geoip.md`](docs/usage/geoip.md)) and drop `GeoLite2-ASN.mmdb` at `~/.netscope/GeoLite2-ASN.mmdb` — `netscope route`'s Network column then names the operator on every hop (`AS13335 Cloudflare, Inc.`), through the same hand-written `.mmdb` reader the City edition uses, zero new dependencies. The fallback: the v0.2 `prefix<TAB>ASN` text table at `~/.netscope/ipasn.dat` (e.g. a routeviews export) still works — pure-Python longest-prefix-match, number-only, honestly without a name. With neither file, routes simply render without ownership. A corrupt mmdb falls through to the text table, never to a crash.
|
|
238
|
+
|
|
239
|
+
### Geo location and distance (optional, offline, v0.12)
|
|
240
|
+
|
|
241
|
+
Download GeoLite2-City (free MaxMind account, your own license key — setup in [`docs/usage/geoip.md`](docs/usage/geoip.md)), drop `GeoLite2-City.mmdb` at `~/.netscope/GeoLite2-City.mmdb`, optionally set `home_ip` (or home coordinates) in `config.toml`, and every check answers *where it is* and *how far away*: `check`/`diagnose` show place, distance and database age in the detail column (and `extra.geo` in `--json`), `route` gains a per-hop Country column, and the evidence report — markdown and `--html` — gains a Geography and ownership section. The `.mmdb` reader is hand-written against the public spec (`adr-011`): zero new dependencies, zero compilation, GeoLite2 never shipped or fetched. A database older than 30 days says so, per the EULA's refresh rhythm.
|
|
242
|
+
|
|
243
|
+
### Personal baseline that actually learns
|
|
244
|
+
|
|
245
|
+
Every successful measurement feeds a per-target Welford tracker (mean + variance, exact round-trips) persisted in `~/.netscope/netscope.db`. After a few rounds NetScope knows *your* normal — 100 ms is a regression for fibre and unremarkable for a mobile hotspot — and scores/diagnoses deviations statistically (σ-based), never against a hardcoded constant. Since v0.13 the same treatment covers **jitter**: a fast, lossless line that wobbles now scores — and diagnoses — like what it is, a wobbly line, not like a steady one.
|
|
246
|
+
|
|
247
|
+
```bash
|
|
248
|
+
netscope history # watch the baseline mature round over round
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
### The drift watch: is "usual" getting worse? (v0.15)
|
|
252
|
+
|
|
253
|
+
The baseline is a trailing average of the measurements it judges — so a line that quietly rots never trips a threshold: every new sweep reads "excellent" against a baseline that rots with it. The drift watch is the complementary lens and needs no baseline at all: it compares the target's **recent history window against the same-length window before it**, vital by vital (latency, loss, jitter, throughput), each with its own verdict and a report-level one that answers exactly one question — *is usual getting worse?*
|
|
254
|
+
|
|
255
|
+
```bash
|
|
256
|
+
netscope drift example.com # last 7 days vs. the 7 before them
|
|
257
|
+
netscope drift example.com --days 3 # a shorter, more recent pair
|
|
258
|
+
netscope drift example.com --json # the full windowed payload for machines
|
|
259
|
+
```
|
|
260
|
+
|
|
261
|
+

|
|
262
|
+
|
|
263
|
+
Median latency 23 ms last week and 31 ms this week is degradation **no single check ever flagged** — the drift watch is the lens that says so, with the numbers cited in its evidence lines.
|
|
264
|
+
|
|
265
|
+
### Monitoring with honest incident detection
|
|
266
|
+
|
|
267
|
+
```bash
|
|
268
|
+
netscope monitor --interval 30
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
A problem must be sustained for **3 consecutive rounds** to *open* an incident, and a sustained-healthy stretch to *close* one. Single noisy samples never flap incident state, and sustained *"not enough evidence"* rounds neither open nor close anything.
|
|
272
|
+
|
|
273
|
+
## Configuration (optional)
|
|
274
|
+
|
|
275
|
+
`~/.netscope/config.toml` — every field has a built-in default; NetScope runs with zero configuration:
|
|
276
|
+
|
|
277
|
+
```toml
|
|
278
|
+
gateway = "192.168.1.1" # default for --gateway
|
|
279
|
+
public_dns_target = "1.1.1.1" # ICMP target standing in for "the internet"
|
|
280
|
+
dns_lookup_domain = "example.com"
|
|
281
|
+
public_cdn_url = "https://www.cloudflare.com/"
|
|
282
|
+
```
|
|
283
|
+
|
|
284
|
+
## Architecture
|
|
285
|
+
|
|
286
|
+
Hexagonal (ports & adapters), enforced by AST-based tests — `core` imports nothing but the standard library; `app` is the only layer allowed to touch both a port and a concrete adapter; `ui` only talks to `app`.
|
|
287
|
+
|
|
288
|
+
```
|
|
289
|
+
src/netscope/
|
|
290
|
+
├── core/ # domain: models, scoring, diagnosis, incidents, routing, baseline (pure, offline-testable)
|
|
291
|
+
├── adapters/ # probes (icmp/dns/tcp/tls/http/traceroute/bandwidth), discovery, ASN lookups
|
|
292
|
+
├── persistence/ # SQLite repositories (measurements, baseline) + versioned schema
|
|
293
|
+
├── app/ # use cases, config, composition root, reports, monitoring session
|
|
294
|
+
└── ui/ # rich CLI + Textual TUI
|
|
295
|
+
```
|
|
296
|
+
|
|
297
|
+
Deep-dive documents live in [`docs/architecture/`](docs/architecture): architecture overview, module boundaries, data flow, and 10+ ADRs — including the evidence/hypothesis diagnosis design and the untested-evidence principle. User-facing docs (install, commands, configuration, JSON output) live in [`docs/usage/`](docs/usage/index.md).
|
|
298
|
+
|
|
299
|
+
## Privacy
|
|
300
|
+
|
|
301
|
+
**100% local-first.** Measurements, baselines and history live in `~/.netscope/netscope.db`. Nothing is uploaded, ever — the only network traffic NetScope generates is the probes themselves.
|
|
302
|
+
|
|
303
|
+
## Development
|
|
304
|
+
|
|
305
|
+
```bash
|
|
306
|
+
make install # editable install + dev tools
|
|
307
|
+
make test # 1002 tests, fully offline (fake probes, no network needed)
|
|
308
|
+
make lint # ruff check + format check
|
|
309
|
+
make typecheck # mypy on the package
|
|
310
|
+
```
|
|
311
|
+
|
|
312
|
+
The test suite is **fully offline** — every probe is a scripted fake, including the TUI tests (driven through Textual's pilot). New probe types plug in via `ProbeRegistry.register()` without touching core.
|
|
313
|
+
|
|
314
|
+
## Roadmap
|
|
315
|
+
|
|
316
|
+
See [`docs/architecture/future-roadmap.md`](docs/architecture/future-roadmap.md). Done recently: (v0.5) evidence-report export (`netscope report`) and user-facing usage docs; (v0.6) the full multi-screen TUI — dashboard, network, route, evidence, history and services screens under one shell; (v0.7) the saved service list — `netscope service add/list/remove/check`, persisted locally (schema v3), pinned on the TUI services board; (v0.8) route memory — churn verdicts across your stored route history with hop-level diffs; (v0.11) shell-level plumbing — `--version`, shell completions, a generated man page; (v0.12) GeoIP distance — the dependency-free GeoLite2 reader, place/distance in every read path (TASK-023, the roadmap's last route-model promise); (v0.13) jitter — the third vital sign learned per target, weighed in the 0–100 score, cited as diagnosis evidence, shown in the dashboard and the evidence tables; (v0.14) ownership — GeoLite2-ASN through the same reader, organization names on every route hop and in every report (`adr-013`); (v0.15) the drift watch — the recent history window vs. the one before it, vital by vital, catching the slow leak no single check can flag (`adr-014`); (v0.16) the evidence reaches the TUI (`adr-015`) — the shell honors config.toml for enrichment wiring, the dashboard's checks table carries a Where column, the route screen names the network and the country exactly like the CLI, and the network screen answers "where am I, whose road am I on" from the same GeoLite2 sources; (v0.17) the readings travel (`adr-016`) — `netscope report --csv` flattens the evidence tables (persisted geo/asn unfolded onto scalar columns, failures included), `netscope report --prometheus` speaks the textfile-collector dialect so a cron line hands the log to any Prometheus without NetScope ever opening a port, and `netscope history --csv` exports every stored measurement with its round denormalized on.
|
|
317
|
+
|
|
318
|
+
## License
|
|
319
|
+
|
|
320
|
+
MIT — see [`LICENSE`](LICENSE). Third-party licenses are documented in [`NOTICE`](NOTICE) (notably the LGPL-3.0 attribution for `icmplib`, used unmodified via dynamic import).
|