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 05-17-2017, 12:02 PM
ofmanyone ofmanyone is offline
Registered User
 
Join Date: Jul 2013
Posts: 3
Help with AutoResponder Script

Hi. I'm trying to use an AutoResponder script for reverse telnet console connections. I'm not a programmer, just a network engineer. I used the sample script that came with the software.

Scenario: I reverse telnet to a device from a Cisco IOS terminal server in order to gain console access. First, I am prompted for the user/pass of the terminal server. Next, I am prompted for the user/pass of the console device. Sometimes I get an "unprivileged" prompt such as "hostname>", in which case I want to type "enable", then the enable password. Sometimes, there is no device connected to the console cable and the session hangs after the initial authentication. In that case, when the cursor doesn't move for 3 seconds, I want to send the abort sequence "CTRL+SHIFT+6", "X". I also want the script to exit in such a case. Here is my script, which I have tweaked many times with no success. Right now, it won't send the abort sequence if the session hangs. I welcome your thoughts and ideas.

#$language = "VBScript"
#$interface = "1.0"

g_vWaitFors = Array("username:", _
"password:", _
">")

g_vRespondWiths = Array("username", _
"password", _
"en")

Sub Main()
Set objTab = crt.GetScriptTab
bCursorMoved = crt.Screen.WaitForCursor(3)

If objTab.Session.Connected <> True then
crt.Dialog.MessageBox _
"Error." & vbcrlf & _
"This script was designed to be launched after a valid " & _
"connection is established." & vbcrlf & vbcrlf & _
"Please connect to a remote machine before running this script."
Exit Sub
end if
If bCursorMoved = True then
Do
Loop Until bCursorMoved = False
objTab.Screen.Synchronous = true
nIndex = objTab.Screen.WaitForStrings(g_vWaitFors)
objTab.Screen.Send g_vRespondWiths(nIndex - 1) & vbcr
Do
Loop
crt.Screen.Send chr(30) & "x"
crt.Screen.WaitForString "#"
crt.Screen.Send "disc" & chr(13)
crt.Screen.WaitForString "[confirm]"
crt.Screen.Send chr(13)
Exit Sub
End If
End Sub
Reply With Quote
  #2  
Old 05-17-2017, 02:46 PM
ekoranyi ekoranyi is offline
VanDyke Technical Support
 
Join Date: Jan 2017
Posts: 654
Hi ofmanyone,

I don't know that using that particular example script is the best option for your usage. It would help me better understand the requirements if you could provide a log file demonstrating you accomplishing this manually. We prefer to keep logs out of the forums to reduce the risk of accidentally exposing sensitive data. Could you take the below steps to generate a log and email it to Support@VanDyke.com with "Attn: Eric forum post 12704" in the subject.
  • Launch SecureCRT and open SecureCRT's main "File" menu and choose "Log Session..."
  • Specify a path to your Desktop folder and a name of the log file, such as SCRT_Log.txt.
  • Connect to the terminal server and a device.
  • Once you've demonstrated the login procedure disconnect from the session.
  • Go to your Desktop folder and locate the SCRT_Log.txt file. Please send the SCRT_Log.txt file to me as an attachment to your reply. Please don't paste the contents into the body of your message -- please attach it!
__________________
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:57 AM.