View Single Post
  #4  
Old 06-05-2019, 10:10 AM
jdev's Avatar
jdev jdev is offline
VanDyke Technical Support
 
Join Date: Nov 2003
Location: Albuquerque, NM
Posts: 922
Quote:
Originally Posted by ecox View Post
So my plan is:
-I am already connected to a Jumpserver
-From this Jumpserver, should happen to the following:

all in only one session
Code:
ssh -l admin 1.1.1.1
*automatic login
uptime
*disconnect or quit, exit
*write down the results in a *.txt-file or whatever
*then connect to the next-device (hosts.txt)
ssh -l admin 1.1.1.2
*automatic login
and so on....
...
...
How can I implement this?
Where can I select the "saved session" for this script?

You wouldn't select any saved session to connect with; before running the script, you'd already be connected to your jump host, right?

I gave some clues on how you could implement it, generally, in my last message. Here's a review of what I wrote:

Quote:
Originally Posted by jdev View Post
There are bits and pieces, however, which you could put together and use to roll your own solution using this script as your base starting point...
One approach would be:
  1. Modify the base script's Connect() function (it's defined within the script file itself) to run your 'ssh' or 'telnet' command to get to the specified host instead of calling crt.Session.ConnectInTab()
  2. Hint: Use the approach exemplified in this other example script, "Example: Jump Host - Handle Secondary Host Connection Attempts" to handle the secondary host connection and authentication.
  3. Modify the part of the base script which currently tells the tab's Session object to Disconnect() to instead send "exit" & vbcr, and wait for your jump host's shell prompt to appear so that the script knows when it's appropriate to move on to the next host in you hosts file.
In other words, your entire Connect() function in the RunCommandsOnMultipleHostsAnLogResults script would be replaced. Instead, you'd structure it to 'connect' with your "ssh -l admin" command to the specified host (passed in as an argument to the function), driving the connection and authentication process as described/demonstrated in the aforementioned Example: Jump Host - Handle Secondary Host Connection Attempts.

What specific problem are you having with this suggested approach?

Where, specifically, are you stuck?

--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