Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 08-27-2014, 04:54 AM
Add1ct Add1ct is offline
Registered User
 
Join Date: Aug 2014
Posts: 5
using both Automate logon and logon script features

Hi Guys

I've build vbs script to automate logon to Cisco routers with default user/pass and all is good. the issue came up with some of the devices that requires enable password which different in each device.
I noticed I cannot use both "automate logon" feature for each session and a "logon script" to accessing the device , since the first initiated before the logon script.

maybe can I prioritize for some sessions - first run the vbs script and only then run automated logon feature (for specific enable password) ?

Appriciate any help on this, some other creative way maybe.

10x
Reply With Quote
  #2  
Old 08-27-2014, 08:11 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
Hello 10x,

I am a bit confused as to how you are approaching your project.

Are you saying you are pointing to a script in the Logon script field in the Connection / Logon Actions category of SecureCRT's Session Options and that provides the initial authentication to the devices?

Then, for some devices, you need to authenticate for enable mode and that has been configured in the Automate logon area in the same category (in other words, through the Expect/Send sequences)?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 08-27-2014, 02:27 PM
Add1ct Add1ct is offline
Registered User
 
Join Date: Aug 2014
Posts: 5
Hi
First - thanks for your response.

Yes! Exactly as you said.
I pointed to logon script field for initial login to devices with my VB script, then I need to use enable password for some devices so for that I thought to use the automate logon (expect/send). The thing is I get the feeling these sequences beeing ignored when using both features.
Reply With Quote
  #4  
Old 08-27-2014, 03:49 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
Hi 10x,

How do you know when enable mode is warranted?

Is it known by the shell prompt displayed after initial authentication?

I think what would better serve your objective is to have one script. Then, you could code an array of "possible responses" (after initial authentication):

Code:
vPossibleResponses = Array(_
    "#", _ 
    "ogin:", _ 
    "ame:")

If authenticating for enable mode (perhaps cases 2 and 3) is warranted, that path would be taken, otherwise you could continue on with your work on the device:

Code:
    crt.Screen.WaitForString "ogin:"
    crt.Screen.Send "initial username" & vbcr
    crt.Screen.WaitForString "assword:"
    crt.Screen.Send "initial password" & vbcr
    crt.Screen.WaitForStrings vPossibleResponses

        Select Case crt.Screen.MatchIndex
            Case 1
                  ' Do Work
 
            Case 2,3
                  ' Enable mode authentication needed
                  crt.Screen.WaitForString "ogin:"
                  crt.Screen.Send "enable username" & vbcr
                  crt.Screen.WaitForString "assword:"
                  crt.Screen.Send "enable password" & vbcr
            Case Else
                  ' Error handling
         End Select
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 08-27-2014, 10:17 PM
Add1ct Add1ct is offline
Registered User
 
Join Date: Aug 2014
Posts: 5
Quote:
Originally Posted by bgagnon View Post

How do you know when enable mode is warranted?

Is it known by the shell prompt displayed after initial authentication?
Yes. by shell prompt only.

Quote:
Originally Posted by bgagnon View Post
I think what would better serve your objective is to have one script. Then, you could code an array of "possible responses" (after initial authentication):
the problem is that I have maybe an hundred of devices which each one has unique enable password so I dont see the point mentioning in one script all these passwords til the correct one. I just want each session will save specific password for specific device and for initial authentication I can use the same VB script for all sessions.
Reply With Quote
  #6  
Old 08-28-2014, 01:53 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
Hello Add1ct,

You do not have to hard-code the enable password (or any of these values, for that matter).

You can use arguments [ie: crt.Arguments(0)] and then pass in the credentials with the Arguments field available under the Logon script option.

Or you can prompt the user.

See the Prompt() method explanation in the SecureCRT Help topic Scripting / Script Objects Reference / Dialog Object.

Since the secondary authentication is something that is not needed for all connections, the prompting solution would probably work best for you.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 08-28-2014, 03:06 PM
Add1ct Add1ct is offline
Registered User
 
Join Date: Aug 2014
Posts: 5
Quote:
Originally Posted by bgagnon View Post

Or you can prompt the user.

See the Prompt() method explanation in the SecureCRT Help topic Scripting / Script Objects Reference / Dialog Object.

Since the secondary authentication is something that is not needed for all connections, the prompting solution would probably work best for you.
As I understand this prompt function will have to get an input from the user every time in order to pass secondary authentication, correct ? if so - that's not good. I want all will be automated and to avoid memorize all these complex passwords by the user.

appriciate any example If you have.
Reply With Quote
  #8  
Old 08-29-2014, 06:52 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,316
Hello Add1ct,

Those are my only suggestions for what is currently possible.

I have added this thread to a feature request in our product enhancement database for an option for Logon script to run before Automate logon expect/send sequence (Logon Actions). Should a future release of SecureCRT include this feature, notification will be posted here.

If you prefer direct email notification, contact support@vandyke.com and include "Feature Request - Forum Thread #11666" in the subject line.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #9  
Old 08-29-2014, 09:37 AM
Add1ct Add1ct is offline
Registered User
 
Join Date: Aug 2014
Posts: 5
Sure I'll be happy to see this feature implemented in future releases.

Thank you again for your assistence.
Reply With Quote
Reply


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -6. The time now is 11:21 PM.