Advertisement
LocutusOfBorg

gcc filename.c -lpcap && sudo ./a.out

Dec 6th, 2013
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.55 KB | None | 0 0
  1. #include<stdio.h>
  2. #include<pcap.h>
  3.  
  4. int main()
  5. {
  6.    char errbuf[PCAP_ERRBUF_SIZE];
  7.    pcap_if_t *alldevs;
  8.    pcap_if_t *dev;
  9.    pcap_findalldevs(&alldevs, errbuf);
  10.    for (dev = (pcap_if_t *)alldevs; dev != NULL; dev = dev->next) {
  11.      printf("Interface: ");
  12.      if(dev->name)
  13.         printf("Name: %10s ", dev->name);
  14.      else
  15.         printf("Empty Name");
  16.  
  17.      if(dev->description)
  18.         printf("Description: %5s", dev->description);
  19.      else
  20.         printf("Empty Description");
  21.      printf("\n");
  22.    }
  23.    printf("End!\n");
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement