简体   繁体   中英

how to drop packets from specific source IP address on c#

i want to write an application for dropping some packets from some specific srcIP address.

i mean i want to write and run an application on a windows system that check all packet send requests from other applications that are run on that system and get srcIP address of that send requests and compare it with an IP address ; if the ip address was not XXX.XXX.XXX.XXX drop the packet before it send .

can anyone please help me to find the ways of doing it ?

is there anyone that have any c# source of it ?

thanks

What you are describing is essentially a firewall rule.

If manually setting such a rule from the Windows Firewall in Control Panel is not what you want, you can do it programmatically with the API . Everything you can do manually to the firewall from the Control Panel can be done from the API.

The other alternative would be to implement a Winsock LSP . Looks like these APIs are deprecated (and for good reason)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM