Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Telnet module

Status
Not open for further replies.

jgercken

MIS
Feb 13, 2002
304
US
having problems. Can anyone see where I'm going wrong? It works fine until the read_all() statement(watched it w/ sniffer)

import getpass
import sys
import telnetlib

host = raw_input("Enter target host: ")
user = raw_input("Enter your username: ")
password = getpass.getpass("Enter your password: ")

tn = telnetlib.Telnet(host)

tn.read_until("Username: ")
tn.write(user + "\n")
if password:
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("enable\n")
tn.read_until("Password: ")
tn.write(password + "\n")
tn.write("set length 0\n")
tn.write("set logging session disable\n")
while 1:
command=raw_input("[shell]: ")
telnet.write(command + "\n")
if command == "exit":
break
telnet.read_all()
----------------------------------------
Wasabi Pop Tarts! Write Kellogs today!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top