Created
November 15, 2017 19:14
-
-
Save picatz/1eec7ee6765ab825bb3080a9cbed7c24 to your computer and use it in GitHub Desktop.
Get interface to listen on
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <pcap.h> | |
int main() | |
{ | |
char *dev; | |
char errbuf[PCAP_ERRBUF_SIZE]; | |
dev = pcap_lookupdev(errbuf); | |
/* Check for failure */ | |
if (dev == NULL) { | |
fprintf(stderr, "Couldn't find a default interface: %s\n", errbuf); | |
return(1); | |
} | |
/* Success */ | |
printf("%s\n", dev); | |
return(0); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment