# -*- 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(port=4014, user="eric", password="4669805"): c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", port, user, password, 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 restart douyinweb-web; sleep 3; systemctl is-active douyinweb-web douyinweb-api'"), flush=True) g.close() time.sleep(2) with httpx.Client(base_url="https://dy.nomadro.com", timeout=25.0, follow_redirects=False) as client: print("page", client.get("/network").status_code, flush=True) r = client.post("/api/auth/login", json={"username": "hackrobot", "password": "Xiao4669805@"}) print("login", r.status_code, flush=True) j = client.get("/api/network").json() wg = j.get("wireguard") or {} sc = j.get("shellcrash") or {} print("wg", wg.get("active"), wg.get("primary", {}).get("name"), "peers", len((wg.get("primary") or {}).get("peers") or []), flush=True) print("sc", sc.get("running"), sc.get("unit"), sc.get("mixed_port"), sc.get("available"), flush=True) # overlay dry-run save only (no apply — keep existing wg-dy) sample = """[Interface] PrivateKey = YAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAEE= Address = 10.8.0.9/24 [Peer] PublicKey = YBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBBEEE= Endpoint = 1.2.3.4:51820 AllowedIPs = 0.0.0.0/0 """ save = client.post( "/api/network/wireguard/save", json={"name": "wg-test-overlay", "content": sample, "route_mode": "overlay", "apply": False}, ) print("overlay_save", save.status_code, flush=True) if save.status_code == 200: w = (save.json().get("wireguard") or {}) print("overlay_allowed", (w.get("overlay") or {}).get("allowed_ips"), flush=True) print("redacted_has_key", "PrivateKey = ***REDACTED***" in (w.get("redacted_config") or ""), flush=True) v = ssh(22, "root", "Xiao4669805") print(run(v, "curl -sS -m 8 -o /dev/null -w 'dylive:%{http_code}\\n' https://dylive.nomadro.com/api/health"), flush=True) v.close()