Sample application to read and inspect packets on a network?
I'm looking to write a quick program to read and inspect packets of a certain format and then blacklist ips with a certain style of packet-traffic (packet patterns of an attack against the ne开发者_开发百科twork). Are there decent samples of reading and inspecting packet flow on a network?
Instead of writing your own program you might consider using WireShark, which can collect packets and filter data to identify certain patterns.
There's a related question here:
Which .NET library / wrapper do you recommend for sniffing packets?
Id have to suggest though, implementing software monitoring is almost guaranteed to add a bottleneck to your network, and there are plenty of existing hardware solutions.
Wireshark, on Windows at least, uses libpcap. You could try that.
Also, if you're using Windows, I know several apps that use the Windows firewall stuff to remove themselves from a blacklist, so going the other way should be possible.
This is a lot easier on Unix... ;-P
精彩评论