# -*- coding: utf-8 -*- import paramiko c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", port=22, username="root", password="Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False) cmds = [ "ss -lntp | grep -E ':3000|:8000|:8090'", "ps aux | grep -E 'uvicorn|next|pocketbase|node' | grep -v grep", "systemctl list-units --type=service --state=running | grep -Ei 'douyin|next|uvicorn|node|pb|pocket|monitor|web' || true", "ls /etc/systemd/system/*.service 2>/dev/null | head -50", "command -v pm2; pm2 list 2>/dev/null || true", "docker ps 2>/dev/null || true", "curl -s http://127.0.0.1:8000/ | head -c 400; echo; curl -s http://127.0.0.1:8000/docs | head -c 200; echo; curl -s http://127.0.0.1:8000/openapi.json | head -c 300", "ls -la /proc/$(ss -lntp | awk '/:8000/{print}' | sed -n 's/.*pid=\\([0-9]*\\).*/\\1/p' | head -1) 2>/dev/null | head", "tr '\\0' ' ' < /proc/$(ss -lntp | python3 -c \"import sys,re; t=sys.stdin.read(); m=re.search(r':8000.*pid=(\\d+)', t); print(m.group(1) if m else '')\")/cmdline 2>/dev/null; echo", ] for cmd in cmds: print("\n====", cmd[:80], flush=True) _, o, _ = c.exec_command(cmd, timeout=60, get_pty=True) print(o.read().decode("utf-8", errors="replace")[-3000:], flush=True) c.close()