我刚刚从https://github.com/sam-github/libnet/tree/master/libnet获得了git libnet项目,并且我一直在查看it.the示例提供的示例源代码,获得一个名为"device“的cmd arg来初始化库。我计算出"eth0“在Linux操作系统上是正确的值,但我使用的是windows7,我的问题是在windows上我可以使用什么作为设备的值。
l = libnet_init(
LIBNET_RAW4, /* injection type */
device, /* network interface */
errbuf); /* errbuf */我尝试了很多值,比如适配器名称、设备索引等。但每次我收到这个错误:
libnet_init() failed: libnet_link_win32.c(): unable to open the driver, error Code : 14发布于 2014-04-27 12:47:41
我也被同样的问题弄糊涂了。它可以这样解决。
在lib wpcap中
有一个名为pcap_findalldevs();的函数
像这样使用它,你就会得逞
int Value = pcap_findalldevs(&alldevs,errbuf);
if( Value == -1)
{
fprintf(stderr,"Error in pcap_findalldevs: %s\n", errbuf);
exit(1);
}
char *device = NULL;
device = alldevs->name; //get the first Card name
libnet_t *l
l = libnet_init(
LIBNET_LINK_ADV,
device,//use it here
error_information); 希望这对你有帮助。祝好运!
https://stackoverflow.com/questions/17400903
复制相似问题