I just git libnet project from https://github.com/sam-github/libnet/tree/master/libnet and i have been looking over the example source provided with it.the example obtain a cmd arg called "device" to initialize libnet. I figured out "eth0" is the proper value on Linux OS but I'm using windows 7 and my question is what can i use as value for device on windows.
l = libnet_init(
LIBNET_RAW4, /* injection type */
device, /* network interface */
errbuf); /* errbuf */
I tried a lots of values like adaptor name, device index, etc... but every time i got this error:
libnet_init() failed: libnet_link_win32.c(): unable to open the driver, error Code : 14
I was confused by the same problem. It can be solve like this.
in lib wpcap
there is a function named pcap_findalldevs();
use it like this and you will succuss
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);
may this help you. good luck!