Guest User

Untitled

a guest
Jan 13th, 2019
133
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.42 KB | None | 0 0
  1. Read remote output and respond using paramiko (SSH.execute)
  2. ExpectedString = 'ExpectedOutput'
  3. Output = SSH.execute('./runScript')
  4. if Output == ExpectedString:
  5. SSH.execute('Enter this')
  6. else:
  7. raise SomeException
  8.  
  9. ssh.connect('127.0.0.1', username='foo', password='bar')
  10.  
  11. stdin, stdout, stderr = ssh.exec_command("some_script")
  12.  
  13. stdin.write('expected_inputn')
  14. stdin.flush()
  15.  
  16. data = stdout.read.splitlines()
Add Comment
Please, Sign In to add comment