Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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

share|improve this question
add comment

1 Answer

up vote 2 down vote accepted

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

Option -N removes shell, -C adds compression, -D is for socks proxy. Any browser supporting socks proxy can now connect to localhost port 8080.

share|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:127.0.0.1:1080' It also works with HTTP CONNECT proxy. <a href="github.com/vi/socksredirect">link</a>; –  Vi. Apr 3 '10 at 2:58
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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