From 8a35240d4c28a82a324d868a151ae346b3db98a8 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Sun, 10 Dec 2023 19:04:58 +0300 Subject: [PATCH] update blespam --- base_pack/ble_spam/application.fam | 2 +- base_pack/ble_spam/ble_spam.c | 2 +- base_pack/ble_spam/protocols/continuity.c | 34 +++++++++++++++-------- base_pack/ble_spam/protocols/easysetup.c | 12 ++++---- base_pack/ble_spam/protocols/fastpair.c | 8 ++++-- base_pack/ble_spam/protocols/lovespouse.c | 8 ++++-- base_pack/ble_spam/protocols/swiftpair.c | 4 +-- base_pack/ble_spam/scenes/config.c | 4 +-- 8 files changed, 45 insertions(+), 29 deletions(-) diff --git a/base_pack/ble_spam/application.fam b/base_pack/ble_spam/application.fam index 62e2f3a7269..150c8ca902d 100644 --- a/base_pack/ble_spam/application.fam +++ b/base_pack/ble_spam/application.fam @@ -3,7 +3,7 @@ App( name="BLE Spam", apptype=FlipperAppType.EXTERNAL, entry_point="ble_spam", - stack_size=6 * 1024, + stack_size=2 * 1024, fap_icon="ble_spam_10px.png", fap_category="Bluetooth", fap_author="@Willy-JL @ECTO-1A @Spooks4576", diff --git a/base_pack/ble_spam/ble_spam.c b/base_pack/ble_spam/ble_spam.c index 68fa611512f..502f14be376 100644 --- a/base_pack/ble_spam/ble_spam.c +++ b/base_pack/ble_spam/ble_spam.c @@ -620,7 +620,7 @@ int32_t ble_spam(void* p) { state->thread = furi_thread_alloc(); furi_thread_set_callback(state->thread, adv_thread); furi_thread_set_context(state->thread, state); - furi_thread_set_stack_size(state->thread, 4096); + furi_thread_set_stack_size(state->thread, 2048); state->ctx.led_indicator = true; state->lock_timer = furi_timer_alloc(lock_timer_callback, FuriTimerTypeOnce, state); diff --git a/base_pack/ble_spam/protocols/continuity.c b/base_pack/ble_spam/protocols/continuity.c index 532b9e9ea36..6cc2eea6ab4 100644 --- a/base_pack/ble_spam/protocols/continuity.c +++ b/base_pack/ble_spam/protocols/continuity.c @@ -844,7 +844,6 @@ void scene_continuity_pp_model_on_enter(void* _ctx) { ContinuityCfg* cfg = &payload->cfg.continuity; Submenu* submenu = ctx->submenu; uint32_t selected = 0; - submenu_reset(submenu); bool value = payload->mode == PayloadModeValue || (payload->mode == PayloadModeBruteforce && cfg->data.proximity_pair.bruteforce_mode != ContinuityPpBruteforceModel); @@ -882,7 +881,8 @@ bool scene_continuity_pp_model_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_continuity_pp_model_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + submenu_reset(ctx->submenu); } static void pp_model_custom_callback(void* _ctx) { @@ -918,7 +918,9 @@ bool scene_continuity_pp_model_custom_on_event(void* _ctx, SceneManagerEvent eve return false; } void scene_continuity_pp_model_custom_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + byte_input_set_result_callback(ctx->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(ctx->byte_input, ""); } static void pp_color_callback(void* _ctx, uint32_t index) { @@ -960,7 +962,6 @@ void scene_continuity_pp_color_on_enter(void* _ctx) { ContinuityCfg* cfg = &payload->cfg.continuity; Submenu* submenu = ctx->submenu; uint32_t selected = 0; - submenu_reset(submenu); bool value = payload->mode == PayloadModeValue || (payload->mode == PayloadModeBruteforce && cfg->data.proximity_pair.bruteforce_mode != ContinuityPpBruteforceColor); @@ -1006,7 +1007,8 @@ bool scene_continuity_pp_color_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_continuity_pp_color_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + submenu_reset(ctx->submenu); } static void pp_color_custom_callback(void* _ctx) { @@ -1041,7 +1043,9 @@ bool scene_continuity_pp_color_custom_on_event(void* _ctx, SceneManagerEvent eve return false; } void scene_continuity_pp_color_custom_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + byte_input_set_result_callback(ctx->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(ctx->byte_input, ""); } static void pp_prefix_callback(void* _ctx, uint32_t index) { @@ -1069,7 +1073,6 @@ void scene_continuity_pp_prefix_on_enter(void* _ctx) { Submenu* submenu = ctx->submenu; uint32_t selected = 0; bool found = false; - submenu_reset(submenu); submenu_add_item(submenu, "Automatic", 0, pp_prefix_callback, ctx); if(cfg->data.proximity_pair.prefix == 0x00) { @@ -1099,7 +1102,8 @@ bool scene_continuity_pp_prefix_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_continuity_pp_prefix_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + submenu_reset(ctx->submenu); } static void pp_prefix_custom_callback(void* _ctx) { @@ -1131,7 +1135,9 @@ bool scene_continuity_pp_prefix_custom_on_event(void* _ctx, SceneManagerEvent ev return false; } void scene_continuity_pp_prefix_custom_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + byte_input_set_result_callback(ctx->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(ctx->byte_input, ""); } static void na_action_callback(void* _ctx, uint32_t index) { @@ -1166,7 +1172,6 @@ void scene_continuity_na_action_on_enter(void* _ctx) { ContinuityCfg* cfg = &payload->cfg.continuity; Submenu* submenu = ctx->submenu; uint32_t selected = 0; - submenu_reset(submenu); submenu_add_item(submenu, "Random", 0, na_action_callback, ctx); if(payload->mode == PayloadModeRandom) { @@ -1202,7 +1207,8 @@ bool scene_continuity_na_action_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_continuity_na_action_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + submenu_reset(ctx->submenu); } static void na_action_custom_callback(void* _ctx) { @@ -1235,7 +1241,9 @@ bool scene_continuity_na_action_custom_on_event(void* _ctx, SceneManagerEvent ev return false; } void scene_continuity_na_action_custom_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + byte_input_set_result_callback(ctx->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(ctx->byte_input, ""); } static void na_flags_callback(void* _ctx) { @@ -1269,4 +1277,6 @@ void scene_continuity_na_flags_on_exit(void* _ctx) { Payload* payload = &ctx->attack->payload; ContinuityCfg* cfg = &payload->cfg.continuity; cfg->data.nearby_action.flags = (ctx->byte_store[0] << 0x00); + byte_input_set_result_callback(ctx->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(ctx->byte_input, ""); } diff --git a/base_pack/ble_spam/protocols/easysetup.c b/base_pack/ble_spam/protocols/easysetup.c index 7ab521238eb..e2e814d0b68 100644 --- a/base_pack/ble_spam/protocols/easysetup.c +++ b/base_pack/ble_spam/protocols/easysetup.c @@ -398,7 +398,6 @@ void scene_easysetup_buds_model_on_enter(void* _ctx) { EasysetupCfg* cfg = &payload->cfg.easysetup; Submenu* submenu = ctx->submenu; uint32_t selected = 0; - submenu_reset(submenu); submenu_add_item(submenu, "Random", 0, buds_model_callback, ctx); if(payload->mode == PayloadModeRandom) { @@ -434,7 +433,8 @@ bool scene_easysetup_buds_model_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_easysetup_buds_model_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + submenu_reset(ctx->submenu); } static void buds_model_custom_callback(void* _ctx) { @@ -470,7 +470,9 @@ bool scene_easysetup_buds_model_custom_on_event(void* _ctx, SceneManagerEvent ev return false; } void scene_easysetup_buds_model_custom_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + byte_input_set_result_callback(ctx->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(ctx->byte_input, ""); } static void watch_model_callback(void* _ctx, uint32_t index) { @@ -505,7 +507,6 @@ void scene_easysetup_watch_model_on_enter(void* _ctx) { EasysetupCfg* cfg = &payload->cfg.easysetup; Submenu* submenu = ctx->submenu; uint32_t selected = 0; - submenu_reset(submenu); submenu_add_item(submenu, "Random", 0, watch_model_callback, ctx); if(payload->mode == PayloadModeRandom) { @@ -541,7 +542,8 @@ bool scene_easysetup_watch_model_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_easysetup_watch_model_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + submenu_reset(ctx->submenu); } static void watch_model_custom_callback(void* _ctx) { diff --git a/base_pack/ble_spam/protocols/fastpair.c b/base_pack/ble_spam/protocols/fastpair.c index faec985264f..37bd7e5c82e 100644 --- a/base_pack/ble_spam/protocols/fastpair.c +++ b/base_pack/ble_spam/protocols/fastpair.c @@ -746,7 +746,6 @@ void scene_fastpair_model_on_enter(void* _ctx) { FastpairCfg* cfg = &payload->cfg.fastpair; Submenu* submenu = ctx->submenu; uint32_t selected = 0; - submenu_reset(submenu); submenu_add_item(submenu, "Random", 0, model_callback, ctx); if(payload->mode == PayloadModeRandom) { @@ -781,7 +780,8 @@ bool scene_fastpair_model_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_fastpair_model_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + submenu_reset(ctx->submenu); } static void model_custom_callback(void* _ctx) { @@ -817,5 +817,7 @@ bool scene_fastpair_model_custom_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_fastpair_model_custom_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + byte_input_set_result_callback(ctx->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(ctx->byte_input, ""); } diff --git a/base_pack/ble_spam/protocols/lovespouse.c b/base_pack/ble_spam/protocols/lovespouse.c index fc5ea1c4ac9..22ad8679188 100644 --- a/base_pack/ble_spam/protocols/lovespouse.c +++ b/base_pack/ble_spam/protocols/lovespouse.c @@ -216,7 +216,6 @@ void scene_lovespouse_mode_on_enter(void* _ctx) { LovespouseCfg* cfg = &payload->cfg.lovespouse; Submenu* submenu = ctx->submenu; uint32_t selected = 0; - submenu_reset(submenu); submenu_add_item(submenu, "Random", 0, mode_callback, ctx); if(payload->mode == PayloadModeRandom) { @@ -252,7 +251,8 @@ bool scene_lovespouse_mode_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_lovespouse_mode_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + submenu_reset(ctx->submenu); } static void mode_custom_callback(void* _ctx) { @@ -288,5 +288,7 @@ bool scene_lovespouse_mode_custom_on_event(void* _ctx, SceneManagerEvent event) return false; } void scene_lovespouse_mode_custom_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + byte_input_set_result_callback(ctx->byte_input, NULL, NULL, NULL, NULL, 0); + byte_input_set_header_text(ctx->byte_input, ""); } diff --git a/base_pack/ble_spam/protocols/swiftpair.c b/base_pack/ble_spam/protocols/swiftpair.c index b07f74f5de8..955b5867504 100644 --- a/base_pack/ble_spam/protocols/swiftpair.c +++ b/base_pack/ble_spam/protocols/swiftpair.c @@ -111,7 +111,6 @@ void scene_swiftpair_name_on_enter(void* _ctx) { Payload* payload = &ctx->attack->payload; SwiftpairCfg* cfg = &payload->cfg.swiftpair; TextInput* text_input = ctx->text_input; - text_input_reset(text_input); text_input_set_header_text(text_input, "Press back for random"); @@ -131,5 +130,6 @@ bool scene_swiftpair_name_on_event(void* _ctx, SceneManagerEvent event) { return false; } void scene_swiftpair_name_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + text_input_reset(ctx->text_input); } diff --git a/base_pack/ble_spam/scenes/config.c b/base_pack/ble_spam/scenes/config.c index 61621ef7e28..c9df073cfce 100644 --- a/base_pack/ble_spam/scenes/config.c +++ b/base_pack/ble_spam/scenes/config.c @@ -40,7 +40,6 @@ static void config_callback(void* _ctx, uint32_t index) { void scene_config_on_enter(void* _ctx) { Ctx* ctx = _ctx; VariableItemList* list = ctx->variable_item_list; - variable_item_list_reset(list); // Add item to be used as attack name header //variable_item_list_add(list, ctx->attack->title, 0, NULL, NULL); @@ -73,5 +72,6 @@ bool scene_config_on_event(void* _ctx, SceneManagerEvent event) { } void scene_config_on_exit(void* _ctx) { - UNUSED(_ctx); + Ctx* ctx = _ctx; + variable_item_list_reset(ctx->variable_item_list); }