Advertisement
Guest User

Untitled

a guest
Sep 4th, 2016
157
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.72 KB | None | 0 0
  1. Missing line numbers are comment lines only, removed them to make it easier to read.d
  2.  
  3. 1 import getpass
  4. 2 import sys
  5. 3 import telnetlib
  6. 4
  7. 5 HOST = "*******************"
  8. 7 user = raw_input("User Name: ")
  9. 9 # user = "*********"
  10. 11 password = getpass.getpass()
  11. 13 # password = "***********************"
  12. 14
  13. 15 tn = telnetlib.Telnet(HOST)
  14. 17 tn.read_until("login: ")
  15. 19 tn.write(user + "\n")
  16. 21 tn.read_until("Password: ")
  17. 23 tn.write(password + "\n")
  18. 25 tn.read_until("5308> ")
  19. 27 # tn.write("show net lan dhcp reserved_ip setup\n")
  20. 28 tn.write("security firewall ipv4 enable 20\n")
  21. 29 # print tn.read_all()
  22. 31 tn.read_until("5308> ")
  23. 33 tn.write(".exit\n")
  24. 35
  25. 36 print tn.read_all()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement