Guest User

Untitled

a guest
Feb 8th, 2019
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.59 KB | None | 0 0
  1. for dev in [ape]:
  2. print ("Now accessing... ", dev)
  3. HOST = dev.strip()
  4. ## print (HOST)
  5. tn = telnetlib.Telnet(HOST, timeout = 5)
  6. tn.read_until(b"Username:")
  7. tn.write(user.encode("ascii") + b"n")
  8.  
  9. if password:
  10. tn.read_until(b"Password: ")
  11. tn.write(password.encode("ascii") + b"n")
  12.  
  13. command = "show ip route "+(ip)
  14. print (command)
  15. tn.read_until(b"#")
  16. tn.write(b"sh ver | i test"+b"n")
  17. time.sleep(1)
  18. print ("P Start")
  19. readoutput = tn.read_all()
  20. print (readoutput)
  21. print ("P End")
  22. ## print (tn.read_all())
  23. tn.close()
Add Comment
Please, Sign In to add comment