Concerning the Netcat/Socat utility . From the man page, it seems like it is possible to create a secure proxy using netcat by which I could point my web browser to like a proxy server , that could fork/drive my web traffic through the proxy. Is this possible? Any hints on how to do this? Socat on windows is preferrable but netcat on linux is ok.



Using netcat or socat as proxy will only work for a single website, if at all. This is because your browser can't instruct netcat/socat to connect to a specific target IP. socat's proxy connection functionality is also limited to connecting to a single IP through an existing HTTP proxy.

For an ad-hoc HTTP proxy, use ssh. This will open a socks 5 compatible server on port 8080:

ssh -NCD8080 user@your.proxy.server
  • -N removes shell
  • -C adds compression
  • -D is for socks proxy.

Any browser supporting socks proxy can now connect to localhost port 8080.

| improve this answer | |
  • 1
    I've implemented a patch to allow socat understand SO_ORIGINAL_DST (set by iptables in REDIRECT target), so you may specify "REDIRECT" instead of destination address or port in proxies. I use patched socat myself, but it is quick and dirty and probably not for serious production. May be in the next version this feature will be available out-of-the-box. socat 'tcp-l:1234,reuseaddr,fork' 'socks5:REDIRECT:REDIRECT|tcp:' It also works with HTTP CONNECT proxy. <a href="github.com/vi/socksredirect">link</a> – Vi. Apr 3 '10 at 2:58

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.