How To Make ProxyChains

0 votes
asked Sep 3 by tkhasss (220 points)

Hi! Is it possible to make proxychain using your library?

1 Answer

0 votes
answered Sep 3 by Lukas Pokorny (124,570 points)

It's possible to create a proxy chain using Rebex Ssh object's SSH tunneling capabilities. In addition to Rebex component at the client, this also needs three SSH servers (more can be easily added as well).

The client-side code to set up the chain might look like this:

// connect and authenticate to the first SSH sever in the chain
var ssh1 = new Ssh();
ssh1.Connect(server1, port1);
ssh1.Login(username1, password1);

// connect and authenticate to the second SSH server in the chain
// (tunnelled through the first SSH server)
var ssh2 = new Ssh();
ssh2.Connect(server2, port2);
ssh2.Login(username2, password2);

// connect and authenticate to the third SSH server in the chain
// (tunnelled through the first and second SSH servers)
var ssh3 = new Ssh();
ssh3.Connect(server3, port3);
ssh3.Login(username3, password3);

// start local SOCKS5 server whose connections are
// tunneled through the three SSH servers
var tunnel1 = ssh3.StartSocksServer("", 1080);
Console.WriteLine("Accepting SOCKS5 connections at {0}.", tunnel1.LocalEndPoint);

// or start a tunnel from a local port to a specific remote endpoint
// (tunneled through the three SSH servers)
//var tunnel2 = ssh3.StartOutgoingTunnel("", 8080, "", 80);
//Console.WriteLine("Accepting HTTP connections at {0}.", tunnel2.LocalEndPoint);

Console.WriteLine("Press any key to exit.");

Also, make sure to verify the fingerprint or public key of all the SSH servers in the chain to make sure the client is indeed connecting through the expected servers.

Ssh class is provided by Rebex.SshShell assembly, which comes with Rebex Terminal Emulation, Rebex SSH Pack and Rebex Total Pack.

At the server side, any SSH server that supports outgoing tunneling (port forwarding) can be utilized. Most SSH servers support this, but some of them don't enable it by default.

commented Sep 3 by tkhasss (220 points)
i do not have access to servers. i have two http proxies and i want to connect to my target host over those 2 http proxies (me -> proxy1 -> proxy2 -> target host). is that possible?
commented Sep 3 by Lukas Pokorny (124,570 points)
Unfortunately, our libraries don't currently offer any API that could be used achieve that. Sorry!