other
- Location
scripts/list_listeners.py:12- Finding
Unfiltered Local Listener Inventory Is Submitted to a Third-Party Service
- Content
View full analysis
list: proc = run(['ss', '-lntpH']) if proc.returncode != 0: raise RuntimeError(proc.stderr.strip() or 'ss failed') listeners = [] for line in proc.stdout.splitlines(): parts = line.split() if len(parts) < 4: continue local = parts[3] proc_info = parts[-1] if parts else '' ip, port = split_host_port(local) listeners.append({ 'proto': 'tcp', 'ip': ip, 'port': int(port) if str(port).isdigit() else port, 'process_name': extract_process_name(proc_info), 'pid': extract_pid(proc_info), }) return listeners def parse_lsof() -> list: proc = run(['lsof', '-nP', '-iTCP', '-sTCP:LISTEN']) if proc.returncode != 0: raise RuntimeError(proc.stderr.strip() or 'lsof failed') lines = proc.stdout.splitlines() if not lines: return [] listeners = [] for line in lines[1:]: parts = line.split() if len(parts) < 9: continue name = parts[0] pid = int(parts[1]) if parts[1].isdigit() else None endpoint = parts[-2] if '(LISTEN)' in parts[-1] else parts[-1] ip, port = split_lsof_endpoint(endpoint) listeners.append({ 'proto': 'tcp', 'ip': ip, 'port': int(port) if str(port).isdigit() else port, 'process_name': name, 'pid': pid, }) return listeners ``` The Skill directs the agent to collect and submit this data: ```markdown #### For `port-check` Collect listening TCP sockets and process names with `{baseDir}/scripts/lis ...[truncated 3265 chars]- Remediation
View remediation
