Selaa lähdekoodia

Add more help messages and Settings command

0xchocolate 3 vuotta sitten
vanhempi
commit
3de1c28786

+ 1 - 1
applications/wifi_marauder_companion/scenes/wifi_marauder_scene_console_output.c

@@ -32,7 +32,7 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
     if (app->is_command) {
         string_reset(app->text_box_store);
         app->text_box_store_strlen = 0;
-        if (0 == strncmp("help", app->selected_tx_string, 4)) {
+        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);

+ 7 - 4
applications/wifi_marauder_companion/scenes/wifi_marauder_scene_start.c

@@ -18,19 +18,21 @@ typedef enum {
 #define SHOW_STOPSCAN_TIP (true)
 #define NO_TIP (false)
 
+#define MAX_OPTIONS (6)
 typedef struct {
     const char* item_string;
-    const char* options_menu[5];
+    const char* options_menu[MAX_OPTIONS];
     int num_options_menu;
-    const char* actual_commands[5];
+    const char* actual_commands[MAX_OPTIONS];
     InputArgs needs_keyboard;
     FocusConsole focus_console;
     bool show_stopscan_tip;
 } WifiMarauderItem;
 
+// NUM_MENU_ITEMS defined in wifi_marauder_app_i.h - if you add an entry here, increment it!
 const WifiMarauderItem items[NUM_MENU_ITEMS] = {
     { "View Log from", {"start", "end"}, 2, {}, NO_ARGS, FOCUS_CONSOLE_TOGGLE, NO_TIP },
-    { "Scan Access Points (AP)", {""}, 1, {"scanap"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP },
+    { "Scan AP", {""}, 1, {"scanap"}, NO_ARGS, FOCUS_CONSOLE_END, SHOW_STOPSCAN_TIP },
     { "SSID", {"add random", "add name", "remove"}, 3, {"ssid -a -g", "ssid -a -n", "ssid -r"}, INPUT_ARGS, FOCUS_CONSOLE_START, NO_TIP },
     { "List", {"ap", "ssid"}, 2, {"list -a", "list -s"}, NO_ARGS, FOCUS_CONSOLE_START, NO_TIP },
     { "Select", {"ap", "ssid"}, 2, {"select -a", "select -s"}, INPUT_ARGS, FOCUS_CONSOLE_END, NO_TIP },
@@ -40,6 +42,7 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
     { "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 },
@@ -58,7 +61,7 @@ static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uin
     app->focus_console_start = (items[index].focus_console == FOCUS_CONSOLE_TOGGLE) ? (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] == 1) : items[index].needs_keyboard;
+    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);
     } else {

+ 14 - 1
applications/wifi_marauder_companion/scenes/wifi_marauder_scene_text_input.c

@@ -25,7 +25,20 @@ void wifi_marauder_scene_text_input_on_enter(void* context) {
 
     // Setup view
     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, wifi_marauder_scene_text_input_callback, app, app->text_input_store, WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE, false);
 
     view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewTextInput);

+ 1 - 1
applications/wifi_marauder_companion/wifi_marauder_app_i.h

@@ -12,7 +12,7 @@
 #include <gui/modules/text_input.h>
 #include <gui/modules/variable_item_list.h>
 
-#define NUM_MENU_ITEMS (14)
+#define NUM_MENU_ITEMS (15)
 
 #define WIFI_MARAUDER_TEXT_BOX_STORE_SIZE (4096)
 #define WIFI_MARAUDER_TEXT_INPUT_STORE_SIZE (512)