Skip to main content

Module scanner

Module scanner 

Source
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() → UI

Identity 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 true if 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.