General Discussions

Proxies – bwoogie

bwoogie

Member

Posts: 380
From: kansas usa
Registered: 03-12-2005
Hey gang,
I'm needing to write a proxy. I'm going to use it on the network to filter web content. I'll be writing this in vb.net and I've played around with some simple examples but they don't seem to be working correctly.

I can receive the request from the browser, but I don't know how to send the data back to the browser. I don't know if I am supposed to send it back through the same port I received it from and if I need to send the browser a header etc. etc. etc.

I've looked for information on the dirt of how proxies work, but all I can find is "browser sends request to proxy, proxy send request to server blah blah blah" I need to know some real, hardcore information on how they truly work and tick.

Can anyone give me some information on how to make a proxy?

------------------
~~~boogie woogie woogie~~~
Jesus didn't come to save the saints.

kenman

Member

Posts: 518
From: Janesville WI
Registered: 08-31-2006
I have done this. I currently use this in one of my commercial products so I do not want to put the code here so I sent a PM. Ken
HanClinto

Administrator

Posts: 1828
From: Indiana
Registered: 10-11-2004
Interesting. I've recently started writing, not a proxy, but a web-page logging program to be used for browsing accountability (similar to Covenant Eyes or x3watch), but I'm wanting to make it cross-platform for Windows, Mac and Linux. I've settled on using the libpcap library, and it's extremely powerful and well-suited to what I'm wanting to do with it.

That doesn't help you with proxy stuff, though since it was on a related topic, I thought I would bring it up. I'll likely make another post about it sometime to see how much interest there would be in such a thing.

Cheers!

--clint

bwoogie

Member

Posts: 380
From: kansas usa
Registered: 03-12-2005
Kenman, interesting project you have there. But a separate browser not really what I want.

Clint, that sounds cool too. I will eventually make my filter software cross-platform as well, ... if I ever get it to work on windows first!

------------------
~~~boogie woogie woogie~~~
Jesus didn't come to save the saints.

bwoogie

Member

Posts: 380
From: kansas usa
Registered: 03-12-2005
Just dropping by to say I've got this project moving along nicely now. Yes, yes! It's moving! So far it has problems with IE. Sometimes it will work but most the time it just doesn't play well. Firefox on the other had works great. -- as long as IE doesn't have a proxy set up. So, some how IE is screwing around with everything.

Anyways, Does anyone know how I can make this work with out setting it up as a proxy? I need this to work in a way that people can't just turn it off. How can I make the filter jump out in front of incoming web requests so I can check the page to make sure it's ok to view?

------------------
~~~boogie woogie woogie~~~
Jesus didn't come to save the saints.

HanClinto

Administrator

Posts: 1828
From: Indiana
Registered: 10-11-2004
quote:
Originally posted by bwoogie:
Anyways, Does anyone know how I can make this work with out setting it up as a proxy? I need this to work in a way that people can't just turn it off. How can I make the filter jump out in front of incoming web requests so I can check the page to make sure it's ok to view?

Aaah. This is quite a bit trickier to do.

I've looked into doing this same thing before, and the only lead that sounded promising to me was to write it as a hook that inserts itself as a hook into the TCP/IP protocol stack. This is the same technique that firewalls use to block incoming/outgoing requests. On POSIX systems (Linux/BSD/Unix), I *think* these are called PFIL hooks. I'm trying to remember what they're called on Windows...
*spends a few minutes on Google...*

Okay. A thing that looks like a good start might be this overview from NDIS called Windows Network Data and Packet Filtering. It goes over what methods there are for packet filtering on Windows XP and 2000.

There is an extremely good looking article on Code Project called An Adventure: How to implement a Firewall-Hook Driver?, and it looks like it might be a great sample project for you to start with.

Microsoft also has a long document explaining how the Windows Firewall works, but that might be less relevant to you.

Something else that looks good is called "IP Firewall Hook", it's supposedly an open-source COM component that can be used to develop firewall apps, but it looks like the homepage is down. However, I think I found it available for download here should you like to try it out.

Okay, that's enough for now -- hopefully I didn't swamp you with information.

Cheers!

In Christ,
clint

Edit: This Microsoft article looked too good to not pass on -- it's more of an official document on how to implement Firewall apps.

[This message has been edited by HanClinto (edited May 01, 2007).]

bwoogie

Member

Posts: 380
From: kansas usa
Registered: 03-12-2005
No! That's great! I can use as much info as I can get my grubby little hands on. Only thing is, if you have to write a driver - i has to be done in c++. That could be a problem.

------------------
~~~boogie woogie woogie~~~
Jesus didn't come to save the saints.