# -*- coding: utf-8 -*- import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("192.227.152.110", 22, "root", "Leaf448772566", timeout=30, allow_agent=False, look_for_keys=False) cmds = [ "dig +short ypp.smallzhiyuns.com A || getent hosts ypp.smallzhiyuns.com; echo ---; hostname -I | awk '{print $1}'", "nginx -t 2>&1; echo ---; ls /etc/nginx/sites-enabled /etc/nginx/conf.d 2>/dev/null; echo ---; ls /etc/letsencrypt/live 2>/dev/null | head", "node -v; npm -v; python3 -V; git --version", "ss -lntp | grep -E ':4015|:8014|:8092|:8020|:8333|:9333' || echo ports-free", "head -80 /etc/nginx/nginx.conf; echo '==== sites ===='; grep -RIl server_name /etc/nginx --include='*.conf' | head -30", ] for cmd in cmds: print("\n===== ", cmd[:70], " =====") _, o, e = c.exec_command(cmd, timeout=30) print((o.read() + e.read()).decode("utf-8", "replace")[-5000:]) c.close()