Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 telnet question
Hi All,
i have some question related to telnet this script. Are we able to login and don't close the session. For example login, and user is able to type in command like that. I saw most of the resource on net, only show login and run some command. Is it possible to just login automatic and stop.
For my script, it will login and run the command. But what i wants is just login, and don't exit the session.

Is python able to do this?


Tesed in python3.5
import telnetlib

HOST = ""
user = "root"
password = "arrisc4"

def command(con, flag, str_=""):
    data = con.read_until(flag.encode())
    con.write(str_.encode() + b"\n")
    return data

tn = telnetlib.Telnet(HOST)
command(tn, "Login:", user)
if password:
    command(tn, "Password:", password)
command(tn, "#", "en")
#command(tn, "$", " exit")
#command(tn, "$", "")


Top Page

Messages In This Thread
telnet question - by jacklee26 - Mar-23-2019, 12:04 PM
RE: telnet question - by nilamo - Mar-29-2019, 05:45 PM
RE: telnet question - by jacklee26 - Mar-30-2019, 06:45 AM

Possibly Related Threads...
Thread Author Replies Views Last Post
  telnet from ssh tunnel oldfart 1 143 Aug-10-2019, 06:44 PM
Last Post: DeaD_EyE
  3.6 telnet eyler 3 4,401 Jun-28-2019, 05:22 AM
Last Post: Khanhamid90
  Any suggestion on python library to use for both ssh and telnet? lord_mani 4 500 Jun-25-2019, 04:07 PM
Last Post: gb74razor
  Retrieve output from telnet command Networker 1 413 Mar-12-2019, 01:36 PM
Last Post: searching1
  GNS3 telnet from bash terminal to virtual cisco router marienbad 2 480 Feb-24-2019, 07:55 AM
Last Post: marienbad
  Telnet to switch from jump start server(linux) searching1 0 463 Jan-09-2019, 10:03 PM
Last Post: searching1
  Issue when running telnet program using python3 searching1 11 2,151 Dec-22-2018, 12:48 AM
Last Post: searching1
  Aggregate multiple telnet connections Jibeji 1 1,550 Mar-02-2018, 07:21 PM
Last Post: mpd
  mysql connector/telnet issue (re: text game) rebubula76 1 680 Feb-06-2018, 08:00 PM
Last Post: rebubula76
  Multithread telnet not working Parallel anna 7 2,087 Feb-05-2018, 01:17 PM
Last Post: anna

Forum Jump:

Users browsing this thread: 1 Guest(s)