Questions tagged [telnetlib]

The telnetlib module provides a Telnet class that implements the Telnet protocol under Python programming language.

The telnetlib module provides a Telnet class that implements the Telnet protocol under Python programming language.

See RFC 854 for details about the Telnet protocol.

In addition, telnetlib provides symbolic constants for the protocol characters (see below), and for the telnet options. The symbolic names of the telnet options follow the definitions in arpa/telnet.h, with the leading TELOPT_ removed. For symbolic names of options which are traditionally not included in arpa/telnet.h, see the module source itself.

Read more about telnetlib at python docs..

318 questions
2
votes
0 answers

telnetlib and python subprocess in telnet

I am telnet into Keysight N1914A power meter and python subprocess.check_out[("Measure:Power?)] is not working. So I am trying to use the python telnetlib. I do not need username or password to log in. IP address and port number is all it…
2
votes
1 answer

Using Python to check if Telnet is still connected

I'm writing a python program that uses Telnet to send the same few commands once every second, and then reads the output, organizes it into a Dictionary, and then prints to a JSON file (Were it is later read in by a front-end web-gui). The purpose…
Brian C
  • 1,333
  • 3
  • 19
  • 36
2
votes
1 answer

how to run a remote command with telnetlib3 on python asyncio

I'm trying to write a simple telnet client that just runs a single command on a remote box using telnet. This needs to run over asyncio as other tasks are monitored at the same time under that framework. I got it almost working, with the code below,…
user5417363
  • 91
  • 2
  • 5
2
votes
1 answer

How can I read multiple lines from a telnet query in Python?

I am attempting to communicate with a device using Python's telnetlib module. I seem to be able to establish a connection and pass my query to the device, however, the output is not what I expect. Here is my simplified code: import telnetlib import…
skyhammer
  • 117
  • 1
  • 7
2
votes
3 answers

cannot parallelize (threads) telnet connections with python

I have a code that will connect to several routers, using the telentlib, run some code within those, and finally write the output to a file. It runs smoothly. However, when I had to access lots of routers (+50) the task consumes a lot of time (the…
Lucas Aimaretto
  • 1,399
  • 1
  • 22
  • 34
2
votes
1 answer

How to read telnet sessions with python

Aloha, i'm creating a teamspeakbot and want to write and read to a telnet session created with a TeamSpeak3 server import telnetlib tn = telnetlib.Telnet('localhost', 10011, 10) tn.read_all() What i'm expecting: Connected to localhost Escape…
fechnert
  • 1,215
  • 2
  • 12
  • 30
2
votes
1 answer

why telnetlib write function not working in my python code?

I was learning python for a few weeks, I was trying to build a chat app, I chose twisted and felt comfortable with it, but I run into a strange problem in client tesing code. Here is my server code: from twisted.internet.protocol import Factory from…
allan
  • 59
  • 1
  • 8
2
votes
1 answer

Python telnetlib to connect to Scrapy Telnet to read stats

I have a Scrapy spider running for days. I usually try to check stats as how many items it has scraped and so. I simply run following cmds in terminal and it gives me stats. $ telnet [IP] [PORT] >>> spider.name alf-spider >>>…
Eden Moore
  • 31
  • 5
2
votes
4 answers

How can I read one line from a telnet response with Python?

I was surprised that I couldn't find this question on here. I would like to take extract one line from a telnet response and make it a variable. (actually one number from that line). I can extract up to where I need using telnet.read_until(), but…
mad5245
  • 394
  • 3
  • 8
  • 20
2
votes
1 answer

python3 telnet socket.gaierror: [Errno 8] nodename nor servname provided, or not known

I'm trying telnet to routers based on ip addresses from hosts.txt file via python3 script. However I receive the following error: $ ./telnet_group_1.py 10.1.1.1 Traceback (most recent call last): File "./telnet_group_1.py", line 23, in…
gregi22
  • 21
  • 1
  • 2
2
votes
3 answers

python telnetlib module: reading and waiting for responses

I am having a similar problem to this poster: Python telnetlib: surprising problem Note the response and my response below it. Essentially telnetlib is not letting me read an entire response when calling any of the read functions. when calling…
tSs
  • 125
  • 3
  • 9
2
votes
1 answer

variable length stream records with python regular expression?

I am using telnetlib to telnet my device. the device return variable length records priodically with NO delimeter. every record has a date and time in the begining of itself, which I can use as a delimeter. How can I use Telnet.expect(list[,…
Adel
  • 21
  • 2
2
votes
1 answer

is it possible to authenticate telnet automatically?

When using telnetlib I noticed some interesting variables: AUTHENTICATION = chr(37) # Authenticate XAUTH = chr(41) # XAUTH PRAGMA_LOGON = chr(138) # TELOPT PRAGMA LOGON SSPI_LOGON = chr(139) # TELOPT SSPI LOGON Also, this page lists some RFCs which…
johndodo
  • 17,247
  • 15
  • 96
  • 113
1
vote
1 answer

telnetlib read_until buffer size

Background: I am pulling the connection table of a firewall in order to build a top talkers/listeners list. In some cases, the connection table is 200,000+ entries. I am using telnetlib to remote to the firewall and grab the connection table. I use…
BDub
  • 11
  • 3
1
vote
1 answer

Need tutorial for telnet module in python 3

I just switched from python 2 to python 3. One of my python code written with python 2 failed. The error cannot be understand and I don't want to convert my python 2 code into python 3 compatible version. It would be better if I just rewrite the…
lamwaiman1988
  • 3,729
  • 15
  • 55
  • 87