Reputation: 3338
How do I develop an application that modifies all requests to server, listens to local ports, adds headers, and then transfers between client and server?
Upvotes: 0
Views: 727
Reputation: 3214
Grab a copy of mentalis: http://www.mentalis.org/soft/projects/proxy/
It supports SOCKS4/5 as well as HTTP proxy. You can take a look at the source and figure it out - its not that hard.
[EDIT - and if you're specifically looking at implementing SOCKS, you should read the protocol definition: http://www.openssh.org/txt/socks4.protocol. Theres really only one message you need to implement in a basic proxy (CONNECT) and all you do is parse the target IP/port, open a socket and start relaying data to the incoming socket that sent the request.]
Upvotes: 1