22 lines
767 B
Python
22 lines
767 B
Python
import paramiko
|
|
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect('140.44.4.22', username='root', key_filename=r'C:\Users\Snarf\.ssh\id_ed25519_snarfnet', timeout=10)
|
|
|
|
cmds = [
|
|
"cat /etc/os-release",
|
|
"cat /boot/dietpi/.version 2>/dev/null || cat /boot/firmware/dietpi/.version 2>/dev/null || echo 'Not DietPi'",
|
|
"which dropbear || which sshd",
|
|
"ip route show",
|
|
"cat /etc/network/interfaces /etc/dhcpcd.conf /etc/netplan/* /etc/systemd/network/* 2>/dev/null",
|
|
"systemctl cat k3s-agent.service 2>/dev/null || cat /etc/systemd/system/k3s-agent.service"
|
|
]
|
|
|
|
for cmd in cmds:
|
|
print(f"=== {cmd} ===")
|
|
stdin, stdout, stderr = ssh.exec_command(cmd)
|
|
print(stdout.read().decode())
|
|
|
|
ssh.close()
|