A lightweight, cross-platform Python tool to monitor active TCP/UDP connections.
It displays process names, local and remote addresses, and connection status in a neat table — while also logging detailed events to a file for auditing.
- Lists all active TCP and UDP connections.
- Shows process names, local/remote IPs and ports, and statuses.
- Generates detailed logs (INFO, DEBUG, CRITICAL, etc.).
- Detects inaccessible processes and handles exceptions gracefully.
- Outputs results in a PrettyTable for easy reading.
- Works on Windows, Linux, and macOS.
- Uses the
psutilmodule to read system network connections. - For each connection, it retrieves:
- Protocol (
TCP/UDP) - Local and Remote address pairs
- Process name and PID (if accessible)
- Connection status (LISTEN, ESTABLISHED, etc.)
- Protocol (
- Logs all operations to both the console and a file (
network_log.log). - Displays the formatted output table using
PrettyTable.
git clone https://github.com/PanthPtl2005/open-Port-Scanner.git
cd open-Port-Scannerpython -m venv venv
source venv/bin/activate # Linux/macOS
venv\Scripts\activate # Windowspip install -r requirements.txtpython open-port-viewer.pysudo python open-port-viewer.py+-------+----------------+-------------------+-------------------+-------------+------+
| Proto | Process Name | Local Address | Remote Address | Status | PID |
+-------+----------------+-------------------+-------------------+-------------+------+
| TCP | chrome.exe | 192.168.1.10:52345| 142.250.190.4:443 | ESTABLISHED | 4820 |
| UDP | svchost.exe | 0.0.0.0:68 | | NONE | 1092 |
| TCP | python.exe | 127.0.0.1:8000 | 127.0.0.1:52544 | LISTEN | 7180 |
+-------+----------------+-------------------+-------------------+-------------+------+| Level | Meaning | Output |
|---|---|---|
| INFO | General status updates | Console + Log file |
| DEBUG | Detailed debug info | Log file only |
| WARNING | Non-critical errors | Console + Log file |
| CRITICAL | Serious errors / exit | Console + Log file |
network_log.logThis project is for educational and local network monitoring purposes only. Do not use it to inspect, track, or analyze connections without proper authorization.
Panth Patel - GitHub
💬 Contributions, bug reports, and improvements are welcome!