Advertisement
Guest User

Untitled

a guest
Dec 21st, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.44 KB | None | 0 0
  1. [root@graylog2 python]# vim enabletelnet.py
  2. import getpass
  3. import sys
  4. import telnetlib
  5.  
  6. HOST = "10.100.6.193"
  7. user = raw_input("Enter your remote account: ")
  8. password = getpass.getpass()
  9.  
  10. tn = telnetlib.Telnet(HOST)
  11.  
  12. tn.read_until("Username:")
  13. tn.write(user + "\n")
  14. if password:
  15. tn.read_until("Password:")
  16. tn.write(password + "\n")
  17.  
  18. tn.write("enable\n")
  19. tn.write(password + "\n")
  20. tn.write("exit\n")
  21.  
  22. print tn.read_all()
  23. ~
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement