|
@@ -3,7 +3,7 @@
|
|
|
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;
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
// If text box store gets too big, then truncate it
|
|
// If text box store gets too big, then truncate it
|
|
|
app->text_box_store_strlen += len;
|
|
app->text_box_store_strlen += len;
|
|
|
if(app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
|
|
if(app->text_box_store_strlen >= WIFI_MARAUDER_TEXT_BOX_STORE_SIZE - 1) {
|
|
@@ -14,10 +14,26 @@ void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, vo
|
|
|
// Null-terminate buf and append to text box store
|
|
// Null-terminate buf and append to text box store
|
|
|
buf[len] = '\0';
|
|
buf[len] = '\0';
|
|
|
furi_string_cat_printf(app->text_box_store, "%s", buf);
|
|
furi_string_cat_printf(app->text_box_store, "%s", buf);
|
|
|
-
|
|
|
|
|
view_dispatcher_send_custom_event(app->view_dispatcher, WifiMarauderEventRefreshConsoleOutput);
|
|
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) {
|
|
|
|
|
+ app->is_writing = true;
|
|
|
|
|
+ if (!app->capture_file || !storage_file_is_open(app->capture_file)) {
|
|
|
|
|
+ wifi_marauder_create_pcap_file(app);
|
|
|
|
|
+ }
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ if (app->is_writing) {
|
|
|
|
|
+ storage_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;
|
|
|
|
|
|
|
@@ -34,7 +50,7 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
|
|
|
app->text_box_store_strlen = 0;
|
|
app->text_box_store_strlen = 0;
|
|
|
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
|
|
if(0 == strncmp("help", app->selected_tx_string, strlen("help"))) {
|
|
|
const char* help_msg =
|
|
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);
|
|
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);
|
|
|
}
|
|
}
|
|
@@ -54,7 +70,9 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
|
|
|
|
|
|
|
|
// Register callback to receive data
|
|
// Register callback to receive data
|
|
|
wifi_marauder_uart_set_handle_rx_data_cb(
|
|
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'
|
|
// Send command with newline '\n'
|
|
|
if(app->is_command && app->selected_tx_string) {
|
|
if(app->is_command && app->selected_tx_string) {
|
|
@@ -84,9 +102,16 @@ void wifi_marauder_scene_console_output_on_exit(void* context) {
|
|
|
|
|
|
|
|
// Unregister rx callback
|
|
// Unregister rx callback
|
|
|
wifi_marauder_uart_set_handle_rx_data_cb(app->uart, NULL);
|
|
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
|
|
// 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"));
|
|
|
}
|
|
}
|
|
|
|
|
+
|
|
|
|
|
+ app->is_writing = false;
|
|
|
|
|
+ if (app->capture_file && storage_file_is_open(app->capture_file)) {
|
|
|
|
|
+ storage_file_close(app->capture_file);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
}
|
|
}
|