From: hackbard Date: Wed, 13 Nov 2002 23:47:31 +0000 (+0000) Subject: fc X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=7a55b727f19281d64c03359e79ff900d5e154d81;p=my-code%2Fhdw-sniff.git fc --- diff --git a/hdw-sniff.c b/hdw-sniff.c index 98f6c6e..3aa657b 100644 --- a/hdw-sniff.c +++ b/hdw-sniff.c @@ -120,6 +120,7 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, const u_char *package) { /* local variables */ + char tmp_buf[20]; struct linux_wlan_ng_prism_hdr *prism_hdr; struct ieee802_11_hdr *w_hdr; struct ethhdr *e_hdr; @@ -149,9 +150,9 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, (strncmp(my_info_struct->dev,"wlan",4)==0)) { printf("prism header: (%d bytes)\n",p_o); prism_hdr=(struct linux_wlan_ng_prism_hdr *)package; - printf("message code/length: %d/%d\n",ntohs(prism_hdr->msgcode), - ntohs(prism_hdr->msglen)); - printf("device: %s\n",prism_hdr->devname); + printf("| message code/length: %d/%d |\t",prism_hdr->msgcode, + prism_hdr->msglen); + printf("device: %s |\n",prism_hdr->devname); /* ieee802.11 header */ printf("ieee802.11 header: (%d bytes)\n",w_o); w_hdr=(struct ieee802_11_hdr *)(package+p_o); @@ -161,16 +162,23 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, printf("%s%d%s",(i==0?"|":""), (((w_hdr->frame_ctl) & (1<0?1:0), (i==15?"|\n":"|")); - printf("fc: | v | t | s-t |t|f|m|r|p|m|w|o|\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"); + else strcpy(tmp_buf,"unknown"); + + printf("=> %s\n",tmp_buf); - printf("ion_id: %x\n",ntohs(w_hdr->duration_id)); + printf("duration/id: %x\n",w_hdr->duration_id); printf("version check ... %s\n", - ((ntohs(w_hdr->frame_ctl) & IEEE802_11_FCTL_VERS)==0x00)? + ((w_hdr->frame_ctl & IEEE802_11_FCTL_VERS)==0x00)? "ok":"unknown"); } /* ieee802.3 */ /* ethernet */ + if((strncmp(my_info_struct->dev,"eth",3)==0) | + ((w_hdr->frame_ctl & IEEE802_11_FTYPE_DATA)>0)) { printf("ethernet: (%d bytes)\n",e_o); e_hdr=(struct ethhdr *)(package+p_o+w_o); /* what types ? */ @@ -209,6 +217,9 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, ntohs(ip_hdr->protocol)); // printf("chksum: %x\n",ntohs(ip_hdr->ip_sum)); } + } + + /* check what we have ... */ printf("all dump: (hex)\n"); for(i=p_o+w_o;icaplen;i++) printf("%x ",*(package+i));