+ else strcpy(tmp_buf,"control or data frame type");
+
+ printf("=> %s\n",tmp_buf);
+ if((strlen(tmp_buf1)>0) && (strlen(tmp_buf2)>0)) printf(" %s%s\n",
+ tmp_buf1,
+ tmp_buf2);
+ 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");
+ }
+
+ /* ethernet */
+ if((strncmp(my_info_struct->dev,"eth",3)==0) |
+ ((w_hdr->frame_ctl & IEEE802_11_FTYPE_DATA)==IEEE802_11_FTYPE_DATA)) {
+
+ if((strncmp(my_info_struct->dev,"eth",3)==0)) {
+ printf("ethernet: (%d bytes)\n",e_o);
+ e_hdr=(struct ethhdr *)(package+p_o+w_o);
+ special_o=sizeof(struct ethhdr);
+ /* what types ? */
+ printf("type = ");
+ printf("%x ",ntohs(e_hdr->h_proto));
+ printf("dest_addr = ");
+ for(i=0;i<ETH_ALEN;i++)
+ printf("%x%s",*(e_hdr->h_dest+i),((i==ETH_ALEN-1)?" ":":"));
+ printf(" src_addr = ");
+ for(i=0;i<ETH_ALEN;i++) printf("%x%s",*(e_hdr->h_source+i),
+ ((i==ETH_ALEN-1)?"\n":":"));
+ if((ntohs(e_hdr->h_proto)==ETH_P_IP))
+ parse_ip(package+p_o+w_o+e_o);
+ }
+ else {
+ snap_hdr=(struct snaphdr *)(package+p_o+w_o);
+ if((snap_hdr->snap[0]==0xaa) &
+ (snap_hdr->snap[1]==0xaa) &
+ (snap_hdr->snap[2]==0x03) &
+ (snap_hdr->snap[3]==0x00) &
+ (snap_hdr->snap[4]==0x00) &
+ (snap_hdr->snap[5]==0x00)) {
+ printf("- no encryption!\n");
+ if(snap_hdr->proto==ntohs(ETH_P_IP)) {
+ e_o=sizeof(struct snaphdr);
+ parse_ip((char *)(snap_hdr+e_o));
+ }
+
+ }
+ else {
+ printf("- crypted packet!\n");
+ /* print crypted snap - write into file */
+ printf("snap: (iv(3) + index(1) + crypted snap(6)) ");
+ for(i=0;i<10;i++) {
+ printf("%x ",*(snap_hdr->snap+i));
+ crypted_snap[i]=*(snap_hdr->snap+i);
+ }
+ /* xor with plain
+ crypted_snap[4]^=0xaa;
+ crypted_snap[5]^=0xaa;
+ crypted_snap[6]^=0x03;
+ crypted_snap[7]^=0x00;
+ crypted_snap[8]^=0x00;
+ crypted_snap[9]^=0x00;
+ */
+
+ printf("\n");
+ crypted_snap[10]='\0';
+ crypted_snap[11]='\n';
+
+ if(file_fd>0) {
+ printf("debug: saved to file\n");
+ dprintf(file_fd,IVLINE,IVL_ARGS);
+ }
+ }
+ }
+ }
+
+ /* dump it */
+#ifdef SHOW_HEX
+ printf("all dump: (hex)\n");
+ for(i=p_o+w_o+special_o;i<pcap_header->caplen;i++)
+ printf("%x ",*(package+i));