Advertisement
Guest User

Untitled

a guest
May 9th, 2016
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.39 KB | None | 0 0
  1. import paramiko
  2. nmsIp = "IP"
  3. user="user"
  4. pwd = "pwd"
  5. ssh = paramiko.SSHClient()
  6. ssh.load_system_host_keys()
  7. ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
  8. ssh.connect(nmsIp, 22, username=user, password=pwd)
  9. channel = ssh.invoke_shell()
  10. stdin = channel.makefile('wb')
  11. stdout = channel.makefile('rb')
  12.  
  13. stdin.write('''
  14. sqlplus
  15. select * from *');
  16. exit
  17. exit
  18. ''')
  19.  
  20. print stdout.read()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement