From 2e6d88daec56b4468969688367462788827b7709 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:03:53 +0000 Subject: [PATCH 1/2] Initial plan From adad79c7e8e3e57752c5c19009f4905e068b0b82 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Tue, 14 Apr 2026 21:05:43 +0000 Subject: [PATCH 2/2] fix: parse both parts[3] and parts[4] in _get_listening_ports() for ss output Agent-Logs-Url: https://github.com/naturallaw777/staging_alpha/sessions/380a4877-aaea-47ea-8998-4c60ff6d49d2 Co-authored-by: naturallaw777 <99053422+naturallaw777@users.noreply.github.com> --- app/sovran_systemsos_web/server.py | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/sovran_systemsos_web/server.py b/app/sovran_systemsos_web/server.py index 39d010a..78efd4a 100644 --- a/app/sovran_systemsos_web/server.py +++ b/app/sovran_systemsos_web/server.py @@ -760,17 +760,21 @@ def _get_listening_ports() -> dict[str, set[int]]: capture_output=True, text=True, timeout=10, ) for line in proc.stdout.splitlines(): - # Column 4 is the local address:port (e.g. "0.0.0.0:443" or "[::]:443") + # The local address:port column varies by ss output format: + # - "0.0.0.0:PORT" style lines have extra spacing that puts the + # local address at index 4 (zero-based). + # - "*:PORT" style lines (dual-stack/wildcard, used by Caddy) + # have the local address at index 3, with the peer at index 4. + # Try both columns so neither format is silently skipped. parts = line.split() if len(parts) < 5: continue - addr = parts[4] - # strip IPv6 brackets and extract port after last ":" - port_str = addr.rsplit(":", 1)[-1] - try: - result[proto].add(int(port_str)) - except ValueError: - pass + for addr in (parts[3], parts[4]): + port_str = addr.rsplit(":", 1)[-1] + try: + result[proto].add(int(port_str)) + except ValueError: + pass except Exception: pass return result