Advertisement
Guest User

Untitled

a guest
Feb 19th, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.35 KB | None | 0 0
  1. import getpass
  2. import telnetlib
  3.  
  4. HOST = "192.168.1.1"
  5. user = "1234"
  6. password = "1234"
  7.  
  8. tn = telnetlib.Telnet(HOST,"21")
  9.  
  10. tn.read_until(b"login: ")
  11. tn.write(user.encode('ascii') + b"r")
  12. if password:
  13. tn.read_until(b"Password: ")
  14. tn.write(password.encode('ascii') + b"r")
  15.  
  16. tn.write(b"rebootr")
  17. tn.write(b"exitr")
  18.  
  19. print(tn.read_all().decode('ascii'))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement