I want to create a host-based firewall for Windows, mainly for filtering URLs starting with HTTPS! I know that Microsoft is introducing WFP as a replacement for legacy old methods like firewall / filter hooks, NDIS, TDI, WSA and Winsock 2 (LSP). But WFP does not currently support filters with a host name or URL. In addition, WFP is only in C / C ++ and in .NET there are no C # wrappers available.
I tried @basil WinDivert a webfilter demo application that analyzes packets in outgoing traffic for IPv4 on TCP port 80 (default HTTP), reset server connection (TCP RST) and send an HTML response to the client (browser) followed by TCP FIN, in case the URL matches any of the entries in the blacklist indicated in the text file as a command line argument and re-enter them otherwise ...
handle = WinDivertOpen(
"outbound && "
"ip && "
"tcp.DstPort == 80 && "
"tcp.PayloadLength > 0",
WINDIVERT_LAYER_NETWORK, priority, 0
);
My question is: can I change this code to support HTTPS (change default port 443) as well as IPv6? If so, I am ready to write a P \ Invoke wrapper class to call it from C # managed code.
Additionally: this solution can be circumvented using SSH tunneling, is there any other way around it?