Files
Ray-Pondeur/n999.py
T
2026-05-15 16:18:21 +02:00

20 lines
914 B
Python

from paramiko import SSHClient, WarningPolicy
import argparse
parser = argparse.ArgumentParser(prog="N999", description="Download files in selected ssh directory", epilog="made with love, used with care")
parser.add_argument("--host", type=str, default="coope-birthday2.local", help="The host to connect to")
parser.add_argument("--user", type=str, default="coope", help="The user to connect as")
parser.add_argument("--record-folder", type=str, default="/coope/", help="path to record folder")
args = parser.parse_args()
client = SSHClient()
client.set_missing_host_key_policy(WarningPolicy())
password = "C0op3r@tive"
if __name__ == "__main__":
print(f"{args.host}, {args.user}, {args.record_folder}")
client.connect(args.host, username=args.user, password=password)
stdin, stdout, stderr = client.exec_command(f"cd {args.record_folder}; ls -la")
print(stdout.readlines())
client.close()