Fuzzer App: Load key file

This commit is contained in:
gid9798
2023-06-04 20:21:51 +03:00
parent 5b4bb66848
commit 3bd08ab31c
7 changed files with 247 additions and 26 deletions

View File

@@ -1,6 +1,8 @@
#include "../fuzzer_i.h"
#include "../helpers/fuzzer_custom_event.h"
#define UID_MAX_SIZE 8 // TODO
void fuzzer_scene_field_editor_callback(FuzzerCustomEvent event, void* context) {
furi_assert(context);
PacsFuzzerApp* app = context;
@@ -14,6 +16,17 @@ void fuzzer_scene_field_editor_on_enter(void* context) {
fuzzer_view_field_editor_set_callback(
app->field_editor_view, fuzzer_scene_field_editor_callback, app);
uint8_t uid[UID_MAX_SIZE];
uint8_t* uid_p = &uid[0];
fuzzer_worker_get_current_key(app->worker, uid_p);
fuzzer_view_field_editor_reset_data(
app->field_editor_view,
uid_p,
fuzzer_proto_items[app->fuzzer_state.proto_index].data_size); // TODO
view_dispatcher_switch_to_view(app->view_dispatcher, FuzzerViewIDFieldEditor);
}
@@ -29,6 +42,15 @@ bool fuzzer_scene_field_editor_on_event(void* context, SceneManagerEvent event)
view_dispatcher_stop(app->view_dispatcher);
}
consumed = true;
} else if(event.event == FuzzerCustomEventViewFieldEditorOk) {
// TODO
if(fuzzer_worker_attack_bf_byte(
app->worker,
app->fuzzer_state.proto_index,
fuzzer_view_field_editor_get_uid(app->field_editor_view),
fuzzer_view_field_editor_get_index(app->field_editor_view))) {
scene_manager_next_scene(app->scene_manager, FuzzerSceneAttack);
}
}
}

View File

@@ -30,6 +30,26 @@ static bool fuzzer_scene_main_load_custom_dict(void* context) {
return res;
}
static bool fuzzer_scene_main_load_key(void* context) {
furi_assert(context);
PacsFuzzerApp* app = context;
FuzzerConsts* consts = app->fuzzer_const;
furi_string_set_str(app->file_path, consts->path_key_folder);
DialogsFileBrowserOptions browser_options;
dialog_file_browser_set_basic_options(
&browser_options, consts->key_extension, &I_rfid_10px); // TODO icon
browser_options.base_path = consts->path_key_folder;
browser_options.hide_ext = true;
bool res =
dialog_file_browser_show(app->dialogs, app->file_path, app->file_path, &browser_options);
return res;
}
void fuzzer_scene_main_on_enter(void* context) {
furi_assert(context);
PacsFuzzerApp* app = context;
@@ -70,9 +90,19 @@ bool fuzzer_scene_main_on_event(void* context, SceneManagerEvent event) {
break;
case FuzzerMainMenuIndexLoadFile:
// TODO Delete
scene_manager_next_scene(app->scene_manager, FuzzerSceneFieldEditor);
if(!fuzzer_scene_main_load_key(app)) {
break;
} else {
if(fuzzer_worker_load_key_from_file(
app->worker,
app->fuzzer_state.proto_index,
furi_string_get_cstr(app->file_path))) {
scene_manager_next_scene(app->scene_manager, FuzzerSceneFieldEditor);
FURI_LOG_I("Scene", "Load ok");
} else {
FURI_LOG_W("Scene", "Load err");
}
}
break;
case FuzzerMainMenuIndexLoadFileCustomUids: