1

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.

http://www.dest-unreach.org/socat/doc/socat.html

djangofan
  • 4,182
  • 10
  • 46
  • 59

1 Answers1

4

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.

Pablo A
  • 177
  • 1
  • 9
korkman
  • 1,657
  • 2
  • 13
  • 26
  • 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:127.0.0.1:1080'` It also works with HTTP CONNECT proxy. link – Vi. Apr 03 '10 at 02:58