Tue, 14 Mar 2000 12:36:30 -0800
Anyone familiar with telnetlib? I'm trying to write a program that will
telnet to a router, login in as a specified user and run a list of commands
from a file. Right now I have a small telnetlib program that telnets to a
mail server and passes a few arguments, but I don't see anyway for to login
using a username and password to a router. I can do this in perl quite
easily, but I'd like to do it in python as I am scripting a bunch of tools
for my employees to use in python.
Basically the below is what I have now, I haven't started working on passing
commands because I can't even get it logged in yet:
username = "name"
password = "pass"
from telnetlib import Telnet
tn = Telnet('routername', 23)
tn.write('%s\r\n' % username)
tn.write('%s\r\n' % password)
Any ideas? I don't get any error messages, it just hangs.