import paramiko import sys sys.stdout.reconfigure(encoding='utf-8') c = paramiko.SSHClient() c.set_missing_host_key_policy(paramiko.AutoAddPolicy()) # Note task is now on snshpd4lnxswm05 (140.44.4.75) c.connect('140.44.4.75', username='snarf', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10) def run(cmd): stdin, stdout, stderr = c.exec_command(cmd) return stdout.read().decode().strip(), stderr.read().decode().strip() cid, _ = run("echo 'Katzir476!' | sudo -S docker ps -q -f name=peanut_peanut") print("CID on 140.44.4.75:", cid) # Check what files are in the web app to see the API routes out, _ = run(f"echo 'Katzir476!' | sudo -S docker exec {cid} node -e 'console.log(require(\"fs\").readdirSync(\"./\"))'") print("App root files:\n", out) # Test connecting to nutserver from 140.44.4.75 as well to be 100% sure node 05 can also reach it out, err = run("ping -c 2 -W 2 14.4.4.44") print("Ping from 140.44.4.75 to 14.4.4.44:\n", out) c.close()