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

76 lines
3.1 KiB
Python

# -*- coding: utf-8 -*-
import sys, paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
MASTER=paramiko.SSHClient(); MASTER.set_missing_host_key_policy(paramiko.AutoAddPolicy())
MASTER.connect('107.172.77.34',22,'root','Xiao4669805',timeout=45,allow_agent=False,look_for_keys=False)
REMOTE=r'''
set +e
echo '=== master logs for @3 / proxy / locked ==='
docker logs --since 6h frp-panel 2>&1 | grep -iE 'pve-ubuntu@3|database is locked|push proxy|new proxy|pull.*client|rpc error' | tail -60
echo
echo '=== wal / db busy ==='
ls -lah /opt/frp-panel/
lsof /opt/frp-panel/data.db* 2>/dev/null | head -20
echo
echo '=== try clientsstatus protobuf shapes ==='
TOKEN=$(curl -sS -X POST 'http://127.0.0.1:9000/api/v1/auth/login' -H 'Content-Type: application/json' -d '{"username":"hackrobot","password":"Xiao4669805@"}' | python3 -c "import sys,json;print(json.load(sys.stdin)['body']['token'])")
python3 - <<PY
import json,urllib.request
token="""$TOKEN""".strip()
H={"Authorization":f"Bearer {token}","Content-Type":"application/json"}
ids=["hackrobot.c.pve-ubuntu@3","hackrobot.c.pve-ubuntu-nomadro@1","hackrobot.c.pve-ubuntu"]
bodies=[
{"clientIds":ids},
{"client_ids":{"values":ids}},
{"clientIds":{"values":ids}},
{"client_id":"hackrobot.c.pve-ubuntu@3"},
{"clientId":"hackrobot.c.pve-ubuntu@3"},
{"client_ids":"hackrobot.c.pve-ubuntu@3"},
]
# also list openapi if any
for path in ["/swagger/index.html","/api/v1/swagger.json","/openapi.json","/docs"]:
req=urllib.request.Request(f"http://127.0.0.1:9000{path}", headers=H)
try:
with urllib.request.urlopen(req,timeout=5) as r:
print(path, r.status, r.headers.get('content-type'), len(r.read()))
except Exception as e:
print(path, type(e).__name__)
for b in bodies:
req=urllib.request.Request('http://127.0.0.1:9000/api/v1/platform/clientsstatus', data=json.dumps(b).encode(), headers=H, method='POST')
try:
with urllib.request.urlopen(req,timeout=15) as r:
d=json.loads(r.read().decode())
print(b, '->', d.get('code'), d.get('msg'), str(d.get('body'))[:300])
except Exception as e:
print(b, 'ERR', e)
# proxy list_configs + get working status endpoints seen in UI logs
for path,body in [
("/api/v1/proxy/list_configs",{"page":1,"page_size":20,"keyword":""}),
("/api/v1/proxy/get_working_status",{}),
("/api/v1/proxy/working_status",{}),
("/api/v1/proxy/get_statuses",{}),
("/api/v1/proxy/statuses",{}),
("/api/v1/server/get_working_status",{"server_id":"hackrobot.s.vps"}),
("/api/v1/client/get_working_status",{"client_id":"hackrobot.c.pve-ubuntu@3"}),
]:
req=urllib.request.Request(f"http://127.0.0.1:9000{path}", data=json.dumps(body).encode(), headers=H, method='POST')
try:
with urllib.request.urlopen(req,timeout=20) as r:
raw=r.read().decode(); d=json.loads(raw)
print(path, '->', d.get('code'), d.get('msg'), str(d)[:500])
except Exception as e:
print(path, type(e).__name__, e)
PY
'''
_,o,e=MASTER.exec_command(REMOTE,timeout=120)
print(o.read().decode('utf-8','replace'))
err=e.read().decode('utf-8','replace')
if err.strip(): print('STDERR', err[-1000:])
MASTER.close()