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

58 lines
2.0 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
import sys
import paramiko
import httpx
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
def main() -> None:
print("=== public probes ===")
with httpx.Client(timeout=20, follow_redirects=False) as c:
for u in [
"https://dylive.nomadro.com/neko/7",
"https://dylive.nomadro.com/neko/7/",
"https://dylive.nomadro.com/neko/1/",
"https://dylive.nomadro.com/neko/8/",
]:
try:
r = c.get(u)
loc = r.headers.get("location", "")
ct = r.headers.get("content-type", "")[:40]
print(f"{u} -> {r.status_code} loc={loc} ct={ct} body={r.text[:80]!r}")
except Exception as e:
print(u, "ERR", e)
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)
remote = r"""
echo '=== caddy sites mentioning neko ==='
grep -nR 'neko' /etc/caddy/sites/ 2>/dev/null | head -80
echo '=== dylive site file ==='
ls /etc/caddy/sites/ | head
for f in /etc/caddy/sites/*dylive* /etc/caddy/sites/*nomadro*; do
[ -f "$f" ] || continue
echo "---- $f ----"
grep -nE 'neko|920|handle' "$f" | head -60
done
echo '=== local ports ==='
ss -lntp | grep -E ':920[0-9]|:9199' || true
echo '=== docker neko 7 ==='
docker ps --format '{{.Names}} {{.Status}} {{.Ports}}' | grep -E 'neko-7|neko-8|neko-1' || true
curl -sS -m 4 -o /dev/null -w 'loop9206=%{http_code}\n' http://127.0.0.1:9206/ || true
curl -sS -m 4 -o /dev/null -w 'loop9200=%{http_code}\n' http://127.0.0.1:9200/ || true
"""
sftp = c.open_sftp()
with sftp.file("/tmp/_diag_neko7_404.sh", "wb") as f:
f.write(remote.encode())
sftp.close()
_i, o, e = c.exec_command("bash /tmp/_diag_neko7_404.sh", timeout=60)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()
if __name__ == "__main__":
main()