MX 2 лет назад
Родитель
Сommit
794a5a8ed9

+ 5 - 2
ReadMe.md

@@ -24,9 +24,12 @@ From a local clone of this repo, you can also build the app yourself using ufbt.
 
 
 For app feedback, bugs, and feature requests, please [create an issue here](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion/issues).
 For app feedback, bugs, and feature requests, please [create an issue here](https://github.com/0xchocolate/flipperzero-firmware-with-wifi-marauder-companion/issues).
 
 
-You can find me (0xchocolate) on discord as @cococode#6011.
+You can find me (0xchocolate) on discord as @cococode.
+
+If you'd like to donate to the app development effort:
+
+[![ko-fi](https://ko-fi.com/img/githubbutton_sm.svg)](https://ko-fi.com/O4O1R7X6K)
 
 
-If you'd like to donate to the app development effort:  
 **ETH**: `0xf32A1F0CD6122C97d8953183E53cB889cc087C9b`  
 **ETH**: `0xf32A1F0CD6122C97d8953183E53cB889cc087C9b`  
 **BTC**: `bc1qtw7s25cwdkuaups22yna8sttfxn0usm2f35wc3`
 **BTC**: `bc1qtw7s25cwdkuaups22yna8sttfxn0usm2f35wc3`
 
 

+ 1 - 1
application.fam

@@ -1,7 +1,7 @@
 App(
 App(
     appid="esp32_wifi_marauder",
     appid="esp32_wifi_marauder",
     name="[ESP32] WiFi Marauder",
     name="[ESP32] WiFi Marauder",
-    fap_version=(6,4),
+    fap_version=(6,5),
     apptype=FlipperAppType.EXTERNAL,
     apptype=FlipperAppType.EXTERNAL,
     entry_point="wifi_marauder_app",
     entry_point="wifi_marauder_app",
     requires=["gui"],
     requires=["gui"],

+ 16 - 0
scenes/wifi_marauder_scene_console_output.c

@@ -144,11 +144,27 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
             }
             }
         }
         }
 
 
+        bool send_html = false;
+        uint8_t* the_html = NULL;
+        size_t html_size = 0;
+        if(app->selected_tx_string && strncmp(
+                                          "evilportal -c sethtmlstr",
+                                          app->selected_tx_string,
+                                          strlen("evilportal -c sethtmlstr")) == 0) {
+            send_html = wifi_marauder_ep_read_html_file(app, &the_html, &html_size);
+        }
+
         // Send command with newline '\n'
         // Send command with newline '\n'
         if(app->selected_tx_string) {
         if(app->selected_tx_string) {
             wifi_marauder_uart_tx(
             wifi_marauder_uart_tx(
                 (uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string));
                 (uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string));
             wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
             wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
+            if(send_html && the_html) {
+                wifi_marauder_uart_tx(the_html, html_size);
+                wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
+                free(the_html);
+                send_html = false;
+            }
         }
         }
 
 
         // Run the script if the file with the script has been opened
         // Run the script if the file with the script has been opened

+ 15 - 20
scenes/wifi_marauder_scene_start.c

@@ -68,12 +68,12 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
      NO_ARGS,
      NO_ARGS,
      FOCUS_CONSOLE_END,
      FOCUS_CONSOLE_END,
      SHOW_STOPSCAN_TIP},
      SHOW_STOPSCAN_TIP},
-    {"Wardrive", 
-     {"ap", "station", "bt", "bt cont"}, 
-     4, 
-     {"wardrive", "wardrive -s", "btwardrive", "btwardrive -c"}, 
-     NO_ARGS, 
-     FOCUS_CONSOLE_END, 
+    {"Wardrive",
+     {"ap", "station", "bt", "bt cont"},
+     4,
+     {"wardrive", "wardrive -s", "btwardrive", "btwardrive -c"},
+     NO_ARGS,
+     FOCUS_CONSOLE_END,
      SHOW_STOPSCAN_TIP},
      SHOW_STOPSCAN_TIP},
     {"Evil Portal",
     {"Evil Portal",
      {"start", "set html"},
      {"start", "set html"},
@@ -82,6 +82,13 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
      TOGGLE_ARGS,
      TOGGLE_ARGS,
      FOCUS_CONSOLE_END,
      FOCUS_CONSOLE_END,
      SHOW_STOPSCAN_TIP},
      SHOW_STOPSCAN_TIP},
