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-27-2017, 04:04 PM
Rhudi's Avatar
Rhudi Rhudi is offline
Registered User
 
Join Date: Jul 2013
Location: Greenville, SC
Posts: 97
/TELNET instead of /SSH ?

I can open and AdHoc SSH session like this:
Code:
SecureCRTCMD = SecureCRTEXE & " /SCRIPT " & Chr(34) & Script2Run & Chr(34) & SecureCRTLogging & " /SSH2 /password " & sRSAKey & " /L " & Environ("USERNAME") & " " & strFQDN
SecureCRTEXE points to the EXE file.
Script2Run is the full path to a valid script.
SecureCRTLogging has all the options to create my AdHoc log file that contains the device I'm accessing.
sRSAKey is a fresly entered Token.
strFQDN is the name of the device.

The variable SecureCRTCMD gets called to start SecureCRT.

How do I send user/pass for TELNET via command line using an AdHoc session? The password is an ever changing RSA Token.
Reply With Quote
  #2  
Old 01-28-2017, 10:43 PM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 1,099
The Telnet protocol itself doesn't do authentication. What does authentication is the remote system prompting for login and password -- has nothing to do with SecureCRT's end of the protocol. This is different from the SSH1/2 protocol in that the protocol actually has a mechanism for performing authentication (before a shell process gets created on the remote side).

In Telnet, you have to wait for the remote to send a login prompt, then send your login; then wait for a password prompt and submit the password.

Your script can handle this if you make it.

/Script myscript.vbs /ARG arg1 /ARG arg2 ...

Then within your script code, you know what the first arg means, 2nd arg, etc.

crt.Arguments.Count will give you the number of args.

crt.Arguments(0) gives you the first arg, etc.

--Jake
__________________
Jake Devenport
VanDyke Software
Technical Support
YouTube Channel: https://www.youtube.com/vandykesoftware
Email: support@vandyke.com
Web: https://www.vandyke.com/support
Reply With Quote
  #3  
Old 01-29-2017, 09:17 PM
Rhudi's Avatar
Rhudi Rhudi is offline
Registered User
 
Join Date: Jul 2013
Location: Greenville, SC
Posts: 97
Thanks! That makes sense.
Reply With Quote
  #4  
Old 01-30-2017, 02:32 PM
Rhudi's Avatar
Rhudi Rhudi is offline
Registered User
 
Join Date: Jul 2013
Location: Greenville, SC
Posts: 97
ok! I did it a different way, that I'm used to. Not using "/ARG". I'm using the Clip Board.

This is only a code fragment. It doesn't show how I'm setting up variables, or the "doClip" object.

What the section of my code is actually doing... I'm logging on to an Ethernet Switch and pulling a mac-address-table that comes back through the Clip Board.

When I call Secure CRT (from within Excel) I have some code like this:
Code:
Public Const SecureCRTEXE$ = "C:\Program Files\VanDyke Software\SecureCRT\SecureCRT.exe"
' ...
SecureCRTLogging = " /LOG " & Chr(34) & Environ("USERPROFILE") & "\SecureCRT Logs\" & Environ("USERNAME") & "\%Y-%M-%D.%h.%m - " & "MAC List - " & strSwitchName & " -- (" & Environ("USERNAME") & ").log" & Chr(34)
Select Case sMode
    Case "SSH"
        SecureCRTCMD = SecureCRTEXE & " /SCRIPT " & Chr(34) & Script2Run & Chr(34) & SecureCRTLogging & " /SSH2 /password " & sRSAKey & " /L " & Environ("USERNAME") & " " & strSwitchName & ".us.windstream.net"
    Case "TELNET"
        SecureCRTCMD = SecureCRTEXE & " /SCRIPT " & Chr(34) & Script2Run & Chr(34) & SecureCRTLogging & " /TELNET " & strSwitchName & ".us.windstream.net"
End Select
doClip.SetText sMode & "," & strSwitchName & "," & Environ("USERNAME") & "," & sRSAKey
doClip.PutInClipboard
' ...
varproc = ShellAndWait(SecureCRTCMD, 0, vbNormalFocus, 2)
"ShellAndWait" is code I found online that does what it's name implies.
Reply With Quote
Reply

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:28 PM.