#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Diagnose and fix dy.nomadro.cn edge on Tencent (443 conflict).""" from __future__ import annotations import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") DOMESTIC = "82.157.112.245" DOMESTIC_USER = "ubuntu" DOMESTIC_PASS = "Xiao4669805" CN_WG = "10.9.0.2" def ssh(h, p, u, pw): c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect(h, p, u, pw, timeout=45, allow_agent=False, look_for_keys=False) return c def run(c, cmd, timeout=120): _, o, e = c.exec_command(cmd, timeout=timeout) return (o.read() + e.read()).decode("utf-8", "replace") def main(): d = ssh(DOMESTIC, 22, DOMESTIC_USER, DOMESTIC_PASS) print("=== who owns 80/443 ===", flush=True) print( run( d, r""" sudo ss -lntp | grep -E ':80|:443' || true echo '--- processes ---' sudo lsof -iTCP:443 -sTCP:LISTEN 2>/dev/null || true sudo lsof -iTCP:80 -sTCP:LISTEN 2>/dev/null || true echo '--- docker ---' docker ps --format 'table {{.Names}}\t{{.Ports}}\t{{.Image}}' 2>/dev/null | head -30 echo '--- nginx? ---' command -v nginx; systemctl is-active nginx 2>/dev/null; ls /etc/nginx/sites-enabled 2>/dev/null; ls /etc/nginx/conf.d 2>/dev/null echo '--- traefik/caddy other ---' ps aux | grep -Ei 'nginx|caddy|traefik|haproxy|apache' | grep -v grep echo '--- certs / sites ---' ls /etc/caddy/sites/ 2>/dev/null; cat /etc/caddy/Caddyfile 2>/dev/null ls /etc/nginx 2>/dev/null | head """, 60, ), flush=True, ) d.close() if __name__ == "__main__": main()