# -*- coding: utf-8 -*- import paramiko c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False) cmds = [ "ps aux | grep -i caddy | grep -v grep", "ls -la /etc/caddy /opt/caddy ~/Caddyfile /Caddyfile 2>/dev/null; find /etc /opt /root /home -maxdepth 3 -name 'Caddyfile*' 2>/dev/null | head", "systemctl cat caddy 2>/dev/null | head -40", "caddy version 2>/dev/null; which caddy", ] for cmd in cmds: print("====", cmd[:70], flush=True) _, o, _ = c.exec_command(cmd, timeout=30, get_pty=True) print(o.read().decode()[-2000:], flush=True) c.close()