#!/usr/bin/env python3 import paramiko, sys sys.stdout.reconfigure(encoding="utf-8", errors="replace") client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect("107.173.30.245", username="root", password="Xiao4669805", timeout=20) cmds = [ "cd /var/www/ebook && git log -1 --oneline", "test -f /var/www/ebook/.next/standalone/server.js && echo HAS_STANDALONE", "ls /var/www/ebook/.next/standalone/src/app/api/pay 2>/dev/null || ls /var/www/ebook/.next/standalone/.next/server/app/api/pay 2>/dev/null || echo NO_PAY_ROUTE", "grep -n NOWPAYMENTS /proc/$(pgrep -n -f 'next-server' | head -1)/environ 2>/dev/null | tr '\\0' '\\n' | grep NOWPAY || pm2 prettylist | grep -i nowpay | head", "curl -s -o /dev/null -w 'local_post:%{http_code}\n' -H 'Content-Type: application/json' -d '{\"amount\":5}' http://127.0.0.1:3000/api/pay/invoice", "curl -s -m 35 -H 'Content-Type: application/json' -d '{\"amount\":5}' http://127.0.0.1:3000/api/pay/invoice | head -c 400", "echo", "cat /etc/caddy/sites/book.nomadro.com.caddy", ] for c in cmds: print("===", c) _, stdout, stderr = client.exec_command(c, timeout=45) print(stdout.read().decode("utf-8", errors="replace") or stderr.read().decode("utf-8", errors="replace")) client.close()