24 lines
677 B
Python
24 lines
677 B
Python
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('ps aux | grep -v "grep" | grep -i apt')
|
|
print("--- APT PROCESSES ---")
|
|
print(stdout.read().decode())
|
|
|
|
stdin, stdout, stderr = ssh.exec_command('ps aux | grep -v "grep" | grep -i dpkg')
|
|
print("--- DPKG PROCESSES ---")
|
|
print(stdout.read().decode())
|
|
|
|
stdin, stdout, stderr = ssh.exec_command('uptime')
|
|
print("--- UPTIME ---")
|
|
print(stdout.read().decode())
|
|
|
|
ssh.close()
|
|
|