douyinWEB/scripts/_diag_frp_vps.py
eric d409e416da Ship physical dual-edge stack, Studio CDP live metrics, and ops tooling.
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>
2026-09-04 22:42:40 -05:00

40 lines
1.3 KiB
Python

# -*- coding: utf-8 -*-
import sys, paramiko
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
HOST="107.173.30.245"
USER="root"
PASS="Xiao4669805"
REMOTE=r'''
set +e
echo '=== host ==='
hostname; uptime; free -h | head -2; df -h / | tail -1
echo
echo '=== listen frp/panel ==='
ss -lntp 2>/dev/null | grep -E ':(7000|7500|9000|9001|8999|4010|4014|4006|4016|4018|4420|4421|4422|8012)\b' || ss -lntp | head -40
echo
echo '=== docker / processes ==='
docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' 2>/dev/null | head -30
ps aux | grep -iE 'frp|frpp|frps|frpc' | grep -v grep | head -30
echo
echo '=== systemd ==='
systemctl list-units --type=service --all 2>/dev/null | grep -iE 'frp|panel' || true
ls /etc/systemd/system/*frp* /lib/systemd/system/*frp* 2>/dev/null
echo
echo '=== find frp files ==='
find /opt /root /home /usr/local /etc -maxdepth 3 -iname '*frp*' 2>/dev/null | head -40
'''
c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
try:
c.connect(HOST,22,USER,PASS,timeout=45,allow_agent=False,look_for_keys=False)
except Exception as e:
print('CONNECT FAIL', e)
raise
_,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[-1000:])
c.close()