+    {"Load Evil Portal HTML file",
+     {""},
+     1,
+     {"evilportal -c sethtmlstr"},
+     NO_ARGS,
+     FOCUS_CONSOLE_END,
+     NO_TIP},
     {"Targeted Deauth",
     {"Targeted Deauth",
      {"station", "manual"},
      {"station", "manual"},
      2,
      2,
@@ -118,13 +125,7 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
      TOGGLE_ARGS,
      TOGGLE_ARGS,
      FOCUS_CONSOLE_END,
      FOCUS_CONSOLE_END,
      NO_TIP},
      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},
     {"GPS Data",
     {"GPS Data",
      {"stream", "fix", "sats", "lat", "lon", "alt", "date"},
      {"stream", "fix", "sats", "lat", "lon", "alt", "date"},
      7,
      7,
@@ -151,13 +152,7 @@ const WifiMarauderItem items[NUM_MENU_ITEMS] = {
      TOGGLE_ARGS,
      TOGGLE_ARGS,
      FOCUS_CONSOLE_START,
      FOCUS_CONSOLE_START,
      NO_TIP},
      NO_TIP},
-    {"List SD",
-     {""},
-     1,
-     {"ls /"},
-     INPUT_ARGS,
-     FOCUS_CONSOLE_END,
-     NO_TIP},
+    {"List SD", {""}, 1, {"ls /"}, INPUT_ARGS, FOCUS_CONSOLE_END, NO_TIP},
     {"Update", {"sd"}, 1, {"update -s"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
     {"Update", {"sd"}, 1, {"update -s"}, NO_ARGS, FOCUS_CONSOLE_END, NO_TIP},
     {"Reboot", {""}, 1, {"reboot"}, 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},
     {"Help", {""}, 1, {"help"}, NO_ARGS, FOCUS_CONSOLE_START, SHOW_STOPSCAN_TIP},

+ 7 - 8
script/menu/wifi_marauder_script_stage_menu_sniffpmkid.c

@@ -11,7 +11,7 @@ static void wifi_marauder_sniffpmkid_stage_hop_channels_change_callback(Variable
 
 
     uint8_t current_stage_index = variable_item_list_get_selected_item_index(app->var_item_list);
     uint8_t current_stage_index = variable_item_list_get_selected_item_index(app->var_item_list);
     const WifiMarauderScriptMenuItem* menu_item =
     const WifiMarauderScriptMenuItem* menu_item =
-            &app->script_stage_menu->items[current_stage_index];
+        &app->script_stage_menu->items[current_stage_index];
 
 
     uint8_t option_index = variable_item_get_current_value_index(item);
     uint8_t option_index = variable_item_get_current_value_index(item);
     variable_item_set_current_value_text(item, menu_item->options[option_index]);
     variable_item_set_current_value_text(item, menu_item->options[option_index]);
@@ -20,7 +20,6 @@ static void wifi_marauder_sniffpmkid_stage_hop_channels_change_callback(Variable
     stage->hop_channels = option_index;
     stage->hop_channels = option_index;
 }
 }
 
 
-
 static void wifi_marauder_sniffpmkid_stage_force_deauth_setup_callback(VariableItem* item) {
 static void wifi_marauder_sniffpmkid_stage_force_deauth_setup_callback(VariableItem* item) {
     WifiMarauderApp* app = variable_item_get_context(item);
     WifiMarauderApp* app = variable_item_get_context(item);
     WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
     WifiMarauderScriptStageSniffPmkid* stage = app->script_edit_selected_stage->stage;
@@ -110,10 +109,10 @@ void wifi_marauder_script_stage_menu_sniffpmkid_load(WifiMarauderScriptStageMenu
         .setup_callback = wifi_marauder_sniffpmkid_stage_timeout_setup_callback,
         .setup_callback = wifi_marauder_sniffpmkid_stage_timeout_setup_callback,
         .select_callback = wifi_marauder_sniffpmkid_stage_timeout_select_callback};
         .select_callback = wifi_marauder_sniffpmkid_stage_timeout_select_callback};
     stage_menu->items[3] = (WifiMarauderScriptMenuItem){
     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};
+        .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};
 }
 }

+ 5 - 6
script/wifi_marauder_script.c

@@ -247,20 +247,20 @@ WifiMarauderScriptStageSniffPmkid* _wifi_marauder_script_get_stage_sniff_pmkid(c
 
 
     cJSON* timeout_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "timeout");
     cJSON* timeout_json = cJSON_GetObjectItem(sniffpmkid_stage_json, "timeout");
     int timeout = timeout_json != NULL ? (int)cJSON_GetNumberValue(timeout_json) :
     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* 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;
     bool force_deauth = cJSON_IsBool(force_deauth_json) ? force_deauth_json->valueint : true;
 
 
     cJSON* hop_channels_json =
     cJSON* hop_channels_json =
-            cJSON_GetObjectItemCaseSensitive(sniffpmkid_stage_json, "hopChannels");
+        cJSON_GetObjectItemCaseSensitive(sniffpmkid_stage_json, "hopChannels");
     bool hop_channels = cJSON_IsBool(hop_channels_json) ? hop_channels_json->valueint : false;
     bool hop_channels = cJSON_IsBool(hop_channels_json) ? hop_channels_json->valueint : false;
 
 
     WifiMarauderScriptStageSniffPmkid* sniff_pmkid_stage =
     WifiMarauderScriptStageSniffPmkid* sniff_pmkid_stage =
-            (WifiMarauderScriptStageSniffPmkid*)malloc(sizeof(WifiMarauderScriptStageSniffPmkid));
+        (WifiMarauderScriptStageSniffPmkid*)malloc(sizeof(WifiMarauderScriptStageSniffPmkid));
 
 
-    if (sniff_pmkid_stage == NULL) {
+    if(sniff_pmkid_stage == NULL) {
         // Handle memory allocation error
         // Handle memory allocation error
         return NULL;
         return NULL;
     }
     }
@@ -272,7 +272,6 @@ WifiMarauderScriptStageSniffPmkid* _wifi_marauder_script_get_stage_sniff_pmkid(c
     return sniff_pmkid_stage;
     return sniff_pmkid_stage;
 }
 }
 
 
