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>
87 lines
2.5 KiB
Python
87 lines
2.5 KiB
Python
# -*- coding: utf-8 -*-
|
|
"""Probe US VPS + PVE Ubuntu guest before deploy. Does not change anything."""
|
|
import sys
|
|
import paramiko
|
|
|
|
sys.stdout.reconfigure(encoding="utf-8", errors="replace")
|
|
|
|
|
|
def run(host, port, user, password, cmd, timeout=90, label=""):
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect(host, port, user, password, timeout=25, allow_agent=False, look_for_keys=False)
|
|
_, o, e = c.exec_command(cmd, timeout=timeout)
|
|
out = o.read().decode("utf-8", "replace")
|
|
err = e.read().decode("utf-8", "replace")
|
|
print(f"\n===== {label} =====")
|
|
print(out)
|
|
if err.strip():
|
|
print("STDERR", err[-2000:])
|
|
c.close()
|
|
|
|
|
|
VPS = r"""
|
|
set +e
|
|
echo HOST $(hostname) $(uname -srm)
|
|
echo IP $(hostname -I)
|
|
free -h | head -2
|
|
echo
|
|
echo '=== docker ==='
|
|
command -v docker; docker --version 2>/dev/null
|
|
docker ps -a --format 'table {{.Names}}\t{{.Status}}\t{{.Ports}}' 2>/dev/null | head -30
|
|
ls /opt/wg-easy 2>/dev/null
|
|
echo
|
|
echo '=== listen 80/443/51820/4015/8014 ==='
|
|
ss -ulnp | grep 51820 || true
|
|
ss -lntp | grep -E ':(80|443|51820|51821|4015|8014|4014)\b'
|
|
echo
|
|
echo '=== caddy ==='
|
|
systemctl is-active caddy
|
|
ls /etc/caddy/sites
|
|
echo '--- Caddyfile ---'
|
|
cat /etc/caddy/Caddyfile
|
|
echo '--- dy.nomadro.com? ---'
|
|
grep -R 'dy.nomadro.com' /etc/caddy 2>/dev/null || echo none
|
|
echo '--- dylive site (first 40) ---'
|
|
head -40 /etc/caddy/sites/dylive.nomadro.com.caddy 2>/dev/null
|
|
echo
|
|
echo '=== firewall ==='
|
|
ufw status 2>/dev/null | head -25
|
|
iptables -S INPUT | head -25
|
|
echo
|
|
echo '=== dns ==='
|
|
getent hosts dy.nomadro.com dylive.nomadro.com
|
|
echo
|
|
echo '=== sing-box / v2ray (DO NOT TOUCH) ==='
|
|
systemctl is-active sing-box xray v2ray v2ray-agent 2>/dev/null
|
|
ls /etc/systemd/system | grep -iE 'sing|xray|v2ray|caddy|docker' | head
|
|
echo
|
|
echo '=== disk ==='
|
|
df -h / /opt | tail -5
|
|
"""
|
|
|
|
PVE = r"""
|
|
set +e
|
|
echo HOST $(hostname) virt=$(systemd-detect-virt)
|
|
echo IP; hostname -I; ip -4 addr | grep inet
|
|
free -h | head -2
|
|
df -h /
|
|
echo
|
|
echo '=== pkgs ==='
|
|
python3 --version; node -v; npm -v; ffmpeg -version 2>/dev/null | head -1
|
|
command -v docker wg wg-quick git curl unzip
|
|
dpkg -l | awk '/^ii/ {print $2}' | grep -iE 'nodejs|ffmpeg|nginx|caddy|wireguard' | head
|
|
echo
|
|
echo '=== frpp/ssh ==='
|
|
systemctl is-active frpp ssh
|
|
echo
|
|
echo '=== listen ==='
|
|
ss -lntp | head -20
|
|
echo
|
|
echo '=== sudo ==='
|
|
echo '4669805' | sudo -S -p '' true && echo sudo_ok
|
|
"""
|
|
|
|
run("107.173.30.245", 22, "root", "Xiao4669805", VPS, 90, "US VPS")
|
|
run("107.173.30.245", 4014, "eric", "4669805", PVE, 60, "PVE Ubuntu guest")
|