#!/usr/bin/env python3 """Read-only: how Caddy routes /api vs page on dy.nomadro.com.""" from __future__ import annotations import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace", line_buffering=True) c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=25, banner_timeout=40, allow_agent=False, look_for_keys=False) print("connected", flush=True) cmd = r''' grep -nE 'handle |reverse_proxy|api|4015|18014|10\.8\.0\.2:4015|10\.8\.0\.2:8014' /etc/caddy/sites/dy.nomadro.com.caddy | head -80 echo '--- probe ---' curl -sS -m 8 -o /dev/null -w 'api_cover=%{http_code}\n' -b 'dy_session=test' https://dy.nomadro.com/api/sessions/f675f45e-bfe4-482e-a1f6-16c994c25f3e/cover curl -sS -m 8 -o /dev/null -w 'douyin_covers_jpg=%{http_code}\n' https://dy.nomadro.com/douyin-covers/covers/f675f45e-bfe4-482e-a1f6-16c994c25f3e.jpg ''' _i, o, e = c.exec_command(cmd, timeout=40) while not o.channel.exit_status_ready(): if o.channel.recv_ready(): sys.stdout.write(o.channel.recv(4096).decode("utf-8", "replace")) sys.stdout.flush() time.sleep(0.1) sys.stdout.write((o.read() + e.read()).decode("utf-8", "replace")) sys.stdout.flush() c.close() print("DONE", flush=True)