int display_console(t_info *info,char *string) {
- int x,y;
+ int x,y,size;
t_display *display;
+ char help[32];
display=(t_display *)&(info->display);
x=display->max_x-1;
y=display->max_y-1;
+ size=strlen(string);
+
display_line(display,0,0,2,0,'-');
display_string(display,4,0,"sta",3);
display_line(display,8,0,12,0,'-');
display_string(display,13,0,"bssid",5);
display_line(display,19,0,23,0,'-');
- display_string(display,24,0,"M",1);
- display_line(display,26,0,x,0,'-');
+ display_string(display,25,0,"M",1);
+ display_line(display,27,0,x,0,'-');
//display_line(display,0,0,0,y,'|');
//display_line(display,x,0,x,y,'|');
+ /* footer */
+ display_line(display,0,y-3,x,y-3,'-');
+
+ memset(help,0,32);
+ snprintf(help,32,"total: %06d",info->count);
+ display_string(display,3,y-2,help,13);
+
+ memset(help,0,32);
+ snprintf(help,32,"management: %06d",info->count_m);
+ display_string(display,18,y-2,help,18);
+
+ memset(help,0,32);
+ snprintf(help,32,"control: %06d",info->count_c);
+ display_string(display,38,y-2,help,15);
+
+ memset(help,0,32);
+ snprintf(help,32,"data: %06d",info->count_d);
+ display_string(display,55,y-2,help,12);
+
display_line(display,0,y-1,x,y-1,'-');
display_draw(display);
puts("set monitoring mode ...");
system(sys_call);
}
- sprintf(sys_call,"ifconfig %s up",info.device);
+ sprintf(sys_call,"/sbin/ifconfig %s up",info.device);
puts("setting up device ...");
system(sys_call);
for example prism header ... */
if(FCTL_TYPE(package[0])==FCTL_TYPE_MGMT) {
- if(FCTL_STYPE(package[0])==FCTL_STYPE_BEACON)
+ info->count_m++;
+ if(FCTL_STYPE(package[0])==FCTL_STYPE_BEACON) {
f3hdr=(t_frame3_hdr *)package;
- beacon_fb=(t_beacon_fb *)package+sizeof(t_frame3_hdr);
- 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: ");
- for(i=0;i<beacon_fb->ssid_length;i++)
- dprintf(info->log_fd,"%c ",(beacon_fb->ssid)+i);
- dprintf(info->log_fd,"\n");
+ beacon_fb=(t_beacon_fb *)(package+sizeof(t_frame3_hdr));
+ // 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");
+ }
}
-
- else {
- dprintf(info->log_fd,"other: ");
- for(i=0;i<16;i++) dprintf(info->log_fd,"%02x ",package[i]);
- dprintf(info->log_fd,"\n");
+ else if(FCTL_TYPE(package[0])==FCTL_TYPE_CTRL) {
+ info->count_c++;
+ }
+ else if(FCTL_TYPE(package[0])==FCTL_TYPE_DATA) {
+ info->count_d++;
}
+ display_console(info,"");
+
}