Advertisement
Guest User

Untitled

a guest
Oct 5th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. HOST= 'server.name.com.br'
  2.  
  3. try:
  4. s = pxssh.pxssh()
  5. hostname = HOST
  6. username = 'root'
  7. password = 'xxxxxxx'
  8. s.login(hostname, username, password)
  9. s.sendline('bconsole') # run a command
  10. s.prompt() # match the prompt
  11. print(s.before) # print everything before the prompt.
  12. s.prompt() # match the prompt
  13. s.sendline('st') # run a command
  14. s.prompt() # match the prompt
  15. print(s.before) # print everything before the prompt.
  16. s.prompt() # match the prompt
  17. s.sendline('1') # run a command
  18. s.prompt() # match the prompt
  19. print(s.before) # print everything before the prompt.
  20. s.prompt() # match the prompt
  21.  
  22. s.logout()
  23. except pxssh.ExceptionPxssh as e:
  24. print("pxssh failed on login.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement