-rw-r--r-- | noncore/net/wellenreiter/daemon/source/sniffer.cc | 18 |
1 files changed, 14 insertions, 4 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/sniffer.cc b/noncore/net/wellenreiter/daemon/source/sniffer.cc index 65c8579..be64d67 100644 --- a/noncore/net/wellenreiter/daemon/source/sniffer.cc +++ b/noncore/net/wellenreiter/daemon/source/sniffer.cc @@ -25,6 +25,8 @@ int start_sniffing (char * device) { - pcap_t *handletopcap; - char errbuf[PCAP_ERRBUF_SIZE]; + pcap_t *handletopcap; /* The handle to the libpcap */ + char errbuf[PCAP_ERRBUF_SIZE]; /* The errorbuffer of libpacap */ + struct pcap_pkthdr header; /* The packet header from pcap*/ + const u_char *packet; /* The actual packet content*/ /* opening the pcap for sniffing */ @@ -35,5 +37,14 @@ int start_sniffing (char * device) #endif /*start scanning */ - pcap_loop(handletopcap,-1,process_packets,NULL); +// pcap_loop(handletopcap,-1,process_packets,NULL); + /* Loope endless */ + while(1) + { + /* Grab one single packet */ + packet = pcap_next(handletopcap, &header); + + /* process the packet */ + process_packets(NULL,&header,*&packet); + } printf("\nDone processing packets... wheew!\n"); @@ -99,5 +110,4 @@ void process_packets(u_char *useless,const struct pcap_pkthdr* pkthdr,const u_ch if (handle_beacon(fc, packet,pinfoptr) ==0) { - printf ("\n\tOn network : %s",pinfoptr->ssid); if (!strcmp(pinfoptr->desthwaddr,"ff:ff:ff:ff:ff:ff") == 0) { |