display_line(display,0,0,2,0,'-');
display_string(display,4,0,"sta",3);
- display_line(display,8,0,x,0,'-');
+ 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_line(display,0,0,0,y,'|');
//display_line(display,x,0,x,y,'|');
info=(t_info *)ptr;
- if(info->current_channel>=CHANNEL_MAX) info->current_channel=1;
+ if((info->current_channel>CHANNEL_MAX)|(info->current_channel==0))
+ info->current_channel=1;
memset(&iwreq,0,sizeof(iwreq));
strcpy(iwreq.ifr_name,info->device);
iwreq.u.freq.e=0;
perror("ioctl");
return -23;
}
- ++(info->current_channel);
- return 23;
+ ++(info->current_channel);
+
+ return 23;
}
int main(int argc, char **argv) {
system(sys_call);
if(info.log_fd==0) {
- if((info.log_fd=open("/tmp/hdw-sniff.log",O_RDWR|O_CREAT))!=0)
- puts("using logfile /tmp/hdw-sniff.log ...");
- else {
- puts("failed to open logfile ...");
- return -23;
+ if((info.log_fd=open("/tmp/hdw-sniff.log",O_RDWR|O_CREAT))!=0)
+ puts("using logfile /tmp/hdw-sniff.log ...");
+ else {
+ puts("failed to open logfile ...");
+ return -23;
+ }
}
/* pcap */
puts("bugreports: hackbard@hackdaworld.org");
return 23;
-
}
*/
#include "parse.h"
-//#include "802.11b.h"
#include "main.h"
/* all the parsing stuff will go here
t_info *info;
int i;
t_sta new_sta;
+ t_frame4_hdr *f4hdr;
+ t_frame3_hdr *f3hdr;
+ t_frame2_hdr *f2hdr;
+ t_frame1_hdr *f1hdr;
+ t_beacon_fb *beacon_fb;
int ret;
info=(t_info *)ptr;
info->count++;
+ memset(&new_sta,0,sizeof(t_sta));
+
if(info->dump_fd!=0) {
ret=write(info->dump_fd,pcap_header,sizeof(struct pcap_pkthdr));
if(ret!=sizeof(struct pcap_pkthdr))
/* maybe there is offset to the actual ieee802.11 frame,
for example prism header ... */
- /* debug log */
- dprintf(info->log_fd,"new package -> %02x/n",package[0]);
+ if(FCTL_TYPE(package[0])==FCTL_TYPE_MGMT) {
+ 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");
+ }
- /* go on parsing frame ctl header here ... */
+ else {
+ dprintf(info->log_fd,"other: ");
+ for(i=0;i<16;i++) dprintf(info->log_fd,"%02x ",package[i]);
+ dprintf(info->log_fd,"\n");
+ }
}
/* ieee802.11 stuff */
+typedef unsigned long long int u64;
typedef unsigned int u32;
typedef unsigned short int u16;
typedef unsigned char u8;
#define FCTL_STYPE_CFPOLL 0x6
#define FCTL_STYPE_CFACKPOLL 0x7
+typedef struct s_beacon_fb {
+ u64 timestamp;
+ u16 beacon_int;
+ u16 cap_info;
+ u8 ssid_element_id;
+ u8 ssid_length;
+ u32 ssid;
+ u8 srates_element_id;
+ u8 srates_element_length;
+ u8 rest; /* go on here ... */
+} __attribute__ ((packed)) t_beacon_fb;
+
/* hdw-sniff stuff */