# -*- coding: utf-8 -*- """Phys Neko deep: containers, chrome, ICE, CN path — no switch changes.""" from __future__ import annotations import json import sys import http.cookiejar as cookiejar import urllib.request import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") def call(url, timeout=20, 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().decode("utf-8", "replace")[:500] except Exception as ex: return getattr(ex, "code", None), str(ex)[:200] cj = cookiejar.CookieJar() op = urllib.request.build_opener(urllib.request.HTTPCookieProcessor(cj)) print("login", call("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/peer", "/api/ops/neko/instances"]: st, body = call(f"https://dy.nomadro.com{path}", opener=op, timeout=45) print(path, st, body[:400].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=120): _, 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("=== containers ===") print(sh( "docker ps -a --format '{{.Names}}|{{.Status}}' | grep neko | sort; " "echo ---ports---; " "for i in 1 2 3 4 5 6 7 8; do " " code=$(curl -sS -m 2 -o /dev/null -w '%{http_code}' http://127.0.0.1:$((9200+i-1))/ 2>/dev/null || echo x); " " echo assign$i:$code; " "done; " "for i in 1 2; do " " code=$(curl -sS -m 2 -o /dev/null -w '%{http_code}' http://127.0.0.1:$((18200+i-1))/ 2>/dev/null || echo x); " " echo ops$i:$code; " "done" )) print("=== chrome in neko-1/3/ops-1 ===") print(sh( "for N in douyinweb-neko-1 douyinweb-neko-3 douyinweb-ops-neko-1; do " " echo ===== $N =====; " " docker inspect -f '{{.State.Status}} {{.State.Running}}' $N 2>/dev/null || echo missing; " " docker exec $N supervisorctl status 2>/dev/null | head -10 || true; " " docker exec $N sh -c 'ps aux | grep -E chrome|neko | grep -v grep | head -8' 2>/dev/null || true; " "done" )) print("=== wg/cn edge ===") print(sh( "ip -br link | grep wg; " "wg show wg-dy-cn 2>/dev/null | head -15; " "wg show wg-dy 2>/dev/null | head -10; " "ping -c1 -W2 10.9.0.1 2>&1 | tail -2; " "ping -c1 -W2 10.8.0.1 2>&1 | tail -2; " "curl -sS -m 3 http://127.0.0.1:8014/api/youtube/neko/status 2>/dev/null | head -c 400; echo" )) print("=== env nat ===") print(sh( "grep -E 'NEKO_NAT|NEKO_CN|PUBLIC_BASE|NEKO_HTTP' /etc/systemd/system/douyinweb-api.service /etc/systemd/system/douyinweb-api.service.d/* 2>/dev/null | head -30; " "docker inspect douyinweb-neko-1 --format '{{range .Config.Env}}{{println .}}{{end}}' 2>/dev/null | grep -iE 'NAT|NEKO_|SCREEN' | head -20" )) c.close() print("=== public ws-ish ===") for u in [ "https://dy.nomadro.com/neko/1/", "https://dy.nomadro.cn/neko/1/", "https://dy.nomadro.com/ops-neko/1/", ]: print(u, call(u, timeout=10)[0], call(u, timeout=10)[1][:80].replace("\n", " "))