Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Notices

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 01-28-2019, 09:57 AM
Capt.Picard Capt.Picard is offline
Registered User
 
Join Date: Jan 2019
Posts: 3
sending a password wthin a script

Hi guys,

I have generated a small batch file which loggs me into a remote machine with username and password through SecureCRT(V 7.0.2 Build 418).
Then I have to push "5" and then entering a password with a following RETURN.
For this I have created a script which contains this:

#$language = "VBScript"
#$interface = "1.0"
crt.Screen.Synchronous = True
' This automatically generated script may need to be
' edited in order to work correctly.
' chr(27) = ESCAPE, chr(13) = RETURN
Sub Main
crt.Screen.Send "5"
crt.Screen.Send "password"
crt.Screen.Send chr(13)
End Sub

The remote machine stops with a filled out password field.
For my opinion the "RETURN" hit was not executed or send by SecureCRT. What is worng in this script ?
Please help.
Thanks a lot.
Reply With Quote
  #2  
Old 01-28-2019, 11:18 AM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 441
Hi Capt.Picard,

Are you already connected to a remote host when you run this script?

When I ran the script (after connecting to a remote host) both the "5" and "password" were sent.

What are you expecting to happen when you send the "5"?

Can you provide a detailed description of the manual process that you would take to accomplish this task?

For example, do you have to press "Enter" after pressing the "5" key, or is just pressing the "5" key sufficient?
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 01-29-2019, 03:53 AM
Capt.Picard Capt.Picard is offline
Registered User
 
Join Date: Jan 2019
Posts: 3
sending a password wthin a script

Hi Brittney,

I'm connecting to the remote host with this command:

"C:\Program Files (x86)\VanDyke Software\SecureCRT\SecureCRT.exe" /SCRIPT C:\SecureCRT_Config\Credinv.vbs /SSH2 /L username /PASSWORD password RemoteHost"

5 and password were send, then the remote host stops, and is waiting for a RETURN, which is send by chr(13).
But nothing happens.
Pressing RETURN manually the remote host goes on with the expected procedure.

Any idea, what could be wrong ?
Thanks a lot.
Reply With Quote
  #4  
Old 01-29-2019, 10:41 AM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 441
Hi Capt.Picard,

I wonder if the issue is that the commands are being sent faster than the remote can handle them.

What are your results if you introduce a pause of 250 milliseconds between each Send command? (I set synchronous to false in the example because your script is not waiting for any strings).

For example:
Code:
#$language = "VBScript"
 #$interface = "1.0"
 crt.Screen.Synchronous = False
 ' This automatically generated script may need to be
 ' edited in order to work correctly.
 ' chr(27) = ESCAPE, chr(13) = RETURN
Sub Main
  crt.Screen.Send "5"
  crt.Sleep 250
  crt.Screen.Send "password"
  crt.Sleep 250
  crt.Screen.Send chr(13)
End Sub
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730

Last edited by berdmann; 01-29-2019 at 11:49 AM. Reason: Typo
Reply With Quote
  #5  
Old 01-30-2019, 07:01 AM
Capt.Picard Capt.Picard is offline
Registered User
 
Join Date: Jan 2019
Posts: 3
Hi Brittney,

seems that we are using a "slow" remote host.

crt.Sleep has solved my problem.

Many, many thanks to you.
Reply With Quote
Reply

Tags
vbs scripting

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 01:11 AM.