douyinWEB/scripts/_probe_dual_edge_gaps.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-04 22:42:40 -05:00

60 lines
2.5 KiB
Python

#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""Probe dual-edge remaining gaps: cookies, neko webrtc ports, CN UDP."""
import sys
import paramiko
import httpx
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
print("=== login + cookie on .cn ===")
with httpx.Client(follow_redirects=False, timeout=25) as c:
# probe login page set-cookie behavior after fake login attempt shape
r = c.get("https://dy.nomadro.cn/login")
print("login page", r.status_code, "set-cookie", r.headers.get("set-cookie", "")[:200])
# find auth API
for path in ["/api/auth/login", "/api/login", "/api/session/login"]:
r2 = c.options(path) if False else None
r3 = c.post("https://dy.nomadro.cn/api/auth/login", json={"username": "x", "password": "y"})
print("auth try", r3.status_code, r3.text[:200], "set-cookie=", r3.headers.get("set-cookie", "")[:300])
print("\n=== neko webrtc env on physical ===")
g = paramiko.SSHClient()
g.set_missing_host_key_policy(paramiko.AutoAddPolicy())
g.connect("107.173.30.245", 4014, "eric", "4669805", timeout=45, allow_agent=False, look_for_keys=False)
_, o, e = g.exec_command(
"echo '4669805' | sudo -S -p '' bash -c '"
"grep -E \"NEKO|NAT|WEBRTC|EDGE\" /etc/douyinweb.env /etc/systemd/system/douyinweb-api.service 2>/dev/null; "
"docker ps --format \"{{.Names}} {{.Ports}}\" 2>/dev/null | grep -i neko | head; "
"ss -ulnp | grep -E \"5200|5230|9200\" | head -20'",
timeout=40,
)
print((o.read() + e.read()).decode())
g.close()
print("=== overseas DNAT sample ===")
v = paramiko.SSHClient()
v.set_missing_host_key_policy(paramiko.AutoAddPolicy())
v.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
_, o, e = v.exec_command(
"iptables -t nat -S PREROUTING 2>/dev/null | grep -E '523|520|920|10\\.(8|9)' | head -30; "
"echo ---; iptables -t nat -S | grep -E 'NEKO|neko|523' | head -20",
timeout=30,
)
print((o.read() + e.read()).decode())
v.close()
print("=== tencent UDP listen / SG hints ===")
d = paramiko.SSHClient()
d.set_missing_host_key_policy(paramiko.AutoAddPolicy())
d.connect("82.157.112.245", 22, "ubuntu", "Xiao4669805", timeout=45, allow_agent=False, look_for_keys=False)
_, o, e = d.exec_command(
"sudo ss -ulnp | head -20; "
"sudo iptables -t nat -S PREROUTING 2>/dev/null | head -20; "
"curl -sS -m 5 -o /dev/null -w 'neko1=%{http_code}\\n' http://10.9.0.2:9200/; "
"echo 'ufw:'; sudo ufw status 2>/dev/null | head -25",
timeout=30,
)
print((o.read() + e.read()).decode())
d.close()