some fixes for rfid fuzzer

This commit is contained in:
MX
2022-09-05 14:05:43 +03:00
parent 361895c689
commit ca8217b692
6 changed files with 38 additions and 22 deletions
+9 -5
View File
@@ -6,6 +6,8 @@
#include "scene/flipfrid_scene_run_attack.h"
#include "scene/flipfrid_scene_load_custom_uids.h"
#define RFIDFUZZER_APP_FOLDER "/ext/rfidfuzzer"
static void flipfrid_draw_callback(Canvas* const canvas, void* ctx) {
FlipFridState* flipfrid_state = (FlipFridState*)acquire_mutex((ValueMutex*)ctx, 100);
@@ -53,8 +55,6 @@ static void flipfrid_timer_callback(FuriMessageQueue* event_queue) {
FlipFridState* flipfrid_alloc() {
FlipFridState* flipfrid = malloc(sizeof(FlipFridState));
string_init(flipfrid->file_path);
string_init(flipfrid->file_path_tmp);
string_init(flipfrid->notification_msg);
string_init(flipfrid->attack_name);
@@ -91,9 +91,7 @@ void flipfrid_free(FlipFridState* flipfrid) {
furi_record_close(RECORD_DIALOGS);
notification_message(flipfrid->notify, &sequence_blink_stop);
// Path strings
string_clear(flipfrid->file_path);
string_clear(flipfrid->file_path_tmp);
// Strings
string_clear(flipfrid->notification_msg);
string_clear(flipfrid->attack_name);
@@ -124,6 +122,12 @@ int32_t flipfrid_start(void* p) {
return 255;
}
Storage* storage = furi_record_open(RECORD_STORAGE);
if(!storage_simply_mkdir(storage, RFIDFUZZER_APP_FOLDER)) {
FURI_LOG_E(TAG, "Could not create folder %s", RFIDFUZZER_APP_FOLDER);
}
furi_record_close(RECORD_STORAGE);
// Configure view port
FURI_LOG_I(TAG, "Initializing viewport");
ViewPort* view_port = view_port_alloc();
-2
View File
@@ -65,8 +65,6 @@ typedef struct {
string_t attack_name;
DialogsApp* dialogs;
string_t file_path;
string_t file_path_tmp;
string_t notification_msg;
uint8_t key_index;
LFRFIDWorker* worker;
@@ -3,6 +3,7 @@
#include "flipfrid_scene_entrypoint.h"
#define LFRFID_UIDS_EXTENSION ".txt"
#define RFIDFUZZER_APP_PATH_FOLDER "/ext/rfidfuzzer"
bool flipfrid_load_uids(FlipFridState* context, const char* file_path) {
bool result = false;
@@ -20,18 +21,19 @@ bool flipfrid_load_uids(FlipFridState* context, const char* file_path) {
bool flipfrid_load_custom_uids_from_file(FlipFridState* context) {
// Input events and views are managed by file_select
string_t uid_path;
string_init(uid_path);
string_set_str(uid_path, RFIDFUZZER_APP_PATH_FOLDER);
bool res = dialog_file_browser_show(
context->dialogs,
context->file_path,
context->file_path,
LFRFID_UIDS_EXTENSION,
true,
&I_sub1_10px,
true);
context->dialogs, uid_path, uid_path, LFRFID_UIDS_EXTENSION, true, &I_125_10px, false);
if(res) {
res = flipfrid_load_uids(context, string_get_cstr(context->file_path));
res = flipfrid_load_uids(context, string_get_cstr(uid_path));
}
string_clear(uid_path);
return res;
}
@@ -2,6 +2,7 @@
#include "flipfrid_scene_entrypoint.h"
#define LFRFID_APP_EXTENSION ".rfid"
#define LFRFID_APP_PATH_FOLDER "/ext/lfrfid"
bool flipfrid_load(FlipFridState* context, const char* file_path) {
bool result = false;
@@ -121,24 +122,25 @@ void flipfrid_scene_load_file_on_draw(Canvas* canvas, FlipFridState* context) {
}
bool flipfrid_load_protocol_from_file(FlipFridState* context) {
string_t file_path;
string_init(file_path);
string_t user_file_path;
string_init(user_file_path);
string_set_str(user_file_path, LFRFID_APP_PATH_FOLDER);
// Input events and views are managed by file_select
bool res = dialog_file_browser_show(
context->dialogs,
context->file_path,
context->file_path,
user_file_path,
user_file_path,
LFRFID_APP_EXTENSION,
true,
&I_125_10px,
true);
if(res) {
res = flipfrid_load(context, string_get_cstr(context->file_path));
res = flipfrid_load(context, string_get_cstr(user_file_path));
}
string_clear(file_path);
string_clear(user_file_path);
return res;
}