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>
59 lines
1.7 KiB
Python
59 lines
1.7 KiB
Python
# -*- coding: utf-8 -*-
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import time
|
|
|
|
import httpx
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
|
|
def ssh():
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 4014, "eric", "4669805", timeout=45, banner_timeout=60, allow_agent=False, look_for_keys=False)
|
|
return c
|
|
|
|
|
|
def run(c, cmd, timeout=40):
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
return (o.read() + e.read()).decode("utf-8", "replace")
|
|
|
|
|
|
g = ssh()
|
|
print(
|
|
run(
|
|
g,
|
|
"echo '4669805' | sudo -S -p '' bash -c '"
|
|
"systemctl kill -s SIGKILL douyinweb-api || true; "
|
|
"sleep 1; systemctl reset-failed douyinweb-api || true; "
|
|
"systemctl start douyinweb-api; sleep 2; systemctl is-active douyinweb-api'"
|
|
),
|
|
flush=True,
|
|
)
|
|
for i in range(8):
|
|
time.sleep(2)
|
|
code = run(g, "curl -sS -m 3 -o /dev/null -w '%{http_code}' http://127.0.0.1:8014/api/health || echo x")
|
|
print("h", code.strip(), flush=True)
|
|
if "200" in code:
|
|
break
|
|
g.close()
|
|
|
|
with httpx.Client(base_url="https://dy.nomadro.com", timeout=20.0) as client:
|
|
client.post("/api/auth/login", json={"username": "hackrobot", "password": "Xiao4669805@"})
|
|
socks = (client.get("/api/network").json() or {}).get("socks") or {}
|
|
print(
|
|
"socks profiles",
|
|
len(socks.get("profiles") or []),
|
|
"active",
|
|
repr(socks.get("active_profile_id")),
|
|
"enabled",
|
|
socks.get("enabled"),
|
|
flush=True,
|
|
)
|
|
print("neko1", client.get("/neko/1/").status_code, flush=True)
|
|
print("network_page", client.get("/network").status_code, flush=True)
|
|
print("DONE", flush=True)
|