Просмотр исходного кода

Creates a new PCAP file to store the captures during script execution if there is any sniff stage

tcpassos 2 лет назад
Родитель
Сommit
6d0a3abf96

+ 59 - 0
applications/external/wifi_marauder_companion/file/sequential_file.c

@@ -0,0 +1,59 @@
+#include "sequential_file.h"
+
+SequentialFile* sequential_file_create(Storage* storage, const char* dir, const char* prefix, const char* extension) {
+    if (storage == NULL || dir == NULL || prefix == NULL || extension == NULL) {
+        return NULL;
+    }
+    char file_path[256];
+    File* file = storage_file_alloc(storage);
+
+    int file_index = 0;
+    do {
+        snprintf(file_path, sizeof(file_path),
+                 "%s/%s_%d.%s",
+                 dir, prefix, file_index, extension);
+        file_index++;
+    } while(storage_file_exists(storage, file_path));
+
+    if(!storage_file_open(file, file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
+        storage_file_free(file);
+        return NULL;
+    }
+
+    SequentialFile* sequential_file = (SequentialFile*) malloc(sizeof(SequentialFile));
+    sequential_file->file = file;
+    sequential_file->path = (char*) malloc(strlen(file_path) + 1);
+    strcpy(sequential_file->path, file_path);
+    sequential_file->file_index = file_index - 1;
+
+    return sequential_file;
+}
+
+
+uint16_t sequential_file_write(SequentialFile* sequential_file, const void *buffer, uint16_t bytes_to_write) {
+    if (sequential_file == NULL || sequential_file->file == NULL) {
+        return 0;
+    }
+    return storage_file_write(sequential_file->file, buffer, bytes_to_write);
+}
+
+void sequential_file_free_destroy_file(SequentialFile* sequential_file) {
+    if (sequential_file != NULL) {
+        if (sequential_file->file != NULL) {
+            storage_file_close(sequential_file->file);
+            storage_file_free(sequential_file->file);
+        }
+        free(sequential_file->path);
+        free(sequential_file);
+    }
+}
+
+void sequential_file_free_close_file(SequentialFile* sequential_file) {
+    if (sequential_file != NULL) {
+        if (sequential_file->file != NULL) {
+            storage_file_close(sequential_file->file);
+        }
+        free(sequential_file->path);
+        free(sequential_file);
+    }
+}

+ 15 - 0
applications/external/wifi_marauder_companion/file/sequential_file.h

@@ -0,0 +1,15 @@
+#pragma once
+
+#include <storage/storage.h>
+
+typedef struct SequentialFile {
+    File* file;
+    char* path;
+    int file_index;
+} SequentialFile;
+
+char* sequential_file_resolve_path(Storage* storage, const char* dir, const char* prefix, const char* extension);
+SequentialFile* sequential_file_create(Storage* storage, const char* dir, const char* prefix, const char* extension);
+uint16_t sequential_file_write(SequentialFile* file, const void *buff, uint16_t bytes_to_write);
+void sequential_file_free_destroy_file(SequentialFile* file);
+void sequential_file_free_close_file(SequentialFile* file);

+ 76 - 46
applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_console_output.c

@@ -1,5 +1,28 @@
 #include "../wifi_marauder_app_i.h"
 #include "../wifi_marauder_app_i.h"
 
 
+char* _wifi_marauder_get_prefix_from_cmd(const char* command) {
+    int end = strcspn(command, " ");
+    char* prefix = (char*) malloc(sizeof(char) * (end + 1));
+    strncpy(prefix, command, end);
+    prefix[end] = '\0';
+    return prefix;
+}
+
+bool _wifi_marauder_is_save_pcaps_enabled(WifiMarauderApp* app) {
+    if (!app->ok_to_save_pcaps) {
+        return false;
+    }
+    // If it is a script that contains a sniff function
+    if (app->script != NULL) {
+        WifiMarauderScriptStage* sniff_pmkid_stage = wifi_marauder_script_get_stage(app->script, WifiMarauderScriptStageTypeSniffPmkid);
+        if (sniff_pmkid_stage != NULL) {
+            return true;
+        }
+    }
+    // If it is a sniff function
+    return app->is_command && app->selected_tx_string && strncmp("sniff", app->selected_tx_string, strlen("sniff")) == 0;
+}
+
 void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, void* context) {
 void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, void* context) {
     furi_assert(context);
     furi_assert(context);
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
@@ -27,30 +50,36 @@ void wifi_marauder_console_output_handle_rx_packets_cb(uint8_t* buf, size_t len,
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
 
 
     if(app->is_writing_pcap) {
     if(app->is_writing_pcap) {
-        storage_file_write(app->capture_file, buf, len);
+        sequential_file_write(app->capture_file, buf, len);
     }
     }
 }
 }
 
 
 void wifi_marauder_scene_console_output_on_enter(void* context) {
 void wifi_marauder_scene_console_output_on_enter(void* context) {
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
 
 
+    // Reset text box and set font
     TextBox* text_box = app->text_box;
     TextBox* text_box = app->text_box;
-    text_box_reset(app->text_box);
+    text_box_reset(text_box);
     text_box_set_font(text_box, TextBoxFontText);
     text_box_set_font(text_box, TextBoxFontText);
+
+    // Set focus on start or end
     if(app->focus_console_start) {
     if(app->focus_console_start) {
         text_box_set_focus(text_box, TextBoxFocusStart);
         text_box_set_focus(text_box, TextBoxFocusStart);
     } else {
     } else {
         text_box_set_focus(text_box, TextBoxFocusEnd);
         text_box_set_focus(text_box, TextBoxFocusEnd);
     }
     }
+
+    // Set command-related messages
     if(app->is_command) {
     if(app->is_command) {
         furi_string_reset(app->text_box_store);
         furi_string_reset(app->text_box_store);
         app->text_box_store_strlen = 0;
         app->text_box_store_strlen = 0;
+        // Help message
         if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
         if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
             const char* help_msg = "Marauder companion " WIFI_MARAUDER_APP_VERSION "\n";
             const char* help_msg = "Marauder companion " WIFI_MARAUDER_APP_VERSION "\n";
             furi_string_cat_str(app->text_box_store, help_msg);
             furi_string_cat_str(app->text_box_store, help_msg);
             app->text_box_store_strlen += strlen(help_msg);
             app->text_box_store_strlen += strlen(help_msg);
         }
         }
-
+        // Stopscan message
         if(app->show_stopscan_tip) {
         if(app->show_stopscan_tip) {
             const char* help_msg = "Press BACK to send stopscan\n";
             const char* help_msg = "Press BACK to send stopscan\n";
             furi_string_cat_str(app->text_box_store, help_msg);
             furi_string_cat_str(app->text_box_store, help_msg);
@@ -58,47 +87,57 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
         }
         }
     }
     }
 
 
