Diffstat (limited to 'noncore/net/wellenreiter/daemon/source/sniffer.cc') (more/less context) (show whitespace changes)
-rw-r--r-- | noncore/net/wellenreiter/daemon/source/sniffer.cc | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/noncore/net/wellenreiter/daemon/source/sniffer.cc b/noncore/net/wellenreiter/daemon/source/sniffer.cc index be64d67..66d5b6f 100644 --- a/noncore/net/wellenreiter/daemon/source/sniffer.cc +++ b/noncore/net/wellenreiter/daemon/source/sniffer.cc @@ -9,51 +9,12 @@ #include "config.hh" #include "cardmode.hh" #include "sniffer.hh" #include "ieee802_11.hh" #include "extract.hh" -int main(void) -{ - if(card_into_monitormode (SNIFFER_DEVICE, CARD_TYPE_NG) < 0) - return 0; - start_sniffing (SNIFFER_DEVICE); - - return 1; -} - -int start_sniffing (char * device) -{ - - 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 */ - handletopcap = pcap_open_live(device, BUFSIZ, 1, 1000, errbuf); - - #ifdef HAVE_PCAP_NONBLOCK - pcap_setnonblock(handletopcap, 1, errstr); - #endif - /*start scanning */ -// 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"); - return 1; -} - void process_packets(u_char *useless,const struct pcap_pkthdr* pkthdr,const u_char* packet) { u_int caplen = pkthdr->caplen; u_int length = pkthdr->len; u_int16_t fc; u_int HEADER_LENGTH; @@ -295,13 +256,13 @@ int handle_beacon(u_int16_t fc, const u_char *p,struct packetinfo *ppinfo) } /* end of for loop */ return 0; } /* End of handle_beacon */ -static int GetHeaderLength(u_int16_t fc) +int GetHeaderLength(u_int16_t fc) { int iLength=0; switch (FC_TYPE(fc)) { case T_MGMT: iLength = MGMT_HEADER_LEN; |