#!/usr/bin/env python3 """Read-only: WG hub 129.204.21.129 → 10.88.0.8:8001 (PVE guest).""" from __future__ import annotations import socket import sys import time import paramiko sys.stdout.reconfigure(encoding="utf-8", errors="replace") def connect(host, port, user, passwords, label): last = None for pw in passwords: c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) for i in range(4): try: c.connect( host, port, user, pw, timeout=40, allow_agent=False, look_for_keys=False, banner_timeout=120, ) print(f"{label}: ok user={user} pw_len={len(pw)}", flush=True) return c except Exception as e: last = e print(f"{label}: retry {user} {i}: {type(e).__name__}: {e}", flush=True) time.sleep(2) print(f"{label}: FAIL {last}", flush=True) return None def run(c, cmd, t=90): _i, o, e = c.exec_command(cmd, timeout=t) return (o.read() + e.read()).decode("utf-8", "replace") # 1) local from Windows print("=== local TCP ===", flush=True) for host, port in [("129.204.21.129", 80), ("129.204.21.129", 22), ("10.88.0.8", 8001)]: s = socket.socket() s.settimeout(5) try: s.connect((host, port)) print(f"local {host}:{port} OK") except Exception as e: print(f"local {host}:{port} FAIL {e}") finally: s.close() # 2) WG hub VPS print("\n======== WG hub 129.204.21.129 ========", flush=True) hub = connect("129.204.21.129", 22, "ubuntu", ["Xiao4669805"], "hub") if hub: print( run( hub, r""" set +e whoami; hostname; uname -a | head -1 echo '--- listen 80 / wg ---' ss -lntp | grep -E ':80\b|:8001\b|:518|wg' | head -30 echo '--- wg ---' sudo wg show 2>/dev/null || wg show 2>/dev/null echo ip -br a | grep -E 'wg|10\.88' || true echo '--- route to 10.88.0.8 ---' ip route get 10.88.0.8 2>&1 echo '--- peer reachability ---' ping -c 3 -W 2 10.88.0.8 2>&1 | tail -6 curl -sS -m 8 -o /tmp/out8001.txt -w 'curl=%{http_code} bytes=%{size_download} time=%{time_total}\n' http://10.88.0.8:8001/ || echo curl_fail head -c 300 /tmp/out8001.txt 2>/dev/null; echo echo '--- conf snippets ---' sudo ls -la /etc/wireguard/ 2>/dev/null sudo grep -RIn '10\.88\|AllowedIPs\|Address\|ListenPort\|Endpoint' /etc/wireguard/ 2>/dev/null | head -60 echo '--- docker/services mentioning 8001 ---' sudo ss -lntp | grep 8001 || true """, ), flush=True, ) hub.close() # 3) try reach PVE guest via known paths print("\n======== try PVE/physical paths ========", flush=True) # overseas VPS FRP SSH to physical eric paths = [ ("frp4014", "107.173.30.245", 4014, "eric", ["4669805", "Xiao4669805"]), ("dy_direct", "108.174.50.68", 22, "root", ["Xiao4669805"]), ("vps_root", "107.173.30.245", 22, "root", ["Xiao4669805"]), ] for label, host, port, user, pws in paths: c = connect(host, port, user, pws, label) if not c: continue print( f"--- on {label}: look for 10.88 / :8001 ---", flush=True, ) print( run( c, r""" set +e hostname; ip -br a | head -20 echo '--- wg / 10.88 ---' wg show 2>/dev/null | head -40 ip -br a | grep -E '10\.88|wg' || true ip route get 10.88.0.8 2>&1 || true ping -c 2 -W 2 10.88.0.8 2>&1 | tail -4 curl -sS -m 5 -o /dev/null -w 'curl_10.88=%{http_code}\n' http://10.88.0.8:8001/ || echo curl_fail echo '--- local :8001 ---' ss -lntp | grep ':8001' || true docker ps --format '{{.Names}} {{.Ports}}' 2>/dev/null | grep 8001 || true # if this host IS 10.88.0.8 ip -br a | grep '10.88.0.8' && echo 'THIS_HOST_IS_10.88.0.8' """, t=60, ), flush=True, ) c.close() print("DONE")