From: hackbard Date: Thu, 14 Nov 2002 00:07:26 +0000 (+0000) Subject: added managemnet frame type support X-Git-Url: https://hackdaworld.org/gitweb/?p=my-code%2Fhdw-sniff.git;a=commitdiff_plain;h=9ad5fae0187dba865b7f823e4a6453ee5fa1740c added managemnet frame type support --- diff --git a/hdw-sniff.c b/hdw-sniff.c index 3aa657b..1814857 100644 --- a/hdw-sniff.c +++ b/hdw-sniff.c @@ -137,12 +137,15 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, e_o=sizeof(struct ethhdr); i_o=sizeof(struct iphdr); + /* new package */ printf("\n"); printf("---> package %d ---- %s",my_info_struct->count, ctime((const time_t*)&(pcap_header->ts.tv_sec))); - printf("pcap header:\n"); - printf("capture_length: %d (dec.)\t",pcap_header->caplen); - printf("length(off wire): %d (dec.)\n",pcap_header->len); + + /* pcap header */ + printf("pcap header: "); + printf("capture_length(dec): %d\t",pcap_header->caplen); + printf("off_wire_length(dec): %d\n",pcap_header->len); /* wireless stuff */ /* prism wlan ng headers */ @@ -163,13 +166,34 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, (((w_hdr->frame_ctl) & (1<0?1:0), (i==15?"|\n":"|")); printf(" | v | t | s-t |t|f|m|r|p|m|w|o|\n"); - printf("debug: %d\n",(w_hdr->frame_ctl)<<15); - if((w_hdr->frame_ctl & IEEE802_11_STYPE_BEACON)>0) strcpy(tmp_buf,"beacon"); + /* frame type */ + if((w_hdr->frame_ctl & IEEE802_11_STYPE_BEACON)>0) + strcpy(tmp_buf,"beacon"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_ATIM)>0) + strcpy(tmp_buf,"announcement traffic indication message"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_DISASSOC)>0) + strcpy(tmp_buf,"disassociation"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_AUTH)>0) + strcpy(tmp_buf,"authentification"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_DEAUTH)>0) + strcpy(tmp_buf,"deauthentification"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_ASSOC_REQ)>0) + strcpy(tmp_buf,"association request"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_ASSOC_RESP)>0) + strcpy(tmp_buf,"association response"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_REASSOC_REQ)>0) + strcpy(tmp_buf,"reassociation request"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_REASSOC_RESP)>0) + strcpy(tmp_buf,"reassociation response"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_PROBE_REQ)>0) + strcpy(tmp_buf,"probe request"); + if((w_hdr->frame_ctl & IEEE802_11_STYPE_PROBE_RESP)>0) + strcpy(tmp_buf,"probe response"); else strcpy(tmp_buf,"unknown"); - + /* print out frame type */ printf("=> %s\n",tmp_buf); - printf("duration/id: %x\n",w_hdr->duration_id); + printf("duration/id: 0x%x\n",w_hdr->duration_id); printf("version check ... %s\n", ((w_hdr->frame_ctl & IEEE802_11_FCTL_VERS)==0x00)? "ok":"unknown");