在做大学最后的毕业设计了,无线局域网络远程安全监控策略
那么抓包是这个系统设计的基础
以前一直都是知道用winpcap的,现在网上搜了一下,有用C#封装好了的,很好用
下面是其中的几个用法
这个类库作者的主页:http://www.tamirgal.com/home/default.aspx
那么抓包是这个系统设计的基础
以前一直都是知道用winpcap的,现在网上搜了一下,有用C#封装好了的,很好用
下面是其中的几个用法
这个类库作者的主页:http://www.tamirgal.com/home/default.aspx
PcapOpen()有下面几个方法
- PcapOpen()
- PcapOpen(bool promiscuous_mode)
- PcapOpen(bool promiscuous_mode, int read_timeout)
promiscuous_mode:在普通的抓取模式下,我们只抓取那些目的地为目标网络的包,而处于promiscuous_mode时,则抓取所有的包,包括转发的包.通常我们都是开启这种模式的
下面是示例:
//
Extract a device from the list
PcapDevice device = devices[i];
// Register our handler function to the
// 'packet arrival' event
device.PcapOnPacketArrival +=
new SharpPcap.PacketArrivalEvent(device_PcapOnPacketArrival);
// Open the device for capturing
// true -- means promiscuous mode
// 1000 -- means a read wait of 1000ms
device.PcapOpen( true , 1000 );
Console.WriteLine(
" -- Listenning on {0}, hit 'Enter' to stop... " ,
device.PcapDescription);
PcapDevice device = devices[i];
// Register our handler function to the
// 'packet arrival' event
device.PcapOnPacketArrival +=
new SharpPcap.PacketArrivalEvent(device_PcapOnPacketArrival);
// Open the device for capturing
// true -- means promiscuous mode
// 1000 -- means a read wait of 1000ms
device.PcapOpen( true , 1000 );
Console.WriteLine(
" -- Listenning on {0}, hit 'Enter' to stop... " ,
device.PcapDescription);