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
1 answer

Python telnet script with two login passwords input?

This is the first time I am using python so please help... :) This telnet script works fine for me if I know the correct password, but the router on 192.168.1.1 will sometimes boot up with the password: password1 and sometimes with the password:…
BoardID
  • 3
  • 2
0
votes
1 answer

TypeError: 'in while send cmd via python telnet

I tried to send ls / cmd via python telnet import telnetlib tel = telnetlib.Telnet('10.10.0.1'.'1234') tel.write('ls / ') But I got an error : if IAC in buffer: TypeError: 'in ' requires string as left operand, not bytes
MicrosoctCprog
  • 460
  • 1
  • 3
  • 23
0
votes
2 answers

telnetlib execution not responding and timing out

I've been trying to connect to a telnet service via telnetlib for a few hours now. I've been trying to use telnetlib to read content and interact with the remote service. I've been using this code for testing purposes (with Python version…
casimir
  • 511
  • 1
  • 4
  • 10
0
votes
1 answer

How to create a list dict dynamically with Python

I have this input to handle: ['', '', '', '', ' Huawei Integrated Access Software (MA5600T).', ' Copyright(C) Huawei Technologies Co., Ltd. 2002-2014. All rights reserved.', '', ' …
snuz
  • 185
  • 12
0
votes
1 answer

Python Threading and Telnet unexpected results

I wrote a script that telnets to some network equipment and pulls the inventory and places it in a file. I used threading to speed up the script as I have around 160 nodes. I wrote a function that telnets to each node, retrieves the inventory,…
0
votes
1 answer

Trying to make asyncio working with telnetlib

I'm having a hard time trying to make asyncio working with telnetlib for interrogate some hardware. I think I clearly don't understand the way asyncio is working and I'm a completely lost in all of this. It's really unclear. My basic version (which…
0
votes
0 answers

Python3 telnetlib ConnectionRefusedError: [Errno 111] Connection refused error

from random_open_port import random_port import telnetlib HOST = 'localhost' # Accepting clients from any IP addresses PORT = random_port() tn = telnetlib.Telnet(HOST) It returns the error Connection Refused
Scrox
  • 1
  • 2
0
votes
0 answers

Make a file that executes a command through telnet?

I am new here, so please excuse some of my mistakes :D I want to turn my Yeelight light bulb (compatible with Google Home/Wifi/LAN) on and off by simply pressing a key on my keyboard. The only thing I need, is a file which connects to the light bulb…
wNdg
  • 1
0
votes
0 answers

Python Telnetlib validating login not working

I'm writing a code in Python3 that login into routers and switches, with different user/password (try next user if the previous is wrong) and different vendors (cisco, huawei, juniper, etc), some use SSH and others use Telnet. With SSH (paramiko),…
0
votes
1 answer

Parsing raw TCP data line by line in Python

I'm getting stock market data via TCP. I'm trying to connect with Python to the broker, e.g. via Telnet (telnetlib) with read_eager() or via socket with socket.recv(). This is how the output looks…
featMarcel
  • 23
  • 4
0
votes
1 answer

python telnetlib.telnet() not connecting using variables

I am working on a script to pull configs from Cisco devices in GNS3. The script should be looping through a text file and slicing the IP & Port from each line into variables. These variable are then fed into the telnet connection as the IP & Port…
0
votes
0 answers

Why am I getting an error when connecting to telnet?

So whenever I run my script I end up getting this error: 2020-03-12T17:59:51 8100.701 ERR IOException in ReadLine for TelnetClient_127.0.0.1:55356: Unable to write data to the transport connection: An established connection was aborted by the…
Outflows
  • 163
  • 11
0
votes
0 answers

Python Telnet block when i get press a key

I'm using telnetlib python to configure my cisco router , i want to "auto" pass a message of "press a key to continue.." because it gets stuck .Is there a command to do that ?
Bad-3
  • 25
  • 6
0
votes
2 answers

Checking ip:port is open on remote host

I have a list of servers and ip:ports (external addressses) and i need to check if each server can connect to those addresses. Looping through the file and trying to open an sshtunnel and doing connect as below tunnel=sshtunnel.SSHTunnelForwarder( …
zkssyth
  • 31
  • 3
0
votes
2 answers

Is there any way to put a variable inside telnet command in python?

is there any way to put the variable posorprom inside the telnet command in python? Here is a peace of my code: posorprom = prom tn.write(b"ls /mnt/flash/prom | wc -l\n") i want to put the variable posorprom inside the command, so i already tried…
Mario
  • 1
  • 1