How to perform dynamic port forwarding in rust?

58 views Asked by At

I'm pretty new to rust and I'd like to create a small automation app which involves using dynamic port forwarding with ssh.

Let's say I have Computer A , B and C. computer A is my laptop, B is a pass through server and Computer C is my target. Until now I had a huge succession of things to do manually and I want to automate it, so I had to do ,

ComputerA ~$ ssh -D 1080 myUser@ComputerB ; ./myActionOns ComputerC:8888 ; ...

I'd like to know how to perform the same with rust , I looked through ssh2-rs and thrussh but I can't seem to find any methods to do so.

Does anyone know how ?

PS: I can't make any changes to the Computer B the server doesn't belong to me only the computer A and C are mine and computer B owner allows me to perform only ssh.

EDIT: some comments made me realize I needed to add some details, I want to do this in rust because I wanna learn with projects. I don't own the network infrastructure and the owner only allows me to connect to some pc using the ssh passthrough (ComputerB) computerC can actually be a list of multiple computers. my goal is to perform in rust something like this in python: https://github.com/mrluaf/SSH-Tunnel-Dynamic-Port-Forwarding-Python. I'm adding a picturing showing in red what I can't change, my goal is to get a binary I can share that is a all in one solution for my friends.

enter image description here

0

There are 0 answers