Fuzzers App: attack gui

This commit is contained in:
gid9798
2023-06-02 20:33:28 +03:00
parent 321f2d8d50
commit e31a0c4d6d
14 changed files with 416 additions and 59 deletions

View File

@@ -0,0 +1,53 @@
#include "../fuzzer_i.h"
#include "../helpers/fuzzer_custom_event.h"
#include "../helpers/protocol.h"
#include "../helpers/gui_const.h"
void fuzzer_scene_attack_callback(FuzzerCustomEvent event, void* context) {
furi_assert(context);
PacsFuzzerApp* app = context;
view_dispatcher_send_custom_event(app->view_dispatcher, event);
}
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_view_attack_reset_data(
app->attack_view,
fuzzer_attack_names[app->fuzzer_state.menu_index],
proto.name,
proto.data_size);
fuzzer_view_attack_set_uid(app->attack_view, &proto.dict.val[0], false);
view_dispatcher_switch_to_view(app->view_dispatcher, FuzzerViewIDAttack);
}
bool fuzzer_scene_attack_on_event(void* context, SceneManagerEvent event) {
furi_assert(context);
PacsFuzzerApp* app = context;
bool consumed = false;
if(event.type == SceneManagerEventTypeCustom) {
if(event.event == FuzzerCustomEventViewAttackBack) {
if(!scene_manager_previous_scene(app->scene_manager)) {
scene_manager_stop(app->scene_manager);
view_dispatcher_stop(app->view_dispatcher);
}
consumed = true;
}
}
return consumed;
}
void fuzzer_scene_attack_on_exit(void* context) {
// furi_assert(context);
// PacsFuzzerApp* app = context;
UNUSED(context);
}

View File

@@ -1 +1,2 @@
ADD_SCENE(fuzzer, main, Main)
ADD_SCENE(fuzzer, main, Main)
ADD_SCENE(fuzzer, attack, Attack)

View File

@@ -13,6 +13,8 @@ void fuzzer_scene_main_on_enter(void* context) {
fuzzer_view_main_set_callback(app->main_view, fuzzer_scene_main_callback, app);
fuzzer_view_main_update_data(app->main_view, app->fuzzer_state);
view_dispatcher_switch_to_view(app->view_dispatcher, FuzzerViewIDMain);
}
@@ -28,6 +30,10 @@ bool fuzzer_scene_main_on_event(void* context, SceneManagerEvent event) {
view_dispatcher_stop(app->view_dispatcher);
}
consumed = true;
} else if(event.event == FuzzerCustomEventViewMainOk) {
fuzzer_view_main_get_state(app->main_view, &app->fuzzer_state);
scene_manager_next_scene(app->scene_manager, FuzzerSceneAttack);
consumed = true;
}
}