Quantcast
Channel: IEOC - INE's Online Community
Viewing all articles
Browse latest Browse all 10744

Login script for SecureCRT MAC(Python script)

$
0
0

All,

I haven't seen many python scripts on the forum for the security rack, and I wanted a way to automate my logins to the racks.

 

In order to use this script your'll need to create a session for each device in the security rack.  The sessions need to be named exactly like the list you see when you telnet into the rack.  For example, R1, R2, R3, SW1, SW2, etc.

Set the destination as racks.ine.com on port 23.  Use the logon actions to send the username and password.  Once you set this up once, you can modify the username and password for all the sessions at once by selecting them all from the sessions window and right clicking->properties.  It will be a multi-item edit.

Next, set the logon script attribute and point it to the file you will create below.

 

Here is the login script.

# $language = "Python"
# $interface = "1.0"



def main():

    crt.Screen.Synchronous = True

    myname= crt.Session.Path
    if myname=="R1": sel="1"
    if myname=="R2": sel="2"
    if myname=="R3": sel="3"
    if myname=="SW1": sel="4"
    if myname=="SW2": sel="5"
    if myname=="ASA1": sel="6"   
    if myname=="ASA2": sel="7"
    if myname=="ASA3": sel="8"
    if myname=="ASA4": sel="9"
    if myname=="R4": sel="10"
    if myname=="R5": sel="11"
    if myname=="R6": sel="12"
    if myname=="SW3": sel="13"
    if myname=="SW4": sel="14"
    if myname=="IPS": sel="15"
    if myname=="SW5": sel="16"
    if myname=="WLC": sel="17"
    if myname=="LWAP": sel="18"
    if myname=="SW6": sel="19"
    if myname=="R7": sel="20"
    if myname=="ACS1": sel="21"
    if myname=="ACS2": sel="22"
    if myname=="ISE1": sel="23"
    if myname=="ISE2": sel="24"
    if myname=="WSA": sel="25"


    crt.Screen.WaitForString("Selection:")
    crt.Screen.Send(sel+"\r")

    crt.Screen.Synchronous = False


main()

Save this wherever you want, named login.py(or anything.py).  Just make sure to point your logon script to this file.

 

Now try to login.  You'll find that it will use the username and password from the logon actions, then uses the script to determine your session name and enters the appropriate number for the device.  You are ready to rock!
-Dan

 


Viewing all articles
Browse latest Browse all 10744

Trending Articles