-    // Set starting text - for "View Log from end", this will just be what was already in the text box store
+    // Set starting text
     text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
     text_box_set_text(app->text_box, furi_string_get_cstr(app->text_box_store));
 
 
+    // Set scene state and switch view
     scene_manager_set_scene_state(app->scene_manager, WifiMarauderSceneConsoleOutput, 0);
     scene_manager_set_scene_state(app->scene_manager, WifiMarauderSceneConsoleOutput, 0);
     view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewConsoleOutput);
     view_dispatcher_switch_to_view(app->view_dispatcher, WifiMarauderAppViewConsoleOutput);
 
 
-    // Register callback to receive data
-    wifi_marauder_uart_set_handle_rx_data_cb(
-        app->uart,
-        wifi_marauder_console_output_handle_rx_data_cb); // setup callback for general log rx thread
-    wifi_marauder_uart_set_handle_rx_data_cb(
-        app->lp_uart,
-        wifi_marauder_console_output_handle_rx_packets_cb); // setup callback for packets rx thread
+    // Register callbacks to receive data
+    wifi_marauder_uart_set_handle_rx_data_cb(app->uart, wifi_marauder_console_output_handle_rx_data_cb); // setup callback for general log rx thread
+    wifi_marauder_uart_set_handle_rx_data_cb(app->lp_uart, wifi_marauder_console_output_handle_rx_packets_cb); // setup callback for packets rx thread
     
     
-    // Run the script if the file with the script has been opened
-    if(app->script != NULL) {
-        furi_string_reset(app->text_box_store);
-        app->text_box_store_strlen = 0;
-        app->script_worker = wifi_marauder_script_worker_alloc();
-        wifi_marauder_script_worker_start(app->script_worker, app->script, wifi_marauder_script_execute_stage, app->script_worker);
-    }
-
     // Get ready to send command
     // Get ready to send command
