A Python command-line network diagnostic utility — run DNS lookups, ping tests, port scans, and HTTP probes against any host or IP in one command. No need to remember individual ping, nmap, or curl flags.
- DNS resolution — resolve hostnames to IPs with response time
- Ping test — ICMP packet loss summary with configurable count and timeout
- Port scanner — check common services (SSH 22, HTTP 80, HTTPS 443, MySQL 3306, Redis 6379, etc.)
- HTTP probe — check response code and server headers
- Export results to a timestamped text file with
--export - Color-coded output: green = open/reachable, red = closed/failed
- No external dependencies — pure Python standard library (
socket,subprocess,urllib)
- Python 3.7+
- No
pip installneeded
git clone https://github.com/jonatakuzi/network-diagnostics.git
cd network-diagnosticspython netdiag.py google.com
python netdiag.py 192.168.1.1[ DNS ] google.com → 142.250.80.46 (2ms)
[ PING ] 4/4 packets received, 0% loss, avg 11ms
[ PORTS ]
22 SSH closed
80 HTTP open
443 HTTPS open
python netdiag.py github.com --ports 22 80 443 9418python netdiag.py example.com --httppython netdiag.py 10.0.0.5 --count 10 --timeout 2python netdiag.py example.com --exportSaves to netdiag_example.com_20241115_143201.txt
- Python 3.7+
- Standard library:
socket,subprocess,urllib,argparse,datetime