• Support
  • Articles
  • Resources
  • Products

Macro post #1

Moderator: boris

2 postsPage 1 of 1

chinsue32
Newbie

Posts:
12
Joined: Mon Sep 10, 2007 5:50 pm
by chinsue32 » Thu Sep 13, 2007 3:19 am
This is a Macro i made for testing a cisco switch with CiscoIOS.
and just like a child it keeps on growing as i find out new things to do with the teraterm program


Code: Select all

; FOR CUSTOMIZING THIS MACRO ENTER 5 * ( ***** ) INTO FIND (CTRL-F)
connect '/C=4';COM PORT
;showtt 0; HIDES TERATERM WINDOW -- 1 UNHIDES
:start
statusbox 'For password recovery on a cisco IOS switch:\#13\ Hold the mode button while plugging in the switch.  wait for green light to go solid' '*****'

:clearconfig
wait 'switch: '
closesbox
statusbox 'Clearing config' '*****';ENTER COMPANYNAME
sendln 'flash_init'
wait 'switch:'
sendln "del flash:config.text"
wait '(y/n)?'
sendln 'y'
wait 'switch:'
sendln "del flash:vlan.dat"
wait '(y/n)?'
sendln 'y'
wait 'switch:'
sendln 'boot'
closesbox
statusbox 'Booting' '*****'
wait '[yes/no]: ' 'Press RETURN to get started'
send 'n'#13
sendln #13
wait 'Switch>'
sendln 'enable'
closesbox
inputbox 'Enter a Temporary IP address.' '*****';ENTER COMPANYNAME
ipaddress=inputstr
inputbox 'Enter Subnet address.' '*****';ENTER COMPANYNAME
subnet=inputstr
vlan1=""
strconcat vlan1 ipaddress
strconcat vlan1 ' '
strconcat vlan1 subnet
sendln 'conf t'
sendln 'line con 0'
sendln 'logging sync
sendln 'exec-timeout 0 0'
sendln 'int vlan1'
sendln 'ip address ' vlan1
sendln 'no shut'

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;      disable ports 1 - 12
sendln 'interface FastEthernet0/1'
sendln 'shut'
sendln 'interface FastEthernet0/2'
sendln 'shut'
sendln 'interface FastEthernet0/3'
sendln 'shut'
sendln 'interface FastEthernet0/4'
sendln 'shut'
sendln 'interface FastEthernet0/5'
sendln 'shut'
sendln 'interface FastEthernet0/6'
sendln 'shut'
sendln 'interface FastEthernet0/7'
sendln 'shut'
sendln 'interface FastEthernet0/8'
sendln 'shut'
sendln 'interface FastEthernet0/9'
sendln 'shut'
sendln 'interface FastEthernet0/10'
sendln 'shut'
sendln 'interface FastEthernet0/11'
sendln 'shut'
sendln 'interface FastEthernet0/12'
sendln 'shut'
sendln 'interface FastEthernet0/13'
sendln 'shut'
sendln 'interface FastEthernet0/14'
sendln 'shut'
sendln 'interface FastEthernet0/15'
sendln 'shut'
sendln 'interface FastEthernet0/16'
sendln 'shut'
sendln 'interface FastEthernet0/17'
sendln 'shut'
sendln 'interface FastEthernet0/18'
sendln 'shut'
sendln 'interface FastEthernet0/19'
sendln 'shut'
sendln 'interface FastEthernet0/20'
sendln 'shut'
sendln 'interface FastEthernet0/21'
sendln 'shut'
sendln 'interface FastEthernet0/22'
sendln 'shut'
sendln 'interface FastEthernet0/23'
sendln 'shut'
sendln 'interface FastEthernet0/24'
sendln 'shut'
sendln 'end'
wait 'console by console'

:ping

sendln 'conf t'
sendln 'interface FastEthernet0/1'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/1'
sendln 'shut'
sendln 'interface FastEthernet0/2'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/2'
sendln 'shut'
sendln 'interface FastEthernet0/3'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/3'
sendln 'shut'
sendln 'interface FastEthernet0/4'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/4'
sendln 'shut'
sendln 'interface FastEthernet0/5'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/5'
sendln 'shut'
sendln 'interface FastEthernet0/6'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/6'
sendln 'shut'
sendln 'interface FastEthernet0/7'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/7'
sendln 'shut'
sendln 'interface FastEthernet0/8'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/8'
sendln 'shut'
sendln 'interface FastEthernet0/9'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/9'
sendln 'shut'
sendln 'interface FastEthernet0/10'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'
sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/10'
sendln 'shut'
sendln 'interface FastEthernet0/11'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/11'
sendln 'shut'
sendln 'interface FastEthernet0/12'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'


sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln 'conf t'
sendln 'interface FastEthernet0/12'
sendln 'shut'
sendln 'end'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
inputbox 'More Ports?'
if result=0 goto start
messagebox 'Plug in ports 12-24'
sendln 'conf t'
sendln 'interface FastEthernet0/13'
sendln 'shut'
sendln 'interface FastEthernet0/14'
sendln 'shut'
sendln 'interface FastEthernet0/15'
sendln 'shut'
sendln 'interface FastEthernet0/16'
sendln 'shut'
sendln 'interface FastEthernet0/17'
sendln 'shut'
sendln 'interface FastEthernet0/18'
sendln 'shut'
sendln 'interface FastEthernet0/19'
sendln 'shut'
sendln 'interface FastEthernet0/20'
sendln 'shut'
sendln 'interface FastEthernet0/21'
sendln 'shut'
sendln 'interface FastEthernet0/22'
sendln 'shut'
sendln 'interface FastEthernet0/23'
sendln 'shut'
sendln 'interface FastEthernet0/24'
sendln 'shut'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;


sendln 'conf t'
sendln 'interface FastEthernet0/13'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/13'
sendln 'shut'
sendln 'interface FastEthernet0/14'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/14'
sendln 'shut'
sendln 'interface FastEthernet0/15'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/15'
sendln 'shut'
sendln 'interface FastEthernet0/16'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/16'
sendln 'shut'
sendln 'interface FastEthernet0/17'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/17'
sendln 'shut'
sendln 'interface FastEthernet0/18'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/18'
sendln 'shut'
sendln 'interface FastEthernet0/19'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/19'
sendln 'shut'
sendln 'interface FastEthernet0/20'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/20'
sendln 'shut'
sendln 'interface FastEthernet0/21'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/21'
sendln 'shut'
sendln 'interface FastEthernet0/22'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/22'
sendln 'shut'
sendln 'interface FastEthernet0/23'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

sendln 'conf t'
sendln 'interface FastEthernet0/23'
sendln 'shut'
sendln 'interface FastEthernet0/24'
sendln 'spanning-tree portfast'
sendln 'no shut'
sendln 'end'

sendln 'ping'
sendln 'ip'
sendln ipaddress
sendln '100'
sendln #13
sendln #13
sendln #13
sendln #13
wait 'Switch#'

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
timeout=0
:Logging
;showtt 0
; tempstr sets the default path to test docs
tempstr = "C:\Documents and Settings\Geoffrey\Desktop\Test Docs\"

inputbox 'Enter a serial for this test Doc' 'Log Creation'
;add file extention
strconcat inputstr '.txt'
strconcat tempstr inputstr
filename=tempstr
logopen filename 0 0
logwrite '     **********************************************************************'#13#10
logwrite '     **        Company name here                               **'#13#10
logwrite '     **        address                                      **'#13#10
logwrite '     **        city state                                  **'#13#10
logwrite '     **          USA                                                   **'#13#10
logwrite '     **        Phone : ()  , Toll Free : ()  (USA) **'#13#10
logwrite '     **        www.digitalwarehouse.com                                  **'#13#10
logwrite '     **********************************************************************'#13#10
:createtestdoc
timeout=5
send $20
sendln 'show ver'
wait '--More--'
send $20
wait 'Switch#'
logclose

 

boris
Moderator, LogMeTT and TTLEditor developer

Posts:
1618
Joined: Sat Jan 08, 2005 2:52 pm
by boris » Thu Sep 13, 2007 4:08 am
Gary, please surround the macros you post with [code] and [/code] tags, like I did with your last posting. It improves readability of the scripts.
Thanks.
Best regards,
Boris
Display posts from previous:
Sort by:

2 postsPage 1 of 1

Users browsing this forum: No registered users
cron