Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import paramiko
- ip='server ip'
- port=22
- username='username'
- password='password'
- cmd='some useful command'
- ssh=paramiko.SSHClient()
- ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
- ssh.connect(ip,port,username,password)
- stdin,stdout,stderr=ssh.exec_command(cmd)
- outlines=stdout.readlines()
- resp=''.join(outlines)
- print(resp)
- stdin,stdout,stderr=ssh.exec_command('some really useful command')
- outlines=stdout.readlines()
- resp=''.join(outlines)
- print(resp)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement