# -*- coding: utf-8 -*- from __future__ import annotations import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") 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, t=90): _, o, e = c.exec_command(cmd, timeout=t) return (o.read() + e.read()).decode("utf-8", "replace") g = ssh("107.173.30.245", 4014, "eric", "4669805") print( run( g, r""" echo '4669805' | sudo -S -p '' bash -lc ' echo === neko snippet files === ls -la /etc/nginx/conf.d/*neko* 2>/dev/null || echo none ls -la /opt/douyinWEB/backend/data/neko/caddy-neko.snippet 2>/dev/null || true wc -l /etc/nginx/conf.d/douyinweb-neko-locations.inc 2>/dev/null || true head -40 /etc/nginx/conf.d/douyinweb-neko-locations.inc 2>/dev/null || true echo === nginx listen === ss -lntp | grep nginx | head echo === conf.d === ls /etc/nginx/conf.d/ 2>/dev/null grep -R "neko\|include.*neko\|listen" /etc/nginx/conf.d/ 2>/dev/null | head -50 echo === MAX groups === python3 - <