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
1
vote
0 answers

Problems decoding old-school BBS ANSI with telnetlib

Was trying to use telnetlib to help me play TradeWars on an old-school BBS. As I recall (this was 30+ years ago) BBS's used some kind of extended ASCII and/or something called ANSI. Made for colorful text and some simple graphics, like edges,…
user3556757
  • 3,469
  • 4
  • 30
  • 70
1
vote
0 answers

TypeError: can't concat list to bytes Python Telnet Error

I have an function that i want to call over CMD in Windows. Problem here is that the function "telnetlib(write)" wants "Bytes". Now if i do the sys.argv i get the error "TypeError: can't concat list to bytes" My Code: import telnetlib import…
BGL
  • 15
  • 6
1
vote
1 answer

Python telnet connection closes

I'm trying to send some commands via telnet to a server. This has been done by hand many times, but I was asked to automate it using python. My code starts like this: import telnetlib HOST = "xxx.xxx.xxx.xxx" PORT = xx print("connecting...") tn =…
1
vote
1 answer

Stuck with read_all() function in Python?

I have written a small code in python to automate the configuration tasks on multiple Cisco routers using telnet library. In the first iteration everything works fine, the problem is I am getting timed out in the second iteration on the function…
Abdul Tayyeb
  • 157
  • 1
  • 2
  • 13
1
vote
3 answers

How to let Python code continue after telnet (telnetlib) timeout

I am using Python for Automated telnet program using telnetlib. The problem is: when the device that I am trying to telnet to doesn't responsd, means timeout; the program gives me timeout message and doesn't continue to next commands. My…
Amr
  • 21
  • 1
  • 3
  • 4
1
vote
0 answers

Ruby and/or python: write telnetdata to file

i have a telnet-server running here (from a vendor) which is implemented in a barcode reader. to get the data, i simply need to connect to the telnetserver port 23 with my telnetclient from commandline. What i want to do is doing this with ruby or…
Peter Core
  • 193
  • 1
  • 2
  • 16
1
vote
1 answer

how do I add a variable into the telnet write command

I've been trying to write a code that allows me to get a file from a telnet server and I want to if we can include variables in telnet write function. Here is my code. import telnetlib import sys import getpass host = "192.168.1.1" tn =…
1
vote
1 answer

Python telnetlib read functions return more data than expected

I'm working on a telnet client for an IBM as400 box and have run into some trouble getting the right amount of data returned. Initially, the program should connect to a telnet session which has a username and password field which it writes to, then…
Bennet Leff
  • 376
  • 1
  • 4
  • 18
1
vote
0 answers

Issues with Python Telnetlib trying to automatize a PDU41001

I am trying to make the Python Telnetlib to work with a PDU41001 switched power bar. I previously tried to interact with the device via putty using telnet and it works fine. In my code, I'm able to connect to the device successfully as the code…
X. Mercure
  • 39
  • 2
1
vote
2 answers

Py telnetlib OKI with 2.7 but error under 3.6

My case is similar to connect Google.com by python 'telnetlib' With python Anaconda 2.7.10 shell I have the blow script that works well: HOST ="www.google.com" tn=telnetlib.Telnet(HOST,"80") tn.write("GET /index.html…
Fabio Pomi
  • 317
  • 1
  • 3
  • 9
1
vote
1 answer

Kill a process in a telnet connection using a python script

I've established a telnet connection and give commands to start following in real time some data. Before closing the connection I have to kill the process first. Manually this can be done with Ctrl+C but I don't know how to do it from .py…
Ramona
  • 11
  • 2
1
vote
0 answers

python telnet and put the message in a particular log file

hi I am coding the python script to login telnet and it has to write log file to op.txt the absolute path is /netperf/mntpt/array1/home/prg_use/op.txt the python code ptlog.py import getpass import sys import telnetlib import time host…
lin Joe
  • 82
  • 1
  • 9
1
vote
1 answer

Unable to telnet to remote host using pythons telnetlib, although bash telnet works

I am using pythons telnetlib as an alternative to the expect shell in unix in order to automate a telnet session. I have tried expect and it works fine, but I want to use the features from python. A normal "telnet HOST PORT" works fine. The…
Grivian
  • 13
  • 3
1
vote
0 answers

Python QT5 with MultiThreading

Dears, I am new on python and trying to start python networking with a simple code that have 2 plain text line edits and try to start 2 telnet sessions and get output of each session on a separate plain text line area however i get the below…
1
vote
2 answers

Let python 3 code continue after telnetlib timeout

I'm trying til load a file with IP addresses, telnet to them, send some commands and save the output.I got it working and the output looks as expected. My problem is, if there is an IP address in the file that in unreachable and telnetlib times out.…
SIMC
  • 13
  • 4