;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; Copyright 2002 Routrek Networks,Inc. All rights reserved ; Cuscom cisco IOS Router/Switch definition ; Version 0.2 ; $RCSfile: TargetCisco.txt,v $ ; $Revision: 1.6 $ $Date: 2003/05/27 02:02:25 $ ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; RMC configuration example: ; ; copy terminal running-config (then paste this file.) ; set port comN ; set target-type cisco-ios ; set target-login-password ; set target-enable-password ; set target-check ; set network-info-time ; set connect-log ; set spy comN tfl0 ml0 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set user-target-type cisco-ios ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set target-filter cisco-ios tfl0 # All severity (0-7) # $Revision: 1.6 $ $Date: 2003/05/27 02:02:25 $ /%[-a-zA-Z0-9_]+-[0-7]/ # Bad password /% Bad passwords/ ----END OF FILTER---- ; set target-filter cisco-ios tfl1 # High severity (0-2) : emergency, alert, critical /%[-a-zA-Z0-9_]+-[0-2]/ ----END OF FILTER---- ; set target-filter cisco-ios tfl2 # Middle severity (3-5) : error, warning, notification /%[-a-zA-Z0-9_]+-[3-5]/ # Bad password /% Bad passwords/ ----END OF FILTER---- ; set target-filter cisco-ios tfl3 # Low severity (6-7) : information, debugging /%[-a-zA-Z0-9_]+-[6-7]/ ----END OF FILTER---- ; ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ; set target-script cisco-ios login # Login script for Cisco IOS. # $Revision: 1.6 $ $Date: 2003/05/27 02:02:25 $ # # r = retry count set r 3 # Send [enter] and wait password prompt. send "" waitprompt: expect { "assword:" break "#" exit 0 ">" exit 0 "(enable)" exit 0 "--More-- " goto more timeout 10 goto error } # Send password password: send $(TARGET_LOGIN_PASSWORD) expect { ">" exit 0 "assword:" dec r "% Bad passwords" goto password_error timeout 10 goto error } # retry failed. password error if 0 = r goto password_error goto password password_error: exit 3 # quit --More-- prompt more: send "q\c" goto waitprompt error: exit 1 ----END OF SCRIPT---- set target-script cisco-ios command call login timeout 300 # Command loop loop: # send a command one by one ! sendcmd if $? != 0 goto logout_disable gosub wait_prompt goto loop wait_prompt: expect { ">" break "#" break "(enable)" break "Press RETURN" exit 0 "assword:" goto enable_password "% Bad passwords" goto password_error "--More-- " goto more "[yes/no]:" goto confirm "[confirm]" goto confirm timeout 120 goto error } # seems to be a prompt but check interval to confirm. wait_interval: expect { timeout 2 return } goto wait_interval # enable password prompt enable_password: send $(TARGET_ENABLE_PASSWORD) goto wait_prompt # send space to "--More--" prompt more: send " \c" goto wait_prompt # send enter to confirm or yes/no prompt confirm: send "" goto wait_prompt logout_disable: #send "logout" send "disable" expect { ">" exit 0 "Press ENTER" exit 0 timeout 20 goto error } error: exit 1 password_error: exit 3 ----END OF SCRIPT---- set target-script cisco-ios target-check # target-check script for Cisco IOS # set target-script cisco-ios target-check call login logout_disable: #send "logout" send "disable" expect { ">" exit 0 "Press ENTER" exit 0 timeout 20 goto error } error: exit 1 ----END OF SCRIPT---- set target-script cisco-ios network-info # command # Network information command for Cisco IOS (use command script) show version enable # This command is necessary for RMS show config # This command is necessary for RMS write terminal show interface show stack show buffers show controllers show process # This command is necessary for RMS show ip route show ip traffic show ip interface disable ----END OF SCRIPT----