23 lines
673 B
Python
23 lines
673 B
Python
import paramiko
|
|
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect('140.44.4.21', username='root', password='dietpi', timeout=10)
|
|
|
|
cmds = [
|
|
"uptime",
|
|
"cat /boot/dietpi/.version 2>/dev/null || cat /boot/dietpi.txt | grep -E 'AUTO_|CONFIG_'",
|
|
"ps aux",
|
|
"ls -la /boot/Automation_Custom_Script.sh /boot/Automation_Custom_PreScript.sh 2>/dev/null",
|
|
"ls -la /var/tmp/dietpi/logs/",
|
|
"cat /var/tmp/dietpi/logs/dietpi-firstrun-setup.log 2>/dev/null | tail -n 30"
|
|
]
|
|
|
|
for cmd in cmds:
|
|
print(f"\n=== {cmd} ===")
|
|
stdin, stdout, stderr = ssh.exec_command(cmd)
|
|
print(stdout.read().decode())
|
|
|
|
ssh.close()
|
|
|