Using C # / C ++, is it possible to limit network traffic?

I am developing a monitoring / tracking application for parents that has the function of blocking all Internet activity. Although disabling the network adapter will look like a simple solution, the application should be able to remotely access the Internet remotely - therefore, the network must remain turned on to a certain limit.

Unfortunately, I did not find a suitable way to achieve this in practice. Without this feature, the application is pretty much dead in the water. So I hit a huge road block and I'm open to any offers.

In my application, I need to fulfill two requirements:

  • Drop all internet activity. and then
  • Enable only Internet activity for the specified port and IP address. (my service to be interviewed).

Simple goal, right? Not so much lately.

While I'm looking for this in C #, I understand that it can be long, and I am open to C ++ solutions that could be called a resource through my application.

Also note: I cannot install third-party software on a user system, as this solution must be comprehensive.

Thanks in advance!

+4
source share
3 answers

You need to add a user level to the IP stack using the Windows Filtering Platform . This SDK is designed specifically for parental control programs, etc. Needless to say, like any kernel module, it must be developed in C, and you must have expert knowledge of the internal components of Windows:

Windows Filtering Platform APIs for use by C / C ++ programmers. Programmers should be familiar with networking concepts and system design using user mode and kernel mode components.

+7
source

You can use the WinINET API to achieve this; WinINET defines the basic Internet settings for most / many Windows applications and can be used to determine proxy information. With this in mind, you can create a proxy server that rejects all requests except messages.

0
source

Not a direct answer, but such things are usually done out of range with a serial connection or with a second network adapter connected to a "trusted" local network.

0
source

Source: https://habr.com/ru/post/979742/


All Articles