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>
70 lines
2.8 KiB
Python
70 lines
2.8 KiB
Python
# -*- coding: utf-8 -*-
|
|
import sys, paramiko
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
# Check VPS frp-panel logs + Master DB proxy configs for @3
|
|
MASTER=paramiko.SSHClient(); MASTER.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
MASTER.connect('107.172.77.34',22,'root','Xiao4669805',timeout=45,allow_agent=False,look_for_keys=False)
|
|
|
|
VPS=paramiko.SSHClient(); VPS.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
VPS.connect('107.173.30.245',22,'root','Xiao4669805',timeout=45,allow_agent=False,look_for_keys=False)
|
|
|
|
print('===== VPS frpp status / logs =====')
|
|
_,o,_=VPS.exec_command(r'''
|
|
set +e
|
|
systemctl status frpp --no-pager -l | head -40
|
|
echo '--- journal ---'
|
|
journalctl -u frpp --no-pager -n 80 2>/dev/null | tail -80
|
|
echo '--- all listen by frp-panel ---'
|
|
ss -lntp | grep frp-panel
|
|
echo '--- recent process start ---'
|
|
ps -o lstart,etime,cmd -p 562469
|
|
''', timeout=60)
|
|
print(o.read().decode('utf-8','replace'))
|
|
|
|
print('===== MASTER proxy configs for vps =====')
|
|
_,o,_=MASTER.exec_command(r'''
|
|
python3 <<'PY'
|
|
import sqlite3, json
|
|
c=sqlite3.connect('/opt/frp-panel/data.db')
|
|
c.row_factory=sqlite3.Row
|
|
rows=c.execute("""
|
|
SELECT id,name,type,server_id,client_id,stopped,content
|
|
FROM proxy_config WHERE deleted_at IS NULL AND server_id='hackrobot.s.vps'
|
|
ORDER BY id
|
|
""").fetchall()
|
|
print('count', len(rows))
|
|
for r in rows:
|
|
raw=r['content']
|
|
if isinstance(raw, memoryview): raw=bytes(raw)
|
|
if isinstance(raw, bytes): raw=raw.decode('utf-8','replace')
|
|
try: j=json.loads(raw)
|
|
except Exception: j={}
|
|
print(f"#{r['id']} {r['name']} client={r['client_id']} stopped={r['stopped']}")
|
|
print(' remotePort=', j.get('remotePort') or j.get('remote_port'), 'localIP=', (j.get('localIP') or j.get('local_ip')), 'localPort=', j.get('localPort') or j.get('local_port'))
|
|
print(' keys', list(j.keys())[:20])
|
|
|
|
# client @3 config
|
|
print('\n=== client hackrobot.c.pve-ubuntu@3 config ===')
|
|
row=c.execute("SELECT client_id,server_id,last_seen_at,stopped,config_content FROM clients WHERE client_id='hackrobot.c.pve-ubuntu@3'").fetchone()
|
|
if row:
|
|
print('server', row['server_id'], 'stopped', row['stopped'], 'last_seen', row['last_seen_at'])
|
|
raw=row['config_content']
|
|
if isinstance(raw, memoryview): raw=bytes(raw)
|
|
if isinstance(raw, bytes): raw=raw.decode('utf-8','replace')
|
|
print(raw[:2500])
|
|
|
|
print('\n=== client nomadro@1 config ===')
|
|
row=c.execute("SELECT client_id,server_id,last_seen_at,stopped,config_content FROM clients WHERE client_id='hackrobot.c.pve-ubuntu-nomadro@1'").fetchone()
|
|
if row:
|
|
print('server', row['server_id'], 'last_seen', row['last_seen_at'])
|
|
raw=row['config_content']
|
|
if isinstance(raw, memoryview): raw=bytes(raw)
|
|
if isinstance(raw, bytes): raw=raw.decode('utf-8','replace')
|
|
print(raw[:1500])
|
|
PY
|
|
''', timeout=60)
|
|
print(o.read().decode('utf-8','replace'))
|
|
|
|
VPS.close(); MASTER.close()
|