#!/usr/bin/env python3 from __future__ import annotations import paramiko HOST, USER, PASS = "10.88.0.4", "eric", "4669805" def run(cmd: str, timeout: int = 90) -> str: client = paramiko.SSHClient() client.set_missing_host_key_policy(paramiko.AutoAddPolicy()) client.connect(HOST, username=USER, password=PASS, timeout=20) _, stdout, stderr = client.exec_command(f"export LC_ALL=C.UTF-8; {cmd}", timeout=timeout) out = (stdout.read() + stderr.read()).decode("utf-8", "replace") client.close() return out.strip() def main() -> int: cmds = [ "cat /opt/live/generated/Caddyfile", "grep -R 'root\\|file_server\\|web-console' /opt/live/generated/Caddyfile /home/eric/d2ypp2-src/live-platform 2>/dev/null | head -30", "ls -la /opt/live/d2ypp/web-console/out/index.html 2>/dev/null || echo no_opt_live_out", "grep -o 'page-[a-z0-9]*\\.js' /opt/live/d2ypp/web-console/out/index.html 2>/dev/null | head -1", "grep -o 'page-[a-z0-9]*\\.js' /home/eric/d2ypp2-src/web-console/out/index.html | head -1", "readlink -f /opt/live/d2ypp 2>/dev/null || true", "systemctl cat live-console.service | head -40", ] for cmd in cmds: print(f"\n=== {cmd} ===") print(run(cmd)[:4000]) return 0 if __name__ == "__main__": raise SystemExit(main())