From: hackbard Date: Thu, 28 Nov 2002 22:45:46 +0000 (+0000) Subject: introduced beacon header X-Git-Url: https://hackdaworld.org/gitweb/?a=commitdiff_plain;h=9042c664acc02475b9dbb9109d1a9ddb5d9180c0;p=my-code%2Fhdw-sniff.git introduced beacon header --- diff --git a/hdw-sniff.c b/hdw-sniff.c index 0259730..08f6998 100644 --- a/hdw-sniff.c +++ b/hdw-sniff.c @@ -128,6 +128,7 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, struct linux_wlan_ng_prism_hdr *prism_hdr; struct ieee802_11_hdr *w_hdr; struct snaphdr *snap_hdr; + struct beacon_struct *beacon_hdr; struct ethhdr *e_hdr; struct iphdr *ip_hdr; struct info_struct *my_info_struct; @@ -162,6 +163,12 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, prism_hdr->msglen); printf("device: %s |\n",prism_hdr->devname); /* ieee802.11 header */ + + /* we need smaller w_hdr for non distributed frames */ + if((w_hdr->frame_ctl & (1<<8)) & (w_hdr->frame_ctl & (1<<9))) { + printf("=> distributed packet !!!!11\n"); + } else w_o-=(sizeof(struct snaphdr)-sizeof(unsigned short)); + printf("ieee802.11 header: (%d bytes)\n",w_o); w_hdr=(struct ieee802_11_hdr *)(package+p_o); @@ -186,8 +193,12 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, strcpy(tmp_buf,"probe request"); else if((w_hdr->frame_ctl & IEEE802_11_STYPE_PROBE_RESP)>0) strcpy(tmp_buf,"probe response"); - else if((w_hdr->frame_ctl & IEEE802_11_STYPE_BEACON)>0) - strcpy(tmp_buf,"beacon"); + else if((w_hdr->frame_ctl & IEEE802_11_STYPE_BEACON)==IEEE802_11_STYPE_BEACON) { + // beacon_hdr=(struct beacon_struct *)(package+p_o+w_o); + // printf("ssid: "); + // for(i=0;i<(((beacon_hdr->ssid)&0x2)>> + // strcpy(tmp_buf,"beacon"); + } else if((w_hdr->frame_ctl & IEEE802_11_STYPE_ATIM)>0) strcpy(tmp_buf,"announcement traffic indication message"); else if((w_hdr->frame_ctl & IEEE802_11_STYPE_DISASSOC)>0) @@ -208,12 +219,6 @@ void pcap_process(u_char *info,const struct pcap_pkthdr *pcap_header, "ok":"unknown"); } - /* ieee802.3 */ - /* we need smaller w_hdr for non distributed frames */ - if((w_hdr->frame_ctl & (1<<8)) & (w_hdr->frame_ctl & (1<<9))) { - printf("=> distributed packet !!!!11\n"); - } else w_o-=(sizeof(struct snaphdr)-sizeof(unsigned short)); - /* ethernet */ if((strncmp(my_info_struct->dev,"eth",3)==0) | ((w_hdr->frame_ctl & IEEE802_11_FTYPE_DATA)>0)) { @@ -311,7 +316,7 @@ int hop_channel(struct info_struct *info,int foo_fd) { struct iwreq my_iwreq; - if (info->channel>=14) info->channel=1; + if (info->channel>=C_MAX) info->channel=1; memset(&my_iwreq,0,sizeof(my_iwreq)); strcpy(my_iwreq.ifr_name,info->dev); diff --git a/hdw-sniff.h b/hdw-sniff.h index 6dc06b9..76eee82 100644 --- a/hdw-sniff.h +++ b/hdw-sniff.h @@ -1,5 +1,7 @@ #include +#define C_MAX 14 + /* the pcap_process callback function */ void pcap_process(u_char *count,const struct pcap_pkthdr *pcap_header, const u_char *package); @@ -21,3 +23,11 @@ struct info_struct { /* hop_chanel function */ int hop_channel(struct info_struct *info,int foo_fd); +/* beacon header */ +struct beacon_struct { + long int timestamp; /* time stamp */ + unsigned short interval; /* beacon interval field */ + unsigned short capability; /* capability field */ + unsigned char ssid; /* ssid field */ +} __attribute__ ((packed)); + diff --git a/wep.c b/wep.c index e2f6799..886ac37 100644 --- a/wep.c +++ b/wep.c @@ -1,3 +1,9 @@ +/* + * + * wep.c - bruteforce wep key + * + */ + #include #include #include