#!/usr/bin/env python3 import paramiko import sys sys.stdout.reconfigure(encoding="utf-8", errors="replace") c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) c.connect("107.173.30.245", 4014, "eric", "4669805", timeout=40, allow_agent=False, look_for_keys=False) _i, o, e = c.exec_command( "echo '4669805' | sudo -S -p '' bash -lc '" "curl -sS -m 8 -b /tmp/cj -c /tmp/cj -X POST http://127.0.0.1:8014/api/auth/login " " -H \"Content-Type: application/json\" " " -d \"{\\\"username\\\":\\\"hackrobot\\\",\\\"password\\\":\\\"Xiao4669805@\\\"}\" >/dev/null; " "curl -sS -m 8 -b /tmp/cj http://127.0.0.1:8014/api/ops/neko | " " python3 -c \"import sys,json; d=json.load(sys.stdin); " "print(\\\"peer\\\", d.get(\\\"peer\\\",{}).get(\\\"effective_public_base\\\"), d.get(\\\"peer\\\",{}).get(\\\"cn_edge_usable\\\")); " "inst=(d.get(\\\"instances\\\") or [{}])[0]; print(\\\"open_url\\\", inst.get(\\\"open_url\\\")); " "print(\\\"running\\\", inst.get(\\\"running\\\"))\"" "'", timeout=40, ) print((o.read() + e.read()).decode("utf-8", "replace")) c.close()