mirror of
https://github.com/DarkFlippers/unleashed-firmware.git
synced 2024-12-26 14:51:52 +03:00
wifi marauder app update
by @0xchocolate / with some changes applied
This commit is contained in:
parent
a928cb6ed7
commit
077898f068
@ -32,6 +32,18 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
|
|||||||
if(app->is_command) {
|
if(app->is_command) {
|
||||||
string_reset(app->text_box_store);
|
string_reset(app->text_box_store);
|
||||||
app->text_box_store_strlen = 0;
|
app->text_box_store_strlen = 0;
|
||||||
|
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
|
||||||
|
const char* help_msg =
|
||||||
|
"For app support/feedback,\nreach out to me:\n@cococode#6011 (discord)\n0xchocolate (github)\n";
|
||||||
|
string_cat_str(app->text_box_store, help_msg);
|
||||||
|
app->text_box_store_strlen += strlen(help_msg);
|
||||||
|
}
|
||||||
|
|
||||||
|
if(app->show_stopscan_tip) {
|
||||||
|
const char* help_msg = "Press BACK to send stopscan\n";
|
||||||
|
string_cat_str(app->text_box_store, help_msg);
|
||||||
|
app->text_box_store_strlen += strlen(help_msg);
|
||||||
|
}
|
||||||
} else { // "View Log" menu action
|
} else { // "View Log" menu action
|
||||||
text_box_set_text(app->text_box, string_get_cstr(app->text_box_store));
|
text_box_set_text(app->text_box, string_get_cstr(app->text_box_store));
|
||||||
}
|
}
|
||||||
|
@ -1,67 +1,135 @@
|
|||||||
#include "../wifi_marauder_app_i.h"
|
#include "../wifi_marauder_app_i.h"
|
||||||
|
|
||||||
#define NUM_MENU_ITEMS (29)
|
|
||||||
|
|
||||||
// For each command, define whether additional arguments are needed
|
// For each command, define whether additional arguments are needed
|
||||||
// (enabling text input to fill them out), and whether the console
|
// (enabling text input to fill them out), and whether the console
|
||||||
// text box should focus at the start of the output or the end
|
// text box should focus at the start of the output or the end
|
||||||
#define INPUT_ARGS (true)
|
typedef enum { NO_ARGS = 0, INPUT_ARGS, TOGGLE_ARGS } InputArgs;
|
||||||
#define NO_ARGS (false)
|
|
||||||
#define FOCUS_CONSOLE_START (true)
|
|
||||||
#define FOCUS_CONSOLE_END (false)
|
|
||||||
struct WifiMarauderItem {
|
|
||||||
const char* item_string;
|
|
||||||
bool needs_keyboard;
|
|
||||||
bool focus_console_start;
|
|
||||||
};
|
|
||||||
|
|
||||||
const struct WifiMarauderItem items[NUM_MENU_ITEMS] = {
|
typedef enum { FOCUS_CONSOLE_END = 0, FOCUS_CONSOLE_START, FOCUS_CONSOLE_TOGGLE } FocusConsole;
|
||||||
{"View Log (start)", NO_ARGS, FOCUS_CONSOLE_START},
|
|
||||||
{"View Log (end)", NO_ARGS, FOCUS_CONSOLE_END},
|
#define SHOW_STOPSCAN_TIP (true)
|
||||||
{"attack -t beacon -l", NO_ARGS, FOCUS_CONSOLE_END},
|
#define NO_TIP (false)
|
||||||
{"attack -t beacon -r", NO_ARGS, FOCUS_CONSOLE_END},
|
|
||||||
{"attack -t beacon -a", NO_ARGS, FOCUS_CONSOLE_END},
|
#define MAX_OPTIONS (6)
|
||||||
{"attack -t deauth", NO_ARGS, FOCUS_CONSOLE_END},
|
typedef struct {
|
||||||
{"attack -t probe", NO_ARGS, FOCUS_CONSOLE_END},
|
const char* item_string;
|
||||||
{"attack -t rickroll", NO_ARGS, FOCUS_CONSOLE_END},
|
const char* options_menu[MAX_OPTIONS];
|
||||||
{"channel", NO_ARGS, FOCUS_CONSOLE_END},
|
int num_options_menu;
|
||||||
{"channel -s", INPUT_ARGS, FOCUS_CONSOLE_END},
|
const char* actual_commands[MAX_OPTIONS];
|
||||||
{"clearlist -a", NO_ARGS, FOCUS_CONSOLE_END},
|
InputArgs needs_keyboard;
|
||||||
{"clearlist -s", NO_ARGS, FOCUS_CONSOLE_END},
|
FocusConsole focus_console;
|
||||||
{"help", NO_ARGS, FOCUS_CONSOLE_START},
|
bool show_stopscan_tip;
|
||||||
{"list -a", NO_ARGS, FOCUS_CONSOLE_START},
|
} WifiMarauderItem;
|
||||||
{"list -s", NO_ARGS, FOCUS_CONSOLE_START},
|
|
||||||
{"reboot", NO_ARGS, FOCUS_CONSOLE_END},
|
// NUM_MENU_ITEMS defined in wifi_marauder_app_i.h - if you add an entry here, increment it!
|
||||||
{"scanap", NO_ARGS, FOCUS_CONSOLE_END},
|
const WifiMarauderItem items[NUM_MENU_ITEMS] = {
|
||||||
{"select -a", INPUT_ARGS, FOCUS_CONSOLE_END},
|
{"View Log from", {"start", "end"}, 2, {}, NO_ARGS, FOCUS_CONSOLE_TOGGLE, NO_TIP},
|
||||||
{"select -s", INPUT_ARGS, FOCUS_CONSOLE_END},
|
{"Scan AP", {""}, 1, {"scanap"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP},
|
||||||
{"sniffbeacon", NO_ARGS, FOCUS_CONSOLE_END},
|
{"SSID",
|
||||||
{"sniffdeauth", NO_ARGS, FOCUS_CONSOLE_END},
|
{"add random", "add name", "remove"},
|
||||||
{"sniffesp", NO_ARGS, FOCUS_CONSOLE_END},
|
3,
|
||||||
{"sniffpmkid", NO_ARGS, FOCUS_CONSOLE_END},
|
{"ssid -a -g", "ssid -a -n", "ssid -r"},
|
||||||
{"sniffpmkid -c", INPUT_ARGS, FOCUS_CONSOLE_END},
|
INPUT_ARGS,
|
||||||
{"sniffpwn", NO_ARGS, FOCUS_CONSOLE_END},
|
FOCUS_CONSOLE_START,
|
||||||
{"ssid -a -g", INPUT_ARGS, FOCUS_CONSOLE_END},
|
NO_TIP},
|
||||||
{"ssid -a -n", INPUT_ARGS, FOCUS_CONSOLE_END},
|
{"List", {"ap", "ssid"}, 2, {"list -a", "list -s"}, NO_ARGS, FOCUS_CONSOLE_START, NO_TIP},
|
||||||
{"ssid -r", INPUT_ARGS, FOCUS_CONSOLE_END},
|
{"Select", {"ap", "ssid"}, 2, {"select -a", "select -s"}, INPUT_ARGS, FOCUS_CONSOLE_END, NO_TIP},
|
||||||
{"update -w", NO_ARGS, FOCUS_CONSOLE_END},
|
{"Clear List",
|
||||||
|
{"ap", "ssid"},
|
||||||
|
2,
|
||||||
|
{"clearlist -a", "clearlist -s"},
|
||||||
|
NO_ARGS,
|
||||||
|
FOCUS_CONSOLE_END,
|
||||||
|
NO_TIP},
|
||||||
|
{"Attack",
|
||||||
|
{"deauth", "probe", "rickroll"},
|
||||||
|
3,
|
||||||
|
{"attack -t deauth", "attack -t probe", "attack -t rickroll"},
|
||||||
|
NO_ARGS,
|
||||||
|
FOCUS_CONSOLE_END,
|
||||||
|
SHOW_STOPSCAN_TIP},
|
||||||
|
{"Beacon Spam",
|
||||||
|
{"ap list", "ssid list", "random"},
|
||||||
|
3,
|
||||||
|
{"attack -t beacon -a", "attack -t beacon -l", "attack -t beacon -r"},
|
||||||
|
NO_ARGS,
|
||||||
|
FOCUS_CONSOLE_END,
|
||||||
|
SHOW_STOPSCAN_TIP},
|
||||||
|
{"Sniff",
|
||||||
|
{"beacon", "deauth", "esp", "pmkid", "pwn"},
|
||||||
|
5,
|
||||||
|
{"sniffbeacon", "sniffdeauth", "sniffesp", "sniffpmkid", "sniffpwn"},
|
||||||
|
NO_ARGS,
|
||||||
|
FOCUS_CONSOLE_END,
|
||||||
|
SHOW_STOPSCAN_TIP},
|
||||||
|
{"Sniff PMKID on channel",
|
||||||
|
{""},
|
||||||
|
1,
|
||||||
|
{"sniffpmkid -c"},
|
||||||
|
INPUT_ARGS,
|
||||||
|
FOCUS_CONSOLE_END,
|
||||||
|
SHOW_STOPSCAN_TIP},
|
||||||
|
{"Channel",
|
||||||
|
{"get", "set"},
|
||||||
|
2,
|
||||||
|
{"channel", "channel -s"},
|
||||||
|
TOGGLE_ARGS,
|
||||||
|
FOCUS_CONSOLE_END,
|
||||||
|
NO_TIP},
|
||||||
|
{"Settings",
|
||||||
|
{"display", "restore", "ForcePMKID", "ForceProbe", "SavePCAP", "other"},
|
||||||
|
6,
|
||||||
|
{"settings",
|
||||||
|
"settings -r",
|
||||||
|
"settings -s ForcePMKID enable",
|
||||||
|
"settings -s ForceProbe enable",
|
||||||
|
"settings -s SavePCAP enable",
|
||||||
|
"settings -s"},
|
||||||
|
TOGGLE_ARGS,
|
||||||
|
FOCUS_CONSOLE_START,
|
||||||
|
NO_TIP},
|
||||||
|
{"Update", {""}, 1, {"update -w"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
|
||||||
|
{"Reboot", {""}, 1, {"reboot"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
|
||||||
|
{"Help", {""}, 1, {"help"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP},
|
||||||
};
|
};
|
||||||
|
|
||||||
static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uint32_t index) {
|
static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uint32_t index) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
WifiMarauderApp* app = context;
|
WifiMarauderApp* app = context;
|
||||||
app->selected_tx_string = items[index].item_string;
|
if(app->selected_option_index[index] < items[index].num_options_menu) {
|
||||||
app->is_command = (2 <= index);
|
app->selected_tx_string = items[index].actual_commands[app->selected_option_index[index]];
|
||||||
|
}
|
||||||
|
app->is_command = (1 <= index);
|
||||||
app->is_custom_tx_string = false;
|
app->is_custom_tx_string = false;
|
||||||
app->selected_menu_index = index;
|
app->selected_menu_index = index;
|
||||||
app->focus_console_start = items[index].focus_console_start;
|
app->focus_console_start = (items[index].focus_console == FOCUS_CONSOLE_TOGGLE) ?
|
||||||
if(items[index].needs_keyboard) {
|
(app->selected_option_index[index] == 0) :
|
||||||
|
items[index].focus_console;
|
||||||
|
app->show_stopscan_tip = items[index].show_stopscan_tip;
|
||||||
|
|
||||||
|
bool needs_keyboard = (items[index].needs_keyboard == TOGGLE_ARGS) ?
|
||||||
|
(app->selected_option_index[index] != 0) :
|
||||||
|
items[index].needs_keyboard;
|
||||||
|
if(needs_keyboard) {
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartKeyboard);
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartKeyboard);
|
||||||
} else {
|
} else {
|
||||||
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartConsole);
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartConsole);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void wifi_marauder_scene_start_var_list_change_callback(VariableItem* item) {
|
||||||
|
furi_assert(item);
|
||||||
|
|
||||||
|
WifiMarauderApp* app = variable_item_get_context(item);
|
||||||
|
furi_assert(app);
|
||||||
|
|
||||||
|
const WifiMarauderItem* menu_item = &items[app->selected_menu_index];
|
||||||
|
uint8_t item_index = variable_item_get_current_value_index(item);
|
||||||
|
furi_assert(item_index < menu_item->num_options_menu);
|
||||||
|
variable_item_set_current_value_text(item, menu_item->options_menu[item_index]);
|
||||||
|
app->selected_option_index[app->selected_menu_index] = item_index;
|
||||||
|
}
|
||||||
|
|
||||||
void wifi_marauder_scene_start_on_enter(void* context) {
|
void wifi_marauder_scene_start_on_enter(void* context) {
|
||||||
WifiMarauderApp* app = context;
|
WifiMarauderApp* app = context;
|
||||||
VariableItemList* var_item_list = app->var_item_list;
|
VariableItemList* var_item_list = app->var_item_list;
|
||||||
@ -69,9 +137,19 @@ void wifi_marauder_scene_start_on_enter(void* context) {
|
|||||||
variable_item_list_set_enter_callback(
|
variable_item_list_set_enter_callback(
|
||||||
var_item_list, wifi_marauder_scene_start_var_list_enter_callback, app);
|
var_item_list, wifi_marauder_scene_start_var_list_enter_callback, app);
|
||||||
|
|
||||||
// TODO: organize menu
|
VariableItem* item;
|
||||||
for(int i = 0; i < NUM_MENU_ITEMS; ++i) {
|
for(int i = 0; i < NUM_MENU_ITEMS; ++i) {
|
||||||
variable_item_list_add(var_item_list, items[i].item_string, 0, NULL, NULL);
|
item = variable_item_list_add(
|
||||||
|
var_item_list,
|
||||||
|
items[i].item_string,
|
||||||
|
items[i].num_options_menu,
|
||||||
|
wifi_marauder_scene_start_var_list_change_callback,
|
||||||
|
app);
|
||||||
|
if(items[i].num_options_menu) {
|
||||||
|
variable_item_set_current_value_index(item, app->selected_option_index[i]);
|
||||||
|
variable_item_set_current_value_text(
|
||||||
|
item, items[i].options_menu[app->selected_option_index[i]]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
variable_item_list_set_selected_item(
|
variable_item_list_set_selected_item(
|
||||||
@ -96,6 +174,9 @@ bool wifi_marauder_scene_start_on_event(void* context, SceneManagerEvent event)
|
|||||||
scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewConsoleOutput);
|
scene_manager_next_scene(app->scene_manager, WifiMarauderAppViewConsoleOutput);
|
||||||
}
|
}
|
||||||
consumed = true;
|
consumed = true;
|
||||||
|
} else if(event.type == SceneManagerEventTypeTick) {
|
||||||
|
app->selected_menu_index = variable_item_list_get_selected_item_index(app->var_item_list);
|
||||||
|
consumed = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
return consumed;
|
return consumed;
|
||||||
|
@ -24,7 +24,20 @@ void wifi_marauder_scene_text_input_on_enter(void* context) {
|
|||||||
|
|
||||||
// Setup view
|
// Setup view
|
||||||
TextInput* text_input = app->text_input;
|
TextInput* text_input = app->text_input;
|
||||||
text_input_set_header_text(text_input, "Add command arguments");
|
// Add help message to header
|
||||||
|
if(0 == strncmp("ssid -a -g", app->selected_tx_string, strlen("ssid -a -g"))) {
|
||||||
|
text_input_set_header_text(text_input, "Enter # SSIDs to generate");
|
||||||
|
} else if(0 == strncmp("ssid -a -n", app->selected_tx_string, strlen("ssid -a -n"))) {
|
||||||
|
text_input_set_header_text(text_input, "Enter SSID name to add");
|
||||||
|
} else if(0 == strncmp("ssid -r", app->selected_tx_string, strlen("ssid -r"))) {
|
||||||
|
text_input_set_header_text(text_input, "Remove target from SSID list");
|
||||||
|
} else if(0 == strncmp("select -a", app->selected_tx_string, strlen("select -a"))) {
|
||||||
|
text_input_set_header_text(text_input, "Add target from AP list");
|
||||||
|
} else if(0 == strncmp("select -s", app->selected_tx_string, strlen("select -s"))) {
|
||||||
|
text_input_set_header_text(text_input, "Add target from SSID list");
|
||||||
|
} else {
|
||||||
|
text_input_set_header_text(text_input, "Add command arguments");
|
||||||
|
}
|
||||||
text_input_set_result_callback(
|
text_input_set_result_callback(
|
||||||
text_input,
|
text_input,
|
||||||
wifi_marauder_scene_text_input_callback,
|
wifi_marauder_scene_text_input_callback,
|
||||||
|
@ -46,6 +46,10 @@ WifiMarauderApp* wifi_marauder_app_alloc() {
|
|||||||
WifiMarauderAppViewVarItemList,
|
WifiMarauderAppViewVarItemList,
|
||||||
variable_item_list_get_view(app->var_item_list));
|
variable_item_list_get_view(app->var_item_list));
|
||||||
|
|
||||||
|
for(int i = 0; i < NUM_MENU_ITEMS; ++i) {
|
||||||
|
app->selected_option_index[i] = 0;
|
||||||
|
}
|
||||||
|
|
||||||
app->text_box = text_box_alloc();
|
app->text_box = text_box_alloc();
|
||||||
view_dispatcher_add_view(
|
view_dispatcher_add_view(
|
||||||
app->view_dispatcher, WifiMarauderAppViewConsoleOutput, text_box_get_view(app->text_box));
|
app->view_dispatcher, WifiMarauderAppViewConsoleOutput, text_box_get_view(app->text_box));
|
||||||
|
@ -12,6 +12,8 @@
|
|||||||
#include <gui/modules/text_input.h>
|
#include <gui/modules/text_input.h>
|
||||||
#include <gui/modules/variable_item_list.h>
|
#include <gui/modules/variable_item_list.h>
|
||||||
|
|
||||||
|
#define NUM_MENU_ITEMS (15)
|
||||||
|
|
||||||
#define WIFI_MARAUDER_TEXT_BOX_STORE_SIZE (4096)
|
#define WIFI_MARAUDER_TEXT_BOX_STORE_SIZE (4096)
|
||||||
#define WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE (512)
|
#define WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE (512)
|
||||||
|
|
||||||
@ -31,10 +33,12 @@ struct WifiMarauderApp {
|
|||||||
|
|
||||||
WifiMarauderUart* uart;
|
WifiMarauderUart* uart;
|
||||||
int selected_menu_index;
|
int selected_menu_index;
|
||||||
|
int selected_option_index[NUM_MENU_ITEMS];
|
||||||
const char* selected_tx_string;
|
const char* selected_tx_string;
|
||||||
bool is_command;
|
bool is_command;
|
||||||
bool is_custom_tx_string;
|
bool is_custom_tx_string;
|
||||||
bool focus_console_start;
|
bool focus_console_start;
|
||||||
|
bool show_stopscan_tip;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Supported commands:
|
// Supported commands:
|
||||||
|
Loading…
Reference in New Issue
Block a user