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>
72 lines
2.6 KiB
Python
72 lines
2.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Probe neko/5 HTML, assets, WS via public + gateway + direct."""
|
|
from __future__ import annotations
|
|
|
|
import re
|
|
import sys
|
|
|
|
import httpx
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
|
|
def main():
|
|
with httpx.Client(follow_redirects=True, timeout=25) as c:
|
|
for url in [
|
|
"https://dy.nomadro.com/neko/5",
|
|
"https://dy.nomadro.com/neko/5/",
|
|
"https://dy.nomadro.com/neko/1/",
|
|
]:
|
|
r = c.get(url)
|
|
print(f"\n=== {url} ===")
|
|
print("status", r.status_code, "final", r.url, "len", len(r.content))
|
|
print("ct", r.headers.get("content-type"))
|
|
text = r.text
|
|
print("title", re.search(r"<title>([^<]*)</title>", text, re.I))
|
|
# asset refs
|
|
assets = re.findall(r'(?:src|href)=["\']([^"\']+)["\']', text)[:20]
|
|
print("assets", assets)
|
|
# try first js/css
|
|
for a in assets:
|
|
if a.startswith("http") or a.startswith("data:"):
|
|
continue
|
|
if a.startswith("/"):
|
|
# absolute from host root — often broken under /neko/N/
|
|
full = f"https://dy.nomadro.com{a}"
|
|
else:
|
|
base = str(r.url).rsplit("/", 1)[0] + "/"
|
|
full = base + a
|
|
try:
|
|
ar = c.get(full)
|
|
print(f" asset {a} -> {ar.status_code} len={len(ar.content)} via {full[:80]}")
|
|
except Exception as ex:
|
|
print(f" asset {a} ERR {ex}")
|
|
|
|
# compare gateway vs direct on guest
|
|
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)
|
|
cmd = r"""
|
|
echo '4669805' | sudo -S -p '' bash -lc '
|
|
echo --- direct 9204 ---
|
|
curl -sS -m 5 http://127.0.0.1:9204/ | head -c 500; echo
|
|
echo --- gateway ---
|
|
curl -sS -m 5 http://127.0.0.1:9199/neko/5/ | head -c 500; echo
|
|
echo --- asset sample direct ---
|
|
curl -sS -m 5 -o /dev/null -w "direct_js=%{http_code}\n" http://127.0.0.1:9204/js/index.js || true
|
|
curl -sS -m 5 http://127.0.0.1:9204/ | grep -oE "src=\"[^\"]+\"" | head
|
|
echo --- container ---
|
|
docker ps --filter name=douyinweb-neko-5 --format "{{.Names}} {{.Status}}"
|
|
docker logs douyinweb-neko-5 --tail 30 2>&1
|
|
'
|
|
"""
|
|
_, o, e = g.exec_command(cmd, timeout=60)
|
|
print("\n=== physical ===")
|
|
print((o.read() + e.read()).decode("utf-8", "replace")[-4000:])
|
|
g.close()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|