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

Why would python not retrieve telnet data from server that I know is there?

I am trying to query the status from an audio device using the telnetlib in python. When I send command strings to the device via python script, it responds appropriately (changes inputs, volume, etc). I am attempting to query the device status by…
Jay
  • 458
  • 1
  • 5
  • 9
1
vote
1 answer

Telnet and SSH calling in main file, Telnet works but ssh fails

I am new to python, I am writing a script to 'telenet' device IP in some cases and SSH username@deviceIp if telnet faiils.. For all Telnet IP's it work perfectly.. But when i am doing "ssh admin@153.88.127.21" the below code fails and I get error in…
vinod reddy
  • 133
  • 1
  • 2
  • 12
1
vote
1 answer

Sending data from python to an esp over telnet

I'm working on a project that involves sending information from an ESP8266 by TCP/IP over telnet to python, and to be honest its my first time using telnetlib. I wrote this small code for testing, but when I execute it, it returns "'in ' requires…
1
vote
0 answers

Telnet.read_very_eager in FOR loop and the first often returns b' ' while the rest works fine

I'm using Telnetlib to control a VIAVI 5800.Here is my code. And I log results of telnet.read_very_eager. Sometimes the first read returns b'', maybe say it occurs a lot. I really don't understand why only the first read has this problem while the…
1
vote
1 answer

Python for loop: telnetlib into multiple hosts from a text file not working

I'm trying to use telnetlib to telnet into multiple devices from a text file to perform commands. When I connect to the host outside of the for loop, it works fine, but when I put it all in the for loop I get the following error: Traceback (most…
knight
  • 39
  • 5
1
vote
1 answer

Python telnet not showing result

with python script I want to make some configuration on mikrotik routers, looks like script is right and no gives errors but ends without printing command outputs import telnetlib import time dev_ip = "172.16.62.160" user = "admin" PASSWORD =…
1
vote
0 answers

Get output from tn.write() during telnet using telnetlib

tl/dr: Is there a simple way to get a command's output during a telnet session with Python? I am writing a Python script (using 3.4) to automate actions during a telnet session. I want to be able to telnet in, write to the command line to perform…
Ebad
  • 131
  • 11
1
vote
1 answer

Python telnetlib not reading everything

I'm trying to automate the download of Argos data using Python's telnetlib, but I can't seem to figure out how to get it to download all of the output. Part of my problem may be that I don't really understand the seemingly asynchronous nature of…
cswingle
  • 585
  • 1
  • 8
  • 13
1
vote
2 answers

python telnet not pressing enter with "\n"

I am working on a script to pull configs from Cisco devices in GNS3. Currently it is using a hard coded IP & port due to another separate issue but this is the code I am currently using. import getpass import telnetlib print "Getting…
1
vote
1 answer

Robot Framework Telnet: EOFError: telnet connection closed

I am connecting a network switch using telnet, please see my script below. This script keeps showing "EOFError: telnet connection closed" error message after running 80-90 iterations when executing the username command. I searched google and tried…
Passionate
  • 139
  • 1
  • 4
  • 13
1
vote
1 answer

How to use python's sshtunnel to connect to a router running only telnet?

I have to connect to a jumpserver to connect to a bunch of routers running only telnet. I'm new to SSH tunneling, but I've figured out that on the command line on my local machine, the following command forms the necessary tunnel: $ ssh -fNL…
Somenath Sinha
  • 1,174
  • 3
  • 16
  • 35
1
vote
1 answer

Python : get running_config from cisco switch by SSH(Paramiko) OR TELNET(Telnetlib)

I need some help for a script in Python. it works for few times, but I just added some time.sleep() and now the script won't work : It did not connect to switch by SSH or Telnet. I also need some tips to optimize it, because i'm not pro and i would…
S. Me
  • 31
  • 1
  • 9
1
vote
0 answers

Telnetlib doesn't seem to be passing .write commands

I'm a python noob here just trying to learn a new skill so please be gentle :) After executing the following script it appears that my script creates a telnet session and I can see the cisco devices banner but is not passing the username/password…
Andrew Lee
  • 11
  • 1
1
vote
0 answers

Issues using telnet in a function causing code scaling issues python

So I am having some code scaling problems in my VLAN script. Basically I have a function addvlanfunc() that will: telnet into a switch create a vlan exit the telnet session close the telnet session This process repeats on all switches A for loop…
1
vote
2 answers

How to filter python telnet print() output

I have a few projectors that i control with a python script using telnetlib, which works fine. I can also read the telnet output to get the current settings from them. The issue i am having is that the telnet output gives me some unwanted characters…