33 lines
1.2 KiB
Python
33 lines
1.2 KiB
Python
#!/usr/bin/env python3
|
|
"""Confirm sing-box / frpp / wg stay active on VPS. Live flush."""
|
|
from __future__ import annotations
|
|
|
|
import sys
|
|
import time
|
|
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace", line_buffering=True)
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("107.173.30.245", 22, "root", "Xiao4669805", timeout=25, banner_timeout=40, allow_agent=False, look_for_keys=False)
|
|
print("connected", flush=True)
|
|
cmd = (
|
|
"systemctl is-active sing-box frpp 'wg-quick@wg-dy' 'wg-quick@wg-dy-cn' 2>/dev/null; "
|
|
"systemctl is-enabled sing-box frpp 'wg-quick@wg-dy' 'wg-quick@wg-dy-cn' 2>/dev/null; "
|
|
"ss -lntp | grep -E ':(4014|7000|8999)\\b' || true; "
|
|
"wg show interfaces 2>/dev/null; "
|
|
"systemctl show -p ActiveState --value sing-box frpp"
|
|
)
|
|
_i, o, e = c.exec_command(cmd, timeout=40)
|
|
while not o.channel.exit_status_ready():
|
|
if o.channel.recv_ready():
|
|
sys.stdout.write(o.channel.recv(4096).decode("utf-8", "replace"))
|
|
sys.stdout.flush()
|
|
time.sleep(0.1)
|
|
sys.stdout.write((o.read() + e.read()).decode("utf-8", "replace"))
|
|
sys.stdout.flush()
|
|
c.close()
|
|
print("DONE", flush=True)
|