|
@@ -4,15 +4,8 @@ void wifi_marauder_console_output_handle_rx_data_cb(uint8_t* buf, size_t len, vo
|
|
|
furi_assert(context);
|
|
furi_assert(context);
|
|
|
WifiMarauderApp* app = context;
|
|
WifiMarauderApp* app = context;
|
|
|
|
|
|
|
|
- if(app->ok_to_save_logs) {
|
|
|
|
|
- if(!app->is_writing_log) {
|
|
|
|
|
- app->is_writing_log = true;
|
|
|
|
|
- app->has_saved_logs_this_session = true;
|
|
|
|
|
- if(!app->log_file || !storage_file_is_open(app->log_file)) {
|
|
|
|
|
- wifi_marauder_create_log_file(app);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
|
|
+ if(app->is_writing_log) {
|
|
|
|
|
+ app->has_saved_logs_this_session = true;
|
|
|
storage_file_write(app->log_file, buf, len);
|
|
storage_file_write(app->log_file, buf, len);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
@@ -33,19 +26,6 @@ void wifi_marauder_console_output_handle_rx_packets_cb(uint8_t* buf, size_t len,
|
|
|
furi_assert(context);
|
|
furi_assert(context);
|
|
|
WifiMarauderApp* app = context;
|
|
WifiMarauderApp* app = context;
|
|
|
|
|
|
|
|
- if(!app->ok_to_save_pcaps) {
|
|
|
|
|
- // user has declined this feature
|
|
|
|
|
- return;
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
- // 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_pcap) {
|
|
|
|
|
- app->is_writing_pcap = true;
|
|
|
|
|
- if(!app->capture_file || !storage_file_is_open(app->capture_file)) {
|
|
|
|
|
- wifi_marauder_create_pcap_file(app);
|
|
|
|
|
- }
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
if(app->is_writing_pcap) {
|
|
if(app->is_writing_pcap) {
|
|
|
storage_file_write(app->capture_file, buf, len);
|
|
storage_file_write(app->capture_file, buf, len);
|
|
|
}
|
|
}
|
|
@@ -78,18 +58,8 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- // Set starting text - for "View Log", this will just be what was already in the text box store
|
|
|
|
|
|
|
+ // Set starting text - for "View Log from end", this will just be what was already in the text box store
|
|
|
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));
|
|
|
- if(furi_string_empty(app->text_box_store)) {
|
|
|
|
|
- char help_msg[256];
|
|
|
|
|
- snprintf(
|
|
|
|
|
- help_msg,
|
|
|
|
|
- sizeof(help_msg),
|
|
|
|
|
- "The log is empty! :(\nTry sending a command?\n\nSaving pcaps to flipper sdcard: %s\nSaving logs to flipper sdcard: %s",
|
|
|
|
|
- app->ok_to_save_pcaps ? "ON" : "OFF",
|
|
|
|
|
- app->ok_to_save_logs ? "ON" : "OFF");
|
|
|
|
|
- text_box_set_text(app->text_box, help_msg);
|
|
|
|
|
- }
|
|
|
|
|
|
|
|
|
|
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);
|
|
@@ -102,8 +72,22 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
|
|
|
app->lp_uart,
|
|
app->lp_uart,
|
|
|
wifi_marauder_console_output_handle_rx_packets_cb); // setup callback for packets rx thread
|
|
wifi_marauder_console_output_handle_rx_packets_cb); // setup callback for packets rx thread
|
|
|
|
|
|
|
|
- // Send command with newline '\n'
|
|
|
|
|
|
|
+ // Get ready to send command
|
|
|
if(app->is_command && app->selected_tx_string) {
|
|
if(app->is_command && app->selected_tx_string) {
|
|
|
|
|
+ // Create files *before* sending command
|
|
|
|
|
+ // (it takes time to iterate through the directory)
|
|
|
|
|
+ if(app->ok_to_save_logs) {
|
|
|
|
|
+ app->is_writing_log = true;
|
|
|
|
|
+ wifi_marauder_create_log_file(app);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // 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) {
|
|
|
|
|
+ app->is_writing_pcap = true;
|
|
|
|
|
+ wifi_marauder_create_pcap_file(app);
|
|
|
|
|
+ }
|
|
|
|
|
+
|
|
|
|
|
+ // Send command with newline '\n'
|
|
|
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);
|