VanDyke Software Forums

VanDyke Software Forums (https://forums.vandyke.com/index.php)
-   Scripting (https://forums.vandyke.com/forumdisplay.php?f=14)
-   -   PortForwarding after Jump Server Script (https://forums.vandyke.com/showthread.php?t=13560)

ITEngineering 05-25-2019 04:18 PM

PortForwarding after Jump Server Script
 
Hi - I currently have a simple hta script that connects to a jump server, and then forwards ports. It opens telnet session to a second host that is only reachable from the jumpserver. The host is just a modem . Goal of the script was to telnet to the modem and also pop up the gui interface for the same modem.

For this example the modem i am trying to reach has an ip of 10.20.30.1

This works with kitty command line as:
objShell.Run """c:\Program Files (x86)\KiTTY\KiTTy.exe"" -load jumpserver -L 80:" + 10.20.30.1 + ":80 -L 8080:" + 10.20.30.1 + ":8080 -cmd ""telnet " + 10.20.30.1 + """"

WaitSeconds 3

objShell.Run """C:\Program Files (x86)\Google\Chrome\Application\chrome.exe"" http://localhost --incognito"

The port forwarding for 80 and 8080 is needed to enable the gui access for the modem interface.

What would be the equivalent SecureCRT script command line to connect to a jumphost, forward the ports to 10.30.20.1 , telnet to 10.30.20.1 and then pop the gui window for the modem in the incognito window.

The jumpserver and its credentials dont change.
The only variable is the ip address of whatever modem I am trying to reach beyond the jump server.

Ideally, would like to just copy the modem IP to clipboard prior to running any SecureCrt script and then just run the SecureCRT script that will grab the ip address from the clipboard as a variable.

Any suggestion on the script syntax would be most appreciated.
Using SecureCRT 8.x

berdmann 05-28-2019 10:59 AM

Hi ITEngineering,

I am not very familiar with Kitty. What do you mean by incognito window?

Have you tried accomplishing the task at hand manually with SecureCRT?

If you can provide the steps that you take to accomplish your task manually in SecureCRT in explicit detail, we **may** be able to help you automate the process.

ITEngineering 06-01-2019 02:39 PM

Jump Server with Scripted Port forwarding
 
step1:

add new ssh2 session for a jumpserver with ip of 50.60.70.80
save the credentials for jubserver.

step2: once connected to jumserver - telnet to a modem at 10.20.30.40

step3: login to the gui of the same modem by launching a browser window http://localhost

step 3 wont work unless i first forwar tunnels from that original jumserver session.
right click saved jumserver session
under connection click port forwarding
click add
enter descriptive name : ForwardPort80
check manually enter local ip address
add ip of modem i am trying to connect to 10.20.30.40
add port i need forwarded: 80

add second port i need forwarded :8080

Now that forwarded ports are saved - launch browser to http://localhost to gain access to the gui interface to the modem

What is not clear is if i have the ip address of the modem on the clip board,
how do I automate this with SecureCRT so that the tunnels/portforward get setup with
the modem ip 10.20.30.40

Goal is to have the script opent both a telnet window and a gui window to the same device.

Any suggestions on how to script this in securtCRT would be welcome.

berdmann 06-03-2019 01:50 PM

Hi ITEngineering,

We do not currently have a script example that would help you to accomplish this task. I will get with my colleagues during our free cycles to see if we are able to come up with one.

I will post here to let you know if we are able to find a scripted solution!

ITEngineering 06-03-2019 02:51 PM

Thanks for your reply - it appears earlier thread has some elements of the fix for automating the port forwarding. Its not clear yet how I would incorporate clipboard contents as the variable ip address that I want to add the forwarded tunnels with.

Earlier thread was https://forums.vandyke.com/showthread.php?t=3651

berdmann 06-06-2019 02:00 PM

2 Attachment(s)
Hi ITEngineering,

We were able to come up with a solution using a Dependent session that has been configured for dynamic port forwarding, along with a short script that handles the telnet and web browser connections.

Please refer to the following steps:

1. Create and save a session in SecureCRT to your jumpserver, named "Jumphost". Save your authentication credentials and ensure that you can connect without issue.

2. Open Session Options for "Jumphost", navigate to the "Port Forwarding" category and press the "Add" button.

3. Configure the "Local Port Forwarding Properties" like so:

https://forums.vandyke.com/attachmen...achmentid=1703

4. Make sure that you save your changes by pressing the "OK" button:

https://forums.vandyke.com/attachmen...achmentid=1705

5. Download and save the attached script (LaunchTelnetAndChromeConnectionsToHost.txt) and configure a button in SecureCRT to run the script.

Please refer to the "SecureCRT's Button Bar" YouTube video for additional information:

https://www.youtube.com/watch?v=olyCcUWRimI&t=176s

If you have followed these steps accurately you should be able to copy the IP address of the destination remote to the clipboard, press the button and get connected!


All times are GMT -6. The time now is 03:21 AM.