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>
37 lines
1.8 KiB
Python
37 lines
1.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
import paramiko, sys
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
REMOTE = r'''
|
|
import sqlite3, json, subprocess
|
|
p="/opt/douyinWEB/backend/data/monitor.db"
|
|
con=sqlite3.connect(p); con.row_factory=sqlite3.Row
|
|
cookie=json.loads(con.execute("SELECT value FROM kv_settings WHERE key='dy_cookie'").fetchone()["value"])
|
|
print("cookie_repr", repr(cookie)[:80], "len", len(cookie or ""))
|
|
proxy=json.loads(con.execute("SELECT value FROM kv_settings WHERE key='http_proxy'").fetchone()["value"])
|
|
print("http_proxy", repr(proxy))
|
|
# events schema
|
|
cols=[r[1] for r in con.execute("PRAGMA table_info(events)")]
|
|
print("event_cols", cols)
|
|
ts=cols[0]
|
|
# find time col
|
|
for c in cols:
|
|
if "time" in c or c.endswith("_at") or c=="ts":
|
|
ts=c
|
|
for r in con.execute(f"SELECT * FROM events WHERE kind='risk' ORDER BY rowid DESC LIMIT 5"):
|
|
d=dict(r); d["message"]=str(d.get("message") or "")[:120]
|
|
print("risk", {k:d[k] for k in d if k in ("kind","message","room_id","anchor_name","ts","created","id") or "at" in k or k==ts})
|
|
# concurrency related keys
|
|
for k in ("max_concurrent_checks","check_concurrency","request_interval_sec","request_gap_sec"):
|
|
row=con.execute("SELECT value FROM kv_settings WHERE key=?", (k,)).fetchone()
|
|
print(k, row["value"] if row else "MISSING")
|
|
con.close()
|
|
print("--- ip ---")
|
|
print(subprocess.check_output(["curl","-sS","-m","8","https://ipinfo.io/json"], text=True)[:400])
|
|
'''
|
|
c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245",4014,"eric","4669805",timeout=45,allow_agent=False,look_for_keys=False)
|
|
sftp=c.open_sftp(); f=sftp.file("/tmp/_dy_risk2.py","w"); f.write(REMOTE); f.close(); sftp.close()
|
|
_,o,e=c.exec_command("echo '4669805' | sudo -S -p '' python3 /tmp/_dy_risk2.py", timeout=60)
|
|
print((o.read()+e.read()).decode())
|
|
c.close()
|