Guest User

Untitled

a guest
Oct 4th, 2018
193
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. import getpass
  2. import telnetlib
  3.  
  4. HOST = "192.168.21.5"
  5. user = input("Enter your remote account: ")
  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. print(tn.read_all().decode('ascii'))
  17.  
  18. tom@ubuntu-server:~/Python_Scripts$ sudo python3.6 telnet3.py
  19. Enter your remote account: tom
  20. Password:
  21. Traceback (most recent call last):
  22. File "telnet3.py", line 16, in <module>
  23. print(tn.read_all().decode('ascii'))
  24. File "/usr/lib/python3.6/telnetlib.py", line 333, in read_all
  25. self.fill_rawq()
  26. File "/usr/lib/python3.6/telnetlib.py", line 524, in fill_rawq
  27. buf = self.sock.recv(50)
  28. socket.timeout: timed out
Add Comment
Please, Sign In to add comment