douyinWEB/scripts/_probe_cn_to_cn_wg.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

24 lines
985 B
Python

#!/usr/bin/env python3
import paramiko, sys, time
sys.stdout.reconfigure(encoding='utf-8', errors='replace')
def ssh(h,p,u,pw):
c=paramiko.SSHClient(); c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
c.connect(h,p,u,pw,timeout=45,allow_agent=False,look_for_keys=False); return c
def run(c,cmd,t=60):
_,o,e=c.exec_command(cmd,timeout=t); return (o.read()+e.read()).decode('utf-8','replace')
d=ssh('82.157.112.245',22,'ubuntu','Xiao4669805')
d.exec_command('sudo timeout 8 tcpdump -ni any udp port 51821 -c 3 >/tmp/pve-probe.log 2>&1 &',timeout=3)
time.sleep(1)
g=ssh('107.173.30.245',4014,'eric','4669805')
print('=== physical send UDP to domestic ===')
print(run(g, "echo '4669805' | sudo -S -p '' bash -c 'echo pve-probe | nc -u -w2 82.157.112.245 51821; wg show wg-dy-cn'", 20))
time.sleep(3)
print('=== domestic tcpdump ===')
print(run(d,'cat /tmp/pve-probe.log',10))
print('=== domestic wg ===')
print(run(d,'sudo wg show wg-dy-cn',10))
g.close(); d.close()