-    if(app->is_command && app->selected_tx_string) {
+    if((app->is_command && app->selected_tx_string) || app->script) {
+        const char* prefix = strlen(app->selected_tx_string) > 0 ?
+                             _wifi_marauder_get_prefix_from_cmd(app->selected_tx_string) : // Function name
+                             app->script->name;                                            // Script name
+
         // Create files *before* sending command
         // Create files *before* sending command
         // (it takes time to iterate through the directory)
         // (it takes time to iterate through the directory)
         if(app->ok_to_save_logs) {
         if(app->ok_to_save_logs) {
             app->is_writing_log = true;
             app->is_writing_log = true;
-            wifi_marauder_create_log_file(app);
+            app->sequential_log_file = sequential_file_create(app->storage, MARAUDER_APP_FOLDER_LOGS, prefix, "log");
+            if (app->sequential_log_file) {
+                app->log_file = app->sequential_log_file->file;
+                strcpy(app->log_file_path, app->sequential_log_file->path);
+            } else {
+                dialog_message_show_storage_error(app->dialogs, "Cannot open log file");
+            }
         }
         }
 
 
-        // If it is a sniff function, open the pcap file for recording
-        if(app->ok_to_save_pcaps && strncmp("sniff", app->selected_tx_string, strlen("sniff")) == 0) {
+        // If it is a sniff function or script, open the pcap file for recording
+        if (_wifi_marauder_is_save_pcaps_enabled(app)) {
             app->is_writing_pcap = true;
             app->is_writing_pcap = true;
-            wifi_marauder_create_pcap_file(app);
+            app->capture_file = sequential_file_create(app->storage, MARAUDER_APP_FOLDER_PCAPS, prefix, "pcap");
+            if (app->capture_file == NULL) {
+                dialog_message_show_storage_error(app->dialogs, "Cannot open pcap file");
+            }
         }
         }
 
 
         // Send command with newline '\n'
         // Send command with newline '\n'
-        wifi_marauder_uart_tx(
-            (uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string));
-        wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
+        if (app->selected_tx_string) {
+            wifi_marauder_uart_tx(
+                (uint8_t*)(app->selected_tx_string), strlen(app->selected_tx_string));
+            wifi_marauder_uart_tx((uint8_t*)("\n"), 1);
+        }
+
+        // Run the script if the file with the script has been opened
+        if(app->script) {
+            app->script_worker = wifi_marauder_script_worker_alloc();
+            wifi_marauder_script_worker_start(app->script_worker, app->script, wifi_marauder_script_execute_stage, app->script_worker);
+        }
     }
     }
 }
 }
 
 
@@ -120,31 +159,22 @@ bool wifi_marauder_scene_console_output_on_event(void* context, SceneManagerEven
 void wifi_marauder_scene_console_output_on_exit(void* context) {
 void wifi_marauder_scene_console_output_on_exit(void* context) {
     WifiMarauderApp* app = context;
     WifiMarauderApp* app = context;
 
 
-    // Unregister rx callback
-    wifi_marauder_uart_set_handle_rx_data_cb(app->uart, NULL);
-    wifi_marauder_uart_set_handle_rx_data_cb(app->lp_uart, NULL);
-
-    if (app->script_worker) {
-        wifi_marauder_script_worker_free(app->script_worker);
-    }
-
-    if (app->script) {
-        wifi_marauder_script_free(app->script);
-    }
-
     // Automatically stop the scan when exiting view
     // Automatically stop the scan when exiting view
     if(app->is_command) {
     if(app->is_command) {
         wifi_marauder_uart_tx((uint8_t*)("stopscan\n"), strlen("stopscan\n"));
         wifi_marauder_uart_tx((uint8_t*)("stopscan\n"), strlen("stopscan\n"));
+        furi_delay_ms(50);
     }
     }
 
 
+    // Unregister rx callback
+    wifi_marauder_uart_set_handle_rx_data_cb(app->uart, NULL);
+    wifi_marauder_uart_set_handle_rx_data_cb(app->lp_uart, NULL);
+
+    wifi_marauder_script_worker_free(app->script_worker);
+    wifi_marauder_script_free(app->script);
+
     app->is_writing_pcap = false;
     app->is_writing_pcap = false;
-    if(app->capture_file && storage_file_is_open(app->capture_file)) {
-        storage_file_close(app->capture_file);
-    }
+    sequential_file_free_destroy_file(app->capture_file);
 
 
     app->is_writing_log = false;
     app->is_writing_log = false;
-    if(app->log_file && storage_file_is_open(app->log_file)) {
-        storage_file_close(app->log_file);
-    }
-
+    sequential_file_free_close_file(app->sequential_log_file);
 }
 }

+ 13 - 13
applications/external/wifi_marauder_companion/scenes/wifi_marauder_scene_start.c

@@ -144,19 +144,6 @@ static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uin
     furi_assert(index < NUM_MENU_ITEMS);
     furi_assert(index < NUM_MENU_ITEMS);
     const WifiMarauderItem* item = &items[index];
     const WifiMarauderItem* item = &items[index];
 
 
-    // Select automation script
-    if(index == NUM_MENU_ITEMS - 2) {
-        view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartScriptSelect);
-        return;
-    }
-
-    if(index == NUM_MENU_ITEMS - 1) {
-        // "Save to flipper sdcard" special case - start SettingsInit widget
-        view_dispatcher_send_custom_event(
-            app->view_dispatcher, WifiMarauderEventStartSettingsInit);
-        return;
-    }
-
     const int selected_option_index = app->selected_option_index[index];
     const int selected_option_index = app->selected_option_index[index];
     furi_assert(selected_option_index < item->num_options_menu);
     furi_assert(selected_option_index < item->num_options_menu);
     app->selected_tx_string = item->actual_commands[selected_option_index];
     app->selected_tx_string = item->actual_commands[selected_option_index];
