我正在用C编写一个无线数据包嗅探器程序。我使用airmon-ng将监测模式设置为无线接口,现在我在接口“mon0”上嗅探。我正在使用Linux(Ubuntu 10.10)。使用pcap,MAC地址过滤器的无线嗅探
我想设置MAC地址作为数据包的过滤器。 我都做到了,如下图所示,但它说 “MON0没有IPv4地址分配”
pcap_lookupnet(dev,&net,&mask,errbuf);
printf("%s\n",errbuf);
/* Open the session in promiscuous mode */
handle = pcap_open_live(dev, BUFSIZ, 1, 1000, errbuf);
if (handle == NULL) {
printf("Couldn't open device %s: %s\n", dev, errbuf);
return 2;
}
if(pcap_compile(handle,&fp,argv[0],0,net)==-1){
fprintf(stderr,"Error calling pcap_compile\n");exit(1);}
if(pcap_setfilter(handle,&fp) == -1){
fprintf(stderr,"Error setting filter\n");exit(1);}
/* The call pcap_loop() and pass our callback function */
pcap_loop(handle, 10, my_callback, NULL);
请帮助我,我怎么可以设置MAC地址过滤?
我在tcpdump的网页上阅读了您的教程。我试着通过阅读你在stackoverflow上写的东西来学习。你有没有发布关于libpcap的更多说明的网页? – Angs 2013-12-04 14:47:05
不幸的是,没有。 – 2013-12-04 21:30:25