feat: add various infrastructure check and automation scripts
This commit is contained in:
35
scripts/test_packet_flow.py
Normal file
35
scripts/test_packet_flow.py
Normal file
@@ -0,0 +1,35 @@
|
||||
import paramiko
|
||||
import sys
|
||||
import time
|
||||
|
||||
sys.stdout.reconfigure(encoding='utf-8')
|
||||
|
||||
# Connect to nutserver (14.4.4.44)
|
||||
c_nut = paramiko.SSHClient()
|
||||
c_nut.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c_nut.connect('14.4.4.44', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
# Connect to shipyard node 04 (140.44.4.74)
|
||||
c_ship = paramiko.SSHClient()
|
||||
c_ship.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
||||
c_ship.connect('140.44.4.74', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
||||
|
||||
# Start tcpdump on nutserver
|
||||
print("Starting tcpdump on nutserver...")
|
||||
stdin, stdout_dump, stderr_dump = c_nut.exec_command("echo 'Katzir476!' | sudo -S tcpdump -i wlan0 -n -c 10 'host 140.44.4.74 or port 3493'")
|
||||
|
||||
time.sleep(1)
|
||||
|
||||
# Send curl / nc from 140.44.4.74
|
||||
print("Sending test probe from 140.44.4.74...")
|
||||
c_ship.exec_command("nc -z -w 3 14.4.4.44 3493 || ping -c 2 -W 2 14.4.4.44")
|
||||
|
||||
time.sleep(3)
|
||||
|
||||
# Read tcpdump output
|
||||
dump_out = stdout_dump.read().decode('utf-8', errors='replace')
|
||||
print("TCPDUMP OUTPUT ON NUTSERVER:\n", dump_out)
|
||||
|
||||
c_nut.close()
|
||||
c_ship.close()
|
||||
|
||||
Reference in New Issue
Block a user