NetScope is a lightweight, beginner-friendly Python command-line tool for basic network reachability checks. It is built for educational use to help students and beginners understand how IPv4 validation, ICMP echo requests (ping), and structured JSON reporting work in Python using only the standard library.
When learning networking and cybersecurity fundamentals, one of the first practical tasks is checking whether a host on a local lab network responds to connectivity probes. NetScope v0.1 focuses on doing this single task clearly and safely:
- Validate user-supplied IPv4 addresses before executing any network command.
- Perform a single, non-intrusive ICMP echo check across Windows, Linux, and macOS.
- Explain what the response means—and why a lack of response does not automatically mean a system is offline.
- Save results in a structured JSON format for lab notes or further analysis.
- IPv4 Validation: Verifies that the target input is a properly formatted IPv4 address using Python's built-in
ipaddressmodule. - Basic Connectivity Check: Sends a single ICMP echo request (
ping) with a configurable timeout. - Clear Terminal Output: Displays the target IP, reachability status (
REACHABLEorUNREACHABLE), operating system, timestamp, and diagnostic details. - Graceful Error Handling: Handles empty inputs, malformed IP addresses, timeouts, and user cancellations (
Ctrl+C) without crashing. - JSON Report Export: Automatically exports each check to a timestamped
.jsonfile inside thereports/directory (or a custom file path). - Simple CLI: Supports both direct command-line arguments (
python main.py 127.0.0.1) and interactive prompts (python main.py).
(Placeholders — replace with actual terminal screenshots from your lab environment)
- Reachable Host Check (
127.0.0.1):[Screenshot placeholder: docs/screenshots/reachable_check.png] - Invalid IPv4 Input Handling:
[Screenshot placeholder: docs/screenshots/invalid_input.png]
- Python: 3.10 or newer
- Operating System: Windows, Linux (including Kali Linux), or macOS
- Dependencies: None (uses only the Python standard library)
- System Utility: Standard OS
pingcommand available in systemPATH
-
Clone the repository:
git clone https://github.com/Mr45401/netscope.git cd netscope -
Verify your Python version (must be 3.10+):
python --version
(On Linux/Kali, you may need to use
python3instead ofpython.)
python main.py 127.0.0.1Example terminal output:
Checking reachability for 127.0.0.1 (timeout: 2s)...
--- NetScope Connectivity Result ---
Target IP : 127.0.0.1
Status : REACHABLE
Check Method : icmp_ping (Windows)
Timestamp (UTC): 2026-11-08T11:05:00Z
Details : Host responded to ICMP echo request (ping).
------------------------------------
JSON report saved to: reports\report_127_0_0_1_20261108_110500.json
python main.pypython main.py 192.168.1.1 --timeout 3 --output reports/router_check.jsonpython main.py 127.0.0.1 --no-reportpython main.py --helpWhen a check completes, NetScope writes a JSON report like this:
{
"tool": "NetScope",
"version": "0.1.0",
"generated_at": "2026-11-08T11:05:00Z",
"result": {
"target_ip": "127.0.0.1",
"reachable": true,
"status": "reachable",
"method": "icmp_ping",
"operating_system": "Windows",
"timestamp": "2026-11-08T11:05:00Z",
"details": "Host responded to ICMP echo request (ping)."
}
}NetScope/
├── README.md # Project documentation
├── LICENSE # MIT License
├── .gitignore # Ignored Python cache and generated report files
├── requirements.txt # Documents standard-library-only requirement
├── main.py # Command-line interface entry point
├── netscope/
│ ├── __init__.py # Package version definition
│ ├── validator.py # IPv4 validation functions
│ ├── scanner.py # Cross-platform ICMP connectivity check
│ └── reporter.py # JSON report formatting and file export
├── reports/
│ └── .gitkeep # Directory where JSON reports are saved
└── tests/
├── __init__.py
├── test_validator.py # Tests for IPv4 validation and CLI input errors
└── test_reporter.py # Tests for JSON payload creation and saving
NetScope uses Python's built-in unittest framework. Run the full test suite from the project root directory:
python -m unittest discover -s tests -v- ICMP Does Not Guarantee Host Status:
- If a host shows UNREACHABLE, it does not prove the machine is powered off. Many servers, firewalls, and Windows workstations block incoming ICMP echo requests by default even when they are online and running network services.
- Conversely, in some network environments, a firewall or proxy device may respond on behalf of an address.
- Single IPv4 Target Only:
- Version 0.1 checks one IPv4 address at a time. It does not yet accept domain names (DNS), IPv6 addresses, or CIDR subnet ranges (such as
192.168.1.0/24).
- Version 0.1 checks one IPv4 address at a time. It does not yet accept domain names (DNS), IPv6 addresses, or CIDR subnet ranges (such as
- Relies on System
pingUtility:- NetScope invokes the operating system's native
pingcommand rather than constructing raw ICMP sockets (which require administrator/root privileges).
- NetScope invokes the operating system's native
Planned improvements as I continue learning Python and networking:
- v0.2: Support checking a list of IPv4 addresses read from a text file.
- v0.3: Add basic TCP port connectivity checks (using Python's
socketmodule) for when ICMP is blocked. - v0.4: Add optional hostname / DNS resolution.
NetScope is created strictly for educational purposes and authorized lab practice.
- Only test hosts, virtual machines, and networks that you own or have explicit permission to test.
- Do not use network discovery tools against external systems without authorization.
- The author assumes no liability for misuse of this software.
This project is licensed under the MIT License.