Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import getpass
- import telnetlib
- HOST = "192.168.21.5"
- user = input("Enter your remote account: ")
- password = getpass.getpass()
- tn = telnetlib.Telnet(HOST)
- 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")
- print(tn.read_all().decode('ascii'))
- tom@ubuntu-server:~/Python_Scripts$ sudo python3.6 telnet3.py
- Enter your remote account: tom
- Password:
- Traceback (most recent call last):
- File "telnet3.py", line 16, in <module>
- print(tn.read_all().decode('ascii'))
- File "/usr/lib/python3.6/telnetlib.py", line 333, in read_all
- self.fill_rawq()
- File "/usr/lib/python3.6/telnetlib.py", line 524, in fill_rawq
- buf = self.sock.recv(50)
- socket.timeout: timed out
Add Comment
Please, Sign In to add comment