douyinWEB/scripts/_compare_client_server_html.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

53 lines
1.8 KiB
Python

# -*- coding: utf-8 -*-
import socket
import sys
import urllib.request
import paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
UA = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/128.0.0.0 Safari/537.36"
def check(label, url):
try:
req = urllib.request.Request(url, headers={"User-Agent": UA, "Accept": "text/html"})
with urllib.request.urlopen(req, timeout=20) as r:
h = r.read()
print(
f"{label}: status={r.status} len={len(h)} "
f"b64={b'data:text/javascript;base64' in h} "
f"ip={socket.gethostbyname('dylive.nomadro.com')}"
)
except Exception as e:
print(label, "ERR", e)
print("=== FROM WINDOWS ===")
check("win-https", "https://dylive.nomadro.com/login")
print("=== FROM SERVER ===")
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
_, o, e = c.exec_command(
"python3 - <<'PY'\n"
"import urllib.request\n"
f"UA={UA!r}\n"
"for label,url in [('srv-https','https://dylive.nomadro.com/login'),('srv-local','http://127.0.0.1:4015/login')]:\n"
" req=urllib.request.Request(url, headers={'User-Agent':UA,'Accept':'text/html'})\n"
" import ssl\n"
" ctx=ssl._create_unverified_context()\n"
" try:\n"
" with urllib.request.urlopen(req, context=ctx, timeout=20) as r:\n"
" h=r.read()\n"
" print(f'{label}: status={r.status} len={len(h)} b64={b\"data:text/javascript;base64\" in h}')\n"
" except Exception as ex:\n"
" print(label,'ERR',ex)\n"
"PY",
timeout=60,
)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()