views:

55

answers:

1
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('exit' + '\r')
    print telnet.read_all() 

My problem is that when I try to grab "show log" from cisco router, it gives me just partial result, I thing it is because you need to hit space bar 5 times (depends how long is log history) to get full log-when I do it manualy, and I don't know how to tell python to list full log. Any suggestion?

+2  A: 

Not a solution, but seems a plausible workaround:

You can disable terminal paging by issuing the following IOS CLI command.

terminal length 0

CaseyJones
Well this is great workaround :) Tx
Whit3H0rse