@@ -174,6 +161,19 @@ static void wifi_marauder_scene_start_var_list_enter_callback(void* context, uin
         return;
         return;
     }
     }
 
 
+    // Select automation script
+    if(index == NUM_MENU_ITEMS - 2) {
+        view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventStartScriptSelect);
+        return;
+    }
+
+    if(index == NUM_MENU_ITEMS - 1) {
+        // "Save to flipper sdcard" special case - start SettingsInit widget
+        view_dispatcher_send_custom_event(
+            app->view_dispatcher, WifiMarauderEventStartSettingsInit);
+        return;
+    }
+
     bool needs_keyboard = (item->needs_keyboard == TOGGLE_ARGS) ? (selected_option_index != 0) :
     bool needs_keyboard = (item->needs_keyboard == TOGGLE_ARGS) ? (selected_option_index != 0) :
                                                                   item->needs_keyboard;
                                                                   item->needs_keyboard;
     if(needs_keyboard) {
     if(needs_keyboard) {

+ 23 - 0
applications/external/wifi_marauder_companion/script/wifi_marauder_script.c

@@ -11,6 +11,7 @@ WifiMarauderScript *wifi_marauder_script_alloc() {
     if (script == NULL) {
     if (script == NULL) {
         return NULL;
         return NULL;
     }
     }
+    script->name = NULL;
     script->description = NULL;
     script->description = NULL;
     script->first_stage = NULL;
     script->first_stage = NULL;
     script->repeat = 1;
     script->repeat = 1;
@@ -278,6 +279,13 @@ WifiMarauderScript *wifi_marauder_script_parse_file(const char* file_path, Stora
         json_buffer[bytes_read] = '\0';
         json_buffer[bytes_read] = '\0';
         
         
         script = wifi_marauder_script_parse_raw(json_buffer);
         script = wifi_marauder_script_parse_raw(json_buffer);
+        if (script != NULL) {
+            // Set script name
+            FuriString* script_name = furi_string_alloc();
+            path_extract_filename_no_ext(file_path, script_name);
+            script->name = strdup(furi_string_get_cstr(script_name));
+            furi_string_free(script_name);
+        }
         storage_file_close(script_file);
         storage_file_close(script_file);
     }
     }
 
 
@@ -285,6 +293,20 @@ WifiMarauderScript *wifi_marauder_script_parse_file(const char* file_path, Stora
     return script;
     return script;
 }
 }
 
 
+WifiMarauderScriptStage* wifi_marauder_script_get_stage(WifiMarauderScript* script, WifiMarauderScriptStageType stage_type) {
+    if (script == NULL) {
+        return NULL;
+    }
+    WifiMarauderScriptStage* current_stage = script->first_stage;
+    while (current_stage != NULL) {
+        if (current_stage->type == stage_type) {
+            return current_stage;
+        }
+        current_stage = current_stage->next_stage;
+    }
+    return NULL;
+}
+
 void wifi_marauder_script_free(WifiMarauderScript *script) {
 void wifi_marauder_script_free(WifiMarauderScript *script) {
     if (script == NULL) {
     if (script == NULL) {
         return;
         return;
@@ -317,6 +339,7 @@ void wifi_marauder_script_free(WifiMarauderScript *script) {
         free(current_stage);
         free(current_stage);
         current_stage = next_stage;
         current_stage = next_stage;
     }
     }
+    free(script->name);
     free(script->description);
     free(script->description);
     free(script);
     free(script);
 }
 }

+ 8 - 6
applications/external/wifi_marauder_companion/script/wifi_marauder_script.h

@@ -27,7 +27,7 @@
  * {
  * {
  *     "meta": {
  *     "meta": {
  *         "description": "My script",
  *         "description": "My script",
- *         "repeat": times the script will repeat
+ *         "repeat": times the script will repeat (default 1),
  *     },
  *     },
  *     "stages": {
  *     "stages": {
  *         "scan": {
  *         "scan": {
@@ -37,13 +37,13 @@
  *         },
  *         },
  *         "select": {
  *         "select": {
  *             "type": "ap" | "station" | "ssid",
  *             "type": "ap" | "station" | "ssid",
- *             "filter": "all" | "contains \"{SSID fragment}\" or equals \"{SSID}\" or ..."
+ *             "filter": "all" | "contains \"{SSID fragment}\" or equals \"{SSID}\" or ..." (Not implemented yet on Marauder firmware)
  *         },
  *         },
  *         "deauth": {
  *         "deauth": {
  *             "timeout": seconds
  *             "timeout": seconds
  *         },
  *         },
  *         "sniffPmkid": {
  *         "sniffPmkid": {
- *             "forceDeauth": true | false,
+ *             "forceDeauth": true (default) | false,
  *             "channel": 1-11,
  *             "channel": 1-11,
  *             "timeout": seconds
  *             "timeout": seconds
  *         },
  *         },
@@ -122,12 +122,14 @@ typedef struct WifiMarauderScriptStageBeaconList {
 
 
 // Script
 // Script
 typedef struct WifiMarauderScript {
 typedef struct WifiMarauderScript {
+    char* name;
     char* description;
     char* description;
     WifiMarauderScriptStage *first_stage;
     WifiMarauderScriptStage *first_stage;
     int repeat;
     int repeat;
 } WifiMarauderScript;
 } WifiMarauderScript;
 
 
-WifiMarauderScript *wifi_marauder_script_alloc();
-WifiMarauderScript *wifi_marauder_script_parse_raw(const char* script_raw);
-WifiMarauderScript *wifi_marauder_script_parse_file(const char* file_path, Storage* storage);
+WifiMarauderScript* wifi_marauder_script_alloc();
+WifiMarauderScript* wifi_marauder_script_parse_raw(const char* script_raw);
+WifiMarauderScript* wifi_marauder_script_parse_file(const char* file_path, Storage* storage);
+WifiMarauderScriptStage* wifi_marauder_script_get_stage(WifiMarauderScript* script, WifiMarauderScriptStageType stage_type);
 void wifi_marauder_script_free(WifiMarauderScript *script);
 void wifi_marauder_script_free(WifiMarauderScript *script);

+ 0 - 2
applications/external/wifi_marauder_companion/wifi_marauder_app.c

@@ -27,7 +27,6 @@ WifiMarauderApp* wifi_marauder_app_alloc() {
     app->gui = furi_record_open(RECORD_GUI);
     app->gui = furi_record_open(RECORD_GUI);
     app->dialogs = furi_record_open(RECORD_DIALOGS);
     app->dialogs = furi_record_open(RECORD_DIALOGS);
     app->storage = furi_record_open(RECORD_STORAGE);
     app->storage = furi_record_open(RECORD_STORAGE);
-    app->capture_file = storage_file_alloc(app->storage);
     app->log_file = storage_file_alloc(app->storage);
     app->log_file = storage_file_alloc(app->storage);
     app->save_pcap_setting_file = storage_file_alloc(app->storage);
     app->save_pcap_setting_file = storage_file_alloc(app->storage);
     app->save_logs_setting_file = storage_file_alloc(app->storage);
     app->save_logs_setting_file = storage_file_alloc(app->storage);
@@ -148,7 +147,6 @@ void wifi_marauder_app_free(WifiMarauderApp* app) {
     text_box_free(app->text_box);
     text_box_free(app->text_box);
     furi_string_free(app->text_box_store);
     furi_string_free(app->text_box_store);
     text_input_free(app->text_input);
     text_input_free(app->text_input);
-    storage_file_free(app->capture_file);
     storage_file_free(app->log_file);
     storage_file_free(app->log_file);
     storage_file_free(app->save_pcap_setting_file);
     storage_file_free(app->save_pcap_setting_file);
     storage_file_free(app->save_logs_setting_file);
     storage_file_free(app->save_logs_setting_file);

+ 3 - 2
applications/external/wifi_marauder_companion/wifi_marauder_app_i.h

@@ -6,7 +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_pcap.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"
 #include "script/wifi_marauder_script_executor.h"
 #include "script/wifi_marauder_script_executor.h"
@@ -49,7 +49,8 @@ struct WifiMarauderApp {
     TextBox* text_box;
     TextBox* text_box;
     TextInput* text_input;
     TextInput* text_input;
     Storage* storage;
     Storage* storage;
-    File* capture_file;
+    SequentialFile* capture_file;
+    SequentialFile* sequential_log_file;
     File* log_file;
     File* log_file;
     char log_file_path[100];
     char log_file_path[100];
     File* save_pcap_setting_file;
     File* save_pcap_setting_file;

+ 0 - 64
applications/external/wifi_marauder_companion/wifi_marauder_pcap.c

@@ -1,64 +0,0 @@
-#include "wifi_marauder_app_i.h"
-#include "wifi_marauder_pcap.h"
-
-void wifi_marauder_get_prefix_from_sniff_cmd(char* dest, const char* command) {
-    int start, end, delta;
-    start = strlen("sniff");
-    end = strcspn(command, " ");
-    delta = end - start;
-    strncpy(dest, command + start, end - start);
-    dest[delta] = '\0';
-}
-
-void wifi_marauder_get_prefix_from_cmd(char* dest, const char* command) {
-    int end;
-    end = strcspn(command, " ");
-    strncpy(dest, command, end);
-    dest[end] = '\0';
-}
-
-void wifi_marauder_create_pcap_file(WifiMarauderApp* app) {
-    char prefix[10];
-    char capture_file_path[100];
-    wifi_marauder_get_prefix_from_sniff_cmd(prefix, app->selected_tx_string);
-
-    int i = 0;
-    do {
-        snprintf(
-            capture_file_path,
-            sizeof(capture_file_path),
-            "%s/%s_%d.pcap",
-            MARAUDER_APP_FOLDER_PCAPS,
-            prefix,
-            i);
-        i++;
-    } while(storage_file_exists(app->storage, capture_file_path));
-
-    if(!storage_file_open(app->capture_file, capture_file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
-        dialog_message_show_storage_error(app->dialogs, "Cannot open pcap file");
-    }
-}
-
-void wifi_marauder_create_log_file(WifiMarauderApp* app) {
-    char prefix[10];
-    char log_file_path[100];
-    wifi_marauder_get_prefix_from_cmd(prefix, app->selected_tx_string);
-
-    int i = 0;
-    do {
-        snprintf(
-            log_file_path,
-            sizeof(log_file_path),
-            "%s/%s_%d.log",
-            MARAUDER_APP_FOLDER_LOGS,
-            prefix,
-            i);
-        i++;
-    } while(storage_file_exists(app->storage, log_file_path));
-
-    if(!storage_file_open(app->log_file, log_file_path, FSAM_WRITE, FSOM_CREATE_ALWAYS)) {
-        dialog_message_show_storage_error(app->dialogs, "Cannot open log file");
-    } else {
-        strcpy(app->log_file_path, log_file_path);
-    }
-}

+ 0 - 20
applications/external/wifi_marauder_companion/wifi_marauder_pcap.h

@@ -1,20 +0,0 @@
-#pragma once
-
-#include "furi_hal.h"
-
-/**
- * Creates a PCAP file to store incoming packets.
- * The file name will have a prefix according to the type of scan being performed by the application (Eg: raw_0.pcap)
- * 
- * @param app Application context
- */
-void wifi_marauder_create_pcap_file(WifiMarauderApp* app);
-
-/**
- * Creates a log file to store text from console output.
- * The file name will have a prefix according to the command being performed by the application (Eg: scanap_0.log)
- *
- * @param app Application context
- */
-// same as wifi_marauder_create_pcap_file, but for log files (to save console text output)
-void wifi_marauder_create_log_file(WifiMarauderApp* app);