Hi
I am planning to develop a windows application in .net which will act like a firewall/proxy server. But I have no iea where to start. Any help?
Basically I want to monitor all outgoing HTTP traffic through my computer.
Hi
I am planning to develop a windows application in .net which will act like a firewall/proxy server. But I have no iea where to start. Any help?
Basically I want to monitor all outgoing HTTP traffic through my computer.
I may be wrong, as your definition of what you need to do is somehow vague, but I'm afraid you'll be disappointed by .NET: you'll have to put your hands in the dirty world of unmanaged code, as afaik there's no .NET wrapping of the needed functionalities.
Actually, it's far more bad than that: there's no "official" win32 wrapping of the needed functionalities; you'll have to either do some ugly/risky mangling on the system calls or use a third party tool which does the ugly/risky mangling on the system calls on your behalf (and I am talking of going on where the system calls' addresses are stored and change the address to point to your function).
I've been long looking for stuff like iptables for windows, and found none; I've looked into the code of both free and of commercial software (of course, I've not tried all available software, but I spent quite a fairly long time looking), and they all implement hooks by doing filthy things.
To monitor all the traffic you have to insert a layered service provider (LSP) that has the functionality that you want. You write one in C and even a well-written LSP looks like garbage. I've heard people on the winsock team complain about these things too. I know that System.Net doesn't really have anything that will directly let you do this (I'm on the team that writes System.Net so trust me on this one). You can query the system for network information like connections open, addresses in use, enumeration of network interfaces, etc. using System.Net.NetworkInformation but this won't let you monitor traffic.
If you just want to write a proxy server then System.Net will probably be as useful as anything else you can find but you're going to have to implement all proxy functionality beyond reading requests and writing responses yourself.