McD has asked for the wisdom of the Perl Monks concerning the following question:
This humble *nix Perl hacker has strayed into an unholy land - Win32 - and has there been laboring to bring forth a simple proxy application for a simple network protocol (in Perl, of course). Thus far, to my delight, my work yields good fruit, and I hope to make it available soon.
My proxy is very simple, as I said: it listens on a port on localhost for new client connections, and when it gets one, it opens a corresponding socket to the sever. Then it simply passes the data, back and forth, between them. The clients are Win32, on the localhost, the server is elsewhere, and my proxy just needs to get in the way. (Ok, yeah, sometimes it does interesting or useful stuff to the data mid-flight. That's what proxies are for, right? But that's not important here.)
But a devil has been whispering in my ear.
The clients are already configured, before my proxy comes along, to talk to the server. So to use my proxy, you need to configure him to know the server name too, then go back to your client and change the server to localhost. Bah. It works fine, but it's hassle.
Which leads me to consider - and this is doubtless the suggestion of my Enemy, meant to keep me from ever finishing this noble work - wouldn't it be nice if this were a TRANSPARENT proxy?
You know - ANY outbound connection from this host on the port in question would be silently intercepted by my proxy, and we're off to the races from there. He'll connect to the server you asked for and proxy the data as usual.
So my question then is: Is it (possible|feasable|easy) to implement a transparent proxy in Perl on Win32?
This is often done on various Unix platforms easily enough, where we have all kinds of ways to muddle about in the protocol stack, etc. But can it be done on Win32? And in Perl?
I've found precious little on this topic, so I'm asking here for the counsel of the Win32 seers among our numbers. I found a post suggesting it could be done using the "Layered Service Provided (LSP) which is part of the Winsock Service Provider Interface (SPI)." Deep black magic. I wondered if winpcap might be useful here. None of the usual suspects (CPAN, Usenet, Google, etc) have been much help so far.
Thanks in advance for any and all insight.
Peace,
-McD
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Transparent Network Proxy on Win32?
by Jaap (Curate) on Jul 31, 2002 at 11:53 UTC | |
by McD (Chaplain) on Jul 31, 2002 at 12:38 UTC |