C - Automaticly choose a valid network device using pcap ======================================================== Public domain ******************************************************************************** /* Automaticly choose a valid network device using pcap */ /* compile : gcc -lpcap dev.c */ #include #include int main() { char *dev; char errbuf[PCAP_ERRBUF_SIZE]; if((dev=pcap_lookupdev(errbuf)) == NULL) { printf("%s\n",errbuf); exit(EXIT_FAILURE); } printf("DEV: %s\n",dev); exit(EXIT_SUCCESS); } ******************************************************************************** _BY: Pejman Moghadam_ _TAG: c, pcap_ _DATE: 2011-02-22 00:30:00_