-
 WifiMarauderScriptStageSniffPwn* _wifi_marauder_script_get_stage_sniff_pwn(cJSON* stages) {
 WifiMarauderScriptStageSniffPwn* _wifi_marauder_script_get_stage_sniff_pwn(cJSON* stages) {
     cJSON* sniffpwn_stage_json = cJSON_GetObjectItem(stages, "sniffpwn");
     cJSON* sniffpwn_stage_json = cJSON_GetObjectItem(stages, "sniffpwn");
     if(sniffpwn_stage_json == NULL) {
     if(sniffpwn_stage_json == NULL) {

+ 4 - 6
script/wifi_marauder_script_executor.c

@@ -14,7 +14,6 @@ void _send_line_break() {
     wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
     wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
 }
 }
 
 
-
 void _send_channel_select(int channel) {
 void _send_channel_select(int channel) {
     char command[30];
     char command[30];
     _send_line_break();
     _send_line_break();
@@ -138,9 +137,8 @@ void _wifi_marauder_script_execute_sniff_esp(
 }
 }
 
 
 void _wifi_marauder_script_execute_sniff_pmkid(
 void _wifi_marauder_script_execute_sniff_pmkid(
-        WifiMarauderScriptStageSniffPmkid* stage,
-        WifiMarauderScriptWorker* worker) {
-
+    WifiMarauderScriptStageSniffPmkid* stage,
+    WifiMarauderScriptWorker* worker) {
     // If channel hopping is enabled, loop through channels 1-11
     // If channel hopping is enabled, loop through channels 1-11
     if(stage->hop_channels) {
     if(stage->hop_channels) {
         for(int i = 1; i <= 11; i++) {
         for(int i = 1; i <= 11; i++) {
@@ -162,8 +160,8 @@ void _wifi_marauder_script_execute_sniff_pmkid(
         int len = strlen(attack_command);
         int len = strlen(attack_command);
 
 
         if(stage->channel > 0) {
         if(stage->channel > 0) {
-            len +=
-                    snprintf(attack_command + len, sizeof(attack_command) - len, " -c %d", stage->channel);
+            len += snprintf(
+                attack_command + len, sizeof(attack_command) - len, " -c %d", stage->channel);
         }
         }
 
 
         if(stage->force_deauth) {
         if(stage->force_deauth) {

+ 0 - 1
script/wifi_marauder_script_worker.c

@@ -1,7 +1,6 @@
 #include "../wifi_marauder_app_i.h"
 #include "../wifi_marauder_app_i.h"
 #include "wifi_marauder_script_worker.h"
 #include "wifi_marauder_script_worker.h"
 
 
-
 WifiMarauderScriptWorker* wifi_marauder_script_worker_alloc() {
 WifiMarauderScriptWorker* wifi_marauder_script_worker_alloc() {
     WifiMarauderScriptWorker* worker = malloc(sizeof(WifiMarauderScriptWorker));
     WifiMarauderScriptWorker* worker = malloc(sizeof(WifiMarauderScriptWorker));
     if(worker == NULL) {
     if(worker == NULL) {

+ 1 - 1
wifi_marauder_app.h

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

+ 3 - 1
wifi_marauder_app_i.h

@@ -6,6 +6,7 @@
 #include "scenes/wifi_marauder_scene.h"
 #include "scenes/wifi_marauder_scene.h"
 #include "wifi_marauder_custom_event.h"
 #include "wifi_marauder_custom_event.h"
 #include "wifi_marauder_uart.h"
 #include "wifi_marauder_uart.h"
+#include "wifi_marauder_ep.h"
 #include "file/sequential_file.h"
 #include "file/sequential_file.h"
 #include "script/wifi_marauder_script.h"
 #include "script/wifi_marauder_script.h"
 #include "script/wifi_marauder_script_worker.h"
 #include "script/wifi_marauder_script_worker.h"
@@ -26,13 +27,14 @@
 #include <lib/toolbox/path.h>
 #include <lib/toolbox/path.h>
 #include <dialogs/dialogs.h>
 #include <dialogs/dialogs.h>
 
 
-#define NUM_MENU_ITEMS (23)
+#define NUM_MENU_ITEMS (24)
 
 
 #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)
 
 
 #define MARAUDER_APP_FOLDER_USER "apps_data/marauder"
 #define MARAUDER_APP_FOLDER_USER "apps_data/marauder"
 #define MARAUDER_APP_FOLDER EXT_PATH(MARAUDER_APP_FOLDER_USER)
 #define MARAUDER_APP_FOLDER EXT_PATH(MARAUDER_APP_FOLDER_USER)
+#define MARAUDER_APP_FOLDER_HTML MARAUDER_APP_FOLDER "/html"
 #define MARAUDER_APP_FOLDER_PCAPS MARAUDER_APP_FOLDER "/pcaps"
 #define MARAUDER_APP_FOLDER_PCAPS MARAUDER_APP_FOLDER "/pcaps"
 #define MARAUDER_APP_FOLDER_LOGS MARAUDER_APP_FOLDER "/logs"
 #define MARAUDER_APP_FOLDER_LOGS MARAUDER_APP_FOLDER "/logs"
 #define MARAUDER_APP_FOLDER_USER_PCAPS MARAUDER_APP_FOLDER_USER "/pcaps"
 #define MARAUDER_APP_FOLDER_USER_PCAPS MARAUDER_APP_FOLDER_USER "/pcaps"

+ 44 - 0
wifi_marauder_ep.c

@@ -0,0 +1,44 @@
+#include "wifi_marauder_ep.h"
+
+// returns success (if true, then caller needs to free(the_html))
+bool wifi_marauder_ep_read_html_file(WifiMarauderApp* app, uint8_t** the_html, size_t* html_size) {
+    // browse for files
+    FuriString* predefined_filepath = furi_string_alloc_set_str(MARAUDER_APP_FOLDER_HTML);
+    FuriString* selected_filepath = furi_string_alloc();
+    DialogsFileBrowserOptions browser_options;
+    dialog_file_browser_set_basic_options(&browser_options, ".html", &I_Text_10x10);
+    if(!dialog_file_browser_show(
+           app->dialogs, selected_filepath, predefined_filepath, &browser_options)) {
+        return false;
+    }
+
+    File* index_html = storage_file_alloc(app->storage);
+    if(!storage_file_open(
+           index_html, furi_string_get_cstr(selected_filepath), FSAM_READ, FSOM_OPEN_EXISTING)) {
+        dialog_message_show_storage_error(app->dialogs, "Cannot open file");
+        return false;
+    }
+
+    uint64_t size = storage_file_size(index_html);
+
+    *the_html = malloc(size); // to be freed by caller
+    uint8_t* buf_ptr = *the_html;
+    size_t read = 0;
+    while(read < size) {
+        size_t to_read = size - read;
+        if(to_read > UINT16_MAX) to_read = UINT16_MAX;
+        uint16_t now_read = storage_file_read(index_html, buf_ptr, (uint16_t)to_read);
+        read += now_read;
+        buf_ptr += now_read;
+    }
+
+    *html_size = read;
+
+    storage_file_close(index_html);
+    storage_file_free(index_html);
+
+    furi_string_free(selected_filepath);
+    furi_string_free(predefined_filepath);
+
+    return true;
+}

+ 6 - 0
wifi_marauder_ep.h

@@ -0,0 +1,6 @@
+// evil portal helper
+#pragma once
+
+#include "wifi_marauder_app_i.h"
+
+bool wifi_marauder_ep_read_html_file(WifiMarauderApp* app, uint8_t** the_html, size_t* html_size);