import paramiko

client = paramiko.SSHClient()
client.set_missing_host_key_policy(paramiko.AutoAddPolicy())
client.connect("192.168.1.50", username="root", password="Vlado7309208104++",
               look_for_keys=False, allow_agent=False)

def run(cmd):
    _, stdout, stderr = client.exec_command(cmd)
    out = stdout.read().decode().strip()
    err = stderr.read().decode().strip()
    if out: print(out)
    if err: print(f"[err] {err}")

print("--- Hostname ---")
run("hostname")

print("\n--- Python ---")
run("python3 --version")
run("pip3 --version")

print("\n--- Balicky (blake3, psycopg2) ---")
run("pip3 list 2>/dev/null | grep -iE 'blake3|psycopg2'")

print("\n--- ZalohaVsechObrazku ---")
run("ls /mnt/user/ | grep -i zaloha")
run("ls /mnt/remotes/ 2>/dev/null | grep -i zaloha")

print("\n--- User Scripts ---")
run("ls /boot/config/plugins/user.scripts/scripts/ 2>/dev/null | head -5")

client.close()
