douyinWEB/scripts/_tmp_audit_watches.py
2026-09-13 22:10:49 -05:00

24 lines
972 B
Python

# -*- coding: utf-8 -*-
"""Read-only: what watchers exist on phys now."""
from __future__ import annotations
import sys
import paramiko
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)
pw = "4669805"
_, o, e = c.exec_command(
f"echo '{pw}' | sudo -S -p '' bash -lc "
"'systemctl list-unit-files \"douyinweb*\" \"wg-quick@*\" | sed -n \"1,40p\"; "
"echo ---; systemctl is-active douyinweb-api-watch douyinweb-wireguard-watch 2>/dev/null; "
"echo ---; systemctl cat douyinweb-wireguard-watch 2>/dev/null | sed -n \"1,60p\"; "
"echo ---; sed -n \"1,80p\" /opt/douyinWEB/scripts/linux/wireguard_watch.sh 2>/dev/null; "
"echo ---; ls -la /opt/douyinWEB/scripts/linux/'",
timeout=40,
)
print((o.read() + e.read()).decode("utf-8", "replace"))
c.close()