MX 2 лет назад
Родитель
Сommit
4012e88205

+ 7 - 1
scenes/wifi_marauder_scene_start.c

@@ -111,7 +111,13 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
      TOGGLE_ARGS,
      FOCUS_CONSOLE_END,
      NO_TIP},
-    {"LED", {"hex", "pattern"}, 2, {"led -s", "led -p"}, INPUT_ARGS, FOCUS_CONSOLE_END, NO_TIP},
+    {"LED",
+     {"hex", "pattern"},
+     2,
+     {"led -s", "led -p"},
+     INPUT_ARGS,
+     FOCUS_CONSOLE_END,
+     NO_TIP},
     {"Settings",
      {"display", "restore", "ForcePMKID", "ForceProbe", "SavePCAP", "EnableLED", "other"},
      7,

+ 30 - 2
script/menu/wifi_marauder_script_stage_menu_sniffpmkid.c

@@ -1,5 +1,26 @@
 #include "../../wifi_marauder_app_i.h"
 
+static void wifi_marauder_sniffpmkid_stage_hop_channels_setup_callback(VariableItem* item) {
+    WifiMarauderApp* app = variable_item_get_context(item);
+    WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
+    variable_item_set_current_value_index(item, stage->hop_channels);
+}
+
+static void wifi_marauder_sniffpmkid_stage_hop_channels_change_callback(VariableItem* item) {
+    WifiMarauderApp* app = variable_item_get_context(item);
+
+    uint8_t current_stage_index = variable_item_list_get_selected_item_index(app->var_item_list);
+    const WifiMarauderScriptMenuItem* menu_item =
+            &app->script_stage_menu->items[current_stage_index];
+
+    uint8_t option_index = variable_item_get_current_value_index(item);
+    variable_item_set_current_value_text(item, menu_item->options[option_index]);
+
+    WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
+    stage->hop_channels = option_index;
+}
+
+
 static void wifi_marauder_sniffpmkid_stage_force_deauth_setup_callback(VariableItem* item) {
     WifiMarauderApp* app = variable_item_get_context(item);
     WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
@@ -65,8 +86,8 @@ static void wifi_marauder_sniffpmkid_stage_timeout_select_callback(void* context
 }
 
 void wifi_marauder_script_stage_menu_sniffpmkid_load(WifiMarauderScriptStageMenu* stage_menu) {
-    stage_menu->num_items = 3;
-    stage_menu->items = malloc(3 * sizeof(WifiMarauderScriptMenuItem));
+    stage_menu->num_items = 4;
+    stage_menu->items = malloc(4 * sizeof(WifiMarauderScriptMenuItem));
 
     stage_menu->items[0] = (WifiMarauderScriptMenuItem){
         .name = strdup("Force deauth"),
@@ -88,4 +109,11 @@ void wifi_marauder_script_stage_menu_sniffpmkid_load(WifiMarauderScriptStageMenu
         .num_options = 1,
         .setup_callback = wifi_marauder_sniffpmkid_stage_timeout_setup_callback,
         .select_callback = wifi_marauder_sniffpmkid_stage_timeout_select_callback};
+    stage_menu->items[3] = (WifiMarauderScriptMenuItem){
+            .name = strdup("Hop Channels"),
+            .type = WifiMarauderScriptMenuItemTypeOptionsString,
+            .num_options = 2,
+            .options = {"no", "yes"},
+            .setup_callback = wifi_marauder_sniffpmkid_stage_hop_channels_setup_callback,
+            .change_callback = wifi_marauder_sniffpmkid_stage_hop_channels_change_callback};
 }

+ 19 - 3
script/wifi_marauder_script.c

@@ -244,22 +244,35 @@ WifiMarauderScriptStageSniffPmkid* _wifi_marauder_script_get_stage_sniff_pmkid(c
 
     cJSON* channel_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "channel");
     int channel = channel_json != NULL ? (int)cJSON_GetNumberValue(channel_json) : 0;
+
     cJSON* timeout_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "timeout");
     int timeout = timeout_json != NULL ? (int)cJSON_GetNumberValue(timeout_json) :
-                                         WIFI_MARAUDER_DEFAULT_TIMEOUT_SNIFF;
+                  WIFI_MARAUDER_DEFAULT_TIMEOUT_SNIFF;
+
     cJSON* force_deauth_json =
-        cJSON_GetObjectItemCaseSensitive(sniffpmkid_stage_json, "forceDeauth");
+            cJSON_GetObjectItemCaseSensitive(sniffpmkid_stage_json, "forceDeauth");
     bool force_deauth = cJSON_IsBool(force_deauth_json) ? force_deauth_json->valueint : true;
 
+    cJSON* hop_channels_json =
+            cJSON_GetObjectItemCaseSensitive(sniffpmkid_stage_json, "hopChannels");
+    bool hop_channels = cJSON_IsBool(hop_channels_json) ? hop_channels_json->valueint : false;
+
     WifiMarauderScriptStageSniffPmkid* sniff_pmkid_stage =
-        (WifiMarauderScriptStageSniffPmkid*)malloc(sizeof(WifiMarauderScriptStageSniffPmkid));
+            (WifiMarauderScriptStageSniffPmkid*)malloc(sizeof(WifiMarauderScriptStageSniffPmkid));
+
+    if (sniff_pmkid_stage == NULL) {
+        // Handle memory allocation error
+        return NULL;
+    }
     sniff_pmkid_stage->channel = channel;
     sniff_pmkid_stage->timeout = timeout;
     sniff_pmkid_stage->force_deauth = force_deauth;
+    sniff_pmkid_stage->hop_channels = hop_channels;
 
     return sniff_pmkid_stage;
 }
 
+
 WifiMarauderScriptStageSniffPwn* _wifi_marauder_script_get_stage_sniff_pwn(cJSON* stages) {
     cJSON* sniffpwn_stage_json = cJSON_GetObjectItem(stages, "sniffpwn");
     if(sniffpwn_stage_json == NULL) {
@@ -659,6 +672,9 @@ cJSON* _wifi_marauder_script_create_json_sniffpmkid(
     if(sniffpmkid_stage->timeout > 0) {
         cJSON_AddNumberToObject(sniffpmkid_json, "timeout", sniffpmkid_stage->timeout);
     }
+    // Hop channels
+    cJSON_AddBoolToObject(sniffpmkid_json, "hopChannels", sniffpmkid_stage->hop_channels);
+
     return stage_json;
 }
 

+ 1 - 0
script/wifi_marauder_script.h

@@ -196,6 +196,7 @@ typedef struct WifiMarauderScriptStageSniffEsp {
 
 typedef struct WifiMarauderScriptStageSniffPmkid {
     bool force_deauth;
+    bool hop_channels;
     int channel;
     int timeout;
 } WifiMarauderScriptStageSniffPmkid;

+ 36 - 17
script/wifi_marauder_script_executor.c

@@ -14,9 +14,10 @@ void _send_line_break() {
     wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
 }
 
+
 void _send_channel_select(int channel) {
     char command[30];
-    wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
+    _send_line_break();
     snprintf(command, sizeof(command), "channel -s %d\n", channel);
     wifi_marauder_uart_tx((uint8_t*)(command), strlen(command));
 }
@@ -137,25 +138,42 @@ void _wifi_marauder_script_execute_sniff_esp(
 }
 
 void _wifi_marauder_script_execute_sniff_pmkid(
-    WifiMarauderScriptStageSniffPmkid* stage,
-    WifiMarauderScriptWorker* worker) {
-    char attack_command[50] = "sniffpmkid";
-    int len = strlen(attack_command);
+        WifiMarauderScriptStageSniffPmkid* stage,
+        WifiMarauderScriptWorker* worker) {
+
+    // If channel hopping is enabled, loop through channels 1-11
+    if(stage->hop_channels) {
+        for(int i = 1; i <= 11; i++) {
+            char attack_command[50] = "sniffpmkid";
+            int len = strlen(attack_command);
+
+            len += snprintf(attack_command + len, sizeof(attack_command) - len, " -c %d", i);
+            if(stage->force_deauth) {
+                len += snprintf(attack_command + len, sizeof(attack_command) - len, " -d");
+            }
+
+            len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");
+            wifi_marauder_uart_tx((uint8_t*)attack_command, len);
+            _wifi_marauder_script_delay(worker, stage->timeout);
+            _send_stop();
+        }
+    } else {
+        char attack_command[50] = "sniffpmkid";
+        int len = strlen(attack_command);
 
-    if(stage->channel > 0) {
-        len +=
-            snprintf(attack_command + len, sizeof(attack_command) - len, " -c %d", stage->channel);
-    }
+        if(stage->channel > 0) {
+            len +=
+                    snprintf(attack_command + len, sizeof(attack_command) - len, " -c %d", stage->channel);
+        }
 
-    if(stage->force_deauth) {
-        len += snprintf(attack_command + len, sizeof(attack_command) - len, " -d");
+        if(stage->force_deauth) {
+            len += snprintf(attack_command + len, sizeof(attack_command) - len, " -d");
+        }
+        len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");
+        wifi_marauder_uart_tx((uint8_t*)attack_command, len);
+        _wifi_marauder_script_delay(worker, stage->timeout);
+        _send_stop();
     }
-
-    len += snprintf(attack_command + len, sizeof(attack_command) - len, "\n");
-
-    wifi_marauder_uart_tx((uint8_t*)attack_command, len);
-    _wifi_marauder_script_delay(worker, stage->timeout);
-    _send_stop();
 }
 
 void _wifi_marauder_script_execute_sniff_pwn(
@@ -209,6 +227,7 @@ void _wifi_marauder_script_execute_beacon_ap(
 void _wifi_marauder_script_execute_exec(WifiMarauderScriptStageExec* stage) {
     if(stage->command != NULL) {
         wifi_marauder_uart_tx((uint8_t*)stage->command, strlen(stage->command));
+        _send_line_break();
     }
 }
 

+ 2 - 0
script/wifi_marauder_script_worker.c

@@ -1,6 +1,7 @@
 #include "../wifi_marauder_app_i.h"
 #include "wifi_marauder_script_worker.h"
 
+
 WifiMarauderScriptWorker* wifi_marauder_script_worker_alloc() {
     WifiMarauderScriptWorker* worker = malloc(sizeof(WifiMarauderScriptWorker));
     if(worker == NULL) {
@@ -39,6 +40,7 @@ int32_t _wifi_marauder_script_worker_task(void* worker) {
     }
 
     script_worker->is_running = false;
+
     return WifiMarauderScriptWorkerStatusSuccess;
 }
 

+ 1 - 1
wifi_marauder_app.h

@@ -4,7 +4,7 @@
 extern "C" {
 #endif
 
-#define WIFI_MARAUDER_APP_VERSION "v0.6.0"
+#define WIFI_MARAUDER_APP_VERSION "v0.6.1"
 
 typedef struct WifiMarauderApp WifiMarauderApp;