mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
Fuzzer App: Some Improvement
This commit is contained in:
@@ -1,8 +1,6 @@
|
||||
#include "../fuzzer_i.h"
|
||||
#include "../helpers/fuzzer_custom_event.h"
|
||||
|
||||
#include "../helpers/gui_const.h"
|
||||
|
||||
// TODO simlify callbacks and attack state
|
||||
|
||||
void fuzzer_scene_attack_worker_tick_callback(void* context) {
|
||||
@@ -23,30 +21,37 @@ void fuzzer_scene_attack_callback(FuzzerCustomEvent event, void* context) {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, event);
|
||||
}
|
||||
|
||||
static void fuzzer_scene_attack_update_uid(PacsFuzzerApp* app) {
|
||||
furi_assert(app);
|
||||
furi_assert(app->worker);
|
||||
furi_assert(app->attack_view);
|
||||
|
||||
FuzzerPayload uid;
|
||||
fuzzer_worker_get_current_key(app->worker, &uid);
|
||||
|
||||
fuzzer_view_attack_set_uid(app->attack_view, uid);
|
||||
|
||||
free(uid.data);
|
||||
}
|
||||
|
||||
void fuzzer_scene_attack_on_enter(void* context) {
|
||||
furi_assert(context);
|
||||
PacsFuzzerApp* app = context;
|
||||
|
||||
fuzzer_view_attack_set_callback(app->attack_view, fuzzer_scene_attack_callback, app);
|
||||
|
||||
FuzzerProtocol proto = fuzzer_proto_items[app->fuzzer_state.proto_index];
|
||||
|
||||
fuzzer_worker_set_uid_chaged_callback(
|
||||
app->worker, fuzzer_scene_attack_worker_tick_callback, app);
|
||||
|
||||
fuzzer_worker_set_end_callback(app->worker, fuzzer_scene_attack_worker_end_callback, app);
|
||||
|
||||
uint8_t temp_uid[proto.data_size];
|
||||
|
||||
fuzzer_worker_get_current_key(app->worker, temp_uid);
|
||||
|
||||
fuzzer_view_attack_reset_data(
|
||||
app->attack_view,
|
||||
fuzzer_attack_names[app->fuzzer_state.menu_index],
|
||||
proto.name,
|
||||
proto.data_size);
|
||||
fuzzer_proto_get_menu_label(app->fuzzer_state.menu_index),
|
||||
fuzzer_proto_get_name(app->fuzzer_state.proto_index));
|
||||
fuzzer_view_attack_set_attack(app->attack_view, false);
|
||||
fuzzer_view_attack_set_uid(app->attack_view, (uint8_t*)&temp_uid);
|
||||
|
||||
fuzzer_scene_attack_update_uid(app);
|
||||
|
||||
scene_manager_set_scene_state(app->scene_manager, FuzzerSceneAttack, false);
|
||||
|
||||
@@ -84,11 +89,7 @@ bool fuzzer_scene_attack_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.event == FuzzerCustomEventViewAttackTick) {
|
||||
uint8_t temp_uid[fuzzer_proto_items[app->fuzzer_state.proto_index].data_size];
|
||||
|
||||
fuzzer_worker_get_current_key(app->worker, temp_uid);
|
||||
|
||||
fuzzer_view_attack_set_uid(app->attack_view, (uint8_t*)&temp_uid);
|
||||
fuzzer_scene_attack_update_uid(app);
|
||||
consumed = true;
|
||||
} else if(event.event == FuzzerCustomEventViewAttackEnd) {
|
||||
scene_manager_set_scene_state(app->scene_manager, FuzzerSceneAttack, false);
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
#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;
|
||||
@@ -16,16 +14,12 @@ 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];
|
||||
FuzzerPayload uid;
|
||||
fuzzer_worker_get_current_key(app->worker, &uid);
|
||||
|
||||
uint8_t* uid_p = &uid[0];
|
||||
fuzzer_view_field_editor_reset_data(app->field_editor_view, uid);
|
||||
|
||||
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
|
||||
free(uid.data);
|
||||
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, FuzzerViewIDFieldEditor);
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
#include "../helpers/fuzzer_custom_event.h"
|
||||
|
||||
#include "../lib/worker/protocol.h"
|
||||
#include "../helpers/gui_const.h"
|
||||
|
||||
void fuzzer_scene_main_callback(FuzzerCustomEvent event, void* context) {
|
||||
furi_assert(context);
|
||||
@@ -40,7 +39,7 @@ static bool fuzzer_scene_main_load_key(void* context) {
|
||||
|
||||
DialogsFileBrowserOptions browser_options;
|
||||
dialog_file_browser_set_basic_options(
|
||||
&browser_options, consts->key_extension, &I_rfid_10px); // TODO icon
|
||||
&browser_options, consts->key_extension, consts->key_icon);
|
||||
browser_options.base_path = consts->path_key_folder;
|
||||
browser_options.hide_ext = true;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user