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>
42 lines
1.6 KiB
Python
42 lines
1.6 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
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)
|
|
|
|
def run(cmd, timeout=180):
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
out = (o.read() + e.read()).decode("utf-8", "replace").strip()
|
|
print(out[-8000:] if len(out) > 8000 else out, flush=True)
|
|
return out
|
|
|
|
print(run(r"""cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'
|
|
from app import db, config
|
|
from app.db import DB_PATH
|
|
import os
|
|
print('DB_PATH', DB_PATH)
|
|
print('cwd', os.getcwd())
|
|
# admin hash exists?
|
|
cfg = db.get_settings_map()
|
|
for k in sorted(cfg):
|
|
if 'pass' in k.lower() or 'admin' in k.lower() or 'user' in k.lower():
|
|
v = str(cfg.get(k))
|
|
print(k, v[:40] if 'pass' in k.lower() else v[:80])
|
|
PY"""))
|
|
|
|
# Read session auth defaults
|
|
print(run("grep -n 'ADMIN\\|password\\|DEFAULT\\|username' /opt/douyinWEB/backend/app/session_auth.py | head -40"))
|
|
print(run("grep -n 'admin\\|password' /opt/douyinWEB/backend/.env /etc/systemd/system/douyinweb-api.service 2>/dev/null | head -30"))
|
|
|
|
# Instrument: write a tiny marker from API by patching? Better: use python to create session cookie
|
|
print(run(r"""cd /opt/douyinWEB/backend && .venv/bin/python - <<'PY'
|
|
from app.session_auth import set_session_cookie, SESSION_COOKIE, sign_session, verify_admin
|
|
from starlette.responses import Response
|
|
import inspect
|
|
print('verify_admin', inspect.getsource(verify_admin)[:500])
|
|
PY"""))
|
|
c.close()
|