#1
|
|||
|
|||
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 |
#2
|
|||
|
|||
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:
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 |
#3
|
|||
|
|||
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 |
#4
|
|||
|
|||
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 |
![]() |
Thread Tools | |
Display Modes | |
|
|