Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- for dev in [ape]:
- print ("Now accessing... ", dev)
- HOST = dev.strip()
- ## print (HOST)
- tn = telnetlib.Telnet(HOST, timeout = 5)
- tn.read_until(b"Username:")
- tn.write(user.encode("ascii") + b"n")
- if password:
- tn.read_until(b"Password: ")
- tn.write(password.encode("ascii") + b"n")
- command = "show ip route "+(ip)
- print (command)
- tn.read_until(b"#")
- tn.write(b"sh ver | i test"+b"n")
- time.sleep(1)
- print ("P Start")
- readoutput = tn.read_all()
- print (readoutput)
- print ("P End")
- ## print (tn.read_all())
- tn.close()
Add Comment
Please, Sign In to add comment