Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > General

Notices

Reply
 
Thread Tools Display Modes
  #1  
Old 01-09-2017, 12:53 PM
tpaolillo tpaolillo is offline
Registered User
 
Join Date: Jan 2017
Posts: 10
Simple Script for data

Hi, I'm new to this and have looked through a lot of the script examples with no luck.
I'm looking to do a simple task: Run a script that will login to a telnet session USING port 6001 and then running a command.
In the end what would be best would be for a script to run and read the hosts from a file and then send the same command to each site and then save the response to a txt file or something.
Ive seen these scripts but have zero luck getting any of them to work:
https://forums.vandyke.com/showthrea...7294#post37294

No username or password and use port 6001.

Any help would be appreciated and Thanks in advance
Tony
Reply With Quote
  #2  
Old 01-09-2017, 01:39 PM
bgagnon bgagnon is offline
VanDyke Technical Support
 
Join Date: Oct 2008
Posts: 4,636
Hi Tony,

What version of SecureCRT are you using?

On what platform?

You may need to add additional error-checking since you are using Telnet protocol instead of SSH2, but you should be able to edit the script named RunCommandsOnMultipleHostsAndLogResults to suit your needs (if using SecureCRT/Windows).

On line 205 is the connect string. You would change it to be simply:

Code:
strConnectString = "/Telnet " & g_strHost & " 6001"

Quote:
No username or password and use port 6001.
What do you mean by "no username or password"?

That there is not a place in the script to enter authentication credentials?

The Connect() function does handle prompts of "login/Login" or "username/Username", so I think that function will work OK for you with Telnet protocol. Lines 97 and 99 are where you can specify username/password.
__________________
Thanks,
--Brenda

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 05-18-2021, 06:38 AM
mohenoun mohenoun is offline
Registered User
 
Join Date: Nov 2020
Posts: 22
Script works for some hosts but not all

Hello,

I'm stuck on this part, as the script works fine for some hosts but not all.

I connect through a jumpbox and it works fine with the script for some routers and not for other.

I think it has something to do with the way it's connecting.

When I connect to Router A for example manually, I connect through a session to a jumpbox and I get : jumpbox# where I input my command to connect :

jumpbox#ssh -l UID Router

Then I get a prompt to input my password.


Is there a way to replicate the same command below.

I mean is there way to connect directly inputing the password without any interactive keyboard ?

Thanks.

Code:
strConnectString = _
                    g_strFirewall & _
                    " /SSH2 " & _
                    " /L " & g_strUsername & _
                    " /AUTH password,keyboard-interactive /PASSWORD " & g_strPassword & _
                    " " & g_strHost

                strConnectString = _
                    g_strFirewall & _
                    " /SSH2 " & _
                    " " & g_strHost

Last edited by cboyack; 05-18-2021 at 07:06 AM. Reason: Please use [CODE] and [/CODE] tags to denote areas of code
Reply With Quote
  #4  
Old 05-18-2021, 10:56 AM
cboyack cboyack is offline
VanDyke Technical Support
 
Join Date: Apr 2020
Location: Albuquerque, NM
Posts: 132
The difficulty here is that you appear to want to pass things like password information in to your ssh command via scripting, but the OpenSSH-based 'ssh' command itself doesn't support passing in the password on the command line (for security reasons, I'd be willing to wager).

If you need to connect via a jump host running the 'ssh' command, you will have to handle - within the script itself - all the possibilities that could arise from such a command. Much of this is already demonstrated in the "Jump Host - Handle Secondary Host Connection Attempts" example.
__________________
Thanks,
--Cameron

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

Last edited by cboyack; 05-18-2021 at 10:57 AM. Reason: Spelling
Reply With Quote
Reply

Thread Tools
Display Modes

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