mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 05:08:35 -07:00
BLE Spam fix parameter byte endianness
This commit is contained in:
1
applications/external/ble_spam/ble_spam.h
vendored
1
applications/external/ble_spam/ble_spam.h
vendored
@@ -20,6 +20,7 @@ typedef struct Attack Attack;
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
Attack* attack;
|
Attack* attack;
|
||||||
|
uint8_t byte_store[3];
|
||||||
|
|
||||||
ViewDispatcher* view_dispatcher;
|
ViewDispatcher* view_dispatcher;
|
||||||
SceneManager* scene_manager;
|
SceneManager* scene_manager;
|
||||||
|
|||||||
@@ -545,13 +545,11 @@ void scene_continuity_pp_model_id_custom_on_enter(void* _ctx) {
|
|||||||
|
|
||||||
byte_input_set_header_text(byte_input, "Enter custom Model ID");
|
byte_input_set_header_text(byte_input, "Enter custom Model ID");
|
||||||
|
|
||||||
|
ctx->byte_store[0] = (cfg->data.proximity_pair.model_id >> 0x08) & 0xFF;
|
||||||
|
ctx->byte_store[1] = (cfg->data.proximity_pair.model_id >> 0x00) & 0xFF;
|
||||||
|
|
||||||
byte_input_set_result_callback(
|
byte_input_set_result_callback(
|
||||||
byte_input,
|
byte_input, pp_model_id_custom_callback, NULL, ctx, (void*)ctx->byte_store, 2);
|
||||||
pp_model_id_custom_callback,
|
|
||||||
NULL,
|
|
||||||
ctx,
|
|
||||||
(void*)&cfg->data.proximity_pair.model_id,
|
|
||||||
sizeof(cfg->data.proximity_pair.model_id));
|
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
||||||
}
|
}
|
||||||
@@ -561,7 +559,10 @@ bool scene_continuity_pp_model_id_custom_on_event(void* _ctx, SceneManagerEvent
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void scene_continuity_pp_model_id_custom_on_exit(void* _ctx) {
|
void scene_continuity_pp_model_id_custom_on_exit(void* _ctx) {
|
||||||
UNUSED(_ctx);
|
Ctx* ctx = _ctx;
|
||||||
|
ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
||||||
|
cfg->data.proximity_pair.model_id =
|
||||||
|
(ctx->byte_store[0] << 0x08) + (ctx->byte_store[1] << 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void pp_prefix_callback(void* _ctx, uint32_t index) {
|
static void pp_prefix_callback(void* _ctx, uint32_t index) {
|
||||||
@@ -632,13 +633,10 @@ void scene_continuity_pp_prefix_custom_on_enter(void* _ctx) {
|
|||||||
|
|
||||||
byte_input_set_header_text(byte_input, "Enter custom Prefix");
|
byte_input_set_header_text(byte_input, "Enter custom Prefix");
|
||||||
|
|
||||||
|
ctx->byte_store[0] = (cfg->data.proximity_pair.prefix >> 0x00) & 0xFF;
|
||||||
|
|
||||||
byte_input_set_result_callback(
|
byte_input_set_result_callback(
|
||||||
byte_input,
|
byte_input, pp_prefix_custom_callback, NULL, ctx, (void*)ctx->byte_store, 1);
|
||||||
pp_prefix_custom_callback,
|
|
||||||
NULL,
|
|
||||||
ctx,
|
|
||||||
(void*)&cfg->data.proximity_pair.prefix,
|
|
||||||
sizeof(cfg->data.proximity_pair.prefix));
|
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
||||||
}
|
}
|
||||||
@@ -648,7 +646,9 @@ bool scene_continuity_pp_prefix_custom_on_event(void* _ctx, SceneManagerEvent ev
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void scene_continuity_pp_prefix_custom_on_exit(void* _ctx) {
|
void scene_continuity_pp_prefix_custom_on_exit(void* _ctx) {
|
||||||
UNUSED(_ctx);
|
Ctx* ctx = _ctx;
|
||||||
|
ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
||||||
|
cfg->data.proximity_pair.prefix = (ctx->byte_store[0] << 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void na_action_type_callback(void* _ctx, uint32_t index) {
|
static void na_action_type_callback(void* _ctx, uint32_t index) {
|
||||||
@@ -719,13 +719,10 @@ void scene_continuity_na_action_type_custom_on_enter(void* _ctx) {
|
|||||||
|
|
||||||
byte_input_set_header_text(byte_input, "Enter custom Action Type");
|
byte_input_set_header_text(byte_input, "Enter custom Action Type");
|
||||||
|
|
||||||
|
ctx->byte_store[0] = (cfg->data.nearby_action.type >> 0x00) & 0xFF;
|
||||||
|
|
||||||
byte_input_set_result_callback(
|
byte_input_set_result_callback(
|
||||||
byte_input,
|
byte_input, na_action_type_custom_callback, NULL, ctx, (void*)ctx->byte_store, 1);
|
||||||
na_action_type_custom_callback,
|
|
||||||
NULL,
|
|
||||||
ctx,
|
|
||||||
(void*)&cfg->data.nearby_action.type,
|
|
||||||
sizeof(cfg->data.nearby_action.type));
|
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
||||||
}
|
}
|
||||||
@@ -735,7 +732,9 @@ bool scene_continuity_na_action_type_custom_on_event(void* _ctx, SceneManagerEve
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void scene_continuity_na_action_type_custom_on_exit(void* _ctx) {
|
void scene_continuity_na_action_type_custom_on_exit(void* _ctx) {
|
||||||
UNUSED(_ctx);
|
Ctx* ctx = _ctx;
|
||||||
|
ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
||||||
|
cfg->data.nearby_action.type = (ctx->byte_store[0] << 0x00);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void na_flags_callback(void* _ctx) {
|
static void na_flags_callback(void* _ctx) {
|
||||||
@@ -749,24 +748,22 @@ void scene_continuity_na_flags_on_enter(void* _ctx) {
|
|||||||
|
|
||||||
byte_input_set_header_text(byte_input, "Press back for automatic");
|
byte_input_set_header_text(byte_input, "Press back for automatic");
|
||||||
|
|
||||||
|
ctx->byte_store[0] = (cfg->data.nearby_action.flags >> 0x00) & 0xFF;
|
||||||
|
|
||||||
byte_input_set_result_callback(
|
byte_input_set_result_callback(
|
||||||
byte_input,
|
byte_input, na_flags_callback, NULL, ctx, (void*)ctx->byte_store, 1);
|
||||||
na_flags_callback,
|
|
||||||
NULL,
|
|
||||||
ctx,
|
|
||||||
(void*)&cfg->data.nearby_action.flags,
|
|
||||||
sizeof(cfg->data.nearby_action.flags));
|
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
||||||
}
|
}
|
||||||
bool scene_continuity_na_flags_on_event(void* _ctx, SceneManagerEvent event) {
|
bool scene_continuity_na_flags_on_event(void* _ctx, SceneManagerEvent event) {
|
||||||
Ctx* ctx = _ctx;
|
Ctx* ctx = _ctx;
|
||||||
ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
|
||||||
if(event.type == SceneManagerEventTypeBack) {
|
if(event.type == SceneManagerEventTypeBack) {
|
||||||
cfg->data.nearby_action.flags = 0x00;
|
ctx->byte_store[0] = 0x00;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void scene_continuity_na_flags_on_exit(void* _ctx) {
|
void scene_continuity_na_flags_on_exit(void* _ctx) {
|
||||||
UNUSED(_ctx);
|
Ctx* ctx = _ctx;
|
||||||
|
ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
||||||
|
cfg->data.nearby_action.flags = (ctx->byte_store[0] << 0x00);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -209,13 +209,12 @@ void scene_fastpair_model_id_custom_on_enter(void* _ctx) {
|
|||||||
|
|
||||||
byte_input_set_header_text(byte_input, "Enter custom Model ID");
|
byte_input_set_header_text(byte_input, "Enter custom Model ID");
|
||||||
|
|
||||||
|
ctx->byte_store[0] = (cfg->model_id >> 0x10) & 0xFF;
|
||||||
|
ctx->byte_store[1] = (cfg->model_id >> 0x08) & 0xFF;
|
||||||
|
ctx->byte_store[2] = (cfg->model_id >> 0x00) & 0xFF;
|
||||||
|
|
||||||
byte_input_set_result_callback(
|
byte_input_set_result_callback(
|
||||||
byte_input,
|
byte_input, model_id_custom_callback, NULL, ctx, (void*)ctx->byte_store, 3);
|
||||||
model_id_custom_callback,
|
|
||||||
NULL,
|
|
||||||
ctx,
|
|
||||||
((void*)&cfg->model_id) + 1,
|
|
||||||
sizeof(cfg->model_id) - 1);
|
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
||||||
}
|
}
|
||||||
@@ -225,5 +224,8 @@ bool scene_fastpair_model_id_custom_on_event(void* _ctx, SceneManagerEvent event
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void scene_fastpair_model_id_custom_on_exit(void* _ctx) {
|
void scene_fastpair_model_id_custom_on_exit(void* _ctx) {
|
||||||
UNUSED(_ctx);
|
Ctx* ctx = _ctx;
|
||||||
|
FastpairCfg* cfg = &ctx->attack->payload.cfg.fastpair;
|
||||||
|
cfg->model_id =
|
||||||
|
(ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -215,13 +215,12 @@ void scene_smartthings_data_custom_on_enter(void* _ctx) {
|
|||||||
|
|
||||||
byte_input_set_header_text(byte_input, "Enter custom Data");
|
byte_input_set_header_text(byte_input, "Enter custom Data");
|
||||||
|
|
||||||
|
ctx->byte_store[0] = (cfg->data >> 0x10) & 0xFF;
|
||||||
|
ctx->byte_store[1] = (cfg->data >> 0x08) & 0xFF;
|
||||||
|
ctx->byte_store[2] = (cfg->data >> 0x00) & 0xFF;
|
||||||
|
|
||||||
byte_input_set_result_callback(
|
byte_input_set_result_callback(
|
||||||
byte_input,
|
byte_input, data_custom_callback, NULL, ctx, (void*)ctx->byte_store, 3);
|
||||||
data_custom_callback,
|
|
||||||
NULL,
|
|
||||||
ctx,
|
|
||||||
((void*)&cfg->data) + 1,
|
|
||||||
sizeof(cfg->data) - 1);
|
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
|
||||||
}
|
}
|
||||||
@@ -231,5 +230,8 @@ bool scene_smartthings_data_custom_on_event(void* _ctx, SceneManagerEvent event)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
void scene_smartthings_data_custom_on_exit(void* _ctx) {
|
void scene_smartthings_data_custom_on_exit(void* _ctx) {
|
||||||
UNUSED(_ctx);
|
Ctx* ctx = _ctx;
|
||||||
|
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings;
|
||||||
|
cfg->data =
|
||||||
|
(ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user