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
0
votes
0 answers

Python telnetlib performance

I've had a task to dump all the keys in memcached and I found script here on stackoverflow to do this: How to export all keys and values from memcached with python-memcache? I modified it a bit to suit my needs and it took "real 5m57.396s" while…
Dmytro Leonenko
  • 1,443
  • 5
  • 19
  • 30
0
votes
1 answer

Python telnetlib read's only print "bs"

I'm trying to do some telnet automation with Python (only pure Python). When I try to print some of my read's in the function read_until, all I see are a series of bs's -- that's bs, as in the backspace character, not something else. :-) Does…
Mike
  • 811
  • 1
  • 10
  • 15
0
votes
1 answer

How to open and search a file in a telnet session with Python

I'm using the following code to log into a server and go to a particular directory (where the logfile I want to search for a string resides). I have accomplished this with the Paramiko module (ssh), fairly straightforward. But the telnetlib module…
suffa
  • 3,606
  • 8
  • 46
  • 66
-1
votes
1 answer

sending a period to end a mail DATA telnet session in python

im using a telnetlib in python to connect to a simple mail server and send out an email; everything works fine until the very end after i enter the DATA command, you submit the body of your message and in order to submit the email in the server's…
mayotic
  • 342
  • 1
  • 3
  • 15
-1
votes
1 answer

How to use telnetlib3 to write and read to/from a telnet connection using python?

I am trying to use telnetlib3 with python 3.8.10 to open a connection, write data to it and try to read the reply. This is the code I am using: reader,writer = asyncio.run(telnetlib3.open_connection(host, port)) writer.write("$SYS,INFO") reply =…
Alex
  • 41,580
  • 88
  • 260
  • 469
-1
votes
1 answer

Telnetlib IAC code not working how they should

I was trying to make an auto break function for network automation with telnetlib, but when i started digging i found out about IAC codes and tried using them but when i type for example tn.write(telnetlib.IAC + telnetlib.DO + telnetlib.TM) device…
-1
votes
1 answer

How can put variable in tn.write?

I want to put a variable in script that i made let's say host = 192.168.1.1 and my comment in the script is : tn.write("cpconf tohost=192.168.200.22:XXX \n") my request : want that instead XXX the variable it is will be host how can do it ? use…
kobilevi
  • 1
  • 3
-1
votes
1 answer

Reading with tn.read in Python

How could I read with tn.read in Python, from the output below, only the "Ont SN" only the thing without what is written in the brackets, so 485754437D85CA9E , "F/S/P" and the "Ont EquipmentID" ? Number : 1 F/S/P :…
snuz
  • 185
  • 12
-1
votes
2 answers

How to open telnet as a textfile rather than a binary file

So I was trying to use the read_until method in telnet but then ran into the error: Traceback (most recent call last): File "c:\Users\Desktop\7DTD Bot\test.py", line 44, in tn.read_until("Please enter password:") File…
Outflows
  • 163
  • 11
-1
votes
2 answers

Trying to get port number (regex)

I got an output over telnet (telnetlib) from a PDU and I am trying to get the port number from the output for each servername. I managed to get the port names by using (?!E000)[A-Z]([^\sPDU]+)\d. I'll be happy for assistance getting the port number…
tabud
  • 1
  • 5
-1
votes
1 answer

how to telnet expect ascii character cli - python 2.7

python telnet conn send {msg}, recv msg log, 1 : ^[]0;ABCD - ABCD - file=/tmp/1234^GConnected to 123.123.123.123 (test=test_ROOT_MO,Context=ABCD,ManagedElement=ABCD)^M 2 : ^M 3 : Last MO: 11668. Loaded 11668 . Total: 11669 MOs.^M 4 : ^M 5 :…
Pyo
  • 1
-1
votes
1 answer

Are my telnetlib imports wrong?

Been having an issue with this code: from telnetlib import Telnet class doTelnet: def login(self): # Configure login variables for input self.user = self.user.encode('ascii') + b'\n' self.password =…
user4404219
-1
votes
1 answer

telnetlib read_until can't work as not sure what hostname to expect

My program requires telnet to a list of suspect devices, however all of their hostnames are different, they do however, follow a suit every time which I shall enclose below. My issue is that the telnetlib requires a read_until argument before it…
Danny Watson
  • 165
  • 5
  • 24
-1
votes
2 answers

another TypeError: a bytes-like object is required, not 'str'

I'm a complete newbie in Python, but I have been programming for fun in (Liberty-)Basic since about 1980. Using Python 3.5.2 I was testing this script: import time, telnetlib host = "dxc.ve7cc.net" port = 23 timeout = 9999 try: session =…
ON5MF Jurgen
  • 113
  • 2
  • 7
-1
votes
1 answer

Telnet Client using PHP

This is my code: $socketConnection = @fsockopen ( "127.0.0.1", "23", $errorNumber, $errorString, 30 ); if ( ! $socketConnection ) { print 'Connection Failed
' . $errorString . '
' . $errorNumber; } else { …
Assad Nazar
  • 1,420
  • 5
  • 20
  • 40
1 2 3
21
22