#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Inspect nomadro Next.js unit + how traffic is routed.""" from __future__ import annotations import sys import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") REMOTE = r"""#!/bin/bash echo '=== unit files ===' for u in nomadro-web nomadro nomadro-api nomadro-router nomadro-live-router; do echo "---- $u ----" systemctl cat ${u}.service 2>/dev/null | head -50 || echo missing done echo '=== /var/www/nomadro.com ===' ls -la /var/www/nomadro.com | head -30 head -40 /var/www/nomadro.com/package.json test -d /var/www/nomadro.com/.next && echo has_next_build=yes echo '=== caddy host nomadro.com ===' grep -RIn --include='*.caddy' -E '^(nomadro\.com|www\.nomadro\.com)|host nomadro' /etc/caddy 2>/dev/null | head -40 grep -RIn --include='*.caddy' 'reverse_proxy.*30[0-9][0-9]|nomadro.com' /etc/caddy/sites 2>/dev/null | head -50 echo '=== nginx nomadro ===' grep -RIn 'nomadro.com' /etc/nginx 2>/dev/null | head -40 echo '=== listening ports likely next ===' ss -lntp | grep -E 'node|next|3000|3001|3010|4000|4015' || 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/_insp_nomadro_next.sh", "w") as f: f.write(REMOTE) sftp.close() _, o, e = c.exec_command("bash /tmp/_insp_nomadro_next.sh", timeout=60) print((o.read() + e.read()).decode("utf-8", "replace")) c.close() return 0 if __name__ == "__main__": raise SystemExit(main())