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>
66 lines
2.7 KiB
Python
66 lines
2.7 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 '=== /opt/frp-panel ==='
|
|
ls -la /opt/frp-panel
|
|
echo
|
|
echo '=== compose / run config ==='
|
|
find /opt/frp-panel -type f 2>/dev/null | head -50
|
|
for f in /opt/frp-panel/docker-compose.yml /opt/frp-panel/compose.yml /opt/frp-panel/.env; do
|
|
[ -f "$f" ] && echo "--- $f ---" && cat "$f"
|
|
done
|
|
echo
|
|
echo '=== docker inspect frp-panel ==='
|
|
docker inspect frp-panel --format 'Image={{.Config.Image}} Status={{.State.Status}} Restart={{.RestartCount}} OOM={{.State.OOMKilled}} Exit={{.State.ExitCode}} Started={{.State.StartedAt}} Health={{.State.Health.Status}}'
|
|
docker inspect frp-panel --format '{{json .HostConfig.PortBindings}}'
|
|
docker inspect frp-panel --format '{{range .Mounts}}{{.Source}} -> {{.Destination}} ({{.Type}}){{println}}{{end}}'
|
|
echo
|
|
echo '=== docker logs (last 80) ==='
|
|
docker logs --tail 80 frp-panel 2>&1
|
|
echo
|
|
echo '=== http probes ==='
|
|
curl -sS -o /tmp/frp9000.html -w '9000 http:%{http_code} size:%{size_download} ctype:%{content_type} time:%{time_total}\n' --max-time 15 http://127.0.0.1:9000/login || echo '9000 fail'
|
|
curl -sS -o /dev/null -w '9000 root:%{http_code}\n' --max-time 10 http://127.0.0.1:9000/ || true
|
|
curl -sS -o /dev/null -w '9001:%{http_code}\n' --max-time 10 http://127.0.0.1:9001/ || true
|
|
curl -sS -o /dev/null -w '8999:%{http_code}\n' --max-time 10 http://127.0.0.1:8999/ || true
|
|
head -c 400 /tmp/frp9000.html; echo
|
|
echo
|
|
echo '=== login API try ==='
|
|
curl -sS -c /tmp/frp.ck -X POST 'http://127.0.0.1:9000/api/auth/login' \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"username":"hackrobot","password":"Xiao4669805@"}' -w '\nhttp:%{http_code}\n' --max-time 15 | head -c 800
|
|
echo
|
|
# alternate common paths
|
|
for p in /api/v1/auth/login /api/login /login /api/user/login; do
|
|
code=$(curl -sS -o /tmp/frplogin.json -w '%{http_code}' -X POST "http://127.0.0.1:9000$p" \
|
|
-H 'Content-Type: application/json' \
|
|
-d '{"username":"hackrobot","password":"Xiao4669805@"}' --max-time 8)
|
|
echo "POST $p -> $code $(head -c 120 /tmp/frplogin.json)"
|
|
done
|
|
echo
|
|
echo '=== dmesg OOM / frp ==='
|
|
dmesg -T 2>/dev/null | grep -iE 'oom|killed|frp' | tail -20
|
|
echo
|
|
echo '=== mem pressure ==='
|
|
free -m; cat /proc/1539/status 2>/dev/null | grep -E 'VmRSS|VmSize|Threads' || true
|
|
"""
|
|
|
|
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=120)
|
|
print(o.read().decode("utf-8", "replace"))
|
|
err = e.read().decode("utf-8", "replace")
|
|
if err.strip():
|
|
print("STDERR:", err[-1500:])
|
|
c.close()
|