TCP/UDP, IPv4/IPv6, local and remote endpoints, connection states, sortable ports, and status counters.
PORTWATCH
Know what your machine is talking to. Inspect live TCP and UDP connections, investigate remote endpoints, and export the evidence that matters.
Linux · Python 3.10+ · PySide6 · IPv4 + IPv6 · Download filename: PortWatch_latest.zip
OBSERVE · INVESTIGATE · DOCUMENT
Network visibility without the noise.
A focused desktop interface for understanding the sockets your Linux system exposes, with tools one right-click away.
Asynchronous reverse DNS and best-effort service identification, with caching to keep the interface responsive.
Ping, Tracert, Whois, Finger, and Dig via installed Linux command-line tools, with output and exit status.
Inspect socket details, visible process owners, interface counters, and optional tcpdump traffic.
Save selected-connection snapshots as JSON or styled HTML, and preserve diagnostic output as text.
Purpose-built Diagnostic and Analysis Driven Intelligence in One Simple Application.
From connection to context.
Observe
Watch the live socket table and identify endpoints, ports, and connection states.
Investigate
Right-click a connection to launch supported diagnostics, monitor details, or analyze its snapshot.
Document
Save diagnostic text, JSON details, or a shareable HTML report for later review.
Put your connections in view.
Download the latest PortWatch archive for Linux. Consult the installation and dependency instructions below before running.
Full documentation
Live TCP/UDP Connection Monitor for Linux
DarkMatter Software | K0NxT3D
PortWatch is a graphical Linux network-connection monitor built with Python and PySide6. It reads the kernel's socket tables, displays active TCP and UDP endpoints, resolves remote hostnames asynchronously, and offers per-connection diagnostics, monitoring, and exports. Its embedded red-and-gold eye icon is rendered at runtime, so no separate image asset is required for the application window.
Scope: PortWatch reports sockets visible through
/proc/net. It is not a network intrusion detection system, a complete packet recorder, or a guarantee that every network flow will be observed. This README describes the suppliedPortWatch.pysource, not independently verified behavior on every Linux distribution.
1. Requirements
- Linux with
/proc/net/tcp,/proc/net/tcp6,/proc/net/udp, and/proc/net/udp6. - Python 3.10 or newer.
- PySide6 6.x, including Qt SVG support (
PySide6.QtSvg). - A graphical desktop session capable of running Qt applications.
Optional external command-line utilities enable the corresponding right-click actions:
| Feature | Linux executable | Notes |
|---|---|---|
| Ping | ping |
Sends four ICMP echo requests with a two-second response timeout per request. |
| Tracert | tracepath, or fallback traceroute |
Displays route information where supported. |
| Whois | whois |
Queries registration information for the selected remote address. |
| Finger | finger |
Runs finger @<remote-address>; most modern hosts do not expose Finger service. |
| Dig | dig |
Runs a reverse DNS query (dig -x). |
| Live packet capture | tcpdump |
May require elevated privileges or capture capabilities. |
| Firewall block | pkexec and iptables or ip6tables |
Requires administrator authorization and compatible firewall configuration. |
Ubuntu/Debian example:
sudo apt update
sudo apt install python3-venv iputils-ping traceroute iputils-tracepath whois finger dnsutils tcpdump policykit-1 iptables
python3 -m venv ENV
./ENV/bin/python -m pip install --upgrade pip
./ENV/bin/python -m pip install 'PySide6>=6,<7'
Package names and availability may vary by distribution or release. Install only the optional utilities you need. tracepath is commonly provided by iputils-tracepath; dig is commonly provided by dnsutils.
2. Start PortWatch
From the directory containing PortWatch.py:
./ENV/bin/python PortWatch.py
Or, if PySide6 is installed for the selected interpreter:
python3 PortWatch.py
The application refreshes its connection snapshot every 1,000 ms (one second).
Running with elevated privileges
Normal-user operation is sufficient for many monitoring tasks. However, process ownership information and packet capture may be incomplete without additional permissions. Avoid running the entire graphical application as root unless necessary and understood. The Block action uses pkexec to request authorization separately; running PortWatch under sudo does not guarantee that a graphical authorization agent or all optional tools will work.
3. Main window
The main table contains nine columns:
| Column | Meaning |
|---|---|
| Protocol | TCP or UDP. |
| Family | IPv4 or IPv6. |
| Local Address | IP address bound to the local socket. |
| Local Port | Local socket port, sorted numerically. |
| Service | Best-effort service name inferred from known port mappings. |
| Remote Address | Peer IP address, if applicable. |
| Remote Port | Peer port, if applicable. |
| Remote Host | Cached reverse DNS hostname or numeric address. |
| State | Human-readable kernel TCP/UDP socket state. |
A dash (—) indicates an endpoint or service value that is not applicable or unavailable. A listening socket may show no remote peer. Service names are inferred from port numbers and do not prove which application protocol is actually being used.
Connection state colors
- Green: established TCP connection.
- Gold: TCP listening socket.
- Blue: TCP connection setup states.
- Red: TCP closing/closed-related states.
- Steel blue: UDP state.
- Gray: other or unrecognized states.
The status bar displays total sockets, TCP sockets, UDP sockets, established connections, listening sockets, and DNS cache entries. The table supports sorting, including numeric sorting for ports.
4. Right-click connection tools
Select a connection row, then right-click to open the diagnostics menu. Actions use the selected row's remote IP address. Commands are launched as child processes without shell interpolation. Diagnostic windows have Run again, Save output, and Close controls, except that Monitor uses Refresh now.
Ping
Runs ping -n -c 4 -W 2 <remote-IP>. It tests ICMP echo responsiveness. Failure does not necessarily mean the host is offline; ICMP may be blocked or rate-limited.
Tracert
Uses tracepath <remote-IP> when available; otherwise attempts traceroute -n -m 20 -w 1 <remote-IP>. This is the Linux equivalent of a traceroute-style diagnostic. Intermediate hops may not respond.
Whois
Runs whois <remote-IP> to request registry information. Results depend on registry data, network access, and the installed utility.
Finger
Runs finger @<remote-IP>. Finger is a legacy protocol, and most systems do not run a publicly accessible Finger server. An unsuccessful result is expected for many hosts.
Dig
Runs dig -x <remote-IP> to query reverse DNS records. Absence of a PTR record does not imply a connection is malicious.
Block
After confirmation, attempts to insert an outbound firewall DROP rule for the selected IP address using pkexec and iptables (IPv4) or ip6tables (IPv6):
iptables -I OUTPUT -d <IPv4-address> -j DROP
# or
ip6tables -I OUTPUT -d <IPv6-address> -j DROP
Important: This is a system-wide firewall change, not a per-process block. It affects outbound traffic to the address, may disrupt legitimate applications, and is not automatically undone when PortWatch closes. The current source does not provide an unblock action, persistent rule management, or a firewall rollback workflow. Review your system firewall before using it.
Monitor
Opens a live detail view, updated every two seconds, showing:
- Selected socket endpoints and whether the original socket is still present.
- Visible processes that hold the socket inode.
- System interface-wide receive/transmit byte and packet counters.
- A narrowly filtered
tcpdumpcapture, when available and permitted.
The capture filter uses the selected remote host and remote port. Interface counters are not per-connection traffic statistics. Packet capture is best-effort and can show no packets even while the selected socket exists.
Analyze
Collects a snapshot containing socket metadata, inferred service, visible owning processes, interface counters, a capture timestamp, and best-effort reverse DNS. Displays the data as JSON and offers an HTML report save dialog.
Save
Saves a connection-detail snapshot as a .json file.
Export
Saves a connection-detail snapshot as a styled .html report.
5. DNS behavior
PortWatch resolves remote IP addresses on background worker threads to avoid blocking the main window during reverse lookups. It uses up to six DNS worker threads and caches results for 600 seconds (ten minutes). Loopback addresses are shown as localhost; unspecified and certain broadcast/multicast addresses are not queried. Reverse DNS names are informative labels, not authenticated identities.
6. Reports and saved data
JSON Save and HTML Export are snapshots for a selected connection, not exports of the entire historical network activity. They can include:
- Protocol, address family, endpoints, state, and socket inode.
- Timestamp and inferred service.
- Reverse DNS result, if available.
- Visible process IDs, process names, and command lines.
- Interface-wide network counters.
Diagnostic output can be saved as plain text from its tool dialog. HTML reports use a dark presentation with crimson and gold accents. Files are written to the location selected in the save dialog; there is no automatic report archive or scheduled export in the supplied source.
Privacy: Process command lines, IP addresses, and connection metadata can be sensitive. Review reports before sharing or publishing them.
7. How PortWatch works
- Reads
/proc/net/tcp,tcp6,udp, andudp6. - Decodes kernel hexadecimal IPv4/IPv6 addresses and port numbers.
- Maps kernel socket-state codes to readable labels.
- Determines a best-effort service name from the local or remote port.
- Updates the Qt table when the connection snapshot changes.
- Queues eligible remote addresses for asynchronous reverse DNS resolution.
- Displays status counts and optional per-connection diagnostic results.
PortWatch reads kernel-provided socket information; it does not intercept every packet merely by displaying the connection table. Short-lived connections may appear and disappear between one-second polling intervals.
8. Troubleshooting
The window does not open: Verify Python and PySide6 installation, Qt SVG availability, and a functioning graphical desktop session.
A diagnostic reports that a command is missing: Install the named utility. For example, Ping requires ping; Dig requires dig.
Ping, Tracert, Finger, or Whois fails: Read the command's displayed output and exit status. The target may reject probes, the service may not exist, or the network may block the request. A command launching successfully does not guarantee a successful network response.
Process owner is not visible: The socket may have closed, its inode may no longer be available, or /proc/<pid>/fd access may be restricted.
Packet capture shows nothing: Install tcpdump, check capture privileges, and ensure matching traffic is actually occurring while the Monitor dialog is open.
Blocking fails: Confirm pkexec, a graphical polkit authorization agent, and the appropriate iptables/ip6tables utility are available. Firewall backends and policy may differ by distribution.
Hostname stays numeric: The remote IP may not have reverse DNS, the lookup may fail, or the result may be cached.
The taskbar icon differs from the window icon: Desktop environments and .desktop launchers may require an installed icon and matching launcher metadata. The runtime-generated SVG icon does not automatically install a launcher icon.
9. Building a standalone Linux executable
The following is an example PyInstaller build workflow, not a bundled or validated build.sh from the supplied source:
./ENV/bin/python -m pip install pyinstaller
./ENV/bin/python -m PyInstaller \
--noconfirm --clean --onedir --windowed \
--name PortWatch \
PortWatch.py
The resulting executable is typically located at dist/PortWatch/PortWatch. Optional system diagnostics (ping, tracepath, whois, tcpdump, etc.) remain external operating-system dependencies and are not bundled by this command. Test the executable on the target desktop environment before distributing it.
10. Current limitations
- Linux-only
/procsocket-table backend. - Polling-based snapshots, not complete historical connection capture.
- No built-in connection history database or alert engine.
- No built-in installation of diagnostic utilities.
- No automatic unblock/undo for firewall rules inserted by Block.
- No per-socket packet/byte counters from the displayed interface totals.
- Reverse DNS and port-based service labels are best-effort.
- Process visibility and packet capture depend on operating-system permissions.
- Network diagnostics depend on external utilities and remote network behavior.
11. Project information
Application: PortWatch
Description: Live TCP/UDP Connection Monitor
Developer/Brand: DarkMatter Software | K0NxT3D
Platform: Linux
Language: Python 3
GUI: PySide6 / Qt
Icon: Embedded SVG, generated at runtime
Version and license: The supplied source does not declare an application version number or a software license. Do not assume permission terms from this README; add a project license and version identifier before public release.
PortWatch provides visibility and diagnostic tools for understanding Linux network connections. Interpret its findings alongside system logs, firewall configuration, and other network evidence rather than treating any single diagnostic result as conclusive.