Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- from scp import SCPClient
- import tempfile
- ssh = paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect("172.17.0.63", username="dssadmin", password="dssadmin")
- with SCPClient(ssh.get_transport()) as scp:
- with tempfile.NamedTemporaryFile() as temp_file:
- scp.get(remote_path='/var/log/dss11-websetup/update.log', local_path=temp_file.name)
- file_content = "\n".join(x.strip() for x in temp_file.readlines())
- print(file_content)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement