33 lines
1.1 KiB
Python
33 lines
1.1 KiB
Python
#!/usr/bin/env python3
|
|
import paramiko
|
|
|
|
HOSTS = [
|
|
("10.88.0.3", "Xiao4669805"),
|
|
("10.88.0.4", "4669805"),
|
|
("10.88.0.5", "4669805"),
|
|
]
|
|
|
|
CMDS = [
|
|
"ss -tlnp | grep -E '7890|7894|7891' || true",
|
|
"curl -sS -m 8 -x socks5://127.0.0.1:7890 https://www.gstatic.com/generate_204 -w 'gstatic_socks=%{http_code} t=%{time_total}\n' -o /dev/null",
|
|
"curl -sS -m 12 -x socks5://127.0.0.1:7890 https://a.rtmps.youtube.com/ -w 'yt_socks=%{http_code} t=%{time_total}\n' -o /dev/null",
|
|
"pgrep -cf 'ffmpeg.*rtmps'; pgrep -cf neko; free -h | grep -E 'Mem|Swap'",
|
|
]
|
|
|
|
|
|
def q(host: str, pw: str, cmd: str) -> str:
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(host, username="eric", password=pw, timeout=15)
|
|
_, o, e = c.exec_command(cmd, timeout=45, get_pty=True)
|
|
out = (o.read() + e.read()).decode("utf-8", "replace")
|
|
c.close()
|
|
return out
|
|
|
|
|
|
for host, pw in HOSTS:
|
|
print(f"\nHOST {host}")
|
|
for cmd in CMDS:
|
|
print(f" > {cmd}")
|
|
print(q(host, pw, cmd).encode("ascii", "backslashreplace").decode()[:900])
|