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 06-01-2017, 10:28 AM
Petecory Petecory is offline
Registered User
 
Join Date: Jan 2013
Posts: 5
SSH Function to try multiple Credentials

I am having an issue with the following Function. If the first set of credentials in my array are successful then everything works fine. If it needs to fall to any of the others it never disconnects and starts again.

I am not sure if I am missing something on this, let me know if you need more of the script and I can scrub it and post it.

Thank You!

Code:
Function ConnectWithSSH2Protocol()

	Dim strLogin
	nCount = 0
	Do While nCount < UBound(vUsername) + 1
	
	strConnectCommand = "/SSH2 /L " & vUsername(nCount) & " /PASSWORD " & vPassword(nCount) & " " & g_strHost & " /ACCEPTHOSTKEYS"
	
	crt.Session.Connect strConnectCommand

	strLogin = crt.Screen.WaitForStrings("#","word:",">",10)
	Select Case strLogin
		Case 1
			crt.Screen.Send vbcr
			Exit Do
		Case 2
			crt.Session.Disconnect
			nCount = nCount + 1
		Case 3
			crt.Screen.Send "enable" & vbcr
			strEnable = crt.Screen.WaitForStrings ("word:","#")
			Select Case strEnable
				Case 1
					crt.Screen.Send g_strPassword & vbcr
				Case 2
					crt.Screen.Send vbcr
					Exit Do
			End Select
		Case 0
			crt.Session.Disconnect
			nCount = nCount + 1
	End Select
	Loop
		
End Function
Reply With Quote
  #2  
Old 06-01-2017, 11:31 AM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi Petecory,

I think I need a little more context. I think this may be better addressed via email. Can you email the entire script and a log of a successful and failed connection to Support@VanDyke.com with "Attn: Eric" in the subject?

To create a log file choose Log Session from the main File menu and select a log file location/name prior to connecting.
__________________
Thanks,
--Eric

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 07:43 PM.