- // new_sta.
- /* debug output */
- dprintf(info->log_fd,"beacon: ");
- for(i=0;i<ADDR_LEN;i++) dprintf(info->log_fd,"%02x ",*((f3hdr->addr2)+i));
- dprintf(info->log_fd," essid: (len=%x) ",beacon_fb->ssid_length);
- for(i=0;i<beacon_fb->ssid_length;i++)
- dprintf(info->log_fd,"%c ",*(u8 *)(beacon_fb->ssid+i));
- dprintf(info->log_fd,"\n");
+ // check sta
+ memcpy(new_sta.addr,f3hdr->addr2,ADDR_LEN);
+ ret=list_search_data(&(info->sniffed_sta),&new_sta,ADDR_LEN);
+ if((ret==L_EMPTY_LIST)|(ret==L_NO_SUCH_ELEMENT)) {
+ list_add_element(&(info->sniffed_sta),&new_sta,sizeof(t_sta));
+ sta=(t_sta *)info->sniffed_sta.current->data;
+ new=1;
+ }
+ else sta=(t_sta *)info->sniffed_sta.current->data;
+ // fill in stuff ...
+ memcpy(sta->ssid,beacon_fb->ssid,beacon_fb->ssid_length);
+ if((CAP_INFO_ESS(beacon_fb->cap_info))&
+ (CAP_INFO_IBSS(beacon_fb->cap_info)==0)) sta->ap=AP;
+ if(CAP_INFO_PRIVACY(beacon_fb->cap_info)) sta->wep=WEP;
+ sta->count_mgmt++;
+ switch_active_state(&(sta->active));
+ if(info->mode&MODE_IEEE80211) sta->sq=0;
+ else if(info->mode&MODE_PRISM)
+ sta->sq=(prismhdr->signal.data)-(prismhdr->noise.data);
+ strncpy(string,"last: beacon, source: ",MESSAGE_MAX);
+ for(i=0;i<ADDR_LEN;i++)
+ snprintf(&string[22+3*i],4,"%02x%c",sta->addr[i],
+ (i==ADDR_LEN-1)?'.':':');
+ string[22+3*ADDR_LEN+1]=0;
+ display_console(info,string);
+ if(new) {
+ snprintf(sc,MAX_SYSCALL_CHARS,
+ "flite 'access point found: %s'",
+ sta->ssid);
+ system(sc);
+ if(sta->wep&WEP) strncpy(sc,"flite ' crypted'",MAX_SYSCALL_CHARS);
+ else strncpy(sc,"flite 'not crypted'",MAX_SYSCALL_CHARS);
+ system(sc);
+ }