我正试着过滤掉wifi上的探测和广播帧。
使用SharpPcap。
((SharpPcap.AirPcap.AirPcapDevice)(device)).Filter = "wlan.fc.type eq 0";不工作
同上
((SharpPcap.AirPcap.AirPcapDevice)(device)).Filter = "wlan.fc.type == 0";这行似乎允许广播
((SharpPcap.AirPcap.AirPcapDevice)(device)).Filter = "broadcast";但需要真正获得所有可管理的帧。
发布于 2013-03-14 16:49:43
我认为你的问题是: Wireshark解码数据包,所以当你应用这些过滤器时,数据包已经被解码,因此能够访问wlan.fc.type字段。
根据我的个人经验和SharpPcap使用情况,您尝试使用的过滤器是在byte[]上计算的,因此您需要更加具体,以确保它被正确应用。
例如,我一直在使用这个过滤器。
private const String filteringSV = "(ether[0:4] = 0x010CCD04)";此外,请记住仅在已打开的设备上设置过滤器。
if (nicToUse != null)
{
try
{
nicToUse.OnPacketArrival -= OnPackectArrivalLive;
nicToUse.OnPacketArrival += OnPackectArrivalLive;
try
{
if (nicToUse.Started)
nicToUse.StopCapture();
if (nicToUse.Opened)
nicToUse.Close();
}
catch (Exception)
{
//no handling, just do it.
}
nicToUse.Open(OpenFlags.Promiscuous|OpenFlags.MaxResponsiveness,10);
nicToUse.Filter = "(ether[0:4] = 0x010CCD04)";
nicToUse.StartCapture();
}
catch (Exception ex)
{
throw new Exception(Resources.SharpPCapPacketsProducer_Start_Error_while_starting_online_capture_, ex);
}
}希望这能帮上忙。
https://stackoverflow.com/questions/10537223
复制相似问题