VanDyke Software Forums

VanDyke Software Forums (
-   Scripting (
-   -   Looking for a script to automatically configure Local Port Forwarding Automatically (

hanskl 05-17-2021 01:31 PM

Looking for a script to automatically configure Local Port Forwarding Automatically

I'm new to the forums and programing with VBS. So be gentle. I am looking to make it easier for users to connect via ssh to a server and setup an ssh tunnel to that same server.

I want to create a script that new users can run. This scrip would configure a new session if it does not exist and configure Local Port Forwarding for them. I have looked around but have not found any examples in the provided sample scripts. Can someone either point me in the right direction or get me started? Thanks!

bgagnon 05-17-2021 02:05 PM

Hi hanskl,

I am not sure we have any example scripts showing what you have described.

What version of SecureCRT are you using?

On what OS/platform?

What is the purpose of the port forward? Is it just a local port forward?

How would the listening port be determined? Just a random port between 1025 and 65535? Or limited by firewall configuration? Prompt the user?

Please explain in more detail about the interaction between user and script that you are expecting.

hanskl 05-18-2021 08:57 AM

Hey Brenda,

Thanks for your reply.

I will try to answer your questions the best I can.

We are on SecureCRT 8.5.3 running on Windows 10.

Our server is running a VNC service on a port 5901 to 5909. The user chooses which port they would like to use. The user then would have to edit their SecureCRT session to forward that port to their local box. We like to do this for two reasons. One, so that the vnc traffic is encrypted. Second, we have a firewall between the server and client that allows only port 22. When the service is running and the port forwarded the user will start a vnc client on their workstation and point it to the local port that is created by the ssh tunnel.

I was hoping to have a script that would ask the user for a port number and create a session in SecuresCRT and configure the forwarded port. Our users are remote and not very tech savvy. I'm hoping to make the process as easy as I can for them.

I hope this clears things up.



bgagnon 05-18-2021 10:06 AM

Hi Kent,

I hope this clears things up.
Somewhat, thanks!

Is upgrading a possibility? (I am not sure it's necessary, but we did add Python 3 support in v9.0.x. It may just be easier in Python.)

You should be able to check your upgrade eligibility here.

hanskl 05-19-2021 07:00 AM

Hey Brenda,

Yes, I think upgrading to the latest version and do it in python if you think that would be easier.



bgagnon 05-19-2021 08:43 AM

Hi Kent,

Well, we don't write custom scripts so the choice is yours. It does sound like a fun project though so I am willing to help. :)

Would you list (in pseudocode) how you envision the interaction (with as much detail as possible)?

As in:
  • User presses button on button bar to run script
  • They are prompted for port and hostname
  • Session created with local port forward
  • etc.

bgagnon 05-20-2021 03:32 PM

Hi Kent,

Would you email and reference Attn Brenda - Forum Thread #14529? I have some ideas I wanted to discuss and email is just easier. :)

All times are GMT -6. The time now is 01:48 AM.