From 60ec667178b09279f7c8035a9072eb15521e1094 Mon Sep 17 00:00:00 2001 From: Willy-JL <49810075+Willy-JL@users.noreply.github.com> Date: Tue, 24 Oct 2023 22:20:06 +0100 Subject: [PATCH] BLE Spam save new custom data only on ok not back --- .../external/ble_spam/protocols/continuity.c | 18 +++++++++--------- .../external/ble_spam/protocols/easysetup.c | 14 +++++++------- .../external/ble_spam/protocols/fastpair.c | 8 ++++---- 3 files changed, 20 insertions(+), 20 deletions(-) diff --git a/applications/external/ble_spam/protocols/continuity.c b/applications/external/ble_spam/protocols/continuity.c index 88c6b5762..efbf87560 100644 --- a/applications/external/ble_spam/protocols/continuity.c +++ b/applications/external/ble_spam/protocols/continuity.c @@ -573,6 +573,8 @@ void scene_continuity_pp_model_on_exit(void* _ctx) { static void pp_model_custom_callback(void* _ctx) { Ctx* ctx = _ctx; + ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity; + cfg->data.proximity_pair.model = (ctx->byte_store[0] << 0x08) + (ctx->byte_store[1] << 0x00); scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager); } @@ -597,9 +599,7 @@ bool scene_continuity_pp_model_custom_on_event(void* _ctx, SceneManagerEvent eve return false; } void scene_continuity_pp_model_custom_on_exit(void* _ctx) { - Ctx* ctx = _ctx; - ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity; - cfg->data.proximity_pair.model = (ctx->byte_store[0] << 0x08) + (ctx->byte_store[1] << 0x00); + UNUSED(_ctx); } static void pp_prefix_callback(void* _ctx, uint32_t index) { @@ -660,6 +660,8 @@ void scene_continuity_pp_prefix_on_exit(void* _ctx) { static void pp_prefix_custom_callback(void* _ctx) { Ctx* ctx = _ctx; + ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity; + cfg->data.proximity_pair.prefix = (ctx->byte_store[0] << 0x00); scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager); } @@ -683,9 +685,7 @@ bool scene_continuity_pp_prefix_custom_on_event(void* _ctx, SceneManagerEvent ev return false; } void scene_continuity_pp_prefix_custom_on_exit(void* _ctx) { - Ctx* ctx = _ctx; - ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity; - cfg->data.proximity_pair.prefix = (ctx->byte_store[0] << 0x00); + UNUSED(_ctx); } static void na_action_callback(void* _ctx, uint32_t index) { @@ -746,6 +746,8 @@ void scene_continuity_na_action_on_exit(void* _ctx) { static void na_action_custom_callback(void* _ctx) { Ctx* ctx = _ctx; + ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity; + cfg->data.nearby_action.action = (ctx->byte_store[0] << 0x00); scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager); } @@ -769,9 +771,7 @@ bool scene_continuity_na_action_custom_on_event(void* _ctx, SceneManagerEvent ev return false; } void scene_continuity_na_action_custom_on_exit(void* _ctx) { - Ctx* ctx = _ctx; - ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity; - cfg->data.nearby_action.action = (ctx->byte_store[0] << 0x00); + UNUSED(_ctx); } static void na_flags_callback(void* _ctx) { diff --git a/applications/external/ble_spam/protocols/easysetup.c b/applications/external/ble_spam/protocols/easysetup.c index e4df74786..e1b6e0584 100644 --- a/applications/external/ble_spam/protocols/easysetup.c +++ b/applications/external/ble_spam/protocols/easysetup.c @@ -384,6 +384,9 @@ void scene_easysetup_buds_model_on_exit(void* _ctx) { static void buds_model_custom_callback(void* _ctx) { Ctx* ctx = _ctx; + EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup; + cfg->data.buds.model = + (ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00); scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager); } @@ -409,10 +412,7 @@ bool scene_easysetup_buds_model_custom_on_event(void* _ctx, SceneManagerEvent ev return false; } void scene_easysetup_buds_model_custom_on_exit(void* _ctx) { - Ctx* ctx = _ctx; - EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup; - cfg->data.buds.model = - (ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00); + UNUSED(_ctx); } static void watch_model_callback(void* _ctx, uint32_t index) { @@ -473,6 +473,8 @@ void scene_easysetup_watch_model_on_exit(void* _ctx) { static void watch_model_custom_callback(void* _ctx) { Ctx* ctx = _ctx; + EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup; + cfg->data.watch.model = (ctx->byte_store[0] << 0x00); scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager); } @@ -496,7 +498,5 @@ bool scene_easysetup_watch_model_custom_on_event(void* _ctx, SceneManagerEvent e return false; } void scene_easysetup_watch_model_custom_on_exit(void* _ctx) { - Ctx* ctx = _ctx; - EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup; - cfg->data.watch.model = (ctx->byte_store[0] << 0x00); + UNUSED(_ctx); } diff --git a/applications/external/ble_spam/protocols/fastpair.c b/applications/external/ble_spam/protocols/fastpair.c index 42d521105..db3d37b35 100644 --- a/applications/external/ble_spam/protocols/fastpair.c +++ b/applications/external/ble_spam/protocols/fastpair.c @@ -223,6 +223,9 @@ void scene_fastpair_model_on_exit(void* _ctx) { static void model_custom_callback(void* _ctx) { Ctx* ctx = _ctx; + FastpairCfg* cfg = &ctx->attack->payload.cfg.fastpair; + cfg->model = + (ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00); scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager); } @@ -248,8 +251,5 @@ bool scene_fastpair_model_custom_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_fastpair_model_custom_on_exit(void* _ctx) { - Ctx* ctx = _ctx; - FastpairCfg* cfg = &ctx->attack->payload.cfg.fastpair; - cfg->model = - (ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00); + UNUSED(_ctx); }