#!/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()