Guest User

Untitled

a guest
Aug 14th, 2018
110
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.46 KB | None | 0 0
  1. import getpass
  2. import telnetlib
  3. import time
  4.  
  5. user= "root"
  6. password = "admin"
  7.  
  8. print("Router Script")
  9.  
  10. HOST = "192.168.100.1" #the gateway of the router
  11.  
  12. tn = telnetlib.Telnet(HOST)
  13.  
  14. tn.set_debuglevel(7) #the master of puppets
  15.  
  16. tn.read_until(b"Login:")
  17. time.sleep(1)
  18. tn.write(user.encode('ascii') + b"n")
  19.  
  20. tn.read_until(b"Password:")
  21. tn.write(password.encode('ascii') + b"n")
  22.  
  23. tn.read_until(b"WAP>")
  24. tn.write(b"display ip routen" )
  25.  
  26. print(tn.read_all().decode('ascii'))
Add Comment
Please, Sign In to add comment