28 lines
806 B
Python
28 lines
806 B
Python
import paramiko
|
|
|
|
SSH_KEY = r"C:\Users\Snarf\.ssh\id_ed25519_snarfnet"
|
|
c = paramiko.SSHClient()
|
|
c.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
c.connect("140.44.4.81", username="rancher", key_filename=SSH_KEY, timeout=10)
|
|
|
|
def run_cmd(cmd):
|
|
full_cmd = f"echo Katzir476! | sudo -S sh -c '{cmd}'"
|
|
_, o, e = c.exec_command(full_cmd)
|
|
return o.read().decode().strip(), e.read().decode().strip()
|
|
|
|
print("Services in /etc/systemd/system:")
|
|
out, _ = run_cmd("ls -la /etc/systemd/system/")
|
|
print(out)
|
|
|
|
print("\nFiles in /usr/local/bin or /opt:")
|
|
out, _ = run_cmd("ls -la /usr/local/bin /opt")
|
|
print(out)
|
|
|
|
# Check if there is a disk-mount service or script
|
|
out, _ = run_cmd("find /etc/systemd/system -name '*mount*' -o -name '*disk*'")
|
|
print("\nSystemd mount/disk units:")
|
|
print(out)
|
|
|
|
c.close()
|
|
|