【问题标题】:libnet device (Network interface) command line argumentlibnet 设备(网络接口)命令行参数
【发布时间】:2013-07-01 09:13:12
【问题描述】:

我只是从https://github.com/sam-github/libnet/tree/master/libnet git libnet 项目,我一直在查看它提供的示例源。示例获取一个名为“设备”的 cmd arg 来初始化 libnet。我发现“eth0”是 Linux 操作系统上的正确值,但我使用的是 windows 7,我的问题是我可以将什么用作 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

【问题讨论】:

    标签: windows networking driver libnet


    【解决方案1】:

    我对同样的问题感到困惑。 可以这样解决。

    在 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); 
    

    希望对您有所帮助。祝你好运!

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2022-10-23
      • 2012-01-15
      • 2012-12-28
      • 2011-10-24
      • 2019-08-04
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多