Hi there, This works (but bear in mind I'm about only 30 minutes into my Python adventure...):
------ def connect(host): tn = telnetlib.Telnet(host) return tn def login(session,user,password): session.write("\n") session.read_until("Login: ") session.write(user + "\n") session.read_until("Password: ") session.write(password + "\n") session.read_until("#") def apply_command(session,command): session.write(command + "\n") response = str(session.read_until("#")) return response def cleanup(session): session.write("exit\n") session.close() tn = connect(1.1.1.1) login(tn,user,password) directory = apply_command(tn,"ls -l") kernel_release = apply_command(tn,"uname -r\n") cleanup(tn) ------ You'd probably need to apply a regex to the output of the apply_command method for it to make sense, and I am confident there is a much, much better way to do this! Cheers SM
-- http://mail.python.org/mailman/listinfo/python-list