Fix build

This commit is contained in:
Sil333033
2023-07-29 22:16:51 +02:00
parent 2f55b8a8e4
commit b3a783acb4
3 changed files with 84 additions and 3 deletions
@@ -0,0 +1,64 @@
#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,0 +1,20 @@
#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);
@@ -104,9 +104,6 @@ void wifi_marauder_scene_console_output_on_enter(void* context) {
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
// Get ready to send command
if((app->is_command && app->selected_tx_string) || app->script) {