import paramiko import sys sys.stdout.reconfigure(encoding='utf-8') ssh = paramiko.SSHClient() ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy()) ssh.connect('140.44.4.27', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=8) stdin, stdout, stderr = ssh.exec_command('pstree -p 3700051 || ps -ef | grep 3712344') print("--- PROCESS TREE ---") print(stdout.read().decode()) stdin, stdout, stderr = ssh.exec_command('cat /proc/3712344/cmdline; echo ""; cat /proc/3712344/wchan') print("--- WCHAN ---") print(stdout.read().decode()) stdin, stdout, stderr = ssh.exec_command('cat /var/lib/dpkg/info/linux-image-6.6.62+rpt-rpi-v8.prerm') print("--- PRERM SCRIPT ---") print(stdout.read().decode()) ssh.close()