34 lines
1.3 KiB
Python
34 lines
1.3 KiB
Python
#!/usr/bin/env python3
|
|
"""Read-only: inspect /covers and /douyin-covers caddy blocks. No edits."""
|
|
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'''
|
|
sed -n '20,45p;500,520p' /etc/caddy/sites/dy.nomadro.com.caddy
|
|
echo '---'
|
|
# probe a known path pattern if any object exists via public
|
|
curl -sS -m 8 -o /dev/null -w 'douyin_covers_root=%{http_code}\n' https://dy.nomadro.com/douyin-covers/
|
|
curl -sS -m 8 -o /dev/null -w 'covers_root=%{http_code}\n' https://dy.nomadro.com/covers/
|
|
curl -sS -m 5 -o /dev/null -w 'via_wg_8333=%{http_code}\n' http://10.8.0.2:8333/ || true
|
|
'''
|
|
_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)
|