]> hackdaworld.org Git - my-code/hdw-sniff.git/commitdiff
framecontrol work
authorhackbard <hackbard>
Wed, 13 Nov 2002 20:43:02 +0000 (20:43 +0000)
committerhackbard <hackbard>
Wed, 13 Nov 2002 20:43:02 +0000 (20:43 +0000)
hdw-sniff.c

index f6da20f0559c471a12de85c28b66e6b8cb9b54b1..05db8bfe8c32b177bc2b5531d0bf4180ca0c1476 100644 (file)
@@ -142,7 +142,8 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
        printf("pcap header:\n");
        printf("capture_length: %d (dec.)\t",pcap_header->caplen);
        printf("length(off wire): %d (dec.)\n",pcap_header->len);
-       
+
+       /* wireless stuff */
        /* prism wlan ng headers */
        if((my_info_struct->mmode-0x30==1) && 
                (strncmp(my_info_struct->dev,"wlan",4)==0)) {
@@ -151,26 +152,20 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
        printf("message code/length: %d/%d\n",ntohs(prism_hdr->msgcode),
                                                ntohs(prism_hdr->msglen));
        printf("device: %s\n",prism_hdr->devname);
-       /* skip wlan_ng_prism header */
-       // package=package+p_o;
-
        /* ieee802.11 header */
        printf("ieee802.11 header: (%d bytes)\n",w_o);
        w_hdr=(struct ieee802_11_hdr *)(package+p_o);
        
-       printf("debug:\n");
-       for(i=0;i<16;i++) {
-               printf("%x -> ",1<<i);
-               printf("%x\n",(ntohs(w_hdr->frame_ctl) & (1<<i)));
-       }
-       printf("frame_control: %x duration_id: %x\n",ntohs(w_hdr->frame_ctl),
-                                               ntohs(w_hdr->duration_id));
+       printf("fc: ");
+       for(i=0;i<16;i++)
+               printf("%s%d%s",(i==0?"|":""),
+                               ((ntohs(w_hdr->frame_ctl) & (1<<i))>0?"1":"0"),
+                               (i==15?"|\n":""));
+       
+       printf("ion_id: %x\n",ntohs(w_hdr->duration_id));
        printf("version check ... %s\n",
        ((ntohs(w_hdr->frame_ctl) & IEEE802_11_FCTL_VERS)==0x00)?
                                                        "ok":"unknown");
-       // printf("type: 
-       /* skip ieee802.11 header */
-       // package=package+w_o;
        }
 
        /* ieee802.3 */
@@ -207,21 +202,18 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header,
                        ip_hdr->daddr&0xff<<i,
                        (i==0?"\n":"."));
                }
-               // printf("ip_addresses: source = ");
-               // printf("%s\tdestination = %s\n",inet_ntoa(ip_hdr->saddr),
-               //                              inet_ntoa(ip_hdr->daddr));
                printf("ip_id = %x ",ntohs(ip_hdr->id));
                printf("ip_offset = %x \n",ntohs(ip_hdr->frag_off));
                printf("time2live = %x ip_proto = %x\n",ntohs(ip_hdr->ttl),
                                                ntohs(ip_hdr->protocol));
                // printf("chksum: %x\n",ntohs(ip_hdr->ip_sum));
        }
-       printf("all ethernet dump: (hex)\n");
-       for(i=p_o+w_o+e_o;i<pcap_header->caplen;i++)
+       printf("all dump: (hex)\n");
+       for(i=p_o+w_o;i<pcap_header->caplen;i++)
                printf("%x ",*(package+i));
        printf("\n");
-       printf("all ethernet dump: (char)\n");
-       for(i=p_o+w_o+e_o;i<pcap_header->caplen;i++)
+       printf("all dump: (char)\n");
+       for(i=p_o+w_o;i<pcap_header->caplen;i++)
                printf("%c ",*(package+i));
        printf("\n");
 }