telnetlib

How to bind an ip address to telnetlib in Python

The code below binds an ip address to urllib, urllib2, etc. import socket true_socket = socket.socket def bound_socket(*a, **k): sock = true_socket(*a, **k) sock.bind((sourceIP, 0)) return sock socket.socket = bound_socket Is it also able to bind an ip address to telnetlib? ...

Python (Django). Store telnet connection

Hello. I am programming web interface which communicates with cisco switches via telnet. I want to make such system which will be storing one telnet connection per switch and every script (web interface, cron jobs, etc.) will have access to it. This is needed to make a single query queue for each device and prevent huge cisco processor ...

Using Python: How can I telnet into a server and then from that connection telnet into a second server?

I am able to establish the initial telnet session. But from this session I need to create a second. Basically I can not telnet directly to the device I need to access. Interactively this is not an issue but I am attempting to setup an automated test using python. Does anyone know who to accomplish this? ...

How to read only last buffer from telnetlib command

Hi, I have following python code: import telnetlib ts = telnetlib.Telnet('192.168.0.2') ts.set_debuglevel(10) ts.read_until("assword:", 5) ts.write("xxxxx\n") ts.write("enable\n") ts.read_until("assword:", 5) ts.write("xxxxx\n") ts.write("term len 0\n") ts.write("show start\n") But how can i read the buffer only from "show start" com...

Python - telnet on routers and list full result (hitting space bar)

import telnetlib def telNetCall(): host = "10.200.1.23" user = "me" password = "matrix" telnet = telnetlib.Telnet(host) telnet.read_until('Username: ', 3) telnet.write(user + '\r') telnet.read_until('Password: ', 3) telnet.write(password + '\r') telnet.write("sh log"+ "\r\n") telnet.write(...

Python telnetlib: surprising problem

I am using the Python module telnetlib to create a telnet session (with a chess server), and I'm having an issue I really can't wrap my brain around. The following code works perfectly: >>> f = login("my_server") #code for login(host) below. >>> f.read_very_eager() This spits out everything the server usually prints upon login. Howeve...