Opening Telnet session to a device.

Opening Telnet session to a device.

Postby noam » Tue Sep 06, 2016 12:19 pm

Hi all,

I would like to open a Telnet session to a device, but I get no response from the following code:
Code: Select all
import sys
import telnetlib

tn = telnetlib.Telnet("10.87.180.104")

tn.read_until(b"login:", 2)
#tn.write("login\n")

user = "root"
tn.write((user + "\n").encode('ascii'))

tn.read_until(b"Password :", 2)
#tn.write("rambo\n")

password = "rambo"
tn.write((password + "\n").encode('ascii'))

less = "ls"
tn.write((less + "\n").encode('ascii'))


#tn.read_until(b"=>", 2)
#tn.write(b"exit\n")

tn.close

any ideas ?
Last edited by Yoriz on Tue Sep 06, 2016 1:22 pm, edited 1 time in total.
Reason: First post lock. Added code tags.
noam
 
Posts: 1
Joined: Tue Sep 06, 2016 12:14 pm

Return to Networking

Who is online

Users browsing this forum: No registered users and 5 guests