# -*- coding: utf-8 -*- """Diagnose why phys dy Neko URLs fail — no config/switch changes.""" from __future__ import annotations import json import sys import http.cookiejar import urllib.request import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") def http(url, timeout=15, method="GET", body=None, opener=None): data = None if body is None else json.dumps(body).encode() req = urllib.request.Request( url, data=data, method=method, headers={"Content-Type": "application/json", "User-Agent": "curl/8"} ) op = opener or urllib.request.build_opener() try: with op.open(req, timeout=timeout) as r: return r.status, r.read()[:200].decode("utf-8", "replace"), dict(r.headers) except Exception as ex: return getattr(ex, "code", None), str(ex)[:200], {} print("=== public neko paths ===") for path in [ "https://dy.nomadro.com/neko/1/", "https://dy.nomadro.com/neko/2/", "https://dy.nomadro.cn/neko/1/", "https://dy.nomadro.cn/ops-neko/1/", "https://dy.nomadro.com/ops-neko/1/", ]: st, body, hdr = http(path, timeout=12) print(path, st, body[:120].replace("\n", " ")) cj = http.cookiejar.CookieJar() op = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)) http("https://dy.nomadro.com/api/auth/login", method="POST", body={"username": "hackrobot", "password": "Xiao4669805@"}, opener=op) for path in [ "/api/youtube/neko/status", "/api/ops/neko/instances", "/api/youtube/assign/groups", ]: st, body, _ = http(f"https://dy.nomadro.com{path}", opener=op, timeout=40) print(path, st, body[:350].replace("\n", " ")) c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 4014, "eric", "4669805", timeout=40, allow_agent=False, look_for_keys=False) pw = "4669805" def sh(cmd, t=90): _, o, e = c.exec_command(f"echo '{pw}' | sudo -S -p '' bash -lc {repr(cmd)}", timeout=t) return (o.read() + e.read()).decode("utf-8", "replace") print("=== docker neko ===") print(sh( "docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' | grep -E 'neko|NAMES' | head -40; " "echo ---; ss -ltn | grep -E ':920|:1820|:623' | head -40; " "echo ---; systemctl is-active docker douyinweb-api nginx caddy 2>/dev/null; " "ip -br link | grep -E 'wg-dy'; " "curl -sS -m 3 -o /dev/null -w 'local9200:%{http_code}\\n' http://127.0.0.1:9200/ || true; " "curl -sS -m 3 -o /dev/null -w 'local9201:%{http_code}\\n' http://127.0.0.1:9201/ || true; " "curl -sS -m 3 -o /dev/null -w 'ops18200:%{http_code}\\n' http://127.0.0.1:18200/ || true" )) print("=== caddy/nginx neko ===") print(sh( "grep -n 'neko\\|9200\\|18200' /etc/caddy/Caddyfile 2>/dev/null | head -40; " "ls /etc/nginx/conf.d/*neko* 2>/dev/null; " "head -40 /etc/nginx/conf.d/douyinweb-neko-locations.inc 2>/dev/null; " "journalctl -u docker -n 15 --no-pager 2>/dev/null | tail -15" )) c.close() # VPS edge for dy.com print("=== VPS caddy dy neko ===") v = paramiko.SSHClient() v.set_missing_host_key_policy(paramiko.AutoAddPolicy()) v.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=40, allow_agent=False, look_for_keys=False) _, o, e = v.exec_command( "grep -nE 'neko|18014|9200|19200|18200' /etc/caddy/Caddyfile | head -50; " "ss -ltn | grep -E ':920|:1920|:1820|:18014' | head; " "systemctl is-active dy-frp-http-aux frpp 2>/dev/null; " "curl -sS -m 3 -o /dev/null -w 'vps9200:%{http_code}\\n' http://127.0.0.1:9200/ || true; " "curl -sS -m 3 -o /dev/null -w 'vps19200:%{http_code}\\n' http://127.0.0.1:19200/ || true", timeout=40, ) print((o.read() + e.read()).decode("utf-8", "replace")) v.close()