WiFi Network Tester
Overview
Zero-dependency Python WiFi network testing tool with real-time web dashboard. Analyzes latency, packet loss, jitter, and bandwidth throughput with stepped/tiered distribution analysis. Single-file application — no pip install required, uses only Python standard library.
When to Use
- User requests WiFi quality testing or network diagnostics
- Need to measure latency, packet loss, jitter, or bandwidth
- Want stepped distribution analysis (e.g., "what percentage of pings are under 10ms")
- Need multi-file-size throughput testing (1MB/5MB/10MB/25MB)
- Network performance assessment or troubleshooting
Quick Start
Run the Tool
Copy scripts/wifi_tester.py to the target machine and execute:
python wifi_tester.py [port]
# Default port: 8091
# Then open http://localhost:<port> in browser
API Endpoints
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Web dashboard (HTML) |
/api/config |
GET | Get configuration (targets, gateway, local IP, download endpoints) |
/api/start |
GET | Start test (?targets=host1,host2&count=30&download=1&upload=1&dl_url=URL&tp_rounds=5&dl_mode=bytes|range) |
/api/status |
GET | Get current test progress and results |
/api/history |
GET | Get test history summaries |
/api/stop |
GET | Stop running test |
Features
1. Multi-Target Ping Test
- Auto-detects default gateway and local IP
- Tests gateway + configurable public DNS targets (AliDNS, DNSPod, Google DNS, Cloudflare DNS)
- Measures: min/avg/max latency, packet loss rate, jitter
- Cross-platform: Windows (Chinese/English) and Linux
2. Latency Tier Distribution
Stepped analysis of individual ping samples:
- < 10ms — Excellent (green)
- 10-20ms — Good (blue)
- 20-50ms — Fair (yellow)
- 50-100ms — Poor (orange)
- > 100ms — Bad (red)
Each tier shows count and percentage. Displayed as grouped bar chart per target.
3. Throughput Tier Test
Downloads files of 4 sizes from a selectable speed test endpoint:
- 1MB — Tests TCP slow-start impact
- 5MB — Small transfer throughput
- 10MB — Medium transfer throughput
- 25MB — Sustained throughput
Endpoint presets (selectable via dashboard dropdown):
- Cloudflare (海外节点) — speed.cloudflare.com/__down, ?bytes=N mode (URL param, N in bytes)
- 腾讯CDN (国内节点) — dldir1.qq.com/weixin/Windows/WeChatSetup.exe, range mode (HTTP Range header on a static ~270MB CDN file)
- 自定义 — user-supplied URL; bytes mode by default
URL mode handling:
- "bytes" — appends ?bytes={N} to the base URL (Cloudflare-style API)
- "range" — uses the URL as-is and requests N bytes via Range: bytes=0-{N-1} header (static CDN files)
Each size is tested multiple rounds (tp_rounds, default 5, range 1-20) — 4 sizes × 5 rounds = 20 tests total for statistical reliability. Supports mid-test stop (should_stop callback) and live progress reporting (progress_cb).
Reports per-size averaged speed (with all samples, best/worst per size), overall average, best/worst, total sample count, and stability (coefficient of variation) over all samples.
4. Speed Tier Distribution
- < 1 Mbps — Critical
- 1-5 Mbps — Basic browsing
- 5-10 Mbps — SD streaming
- 10-25 Mbps — HD streaming
- ≥ 25 Mbps — Excellent
Shows percentage of ALL test samples (up to sizes × rounds) achieving each speed tier, with emphasis on ≥25Mbps ratio.
5. Quality Scoring
Weighted algorithm (0-100, grade A+ to F):
- Latency (30%): <10ms=100, <20ms=90, <50ms=75, <100ms=55
- Packet loss (30%): 0%=100, <1%=85, <3%=65, <5%=40
- Jitter (20%): <2ms=100, <5ms=85, <10ms=70, <20ms=50
- Download speed (20%): >100Mbps=100, >50=90, >20=75, >10=60
6. Auto Recommendations
Generates contextual optimization suggestions based on test results (signal strength, channel interference, 5GHz recommendation, QoS settings, etc.).
Technical Notes
- Windows Chinese encoding:
ping/ipconfigoutput uses GBK on Chinese Windows. The_decode_output()helper tries system encoding → UTF-8 → GBK → Latin-1 with error replacement. - Ping parsing: Reply lines identified by "TTL" keyword (locale-independent). Stats parsed using both English ("Sent/Received/Lost") and Chinese ("已发送/已接收/丢失") patterns.
- Bandwidth endpoint: Default uses
https://speed.cloudflare.com/__down?bytes=N(configurable). Upload useshttps://speed.cloudflare.com/__up. - Threading: Network tests run in background thread; HTTP server remains responsive. Frontend polls
/api/statusevery 800ms. - No dependencies: Uses only Python stdlib (
http.server,subprocess,urllib,socket,json,re). Chart.js loaded from CDN in the dashboard.
Dashboard
Dark-themed glass-morphism UI with:
- 6 metric cards (latency, loss, jitter, download, upload, quality grade)
- Real-time latency line chart with average line
- Latency tier distribution grouped bar chart with detailed legend
- Throughput tier bar chart (1MB/5MB/10MB/25MB speeds)
- Speed tier distribution progress bars
- Multi-target results comparison table
- Auto-generated optimization recommendations
- Test history with ≥25Mbps percentage column