Hi everyone ^^
I want to programing router moniter.

1)connect cicsco 8 router  
2)show NAT table (# show ip nat translations)
3)search of a IP Address

you send me to a good idea. Thank you.
 
# this is my code. Do you know "--More--" command line passing method?
from telnetlib import Telnet
import sys
import getpass
def Router_Connect(HOST):
    telnet = Telnet(HOST)
    telnet.read_until('Password: ')
    PASSWORD = getpass.getpass()
    telnet.write(PASSWORD + '\n')
    print "Router Connection complete...\n"
   
    cmd = raw_input("Enter your command: ")
    telnet.write(cmd+'\n')
    if telnet.read_until('>'):
        telnet.write('exit\n')
    elif telnet.read_until('--More-- '):
        telnet.write(' ') # Do you know Good idea?
        telnet.write('exit\n')
    return telnet.read_all()

if __name__=='__main__':
    r = Router_Connect('192.168.1.2')
    f = file('capture.txt', 'a')
    f.write(r)
    f.close()
 





Reply via email to