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

88 lines
3.1 KiB
Python

# -*- coding: utf-8 -*-
"""Verify default admin hackrobot / Xiao4669805@ across all server projects."""
import json
import paramiko
HOST = "107.173.30.245"
USER = "hackrobot"
PASSWORD = "Xiao4669805@"
c = paramiko.SSHClient()
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(HOST, 22, "root", "Xiao4669805", timeout=30, allow_agent=False, look_for_keys=False)
def run(cmd, timeout=120):
_, o, e = c.exec_command(cmd, timeout=timeout)
return (o.read().decode("utf-8", "replace") + e.read().decode("utf-8", "replace")).strip()
print("=== hackrobot-pb status ===")
print(run("systemctl status hackrobot-pb --no-pager -l 2>&1 | head -25"))
print(run("journalctl -u hackrobot-pb -n 15 --no-pager 2>&1"))
print(run("ls -la /opt/wauto/pocketbase/pocketbase 2>&1"))
print(run("ss -ltnp | grep 8090 || echo 'port 8090 not listening'"))
print("\n=== PB superuser upsert wauto ===")
print(
run(
f"/opt/wauto/pocketbase/pocketbase superuser upsert hackrobot@wx.nomadro.com '{PASSWORD}' "
"--dir=/opt/wauto/pocketbase/pb_data 2>&1"
)
)
print("\n=== start hackrobot-pb ===")
print(run("systemctl start hackrobot-pb; sleep 2; systemctl is-active hackrobot-pb 2>&1"))
print(run("ss -ltnp | grep 8090 || echo 'port 8090 not listening'"))
print("\n=== douyinWEB login ===")
print(
run(
"curl -s -X POST http://127.0.0.1:8014/api/auth/login "
f"-H 'Content-Type: application/json' -d '{json.dumps({'username': USER, 'password': PASSWORD})}'"
)
)
print("\n=== umami login ===")
print(
run(
"curl -s -X POST http://127.0.0.1:3000/api/auth/login "
f"-H 'Content-Type: application/json' -d '{json.dumps({'username': USER, 'password': PASSWORD})}'"
)
)
print("\n=== ntfy users ===")
print(run("docker exec ntfy-ntfy-1 ntfy user list 2>&1"))
print("\n=== env grep admin ===")
for path in [
"/opt/tiktokWEB/.env",
"/opt/xauto/.env",
"/opt/robook/.env",
"/etc/nomadro/umami.env",
"/etc/nomadro/ntfy.env",
]:
print(f"--- {path} ---")
print(run(f"grep -iE 'ADMIN|USER|PASS|PB_' {path} 2>/dev/null | grep -v '^#' || echo '(missing)'"))
print("\n=== systemd admin env douyinweb ===")
print(run("cat /etc/systemd/system/douyinweb-api.service.d/admin.conf 2>/dev/null || echo missing"))
print("\n=== PB superusers (upsert all) ===")
upserts = [
("/opt/pocketbase/pocketbase", "/opt/douyinWEB/pb/pb_data", "hackrobot@douyin.local"),
("/opt/wauto/pocketbase/pocketbase", "/opt/wauto/pocketbase/pb_data", "hackrobot@wx.nomadro.com"),
("/opt/tiktokWEB/pocketbase/pocketbase", "/opt/tiktokWEB/pocketbase/pb_data", "hackrobot@nomadro.live"),
("/opt/xauto/pocketbase/pocketbase", "/opt/xauto/pocketbase/pb_data", "hackrobot@xauto.local"),
("/opt/robook/pocketbase/pocketbase", "/opt/robook/pocketbase/pb_data", "hackrobot@book.nomadro.com"),
("/opt/pocketbase/pocketbase", "/opt/pocketbase/pb_data", "hackrobot@nomadro.com"),
]
for bin_path, data_dir, email in upserts:
out = run(
f"test -x {bin_path} && {bin_path} superuser upsert {email} '{PASSWORD}' --dir={data_dir} 2>&1 || echo SKIP"
)
print(f" {email}: {out.splitlines()[-1] if out else 'ok'}")
c.close()
print("\nDONE")