# -*- coding: utf-8 -*- """Audit admin credential config on server self-deployed projects.""" import paramiko HOST = "107.173.30.245" 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: str, timeout: int = 120) -> str: _, o, e = c.exec_command(cmd, timeout=timeout) out = o.read().decode("utf-8", "replace").strip() err = e.read().decode("utf-8", "replace").strip() return (out + ("\n" + err if err else "")).strip() cmds = [ "systemctl list-units --type=service --state=running | grep -E 'nomadro|douyin|tiktok|hackrobot|xauto|umami|ntfy|pocket|pb' || true", "ls -la /opt 2>/dev/null | head -40", "ls -la /etc/nomadro 2>/dev/null", "for f in /etc/nomadro/*.env /opt/*/.env /opt/*/*/.env; do [ -f \"$f\" ] && echo '=== '$f' ===' && grep -iE 'admin|user|pass|auth' \"$f\" 2>/dev/null | grep -viE 'oauth|client_secret|token|smtp|postgres|redis|mysql|database' | head -20; done", "grep -rniE 'ADMIN_USER|ADMIN_PASS|admin_password|hackrobot|DouyinMonitor' /etc/systemd/system/*.service 2>/dev/null | head -40", "docker ps --format '{{.Names}}' 2>/dev/null | head -30", ] for cmd in cmds: print("\n" + "=" * 72) print(cmd[:120]) print("-" * 72) print(run(cmd)) c.close()