wificurse

wifi jamming tool
git clone git://git.2f30.org/wificurse
Log | Files | Refs | README | LICENSE

console.c (1866B)


      1 /*
      2     wificurse - WiFi Jamming tool
      3     Copyright (C) 2012  oblique
      4 
      5     This program is free software: you can redistribute it and/or modify
      6     it under the terms of the GNU General Public License as published by
      7     the Free Software Foundation, either version 3 of the License, or
      8     (at your option) any later version.
      9 
     10     This program is distributed in the hope that it will be useful,
     11     but WITHOUT ANY WARRANTY; without even the implied warranty of
     12     MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
     13     GNU General Public License for more details.
     14 
     15     You should have received a copy of the GNU General Public License
     16     along with this program.  If not, see <http://www.gnu.org/licenses/>.
     17 */
     18 
     19 #include <stdio.h>
     20 #include <stdlib.h>
     21 #include "iw.h"
     22 #include "ap_list.h"
     23 #include "console.h"
     24 #include "wificurse.h"
     25 
     26 
     27 void clear_scr() {
     28 	printf("\033[2J\033[1;1H");
     29 	fflush(stdout);
     30 }
     31 
     32 void update_scr(struct ap_list *apl, struct iw_dev *dev) {
     33 	struct access_point *ap;
     34 
     35 	/* move cursor at colum 1 row 1 */
     36 	printf("\033[1;1H");
     37 
     38 	printf("\n CH %3d ][ WiFi Curse v" VERSION "\n\n", dev->chan);
     39 	printf("       Deauth  "
     40 	       "BSSID             "
     41 	       "  CH  "
     42 	       "ESSID\n\n");
     43 
     44 	ap = apl->head;
     45 	while (ap != NULL) {
     46 		/* erase whole line */
     47 		printf("\033[2K");
     48 		if (ap->info.chan == dev->chan)
     49 			printf(RED_COLOR "*" RESET_COLOR);
     50 		else
     51 			printf(" ");
     52 		printf(" %11d", ap->num_of_deauths);
     53 		printf("  %02x:%02x:%02x:%02x:%02x:%02x", ap->info.bssid[0],
     54 		       ap->info.bssid[1], ap->info.bssid[2], ap->info.bssid[3],
     55 		       ap->info.bssid[4], ap->info.bssid[5]);
     56 		printf("  %3d ", ap->info.chan);
     57 		if (ap->info.essid[0] == '\0') {
     58 			printf(" <hidden>\n");
     59 		} else
     60 			printf(" %s\n", ap->info.essid);
     61 		ap = ap->next;
     62 	}
     63 
     64 	/* clear screen from cursor to end of display */
     65 	printf("\033[J");
     66 	fflush(stdout);
     67 }