#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Inspect BT nginx on Tencent + add dy.nomadro.cn → 10.9.0.2.""" from __future__ import annotations import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") DOMESTIC = "82.157.112.245" USER = "ubuntu" PASS = "Xiao4669805" CN_WG = "10.9.0.2" DOMAIN = "dy.nomadro.cn" def ssh(): c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect(DOMESTIC, 22, USER, PASS, 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() print( run( d, r""" sudo systemctl disable --now caddy 2>/dev/null || true sudo killall caddy 2>/dev/null || true echo '=== nginx tree ===' ls /www/server/panel/vhost/nginx 2>/dev/null | head -40 ls /www/server/nginx/conf/vhost 2>/dev/null | head -40 ls /www/server/panel/vhost/nginx/extension 2>/dev/null | head -20 echo '=== sample site ===' ls /www/server/panel/vhost/nginx/*.conf 2>/dev/null | head -10 SAMPLE=$(ls /www/server/panel/vhost/nginx/*.conf 2>/dev/null | head -1) echo SAMPLE=$SAMPLE [ -n "$SAMPLE" ] && sudo head -80 "$SAMPLE" echo '=== ssl dirs ===' ls /www/server/panel/vhost/cert 2>/dev/null | head -20 echo '=== bt cli ===' command -v bt; ls /www/server/panel/btpython 2>/dev/null | head which certbot || true """, 60, ), flush=True, ) d.close() if __name__ == "__main__": main()