commit often and soon
[my-code/hdw-sniff.git] / main.c
diff --git a/main.c b/main.c
index e3cb85c..d26fbf2 100644 (file)
--- a/main.c
+++ b/main.c
@@ -14,7 +14,7 @@ int display_console(t_info *info,char *string) {
   int x,y,size,count,cnt,i,s;
   t_display *display;
   t_sta *sta;
-  char help[32];
+  char help[128];
 
   display=(t_display *)&(info->display);
 
@@ -56,13 +56,8 @@ int display_console(t_info *info,char *string) {
       display_string(display,GUI_OFFSET_AP,3+i,help,3);
       snprintf(help,5,"|  %c",sta->wep?'y':'n');
       display_string(display,GUI_OFFSET_WEP,3+i,help,4);
-/*
-      snprintf(help,21,"| %04d | %04d | %04d",
-               sta->count_mgmt,sta->count_ctrl,
-               sta->count_data);
-*/
-      snprintf(help,21,"| %04d | n.a. | n.a.",
-               sta->count_mgmt);
+      snprintf(help,21,"| %04d | n.a. | %04d",
+               sta->count_mgmt,sta->count_data);
       display_string(display,GUI_OFFSET_MGMT,3+i,help,20);
       snprintf(help,5,"|  %c",sta->active);
       display_string(display,GUI_OFFSET_ACTIVE,3+i,help,4);
@@ -81,13 +76,46 @@ int display_console(t_info *info,char *string) {
              sta->addr[0],sta->addr[1],sta->addr[2],
              sta->addr[3],sta->addr[4],sta->addr[5]);
     display_string(display,1,1,help,21);
+    if(sta->ap) strcpy(help,"(access point)");
+    else strcpy(help,"(station)");
+    s=strlen(help);
+    display_string(display,23,1,help,s);
+    if(sta->wds) {
+      strcpy(help,"wds link");
+      display_string(display,60,1,help,8);
+    }
+    snprintf(help,2,"%c",sta->active);
+    display_string(display,x-1,1,help,1);
+    snprintf(help,7,"sq: %02d",sta->sq);
+    display_string(display,x-8,1,help,6);
     display_line(display,0,2,x,2,'-');
-    display_string(display,1,3,info->clean_line,x);
     display_string(display,1,3,"ssid: ",6);
     s=strlen(sta->ssid);
     memcpy(help,sta->ssid,s);
     display_string(display,7,3,help,s);
-    display_string(display,1,5,"more specific info soon ...",27);
+    if(sta->wep) strcpy(help,"crypted");
+    else strcpy(help,"not crypted");
+    s=strlen(help);
+    display_string(display,x-s-1,3,help,s);
+
+    snprintf(help,13,"mgmt: %06d",sta->count_mgmt);
+    display_string(display,1,5,help,12);
+    snprintf(help,13,"ctrl: %06d",sta->count_ctrl);
+    display_string(display,1,6,help,12);
+    snprintf(help,13,"data: %06d",sta->count_data);
+    display_string(display,1,7,help,12);
+
+    snprintf(help,25,"bssid: %02x:%02x:%02x:%02x:%02x:%02x",
+             sta->bssid[0],sta->bssid[1],sta->bssid[2],
+             sta->bssid[3],sta->bssid[4],sta->bssid[5]);
+    display_string(display,1,9,help,24);
+    if(sta->wep==WEP) {
+      snprintf(help,67,"iv + keynr | crypted snap: %02x %02x %02x %02x | %02x %02x %02x %02x %02x %02x",
+               sta->snap[0],sta->snap[1],sta->snap[2],sta->snap[3],
+               sta->snap[4],sta->snap[5],sta->snap[6],sta->snap[7],
+               sta->snap[8],sta->snap[9]);
+      display_string(display,1,10,help,66);
+    }
   }
 
   /* footer */
@@ -132,17 +160,8 @@ int get_user_interaction(t_info *info) {
 
   input_get_event(&(info->input),noop,info);
 
-  /*
-  if(info->input.content[0]=='h') {
-    display_console(info,"hdw-sniff help:");
-    display_console(info,"h - print this help");
-    display_console(info,"x - enable/disable hex output");
-    display_console(info,"a - enable/disable ascii output");
-    display_console(info,"q - quit");
-    display_console(info,"console navigation: arrow up/down");
-    display_console(info,"network list navigation: page up/down");
-  }
-  */
+  /* clear display */
+  display_clear_screen(&(info->display));
 
   if(info->input.content[0]=='x') {
     info->mode^=MODE_HEXOUT;