| import pexpect |
| import argparse |
|
|
| |
| parser = argparse.ArgumentParser(description='Rsync files from a remote server to local.') |
| parser.add_argument('--host', required=True, help='Remote host IP address') |
| parser.add_argument('--port', required=True, help='Remote SSH port') |
| args = parser.parse_args() |
|
|
| |
| local_path = "/sillytavern/" |
| remote_user = "root" |
| remote_host = args.host |
| remote_port = args.port |
| remote_path = "/sillytavern/" |
| password = "qilan" |
|
|
| |
| command = f"rsync -avzP -e 'ssh -o StrictHostKeyChecking=no -p {remote_port}' {remote_user}@{remote_host}:{remote_path} {local_path}" |
|
|
| |
| child = pexpect.spawn(command) |
|
|
| |
| child.expect("password:") |
| child.sendline(password) |
|
|
| |
| child.expect(pexpect.EOF) |
| print(child.before.decode()) |
|
|