Capture Neko/WG/network hubs, Studio viewer charts, physical deploy docs, and one-shot scripts so VPS vs physical can be toggled later without losing WIP. Co-authored-by: Cursor <cursoragent@cursor.com>
51 lines
1.5 KiB
Python
51 lines
1.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
HOST = "107.172.77.34"
|
|
USER = "root"
|
|
PASS = "Xiao4669805"
|
|
|
|
REMOTE = r"""
|
|
set +e
|
|
echo '=== host ==='
|
|
hostname; uname -a; uptime; date
|
|
echo
|
|
echo '=== listening ports (9000/frp) ==='
|
|
ss -lntp 2>/dev/null | grep -E ':(9000|7000|7500|8080|443|80|frp)|frp|panel' || ss -lntp 2>/dev/null | head -40
|
|
echo
|
|
echo '=== docker ==='
|
|
docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' 2>/dev/null | head -40
|
|
echo
|
|
echo '=== systemd frp/panel ==='
|
|
systemctl list-units --type=service --all 2>/dev/null | grep -iE 'frp|panel' || true
|
|
ls /etc/systemd/system/*frp* /etc/systemd/system/*panel* 2>/dev/null
|
|
echo
|
|
echo '=== processes ==='
|
|
ps aux 2>/dev/null | grep -iE 'frp|panel' | grep -v grep | head -30
|
|
echo
|
|
echo '=== disk/mem ==='
|
|
df -h / 2>/dev/null | tail -1
|
|
free -h 2>/dev/null | head -2
|
|
echo
|
|
echo '=== recent journal (frp/panel) ==='
|
|
journalctl -u 'frp*' -u '*panel*' --no-pager -n 40 2>/dev/null | tail -40
|
|
echo
|
|
echo '=== find install dirs ==='
|
|
ls -la /opt 2>/dev/null | head -30
|
|
ls -la /root 2>/dev/null | head -20
|
|
find /opt /root /home /usr/local -maxdepth 3 -iname '*frp*' 2>/dev/null | head -40
|
|
"""
|
|
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(HOST, 22, USER, PASS, timeout=45, allow_agent=False, look_for_keys=False)
|
|
_, o, e = c.exec_command(REMOTE, timeout=90)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace")
|
|
if err.strip():
|
|
print("STDERR:", err[-2000:])
|
|
c.close()
|