mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-22 05:14:46 -07:00
Fuzzers App: load custom dict
This commit is contained in:
@@ -31,21 +31,20 @@ void fuzzer_scene_attack_on_enter(void* context) {
|
||||
|
||||
FuzzerProtocol proto = fuzzer_proto_items[app->fuzzer_state.proto_index];
|
||||
|
||||
fuzzer_view_attack_reset_data(
|
||||
app->attack_view,
|
||||
fuzzer_attack_names[app->fuzzer_state.menu_index],
|
||||
proto.name,
|
||||
proto.data_size);
|
||||
|
||||
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[MAX_PAYLOAD_SIZE];
|
||||
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_view_attack_set_attack(app->attack_view, false);
|
||||
fuzzer_view_attack_set_uid(app->attack_view, (uint8_t*)&temp_uid);
|
||||
|
||||
@@ -73,11 +72,11 @@ bool fuzzer_scene_attack_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.event == FuzzerCustomEventViewAttackOk) {
|
||||
if(!scene_manager_get_scene_state(app->scene_manager, FuzzerSceneAttack)) {
|
||||
if(!scene_manager_get_scene_state(app->scene_manager, FuzzerSceneAttack) &&
|
||||
fuzzer_worker_start(
|
||||
app->worker, fuzzer_view_attack_get_time_delay(app->attack_view))) {
|
||||
scene_manager_set_scene_state(app->scene_manager, FuzzerSceneAttack, true);
|
||||
fuzzer_view_attack_set_attack(app->attack_view, true);
|
||||
fuzzer_worker_start(
|
||||
app->worker, fuzzer_view_attack_get_time_delay(app->attack_view));
|
||||
} else {
|
||||
scene_manager_set_scene_state(app->scene_manager, FuzzerSceneAttack, false);
|
||||
fuzzer_view_attack_set_attack(app->attack_view, false);
|
||||
@@ -85,7 +84,7 @@ bool fuzzer_scene_attack_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.event == FuzzerCustomEventViewAttackTick) {
|
||||
uint8_t temp_uid[MAX_PAYLOAD_SIZE];
|
||||
uint8_t temp_uid[fuzzer_proto_items[app->fuzzer_state.proto_index].data_size];
|
||||
|
||||
fuzzer_worker_get_current_key(app->worker, temp_uid);
|
||||
|
||||
|
||||
@@ -10,6 +10,26 @@ void fuzzer_scene_main_callback(FuzzerCustomEvent event, void* context) {
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, event);
|
||||
}
|
||||
|
||||
static bool fuzzer_scene_main_load_custom_dict(void* context) {
|
||||
furi_assert(context);
|
||||
PacsFuzzerApp* app = context;
|
||||
|
||||
FuzzerConsts* consts = app->fuzzer_const;
|
||||
|
||||
furi_string_set_str(app->file_path, consts->custom_dict_folder);
|
||||
|
||||
DialogsFileBrowserOptions browser_options;
|
||||
dialog_file_browser_set_basic_options(
|
||||
&browser_options, consts->custom_dict_extension, &I_rfid_10px);
|
||||
browser_options.base_path = consts->custom_dict_folder;
|
||||
browser_options.hide_ext = false;
|
||||
|
||||
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;
|
||||
@@ -36,16 +56,35 @@ bool fuzzer_scene_main_on_event(void* context, SceneManagerEvent event) {
|
||||
} else if(event.event == FuzzerCustomEventViewMainOk) {
|
||||
fuzzer_view_main_get_state(app->main_view, &app->fuzzer_state);
|
||||
|
||||
// TODO error logic
|
||||
bool loading_ok = false;
|
||||
|
||||
switch(app->fuzzer_state.menu_index) {
|
||||
case FuzzerMainMenuIndexDefaultValues:
|
||||
fuzzer_worker_attack_dict(app->worker, app->fuzzer_state.proto_index);
|
||||
|
||||
loading_ok = fuzzer_worker_attack_dict(app->worker, app->fuzzer_state.proto_index);
|
||||
|
||||
if(!loading_ok) {
|
||||
// error
|
||||
}
|
||||
break;
|
||||
|
||||
case FuzzerMainMenuIndexLoadFileCustomUids:
|
||||
if(!fuzzer_scene_main_load_custom_dict(app)) {
|
||||
break;
|
||||
} else {
|
||||
loading_ok = fuzzer_worker_attack_file_dict(
|
||||
app->worker, app->fuzzer_state.proto_index, app->file_path);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
scene_manager_next_scene(app->scene_manager, FuzzerSceneAttack);
|
||||
if(loading_ok) {
|
||||
scene_manager_next_scene(app->scene_manager, FuzzerSceneAttack);
|
||||
}
|
||||
consumed = true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user