About the Author

author photo

Joe Harris, CCIE No. 6200 (R&S, Security & SP) is a Systems Engineer with Cisco Systems® specializing in Security. In addition to authoring Cisco Network Security Little Black Book, Joe has also been a technical reviewer for several Cisco Press publications and written articles, white papers, and presentations on various security technologies. He also assists various Certification Partners by beta testing their newest CCIE certification workbooks and has been recognized by Cisco as an SE Wall of Fame award winner.

See All Posts by This Author

SecureCRT Script

So many of you may use SecureCRT ® for your terminal emulator (I do) and you are studying for your CCIE® Lab. If you are and you use a Terminal Server which allows you to connect to it and reverse telnet out to all of the other equipment, you may want to use a script to automate the process of accessing those tty lines from your terminal server so that you don’t have to manually type in the router’s/switches hostname or ip address then hit Ctrl+Shift+6 & X then perform the process all over again for each router/switch. Here is a script that automates the process of accessing those lines and logins into the router/switch for you (assuming no username or password prompt)…The scripts are usually located by default in your C:\Program Files\Secure CRT\scripts folder.

#$Language = "VBScript"
#$Interface = "1.0"

Sub Main

crt.Screen.Synchronous = True

crt.Screen.Send "R1" & vbCr
crt.Screen.Send vbCr
If (Not crt.Screen.WaitForString(">", 1)) Then
crt.Screen.Send vbCr
End If
crt.Screen.Send "en" & vbCr
crt.Screen.WaitForString "#"
crt.Screen.send chr(30) & "x"

crt.Screen.Send "R2" & vbCr
crt.Screen.Send vbCr
If (Not crt.Screen.WaitForString(">", 1)) Then
crt.Screen.Send vbCr
End If
crt.Screen.Send "en" & vbCr
crt.Screen.WaitForString "#"
crt.Screen.send chr(30) & "x"

crt.Screen.Send "R3" & vbCr
crt.Screen.Send vbCr
If (Not crt.Screen.WaitForString(">", 1)) Then
crt.Screen.Send vbCr
End If
crt.Screen.Send "en" & vbCr
crt.Screen.WaitForString "#"
crt.Screen.send chr(30) & "x"

You would just continue to copy each block of code changing the names to reflect the router you are logging into. If you prefer the script to not move the router into enable mode then you can simple remove these line of code:

crt.Screen.Send "en" & vbCr
crt.Screen.WaitForString "#"
crt.Screen.send chr(30) & "x"

and replace them with:

crt.Screen.WaitForString ">"
crt.Screen.send chr(30) & "x"

My routers needed a kick in order to get logged into thus the lines of code that starts with "If" and ends with "End If". Your router(s) may or may not need this line of code.

Comments are closed.