File: display-essid.c

package info (click to toggle)
horst 5.1-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 932 kB
  • sloc: ansic: 9,261; makefile: 109; sh: 28
file content (83 lines) | stat: -rw-r--r-- 2,413 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
/* horst - Highly Optimized Radio Scanning Tool
 *
 * Copyright (C) 2005-2016 Bruno Randolf (br1@einfach.org)
 *
 * This program is free software; you can redistribute it and/or
 * modify it under the terms of the GNU General Public License
 * as published by the Free Software Foundation; either version 2
 * of the License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
 */

/******************* ESSID *******************/

#include <stdlib.h>

#include "display.h"
#include "main.h"
#include "util.h"

void update_essid_win(WINDOW *win)
{
	int i;
	int line = 1;
	struct essid_info* e;
	struct node_info* n;

	werase(win);
	wattron(win, WHITE);
	wattroff(win, A_BOLD);
	box(win, 0 , 0);
	print_centered(win, 0, COLS, " ESSIDs ");

	mvwprintw(win, line++, 3, "NO. MODE SOURCE            (BSSID)             TSF              (BINT) CH Sig E IP");

	list_for_each(&essids.list, e, list) {
		if (line > LINES-3)
			break;

		wattron(win, WHITE | A_BOLD);
		mvwprintw(win, line, 2, "ESSID '%s'", e->essid );
		if (e->split > 0) {
			wattron(win, RED);
			wprintw(win, " *** SPLIT ***");
		}
		else
			wattron(win, GREEN);
		line++;

		i = 1;
		list_for_each(&e->nodes, n, essid_nodes) {
			if (line > LINES-3)
				break;

			if (n->last_seen > (time_mono.tv_sec - conf.node_timeout / 2))
				wattron(win, A_BOLD);
			else
				wattroff(win, A_BOLD);
			mvwprintw(win, line, 3, "%2d. %s %-17s", i++,
				(n->wlan_mode & WLAN_MODE_AP) ? "AP  " : "IBSS",
				mac_name_lookup(n->last_pkt.wlan_src, 0));
			wprintw(win, " (%s)", ether_sprintf(n->wlan_bssid));
			wprintw(win, " %016llx", n->wlan_tsf);
			wprintw(win, " (%d)", n->wlan_bintval);
			if (n->wlan_bintval < 1000)
				wprintw(win, " ");
			wprintw(win, " %2d", n->wlan_channel);
			wprintw(win, " %3d", n->last_pkt.phy_signal);
			wprintw(win, " %s", n->wlan_wep ? "W" : " ");
			if (n->pkt_types & PKT_TYPE_IP)
				wprintw(win, " %s", ip_sprintf(n->ip_src));
			line++;
		}
	}
	wnoutrefresh(win);
}