|
|
@@ -1,17 +1,5 @@
|
|
|
#include "../wifi_marauder_app_i.h"
|
|
|
|
|
|
-void wifi_marauder_print_message(uint8_t* buf, size_t len, WifiMarauderApp* app) {
|
|
|
- // If text box store gets too big, then truncate it
|
|
|
- app->text_box_store_strlen += len;
|
|
|
- if(app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
|
|
|
- furi_string_right(app->text_box_store, app->text_box_store_strlen / 2);
|
|
|
- app->text_box_store_strlen = furi_string_size(app->text_box_store) + len;
|
|
|
- }
|
|
|
- // Null-terminate buf and append to text box store
|
|
|
- buf[len] = '\0';
|
|
|
- furi_string_cat_printf(app->text_box_store, "%s", buf);
|
|
|
-}
|
|
|
-
|
|
|
void wifi_marauder_get_prefix_from_cmd(char* dest, const char* command) {
|
|
|
int start, end, delta;
|
|
|
start = strlen("sniff");
|
|
|
@@ -41,6 +29,23 @@ void wifi_marauder_create_pcap_file(WifiMarauderApp* app) {
|
|
|
void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, void* context) {
|
|
|
furi_assert(context);
|
|
|
WifiMarauderApp* app = context;
|
|
|
+
|
|
|
+ // If text box store gets too big, then truncate it
|
|
|
+ app->text_box_store_strlen += len;
|
|
|
+ if(app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
|
|
|
+ furi_string_right(app->text_box_store, app->text_box_store_strlen / 2);
|
|
|
+ app->text_box_store_strlen = furi_string_size(app->text_box_store) + len;
|
|
|
+ }
|
|
|
+
|
|
|
+ // Null-terminate buf and append to text box store
|
|
|
+ buf[len] = '\0';
|
|
|
+ furi_string_cat_printf(app->text_box_store, "%s", buf);
|
|
|
+ view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshConsoleOutput);
|
|
|
+}
|
|
|
+
|
|
|
+void wifi_marauder_console_output_handle_rx_packets_cb(uint8_t* buf, size_t len, void* context) {
|
|
|
+ furi_assert(context);
|
|
|
+ WifiMarauderApp* app = context;
|
|
|
|
|
|
// If it is a sniff function, open the pcap file for recording
|
|
|
if (strncmp("sniff", app->selected_tx_string, strlen("sniff")) == 0 && !app->is_writing) {
|
|
|
@@ -52,8 +57,6 @@ void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, vo
|
|
|
|
|
|
if (app->is_writing) {
|
|
|
storage_file_write(app->capture_file, buf, len);
|
|
|
- } else {
|
|
|
- wifi_marauder_print_message(buf, len, app);
|
|
|
}
|
|
|
|
|
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshConsoleOutput);
|
|
|
@@ -75,7 +78,7 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
|
|
|
app->text_box_store_strlen = 0;
|
|
|
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
|
|
|
const char* help_msg =
|
|
|
- "Marauder companion " WIFI_MARAUDER_APP_VERSION "\nFor app support/feedback,\nreach out to me:\n@cococode#6011 (discord)\n0xchocolate (github)\n";
|
|
|
+ "Marauder companion " WIFI_MARAUDER_APP_VERSION "\n";
|
|
|
furi_string_cat_str(app->text_box_store, help_msg);
|
|
|
app->text_box_store_strlen += strlen(help_msg);
|
|
|
}
|
|
|
@@ -95,7 +98,9 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
|
|
|
|
|
|
// 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 rx thread
|
|
|
+ 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
|
|
|
|
|
|
// Send command with newline '\n'
|
|
|
if(app->is_command && app->selected_tx_string) {
|
|
|
@@ -125,6 +130,7 @@ void wifi_marauder_scene_console_output_on_exit(void* 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);
|
|
|
|
|
|
// Automatically stop the scan when exiting view
|
|
|
if(app->is_command) {
|