mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-18 00:38:10 -07:00
Merge branch 'dev' of https://github.com/Flipper-XFW/Xtreme-Firmware into dev
This commit is contained in:
+1
-1
@@ -8,7 +8,7 @@ App(
|
||||
fap_category="Bluetooth",
|
||||
fap_author="@Willy-JL @ECTO-1A @Spooks4576",
|
||||
fap_weburl="https://github.com/Flipper-XFW/Xtreme-Apps/tree/dev/ble_spam",
|
||||
fap_version="3.1",
|
||||
fap_version="3.3",
|
||||
fap_description="Flood BLE advertisements to cause spammy and annoying popups/notifications",
|
||||
fap_icon_assets="icons",
|
||||
fap_icon_assets_symbol="ble_spam",
|
||||
|
||||
+88
-12
@@ -142,6 +142,11 @@ static uint16_t delays[] = {20, 50, 100, 200};
|
||||
|
||||
typedef struct {
|
||||
Ctx ctx;
|
||||
View* main_view;
|
||||
bool lock_warning;
|
||||
uint8_t lock_count;
|
||||
FuriTimer* lock_timer;
|
||||
|
||||
bool resume;
|
||||
bool advertising;
|
||||
uint8_t delay;
|
||||
@@ -149,6 +154,27 @@ typedef struct {
|
||||
int8_t index;
|
||||
} State;
|
||||
|
||||
NotificationMessage blink_message = {
|
||||
.type = NotificationMessageTypeLedBlinkStart,
|
||||
.data.led_blink.color = LightBlue | LightGreen,
|
||||
.data.led_blink.on_time = 10,
|
||||
.data.led_blink.period = 100,
|
||||
};
|
||||
const NotificationSequence blink_sequence = {
|
||||
&blink_message,
|
||||
&message_do_not_reset,
|
||||
NULL,
|
||||
};
|
||||
static void start_blink(State* state) {
|
||||
uint16_t period = delays[state->delay];
|
||||
if(period <= 100) period += 30;
|
||||
blink_message.data.led_blink.period = period;
|
||||
notification_message_block(state->ctx.notification, &blink_sequence);
|
||||
}
|
||||
static void stop_blink(State* state) {
|
||||
notification_message_block(state->ctx.notification, &sequence_blink_stop);
|
||||
}
|
||||
|
||||
static int32_t adv_thread(void* _ctx) {
|
||||
State* state = _ctx;
|
||||
uint8_t size;
|
||||
@@ -158,6 +184,7 @@ static int32_t adv_thread(void* _ctx) {
|
||||
Payload* payload = &attacks[state->index].payload;
|
||||
const Protocol* protocol = attacks[state->index].protocol;
|
||||
if(!payload->random_mac) furi_hal_random_fill_buf(mac, sizeof(mac));
|
||||
if(state->ctx.led_indicator) start_blink(state);
|
||||
|
||||
while(state->advertising) {
|
||||
if(protocol) {
|
||||
@@ -175,6 +202,7 @@ static int32_t adv_thread(void* _ctx) {
|
||||
furi_hal_bt_custom_adv_stop();
|
||||
}
|
||||
|
||||
if(state->ctx.led_indicator) stop_blink(state);
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -185,9 +213,9 @@ static void toggle_adv(State* state) {
|
||||
furi_thread_join(state->thread);
|
||||
if(state->resume) furi_hal_bt_start_advertising();
|
||||
} else {
|
||||
state->advertising = true;
|
||||
state->resume = furi_hal_bt_is_active();
|
||||
furi_hal_bt_stop_advertising();
|
||||
state->advertising = true;
|
||||
furi_thread_start(state->thread);
|
||||
}
|
||||
}
|
||||
@@ -315,11 +343,15 @@ static void draw_callback(Canvas* canvas, void* _ctx) {
|
||||
"App+Spam: \e#WillyJL\e# XFW\n"
|
||||
"Apple+Crash: \e#ECTO-1A\e#\n"
|
||||
"Android+Win: \e#Spooks4576\e#\n"
|
||||
" Version \e#3.1\e#",
|
||||
" Version \e#3.3\e#",
|
||||
false);
|
||||
break;
|
||||
default: {
|
||||
if(!attack) break;
|
||||
if(state->ctx.lock_keyboard && !state->advertising) {
|
||||
// Forgive me Lord for I have sinned by handling state in draw
|
||||
toggle_adv(state);
|
||||
}
|
||||
char str[32];
|
||||
|
||||
canvas_set_font(canvas, FontBatteryPercent);
|
||||
@@ -355,6 +387,17 @@ static void draw_callback(Canvas* canvas, void* _ctx) {
|
||||
if(state->index < PAGE_MAX) {
|
||||
elements_button_right(canvas, next);
|
||||
}
|
||||
|
||||
if(state->lock_warning) {
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
elements_bold_rounded_frame(canvas, 14, 8, 99, 48);
|
||||
elements_multiline_text(canvas, 65, 26, "To unlock\npress:");
|
||||
canvas_draw_icon(canvas, 65, 42, &I_Pin_back_arrow_10x8);
|
||||
canvas_draw_icon(canvas, 80, 42, &I_Pin_back_arrow_10x8);
|
||||
canvas_draw_icon(canvas, 95, 42, &I_Pin_back_arrow_10x8);
|
||||
canvas_draw_icon(canvas, 16, 13, &I_WarningDolphin_45x42);
|
||||
canvas_draw_dot(canvas, 17, 61);
|
||||
}
|
||||
}
|
||||
|
||||
static bool input_callback(InputEvent* input, void* _ctx) {
|
||||
@@ -362,8 +405,22 @@ static bool input_callback(InputEvent* input, void* _ctx) {
|
||||
State* state = *(State**)view_get_model(view);
|
||||
bool consumed = false;
|
||||
|
||||
if(input->type == InputTypeShort || input->type == InputTypeLong ||
|
||||
input->type == InputTypeRepeat) {
|
||||
if(state->ctx.lock_keyboard) {
|
||||
consumed = true;
|
||||
with_view_model(
|
||||
state->main_view, State * *model, { (*model)->lock_warning = true; }, true);
|
||||
if(state->lock_count == 0) {
|
||||
furi_timer_start(state->lock_timer, pdMS_TO_TICKS(1000));
|
||||
}
|
||||
if(input->type == InputTypeShort && input->key == InputKeyBack) {
|
||||
state->lock_count++;
|
||||
}
|
||||
if(state->lock_count >= 3) {
|
||||
furi_timer_start(state->lock_timer, 1);
|
||||
}
|
||||
} else if(
|
||||
input->type == InputTypeShort || input->type == InputTypeLong ||
|
||||
input->type == InputTypeRepeat) {
|
||||
consumed = true;
|
||||
|
||||
bool is_attack = state->index >= 0 && state->index <= ATTACKS_COUNT - 1;
|
||||
@@ -385,11 +442,13 @@ static bool input_callback(InputEvent* input, void* _ctx) {
|
||||
case InputKeyUp:
|
||||
if(is_attack && state->delay < COUNT_OF(delays) - 1) {
|
||||
state->delay++;
|
||||
if(advertising) start_blink(state);
|
||||
}
|
||||
break;
|
||||
case InputKeyDown:
|
||||
if(is_attack && state->delay > 0) {
|
||||
state->delay--;
|
||||
if(advertising) start_blink(state);
|
||||
}
|
||||
break;
|
||||
case InputKeyLeft:
|
||||
@@ -417,6 +476,18 @@ static bool input_callback(InputEvent* input, void* _ctx) {
|
||||
return consumed;
|
||||
}
|
||||
|
||||
static void lock_timer_callback(void* _ctx) {
|
||||
State* state = _ctx;
|
||||
if(state->lock_count < 3) {
|
||||
notification_message_block(state->ctx.notification, &sequence_display_backlight_off);
|
||||
} else {
|
||||
state->ctx.lock_keyboard = false;
|
||||
}
|
||||
with_view_model(
|
||||
state->main_view, State * *model, { (*model)->lock_warning = false; }, true);
|
||||
state->lock_count = 0;
|
||||
}
|
||||
|
||||
static bool back_event_callback(void* _ctx) {
|
||||
Ctx* ctx = _ctx;
|
||||
return scene_manager_handle_back_event(ctx->scene_manager);
|
||||
@@ -429,7 +500,10 @@ int32_t ble_spam(void* p) {
|
||||
furi_thread_set_callback(state->thread, adv_thread);
|
||||
furi_thread_set_context(state->thread, state);
|
||||
furi_thread_set_stack_size(state->thread, 4096);
|
||||
state->ctx.led_indicator = true;
|
||||
state->lock_timer = furi_timer_alloc(lock_timer_callback, FuriTimerTypeOnce, state);
|
||||
|
||||
state->ctx.notification = furi_record_open(RECORD_NOTIFICATION);
|
||||
Gui* gui = furi_record_open(RECORD_GUI);
|
||||
state->ctx.view_dispatcher = view_dispatcher_alloc();
|
||||
view_dispatcher_enable_queue(state->ctx.view_dispatcher);
|
||||
@@ -437,14 +511,14 @@ int32_t ble_spam(void* p) {
|
||||
view_dispatcher_set_navigation_event_callback(state->ctx.view_dispatcher, back_event_callback);
|
||||
state->ctx.scene_manager = scene_manager_alloc(&scene_handlers, &state->ctx);
|
||||
|
||||
View* view_main = view_alloc();
|
||||
view_allocate_model(view_main, ViewModelTypeLockFree, sizeof(State*));
|
||||
state->main_view = view_alloc();
|
||||
view_allocate_model(state->main_view, ViewModelTypeLocking, sizeof(State*));
|
||||
with_view_model(
|
||||
view_main, State * *model, { *model = state; }, false);
|
||||
view_set_context(view_main, view_main);
|
||||
view_set_draw_callback(view_main, draw_callback);
|
||||
view_set_input_callback(view_main, input_callback);
|
||||
view_dispatcher_add_view(state->ctx.view_dispatcher, ViewMain, view_main);
|
||||
state->main_view, State * *model, { *model = state; }, false);
|
||||
view_set_context(state->main_view, state->main_view);
|
||||
view_set_draw_callback(state->main_view, draw_callback);
|
||||
view_set_input_callback(state->main_view, input_callback);
|
||||
view_dispatcher_add_view(state->ctx.view_dispatcher, ViewMain, state->main_view);
|
||||
|
||||
state->ctx.byte_input = byte_input_alloc();
|
||||
view_dispatcher_add_view(
|
||||
@@ -481,12 +555,14 @@ int32_t ble_spam(void* p) {
|
||||
variable_item_list_free(state->ctx.variable_item_list);
|
||||
|
||||
view_dispatcher_remove_view(state->ctx.view_dispatcher, ViewMain);
|
||||
view_free(view_main);
|
||||
view_free(state->main_view);
|
||||
|
||||
scene_manager_free(state->ctx.scene_manager);
|
||||
view_dispatcher_free(state->ctx.view_dispatcher);
|
||||
furi_record_close(RECORD_GUI);
|
||||
furi_record_close(RECORD_NOTIFICATION);
|
||||
|
||||
furi_timer_free(state->lock_timer);
|
||||
furi_thread_free(state->thread);
|
||||
free(state);
|
||||
return 0;
|
||||
|
||||
+7
@@ -1,5 +1,6 @@
|
||||
#pragma once
|
||||
|
||||
#include <notification/notification_messages.h>
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/byte_input.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
@@ -19,6 +20,8 @@ enum {
|
||||
enum {
|
||||
ConfigRandomMac,
|
||||
ConfigExtraStart = ConfigRandomMac,
|
||||
ConfigLedIndicator,
|
||||
ConfigLockKeyboard,
|
||||
};
|
||||
|
||||
typedef struct Attack Attack;
|
||||
@@ -26,7 +29,11 @@ typedef struct Attack Attack;
|
||||
typedef struct {
|
||||
Attack* attack;
|
||||
uint8_t byte_store[3];
|
||||
VariableItemListEnterCallback fallback_config_enter;
|
||||
bool led_indicator;
|
||||
bool lock_keyboard;
|
||||
|
||||
NotificationApp* notification;
|
||||
ViewDispatcher* view_dispatcher;
|
||||
SceneManager* scene_manager;
|
||||
|
||||
|
||||
@@ -17,4 +17,5 @@ typedef struct {
|
||||
const char* (*get_name)(const ProtocolCfg* _cfg);
|
||||
void (*make_packet)(uint8_t* _size, uint8_t** _packet, const ProtocolCfg* _cfg);
|
||||
void (*extra_config)(Ctx* ctx);
|
||||
uint8_t (*config_count)(const ProtocolCfg* _cfg);
|
||||
} Protocol;
|
||||
|
||||
@@ -277,11 +277,19 @@ enum {
|
||||
_ConfigPpExtraStart = ConfigExtraStart,
|
||||
ConfigPpModel,
|
||||
ConfigPpPrefix,
|
||||
ConfigPpCOUNT,
|
||||
};
|
||||
enum {
|
||||
_ConfigNaExtraStart = ConfigExtraStart,
|
||||
ConfigNaAction,
|
||||
ConfigNaFlags,
|
||||
ConfigNaCOUNT,
|
||||
};
|
||||
enum {
|
||||
_ConfigCcExtraStart = ConfigExtraStart,
|
||||
ConfigCcInfoLock,
|
||||
ConfigCcInfoDevice,
|
||||
ConfigCcCOUNT,
|
||||
};
|
||||
static void config_callback(void* _ctx, uint32_t index) {
|
||||
Ctx* ctx = _ctx;
|
||||
@@ -297,6 +305,7 @@ static void config_callback(void* _ctx, uint32_t index) {
|
||||
scene_manager_next_scene(ctx->scene_manager, SceneContinuityPpPrefix);
|
||||
break;
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -310,11 +319,24 @@ static void config_callback(void* _ctx, uint32_t index) {
|
||||
scene_manager_next_scene(ctx->scene_manager, SceneContinuityNaFlags);
|
||||
break;
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
case ContinuityTypeCustomCrash: {
|
||||
switch(index) {
|
||||
case ConfigCcInfoLock:
|
||||
case ConfigCcInfoDevice:
|
||||
break;
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -470,11 +492,27 @@ static void continuity_extra_config(Ctx* ctx) {
|
||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||
}
|
||||
|
||||
static uint8_t config_counts[ContinuityTypeCOUNT] = {
|
||||
[ContinuityTypeAirDrop] = 0,
|
||||
[ContinuityTypeProximityPair] = ConfigPpCOUNT - ConfigExtraStart - 1,
|
||||
[ContinuityTypeAirplayTarget] = 0,
|
||||
[ContinuityTypeHandoff] = 0,
|
||||
[ContinuityTypeTetheringSource] = 0,
|
||||
[ContinuityTypeNearbyAction] = ConfigNaCOUNT - ConfigExtraStart - 1,
|
||||
[ContinuityTypeNearbyInfo] = 0,
|
||||
[ContinuityTypeCustomCrash] = ConfigCcCOUNT - ConfigExtraStart - 1,
|
||||
};
|
||||
static uint8_t continuity_config_count(const ProtocolCfg* _cfg) {
|
||||
const ContinuityCfg* cfg = &_cfg->continuity;
|
||||
return config_counts[cfg->type];
|
||||
}
|
||||
|
||||
const Protocol protocol_continuity = {
|
||||
.icon = &I_apple,
|
||||
.get_name = continuity_get_name,
|
||||
.make_packet = continuity_make_packet,
|
||||
.extra_config = continuity_extra_config,
|
||||
.config_count = continuity_config_count,
|
||||
};
|
||||
|
||||
static void pp_model_callback(void* _ctx, uint32_t index) {
|
||||
|
||||
@@ -171,10 +171,13 @@ void easysetup_make_packet(uint8_t* out_size, uint8_t** out_packet, const Protoc
|
||||
enum {
|
||||
_ConfigBudsExtraStart = ConfigExtraStart,
|
||||
ConfigBudsModel,
|
||||
ConfigBudsInfoVersion,
|
||||
ConfigBudsCOUNT,
|
||||
};
|
||||
enum {
|
||||
_ConfigWatchExtraStart = ConfigExtraStart,
|
||||
ConfigWatchModel,
|
||||
ConfigWatchCOUNT,
|
||||
};
|
||||
static void config_callback(void* _ctx, uint32_t index) {
|
||||
Ctx* ctx = _ctx;
|
||||
@@ -186,7 +189,10 @@ static void config_callback(void* _ctx, uint32_t index) {
|
||||
case ConfigBudsModel:
|
||||
scene_manager_next_scene(ctx->scene_manager, SceneEasysetupBudsModel);
|
||||
break;
|
||||
case ConfigBudsInfoVersion:
|
||||
break;
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
@@ -197,11 +203,13 @@ static void config_callback(void* _ctx, uint32_t index) {
|
||||
scene_manager_next_scene(ctx->scene_manager, SceneEasysetupWatchModel);
|
||||
break;
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
}
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -297,11 +305,21 @@ static void easysetup_extra_config(Ctx* ctx) {
|
||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||
}
|
||||
|
||||
static uint8_t config_counts[EasysetupTypeCOUNT] = {
|
||||
[EasysetupTypeBuds] = ConfigBudsCOUNT - ConfigExtraStart - 1,
|
||||
[EasysetupTypeWatch] = ConfigWatchCOUNT - ConfigExtraStart - 1,
|
||||
};
|
||||
static uint8_t easysetup_config_count(const ProtocolCfg* _cfg) {
|
||||
const EasysetupCfg* cfg = &_cfg->easysetup;
|
||||
return config_counts[cfg->type];
|
||||
}
|
||||
|
||||
const Protocol protocol_easysetup = {
|
||||
.icon = &I_android,
|
||||
.get_name = easysetup_get_name,
|
||||
.make_packet = easysetup_make_packet,
|
||||
.extra_config = easysetup_extra_config,
|
||||
.config_count = easysetup_config_count,
|
||||
};
|
||||
|
||||
static void buds_model_callback(void* _ctx, uint32_t index) {
|
||||
|
||||
@@ -82,6 +82,8 @@ static void fastpair_make_packet(uint8_t* _size, uint8_t** _packet, const Protoc
|
||||
enum {
|
||||
_ConfigExtraStart = ConfigExtraStart,
|
||||
ConfigModel,
|
||||
ConfigInfoRequire,
|
||||
ConfigCOUNT,
|
||||
};
|
||||
static void config_callback(void* _ctx, uint32_t index) {
|
||||
Ctx* ctx = _ctx;
|
||||
@@ -89,7 +91,11 @@ static void config_callback(void* _ctx, uint32_t index) {
|
||||
switch(index) {
|
||||
case ConfigModel:
|
||||
scene_manager_next_scene(ctx->scene_manager, SceneFastpairModel);
|
||||
break;
|
||||
case ConfigInfoRequire:
|
||||
break;
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -139,11 +145,17 @@ static void fastpair_extra_config(Ctx* ctx) {
|
||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||
}
|
||||
|
||||
static uint8_t fastpair_config_count(const ProtocolCfg* _cfg) {
|
||||
UNUSED(_cfg);
|
||||
return ConfigCOUNT - ConfigExtraStart - 1;
|
||||
}
|
||||
|
||||
const Protocol protocol_fastpair = {
|
||||
.icon = &I_android,
|
||||
.get_name = fastpair_get_name,
|
||||
.make_packet = fastpair_make_packet,
|
||||
.extra_config = fastpair_extra_config,
|
||||
.config_count = fastpair_config_count,
|
||||
};
|
||||
|
||||
static void model_callback(void* _ctx, uint32_t index) {
|
||||
|
||||
@@ -49,6 +49,8 @@ static void swiftpair_make_packet(uint8_t* _size, uint8_t** _packet, const Proto
|
||||
enum {
|
||||
_ConfigExtraStart = ConfigExtraStart,
|
||||
ConfigName,
|
||||
ConfigInfoRequire,
|
||||
ConfigCOUNT,
|
||||
};
|
||||
static void config_callback(void* _ctx, uint32_t index) {
|
||||
Ctx* ctx = _ctx;
|
||||
@@ -56,7 +58,11 @@ static void config_callback(void* _ctx, uint32_t index) {
|
||||
switch(index) {
|
||||
case ConfigName:
|
||||
scene_manager_next_scene(ctx->scene_manager, SceneSwiftpairName);
|
||||
break;
|
||||
case ConfigInfoRequire:
|
||||
break;
|
||||
default:
|
||||
ctx->fallback_config_enter(ctx, index);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -73,11 +79,17 @@ static void swiftpair_extra_config(Ctx* ctx) {
|
||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||
}
|
||||
|
||||
static uint8_t swiftpair_config_count(const ProtocolCfg* _cfg) {
|
||||
UNUSED(_cfg);
|
||||
return ConfigCOUNT - ConfigExtraStart - 1;
|
||||
}
|
||||
|
||||
const Protocol protocol_swiftpair = {
|
||||
.icon = &I_windows,
|
||||
.get_name = swiftpair_get_name,
|
||||
.make_packet = swiftpair_make_packet,
|
||||
.extra_config = swiftpair_extra_config,
|
||||
.config_count = swiftpair_config_count,
|
||||
};
|
||||
|
||||
static void name_callback(void* _ctx) {
|
||||
|
||||
+41
-9
@@ -2,30 +2,62 @@
|
||||
|
||||
#include "protocols/_protocols.h"
|
||||
|
||||
static void random_mac_changed(VariableItem* item) {
|
||||
Ctx* ctx = variable_item_get_context(item);
|
||||
ctx->attack->payload.random_mac = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, ctx->attack->payload.random_mac ? "ON" : "OFF");
|
||||
static void _config_bool(VariableItem* item) {
|
||||
bool* value = variable_item_get_context(item);
|
||||
*value = variable_item_get_current_value_index(item);
|
||||
variable_item_set_current_value_text(item, *value ? "ON" : "OFF");
|
||||
}
|
||||
static void config_bool(VariableItemList* list, const char* name, bool* value) {
|
||||
VariableItem* item = variable_item_list_add(list, name, 2, _config_bool, value);
|
||||
variable_item_set_current_value_index(item, *value);
|
||||
variable_item_set_current_value_text(item, *value ? "ON" : "OFF");
|
||||
}
|
||||
|
||||
static void config_callback(void* _ctx, uint32_t index) {
|
||||
Ctx* ctx = _ctx;
|
||||
scene_manager_set_scene_state(ctx->scene_manager, SceneConfig, index);
|
||||
if(!ctx->attack->protocol) {
|
||||
index--;
|
||||
} else if(ctx->attack->protocol->config_count) {
|
||||
uint8_t extra = ctx->attack->protocol->config_count(&ctx->attack->payload.cfg);
|
||||
if(index > extra) index -= extra;
|
||||
}
|
||||
|
||||
switch(index) {
|
||||
case ConfigRandomMac:
|
||||
break;
|
||||
case ConfigLedIndicator:
|
||||
break;
|
||||
case ConfigLockKeyboard:
|
||||
ctx->lock_keyboard = true;
|
||||
scene_manager_previous_scene(ctx->scene_manager);
|
||||
notification_message_block(ctx->notification, &sequence_display_backlight_off);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
void scene_config_on_enter(void* _ctx) {
|
||||
Ctx* ctx = _ctx;
|
||||
VariableItem* item;
|
||||
VariableItemList* list = ctx->variable_item_list;
|
||||
variable_item_list_reset(list);
|
||||
|
||||
variable_item_list_set_header(list, ctx->attack->title);
|
||||
|
||||
item = variable_item_list_add(list, "Random MAC", 2, random_mac_changed, ctx);
|
||||
variable_item_set_current_value_index(item, ctx->attack->payload.random_mac);
|
||||
variable_item_set_current_value_text(item, ctx->attack->payload.random_mac ? "ON" : "OFF");
|
||||
config_bool(list, "Random MAC", &ctx->attack->payload.random_mac);
|
||||
|
||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||
if(!ctx->attack->protocol) {
|
||||
variable_item_list_add(list, "None shall escape the S I N K", 0, NULL, NULL);
|
||||
variable_item_list_add(list, "None shall escape the SINK", 0, NULL, NULL);
|
||||
} else if(ctx->attack->protocol->extra_config) {
|
||||
ctx->fallback_config_enter = config_callback;
|
||||
ctx->attack->protocol->extra_config(ctx);
|
||||
}
|
||||
|
||||
config_bool(list, "LED Indicator", &ctx->led_indicator);
|
||||
|
||||
variable_item_list_add(list, "Lock Keyboard", 0, NULL, NULL);
|
||||
|
||||
variable_item_list_set_selected_item(
|
||||
list, scene_manager_get_scene_state(ctx->scene_manager, SceneConfig));
|
||||
|
||||
|
||||
+1
-1
@@ -16,6 +16,6 @@ App(
|
||||
fap_category="Tools",
|
||||
fap_author="Struan Clark (xtruan)",
|
||||
fap_weburl="https://github.com/xtruan/FlipBIP",
|
||||
fap_version=(1, 13),
|
||||
fap_version=(1, 14),
|
||||
fap_description="Crypto wallet for Flipper",
|
||||
)
|
||||
|
||||
+30
@@ -90,6 +90,22 @@ static void text_input_callback(void* context) {
|
||||
}
|
||||
}
|
||||
|
||||
static void flipbip_scene_renew_dialog_callback(DialogExResult result, void* context) {
|
||||
FlipBip* app = context;
|
||||
if(result == DialogExResultRight) {
|
||||
app->wallet_create(app);
|
||||
} else {
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewIdMenu);
|
||||
}
|
||||
}
|
||||
|
||||
static void flipbip_wallet_create(void* context) {
|
||||
FlipBip* app = context;
|
||||
furi_assert(app);
|
||||
scene_manager_set_scene_state(app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1New);
|
||||
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
|
||||
}
|
||||
|
||||
FlipBip* flipbip_app_alloc() {
|
||||
FlipBip* app = malloc(sizeof(FlipBip));
|
||||
app->gui = furi_record_open(RECORD_GUI);
|
||||
@@ -148,6 +164,17 @@ FlipBip* flipbip_app_alloc() {
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, FlipBipViewIdTextInput, text_input_get_view(app->text_input));
|
||||
|
||||
app->wallet_create = flipbip_wallet_create;
|
||||
app->renew_dialog = dialog_ex_alloc();
|
||||
dialog_ex_set_result_callback(app->renew_dialog, flipbip_scene_renew_dialog_callback);
|
||||
dialog_ex_set_context(app->renew_dialog, app);
|
||||
dialog_ex_set_left_button_text(app->renew_dialog, "No");
|
||||
dialog_ex_set_right_button_text(app->renew_dialog, "Yes");
|
||||
dialog_ex_set_header(
|
||||
app->renew_dialog, "Current wallet\nWill be lost.\nProceed?", 16, 12, AlignLeft, AlignTop);
|
||||
view_dispatcher_add_view(
|
||||
app->view_dispatcher, FlipBipViewRenewConfirm, dialog_ex_get_view(app->renew_dialog));
|
||||
|
||||
// End Scene Additions
|
||||
|
||||
return app;
|
||||
@@ -168,6 +195,9 @@ void flipbip_app_free(FlipBip* app) {
|
||||
view_dispatcher_remove_view(app->view_dispatcher, FlipBipViewIdTextInput);
|
||||
submenu_free(app->submenu);
|
||||
|
||||
view_dispatcher_remove_view(app->view_dispatcher, FlipBipViewRenewConfirm);
|
||||
dialog_ex_free(app->renew_dialog);
|
||||
|
||||
view_dispatcher_free(app->view_dispatcher);
|
||||
furi_record_close(RECORD_GUI);
|
||||
|
||||
|
||||
+18
-1
@@ -9,12 +9,13 @@
|
||||
#include <gui/view_dispatcher.h>
|
||||
#include <gui/modules/submenu.h>
|
||||
#include <gui/scene_manager.h>
|
||||
#include <gui/modules/dialog_ex.h>
|
||||
#include <gui/modules/variable_item_list.h>
|
||||
#include <gui/modules/text_input.h>
|
||||
#include "scenes/flipbip_scene.h"
|
||||
#include "views/flipbip_scene_1.h"
|
||||
|
||||
#define FLIPBIP_VERSION "v1.13"
|
||||
#define FLIPBIP_VERSION "v1.14"
|
||||
|
||||
#define COIN_BTC 0
|
||||
#define COIN_DOGE 3
|
||||
@@ -31,6 +32,7 @@ typedef struct {
|
||||
SceneManager* scene_manager;
|
||||
VariableItemList* variable_item_list;
|
||||
TextInput* text_input;
|
||||
DialogEx* renew_dialog;
|
||||
FlipBipScene1* flipbip_scene_1;
|
||||
char* mnemonic_menu_text;
|
||||
// Settings options
|
||||
@@ -45,6 +47,8 @@ typedef struct {
|
||||
char passphrase_text[TEXT_BUFFER_SIZE];
|
||||
char import_mnemonic_text[TEXT_BUFFER_SIZE];
|
||||
char input_text[TEXT_BUFFER_SIZE];
|
||||
|
||||
void (*wallet_create)(void* context);
|
||||
} FlipBip;
|
||||
|
||||
typedef enum {
|
||||
@@ -53,6 +57,7 @@ typedef enum {
|
||||
FlipBipViewIdScene1,
|
||||
FlipBipViewIdSettings,
|
||||
FlipBipViewIdTextInput,
|
||||
FlipBipViewRenewConfirm,
|
||||
} FlipBipViewId;
|
||||
|
||||
typedef enum {
|
||||
@@ -86,3 +91,15 @@ typedef enum {
|
||||
FlipBipStatusSaveError = 12,
|
||||
FlipBipStatusMnemonicCheckError = 13,
|
||||
} FlipBipStatus;
|
||||
|
||||
typedef enum {
|
||||
SubmenuIndexScene1BTC = 10,
|
||||
SubmenuIndexScene1ETH,
|
||||
SubmenuIndexScene1DOGE,
|
||||
SubmenuIndexScene1ZEC,
|
||||
SubmenuIndexScene1New,
|
||||
SubmenuIndexScene1Renew,
|
||||
SubmenuIndexScene1Import,
|
||||
SubmenuIndexSettings,
|
||||
SubmenuIndexNOP,
|
||||
} SubmenuIndex;
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 6.1 KiB |
+8
-15
@@ -3,18 +3,8 @@
|
||||
|
||||
#define FLIPBIP_SUBMENU_TEXT "** FlipBIP wallet " FLIPBIP_VERSION " **"
|
||||
|
||||
enum SubmenuIndex {
|
||||
SubmenuIndexScene1BTC = 10,
|
||||
SubmenuIndexScene1ETH,
|
||||
SubmenuIndexScene1DOGE,
|
||||
SubmenuIndexScene1ZEC,
|
||||
SubmenuIndexScene1New,
|
||||
SubmenuIndexScene1Import,
|
||||
SubmenuIndexSettings,
|
||||
SubmenuIndexNOP,
|
||||
};
|
||||
|
||||
void flipbip_scene_menu_submenu_callback(void* context, uint32_t index) {
|
||||
furi_assert(context);
|
||||
FlipBip* app = context;
|
||||
view_dispatcher_send_custom_event(app->view_dispatcher, index);
|
||||
}
|
||||
@@ -59,7 +49,7 @@ void flipbip_scene_menu_on_enter(void* context) {
|
||||
submenu_add_item(
|
||||
app->submenu,
|
||||
"Regenerate wallet",
|
||||
SubmenuIndexScene1New,
|
||||
SubmenuIndexScene1Renew,
|
||||
flipbip_scene_menu_submenu_callback,
|
||||
app);
|
||||
} else {
|
||||
@@ -130,9 +120,12 @@ bool flipbip_scene_menu_on_event(void* context, SceneManagerEvent event) {
|
||||
} else if(event.event == SubmenuIndexScene1New) {
|
||||
app->overwrite_saved_seed = 1;
|
||||
app->import_from_mnemonic = 0;
|
||||
scene_manager_set_scene_state(
|
||||
app->scene_manager, FlipBipSceneMenu, SubmenuIndexScene1New);
|
||||
scene_manager_next_scene(app->scene_manager, FlipBipSceneScene_1);
|
||||
app->wallet_create(app);
|
||||
return true;
|
||||
} else if(event.event == SubmenuIndexScene1Renew) {
|
||||
app->overwrite_saved_seed = 1;
|
||||
app->import_from_mnemonic = 0;
|
||||
view_dispatcher_switch_to_view(app->view_dispatcher, FlipBipViewRenewConfirm);
|
||||
return true;
|
||||
} else if(event.event == SubmenuIndexScene1Import) {
|
||||
app->import_from_mnemonic = 1;
|
||||
|
||||
Reference in New Issue
Block a user