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("")

tn.read_until(b"login:", 2)

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

tn.read_until(b"Password :", 2)

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

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

#tn.read_until(b"=>", 2)


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.
Posts: 1
Joined: Tue Sep 06, 2016 12:14 pm

Return to Networking

Who is online

Users browsing this forum: No registered users and 2 guests