mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
Fuzzer App: Load key file
This commit is contained in:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user