all: $(TARGETS)
hdw-sniff:
- $(CC) $(CFLAGS) -Wall list.c hdw-sniff.c $(LDFLAGS) -o hdw-sniff
+ $(CC) $(CFLAGS) -Wall list.c hdw_outlib.c hdw-sniff.c $(LDFLAGS) \
+ -o hdw-sniff
# $(CC) $(CFLAGS) -Wall hdw-sniff.c $(LDFLAGS) -o hdw-sniff
/* 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))) {
+ 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));
:strcpy(tmp_buf1,"ibssid = ");
strncpy(tmp_buf2,beacon_hdr->ssid_s.ssid,
beacon_hdr->ssid_s.length);
+
tmp_buf2[beacon_hdr->ssid_s.length]='\0';
strcpy(tmp_buf,"beacon");
- add_ssid_2_list(tmp_buf2,my_info_struct->ssid_list);
+ add_ssid_2_list(tmp_buf2,beacon_hdr->capability,
+ my_info_struct->ssid_list);
}
else if((w_hdr->frame_ctl & IEEE802_11_STYPE_ATIM)>0)
strcpy(tmp_buf,"announcement traffic indication message");
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",
+ 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("- no encryption!\n");
if(snap_hdr->proto==ntohs(ETH_P_IP)) {
e_o=sizeof(struct snaphdr);
- parse_ip(snap_hdr+e_o);
+ parse_ip((char *)(snap_hdr+e_o));
}
}
--- /dev/null
+/* call out ieee802.11 information
+ *
+ * author: hackbard
+ *
+ */
+
+#define _GNU_SOURCE
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
+
+char sys_call[20];
+
+int tell_ssid(char *ssid) {
+ sprintf(sys_call,"flite \"new ssid. %s\"",ssid);
+ system(sys_call);
+ return 1;
+}
+
+int lcd_ssid(char *ssid,unsigned short cap) {
+ int lcd_fd;
+ char lcd_com[2];
+ char c_msg[7];
+
+ if((lcd_fd=open("/dev/lcd",O_WRONLY|O_NDELAY)) <= 0) {
+ printf("failed to open lcd device");
+ exit -1;
+ }
+
+ printf("debug: lcd_fd = %d\n",lcd_fd);
+ strcpy(sys_call,ssid);
+ lcd_com[0]=27;
+ lcd_com[1]='c';
+ write(lcd_fd,lcd_com,sizeof(lcd_com));
+ lcd_com[0]=27;
+ lcd_com[1]='h';
+ write(lcd_fd,lcd_com,sizeof(lcd_com));
+ if((1<<4 & cap)) sprintf(c_msg," wep");
+ else sprintf(c_msg," no_wep");
+ dprintf(lcd_fd,"ssid: %s\ncap: %x%s",sys_call,cap,c_msg);
+ // write(lcd_fd,sys_call,sizeof(sys_call));
+ close(lcd_fd);
+ return 1;
+}
+
+
+
--- /dev/null
+/* outlib.h - prototypes
+ *
+ * author: hackbard
+ *
+ */
+
+/* prototypes */
+int tell_ssid(char *ssid);
+int lcd_ssid(char *ssidi,unsigned short cap);
+
*
*/
+#include "hdw_outlib.h"
#include "list.h"
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-char sys_call[20];
+// char sys_call[20];
-int add_ssid_2_list(char *ssid, struct list *my_list) {
+int add_ssid_2_list(char *ssid,unsigned short cap,struct list *my_list) {
struct list *new_entry;
if(my_list->next==NULL) {
- // printf("debug: new ssid found!\n");
- sprintf(sys_call,"flite \"new ssid. %s\"",ssid);
- system(sys_call);
+ tell_ssid(ssid);
+ lcd_ssid(ssid,cap);
new_entry=(struct list *)malloc(sizeof(struct list));
my_list->next=new_entry;
strcpy(my_list->ssid,ssid);
} else if(!strcmp(my_list->ssid,ssid)) {
/* do nothing! */
} else {
- add_ssid_2_list(ssid,my_list->next);
+ add_ssid_2_list(ssid,cap,my_list->next);
}
return 1;
}
};
/* prototypes */
-int add_ssid_2_list(char *ssid, struct list *my_list);
+int add_ssid_2_list(char *ssid,unsigned short cap, struct list *my_list);