-
Notifications
You must be signed in to change notification settings - Fork 0
/
ModeConfigurator.h
78 lines (63 loc) · 1.89 KB
/
ModeConfigurator.h
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
#include "Sniffer.h"
Sniffer ap_sniffer;
class ModeConfigurator {
private:
String available_modes[3] = { "SCAN_MODE", "SELECT_MODE", "DEAUTH_ATTACK_MODE" };
int mode_index = 0;
String current_selected_mode = "SCAN_MODE";
public:
String get_current_mode() {
return current_selected_mode;
}
int get_mode_index() {
return mode_index;
}
void reset_mode_to_default() {
current_selected_mode = "";
}
void scroll_to_next_mode() {
if (mode_index == ((sizeof(available_modes) / sizeof(available_modes[0])) - 1)) {
mode_index = 0;
} else {
mode_index++;
}
Serial.print("Mode: ");
Serial.println(available_modes[mode_index]);
}
void confirm_mode_action() {
current_selected_mode = available_modes[mode_index];
Serial.print("Confirming action: ");
Serial.println(available_modes[mode_index]);
switch(mode_index) {
case 0: // SCAN MODE
ap_sniffer.sniff_access_points();
Serial.println("\n");
break;
case 1: // SELECT_MODE
// ap_sniffer.list_access_points();
if (ap_sniffer.get_detected_access_points_num() == 0) {
reset_mode_to_default();
break;
}
Serial.println("\nSelect an Access Point from the list:");
Serial.println("\n");
break;
case 2: // DEAUTH ATTACK MODE
Serial.println("Deauth attack not implemented yet.");
break;
default:
Serial.println("Invalid command");
}
}
void scroll_ap_list() {
String option = ap_sniffer.scroll_to_next_access_point();
Serial.println(option);
}
void confirm_ap_selection() {
int confirmation = ap_sniffer.confirm_ap_selection();
if (confirmation == -1) {
reset_mode_to_default();
// scroll_to_next_mode();
}
}
};