Welcome to the VanDyke Software Forums

Join the discussion today!


Go Back   VanDyke Software Forums > Scripting

Reply
 
Thread Tools Rate Thread Display Modes
  #1  
Old 05-25-2019, 04:18 PM
ITEngineering ITEngineering is offline
Registered User
 
Join Date: May 2019
Posts: 3
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
Reply With Quote
  #2  
Old 05-28-2019, 10:59 AM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 253
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.
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #3  
Old 06-01-2019, 02:39 PM
ITEngineering ITEngineering is offline
Registered User
 
Join Date: May 2019
Posts: 3
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.
Reply With Quote
  #4  
Old 06-03-2019, 01:50 PM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 253
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!
__________________
Thanks,
--Brittney

VanDyke Software
Technical Support
support@vandyke.com
(505) 332-5730
Reply With Quote
  #5  
Old 06-03-2019, 02:51 PM
ITEngineering ITEngineering is offline
Registered User
 
Join Date: May 2019
Posts: 3
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
Reply With Quote
  #6  
Old 06-06-2019, 02:00 PM
berdmann berdmann is offline
VanDyke Technical Support
 
Join Date: Aug 2017
Posts: 253
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:



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



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!
Attached Images
File Type: png PortForwardingProperties.png (37.7 KB, 85 views)
Attached Files
File Type: txt LaunchTelnetAndChromeConnectionsToHost.txt (698 Bytes, 241 views)
__________________
Thanks,
--Brittney

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


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
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 03:17 PM.