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-08-2018, 09:10 PM
Connor Connor is offline
Registered User
 
Join Date: Mar 2018
Posts: 3
My logon script wont get to the third credential tuple

Hi there,

I've been trying to fix this for months so any help would be appreciate.

The below logon script will attempt the first and second set of credentials but will then stop at the 3rd on every site for some reason, I do not know why.


Code:
Credentials = [['username1', 'password1'],   # <- Will always attempt this set. 
               ['username2', 'password2'],   # <- Will always attempt this set. 
               ['username3', 'password3'],   # <- wont attempt this credential set and exists script
               ['username4', 'password4']]   

			   
def connect():

	host2 = crt.Dialog.Prompt("Ip?: ", "Host IP", "", False)
	host = host2.strip()
	

	for x,y in Credentials:
	
		cmd = "/SSH2 /L %s /ACCEPTHOSTKEYS /PASSWORD %s /C 3DES /M SHA1 %s" % (x, y, host)	
		tab = crt.Session.ConnectInTab(cmd, False)
		tabactual = tab
		
		tabactual.Screen.Synchronous = True
		tabactual.Activate()
		
	
		if (tabactual.Screen.WaitForString("Password authentication failed", 6) == True):
			tabactual.Screen.SendSpecial("MENU_TAB_CLOSE")
		else:
			return

connect()
Reply With Quote
  #2  
Old 08-09-2018, 07:49 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,500
Hi Connor,

What version of SecureCRT are you using?

Quote:
The below logon script will attempt the first and second set of credentials but will then stop at the 3rd on every site for some reason, I do not know why.
What do you mean by "will stop at 3rd"?

Is Cancel available in the Script menu?

If so and you choose it, what's the error?
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 08-09-2018, 12:20 PM
Connor Connor is offline
Registered User
 
Join Date: Mar 2018
Posts: 3
Reply to brenda

Quote:
Originally Posted by bgagnon View Post
Hi Connor,

What version of SecureCRT are you using?



What do you mean by "will stop at 3rd"?

Is Cancel available in the Script menu?

If so and you choose it, what's the error?


Hi Brenda,

I'm using version 8.0.2

So my script will stop running at the 3rd set of credentials. This means that if it is able to authenticate on the 1st of 2nd set it will connect, but it will stop running before it enters the 3rd set of credentials (username 3 and password 3)

While the script is running the cancel option is available yes, but after the 1st and 2nd set of credentials have been attempted this will no longer be available and I will be left with a password authentication failed error.


"Password authentication failed.
Please verify that the username and password are correct.
Password:
"


If I cancel the script while it is running I get the error
"Script cancelled

file c:\ (script path)
line 38
"
Reply With Quote
  #4  
Old 08-09-2018, 01:35 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,500
Hi Connor,

What is the output you are seeing in the terminal window?

What if the remote server is only allowing two authentication attempts?

Then you would not expect to get the user/password prompt again...
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 08-09-2018, 03:40 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,500
Hi Connor,

I cannot replicate those results. Are you starting SecureCRT from the command-line with the /Script option?

It's not really clear to me why you are taking the "connect string" approach, as opposed to a loop where you just try the credentials "in-line" (ie: using Send() and WaitForString()) ...

Please send the explicit steps to replicate along with Trace Options output from the connection attempt(s). Since it appears you are making ad hoc connections via the script, you will have to enable Trace Options output from the Default.ini file found in the Sessions subfolder of SecureCRT's config folder:
  • Take note of SecureCRT's config location in Global Options -> General / Configuration Paths category

  • Close SecureCRT

  • Edit the Default.ini file:
D:"Trace Level"=00000000
to
D:"Trace Level"=00000001

  • Launch SecureCRT and take steps that replicate the issue
Since trace options can contain sensitive information, feel free to send it as an attachment via email to support@vandyke.com. Please reference "Attn Brenda - Forum Thread #13208" in the subject line.

NOTICE: The requested troubleshooting data may include sensitive information (usernames, passwords, publicly-accessible host names or IP addresses, etc.).

Please redact sensitive information that would not be appropriate for email communication prior to sending the requested information.

If there is sensitive information that must be conveyed in order to provide a complete picture of the scenario you're facing, please let us know and we will set up a secure upload mechanism that can be used.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #6  
Old 08-09-2018, 03:47 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,500
Hi Connor,

Are you getting prompted if you want to disconnect the failed tab before it moves on to connecting in a new tab?

If so, what are you choosing? (Yes or No)
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #7  
Old 08-09-2018, 04:28 PM
Connor Connor is offline
Registered User
 
Join Date: Mar 2018
Posts: 3
Quote:
Originally Posted by bgagnon View Post
Hi Connor,

Are you getting prompted if you want to disconnect the failed tab before it moves on to connecting in a new tab?

If so, what are you choosing? (Yes or No)

Hi brenda, no I am not getting prompted before I exit the tab. I have disabled this in global options > general > Show confirm disconnect dialog. I also enabled

global options > terminal > connect sessions in tabs
global options > default session options > connection > logon actions

As to your previous reply, I have sent you the trace

And the reason I am not using inline commands is that I found it did not work when I already had multiple tabs open before starting the script, the script would then try to run the inline commands on the tab I already have open instead of the new one. Presumably because it didn't know which tab to run the commands on.
Reply With Quote
  #8  
Old 08-10-2018, 07:47 AM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 3,500
Hi Connor,

Thanks for the additional info. I've replied to your email. Once we get this issue sorted, I will post a follow-up here.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
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 05:44 PM.