Advertisement
Guest User

Untitled

a guest
Jul 31st, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. import getpass
  2. import telnetlib
  3.  
  4. HOST = "192.168.88.130"
  5. user = input("Enter your username: ")
  6. password = getpass.getpass()
  7.  
  8. tn = telnetlib.Telnet(HOST)
  9.  
  10. tn.read_until(b"Username: ")
  11. tn.write(user.encode('ascii') + b"\n")
  12. if password:
  13. tn.read_until(b"Password: ")
  14. tn.write(password.encode('ascii') + b"\n")
  15.  
  16. tn.write(b"conf t\n")
  17. tn.write(b"int loo 0\n")
  18. tn.write(b"ip address 1.1.1.1 255.255.255.255\n")
  19. tn.write(b"end\n")
  20. tn.write(b"exit\n"
  21.  
  22.  
  23. print(tn.read_all().decode('ascii'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement