I am trying to telnet to a device with ip.
import telnetlib
deviceIp = '192.168.1.135'
password1='xxxxxx'
telnetConeection = telnetlib.Telnet(deviceIp,23)
telnetConeection.read_until(b'Password: ')
telnetConeection.write(password1.encode('ascii') + b"\n")
telnetConeection.write(b'\n')
telnetConeection.write(b'port\n')
print(telnetConeection.read_all())
The ouput as : b'Timeout!\n'
It is clear that :-
- the connection to device is made
- the script is reading till 'Password'
What is not clear to me is that :why the write password is not working and timeout is happening? Kindly help me out.
Any suggestion will be highly appreciated !