douyinWEB/scripts/_route_nomadro_apex.py
2026-09-13 22:10:49 -05:00

43 lines
1.5 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Find how apex nomadro.com is proxied; start Next only (no WP)."""
from __future__ import annotations
import sys
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
REMOTE = r"""#!/bin/bash
set -e
echo '=== proxy config for apex ==='
grep -RIn --include='*' -E 'server_name\s+.*nomadro\.com|nomadro\.com|4403|4003|8088' /etc/nginx/sites-enabled /etc/nginx/conf.d /etc/caddy 2>/dev/null | head -80
ls -la /etc/nginx/sites-enabled/ 2>/dev/null
echo '=== router source ==='
head -80 /var/www/nomadro-router/server.mjs 2>/dev/null || true
echo '=== current status ==='
systemctl is-active nomadro.service nomadro-router.service 2>/dev/null || true
ss -lntp | grep -E ':4003|:4403|:8088' || true
curl -sS -m 8 -o /dev/null -w 'public_nomadro=%{http_code}\n' -L https://nomadro.com/ || true
curl -sS -m 8 -o /dev/null -w 'public_www=%{http_code}\n' -L https://www.nomadro.com/ || true
"""
def main() -> int:
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=40, allow_agent=False, look_for_keys=False)
sftp = c.open_sftp()
with sftp.file("/tmp/_route_nomadro.sh", "w") as f:
f.write(REMOTE)
sftp.close()
_, o, e = c.exec_command("bash /tmp/_route_nomadro.sh", timeout=60)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()
return 0
if __name__ == "__main__":
raise SystemExit(main())