26 lines
591 B
Python
26 lines
591 B
Python
import paramiko
|
|
import os
|
|
|
|
HOST = '123.207.67.197'
|
|
PORT = 22
|
|
USER = 'root'
|
|
PASS = '520Kiss123'
|
|
|
|
LOCAL_IMG = r'e:\project\flutter\f\xianyan\assets\images\empty\rz.png'
|
|
REMOTE_DIR = '/www/wwwroot/tools.wktyl.com/public/agreements/'
|
|
|
|
ssh = paramiko.SSHClient()
|
|
ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
|
|
ssh.connect(HOST, PORT, USER, PASS)
|
|
sftp = ssh.open_sftp()
|
|
|
|
remote_path = REMOTE_DIR + 'rz.png'
|
|
print(f'Uploading {LOCAL_IMG} -> {remote_path}')
|
|
sftp.put(LOCAL_IMG, remote_path)
|
|
sftp.chmod(remote_path, 0o644)
|
|
print('Upload complete')
|
|
|
|
sftp.close()
|
|
ssh.close()
|
|
print('Done!')
|