Guest User

Untitled

a guest
Mar 9th, 2018
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.79 KB | None | 0 0
  1. try:
  2. username = 'username'
  3. password = 'password'
  4. ip = 'xx.xx.xx.xx'
  5. port = XXXX
  6.  
  7. reading_timeout = 5
  8.  
  9. connection = telnetlib.Telnet (ip)
  10.  
  11. console_output = connection.read_until ("ENTER USERNAME <", reading_timeout)
  12. print console_output
  13. connection.write (username + 'rn')
  14.  
  15. console_output = connection.read_until ("ENTER PASSWORD <", reading_timeout)
  16. connection.write (password + 'rn')
  17. print console_output
  18.  
  19. connection.write ("***My command to follow the process***")
  20. console_output = connection.read_until ("here I can put any text, I use this only to get the output", 600)
  21. print console_output
  22.  
  23.  
  24. connection.write('***Command instead of Ctrl-C***') ***????***
  25.  
  26. connection.close ()
  27. except IOError:
  28. print "connection not established"
Add Comment
Please, Sign In to add comment