Over 10 years ago I wrote a small command line utility called “Bouncer” that allowed you to tunnel TCP based connections through a HTTPS proxy server. At the time it was quite popular but as I moved onto other things it got forgotten about. That was until the other day when someone reminded me about it and I went in search of it. After searching through a load of old CD archives, I was able to put my hands on the original source code that was last touched in 2002. I then went about trying to compile it with something written in the current decade (Visual Studio 2012) and after a few updates I was successful.
It basically connects to the proxy and issues the CONNECT command to connect to a host on the outside of the proxy. Once connected it will create a bidirectional tunnel through the proxy from the inside to the outside. Generally proxies aren’t intelligent enough to tell what TCP protocol you are trying to tunnel, but it will usually restrict you to using a destination port of 443 (HTTPS). For the most flexibility you can have an SSH server listening on port 443 on the outside as you can virtually tunnel any TCP based protocol with SSH.
Let’s assume we have an SSH server listening on port 443 on host “outside-server” and we want to tunnel through proxy “proxy” on port 8080. We can run the Bouncer with the following command and when we SSH to “localhost” on port 2222 it will get tunneled through:
bouncer --port 2222 --destination "outside-server":443 --proxy "proxy":8080
There are other options that can be specified – things like restricting access, acting as a Socks 5 proxy instead of specifying a specific destination, becoming a daemon in the background, capturing the session output to a file, running a local web server to view statistics and when tunneling through a proxy it supports Basic, Digest and NTLM based proxy authentication.
However, tunneling through a proxy is optional – you can use it as a simple tool to bounce connections from one port or host to another. You might want to view the data which is passed between two hosts and with the “–capture” option the data can be saved to a local file:
bouncer --port "port" --destination "host":"port" --capture
DISCLAIMER: You use this software at your own risk and I claim no responsibility for any trouble you may get into in using it. This is released for educational purposes only and to place the source code into the public domain. Tools like this are generally frowned upon as they allow people to bypass restrictions that are generally put in place for good reasons.