Expand description
Port scanning, diffing, filtering, sorting, and export.
This is the central business-logic module. The data pipeline is:
scan() → diff_entries() → sort_entries() → filter_indices() → UIIdentity key for change tracking is (local_port, pid).
Functions§
- build_
process_ tree - Build a text-based process tree for the given PID.
- diff_
entries - Compute entry diffs between the previous and current scan.
- export
- Export port entries to JSON or CSV string.
- filter_
indices - Filter entries by query, returning indices into the original slice.
Empty query returns all indices
0..len. - format_
duration - Format a duration as a human-readable short string.
- is_root
- Returns
trueif the current process is running as root (UID 0). - process_
connections - Collect all entries belonging to a given PID.
- resolve_
interface - Resolve a socket address to a human-readable interface description.
- scan
- Scan all network ports visible to the current user.
- scan_
elevated - Scan ports with cached sudo credentials (
sudo -n). Falls back to unprivileged scan if credentials are not cached. - scan_
with_ sudo - Scan ports using an explicit sudo password (
sudo -S). The password is piped to stdin; no tty required. - sort_
entries - Sort entries in-place by the given column and direction.