mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-11 06:09:08 -07:00
BLE Spam move extra config after
This commit is contained in:
5
applications/external/ble_spam/ble_spam.h
vendored
5
applications/external/ble_spam/ble_spam.h
vendored
@@ -16,6 +16,11 @@ enum {
|
|||||||
ViewVariableItemList,
|
ViewVariableItemList,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum {
|
||||||
|
ConfigRandomMac,
|
||||||
|
ConfigExtraStart = ConfigRandomMac,
|
||||||
|
};
|
||||||
|
|
||||||
typedef struct Attack Attack;
|
typedef struct Attack Attack;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
|
|||||||
@@ -16,5 +16,5 @@ typedef struct {
|
|||||||
const Icon* icon;
|
const Icon* icon;
|
||||||
const char* (*get_name)(const ProtocolCfg* _cfg);
|
const char* (*get_name)(const ProtocolCfg* _cfg);
|
||||||
void (*make_packet)(uint8_t* _size, uint8_t** _packet, const ProtocolCfg* _cfg);
|
void (*make_packet)(uint8_t* _size, uint8_t** _packet, const ProtocolCfg* _cfg);
|
||||||
uint8_t (*config_list)(Ctx* ctx);
|
void (*extra_config)(Ctx* ctx);
|
||||||
} Protocol;
|
} Protocol;
|
||||||
|
|||||||
@@ -274,10 +274,12 @@ static void continuity_make_packet(uint8_t* _size, uint8_t** _packet, const Prot
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
_ConfigPpExtraStart = ConfigExtraStart,
|
||||||
ConfigPpModelId,
|
ConfigPpModelId,
|
||||||
ConfigPpPrefix,
|
ConfigPpPrefix,
|
||||||
};
|
};
|
||||||
enum {
|
enum {
|
||||||
|
_ConfigNaExtraStart = ConfigExtraStart,
|
||||||
ConfigNaActionType,
|
ConfigNaActionType,
|
||||||
ConfigNaFlags,
|
ConfigNaFlags,
|
||||||
};
|
};
|
||||||
@@ -352,16 +354,14 @@ static void na_action_type_changed(VariableItem* item) {
|
|||||||
variable_item_set_current_value_text(item, "Random");
|
variable_item_set_current_value_text(item, "Random");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static uint8_t continuity_config_list(Ctx* ctx) {
|
static void continuity_extra_config(Ctx* ctx) {
|
||||||
ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
ContinuityCfg* cfg = &ctx->attack->payload.cfg.continuity;
|
||||||
VariableItemList* list = ctx->variable_item_list;
|
VariableItemList* list = ctx->variable_item_list;
|
||||||
uint8_t item_count = 0;
|
|
||||||
VariableItem* item;
|
VariableItem* item;
|
||||||
size_t value_index;
|
size_t value_index;
|
||||||
|
|
||||||
switch(cfg->type) {
|
switch(cfg->type) {
|
||||||
case ContinuityTypeProximityPair: {
|
case ContinuityTypeProximityPair: {
|
||||||
item_count++;
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
list, "Model ID", pp_models_count + 1, pp_model_id_changed, cfg);
|
list, "Model ID", pp_models_count + 1, pp_model_id_changed, cfg);
|
||||||
const char* model_name = NULL;
|
const char* model_name = NULL;
|
||||||
@@ -390,7 +390,6 @@ static uint8_t continuity_config_list(Ctx* ctx) {
|
|||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, model_name);
|
variable_item_set_current_value_text(item, model_name);
|
||||||
|
|
||||||
item_count++;
|
|
||||||
item =
|
item =
|
||||||
variable_item_list_add(list, "Prefix", pp_prefixes_count + 1, pp_prefix_changed, cfg);
|
variable_item_list_add(list, "Prefix", pp_prefixes_count + 1, pp_prefix_changed, cfg);
|
||||||
const char* prefix_name = NULL;
|
const char* prefix_name = NULL;
|
||||||
@@ -421,7 +420,6 @@ static uint8_t continuity_config_list(Ctx* ctx) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case ContinuityTypeNearbyAction: {
|
case ContinuityTypeNearbyAction: {
|
||||||
item_count++;
|
|
||||||
item = variable_item_list_add(
|
item = variable_item_list_add(
|
||||||
list, "Action Type", na_actions_count + 1, na_action_type_changed, cfg);
|
list, "Action Type", na_actions_count + 1, na_action_type_changed, cfg);
|
||||||
const char* action_name = NULL;
|
const char* action_name = NULL;
|
||||||
@@ -447,7 +445,6 @@ static uint8_t continuity_config_list(Ctx* ctx) {
|
|||||||
variable_item_set_current_value_index(item, value_index);
|
variable_item_set_current_value_index(item, value_index);
|
||||||
variable_item_set_current_value_text(item, action_name);
|
variable_item_set_current_value_text(item, action_name);
|
||||||
|
|
||||||
item_count++;
|
|
||||||
item = variable_item_list_add(list, "Flags", 0, NULL, NULL);
|
item = variable_item_list_add(list, "Flags", 0, NULL, NULL);
|
||||||
const char* flags_name = NULL;
|
const char* flags_name = NULL;
|
||||||
char flags_name_buf[3];
|
char flags_name_buf[3];
|
||||||
@@ -466,15 +463,13 @@ static uint8_t continuity_config_list(Ctx* ctx) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||||
|
|
||||||
return item_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Protocol protocol_continuity = {
|
const Protocol protocol_continuity = {
|
||||||
.icon = &I_apple,
|
.icon = &I_apple,
|
||||||
.get_name = continuity_get_name,
|
.get_name = continuity_get_name,
|
||||||
.make_packet = continuity_make_packet,
|
.make_packet = continuity_make_packet,
|
||||||
.config_list = continuity_config_list,
|
.extra_config = continuity_extra_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void pp_model_id_callback(void* _ctx, uint32_t index) {
|
static void pp_model_id_callback(void* _ctx, uint32_t index) {
|
||||||
|
|||||||
@@ -74,6 +74,7 @@ static void fastpair_make_packet(uint8_t* _size, uint8_t** _packet, const Protoc
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
_ConfigExtraStart = ConfigExtraStart,
|
||||||
ConfigModelId,
|
ConfigModelId,
|
||||||
};
|
};
|
||||||
static void config_callback(void* _ctx, uint32_t index) {
|
static void config_callback(void* _ctx, uint32_t index) {
|
||||||
@@ -98,14 +99,12 @@ static void model_id_changed(VariableItem* item) {
|
|||||||
variable_item_set_current_value_text(item, "Random");
|
variable_item_set_current_value_text(item, "Random");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static uint8_t fastpair_config_list(Ctx* ctx) {
|
static void fastpair_extra_config(Ctx* ctx) {
|
||||||
FastpairCfg* cfg = &ctx->attack->payload.cfg.fastpair;
|
FastpairCfg* cfg = &ctx->attack->payload.cfg.fastpair;
|
||||||
VariableItemList* list = ctx->variable_item_list;
|
VariableItemList* list = ctx->variable_item_list;
|
||||||
uint8_t item_count = 0;
|
|
||||||
VariableItem* item;
|
VariableItem* item;
|
||||||
size_t value_index;
|
size_t value_index;
|
||||||
|
|
||||||
item_count++;
|
|
||||||
item = variable_item_list_add(list, "Model ID", models_count + 1, model_id_changed, cfg);
|
item = variable_item_list_add(list, "Model ID", models_count + 1, model_id_changed, cfg);
|
||||||
const char* model_name = NULL;
|
const char* model_name = NULL;
|
||||||
char model_name_buf[9];
|
char model_name_buf[9];
|
||||||
@@ -130,15 +129,13 @@ static uint8_t fastpair_config_list(Ctx* ctx) {
|
|||||||
variable_item_set_current_value_text(item, model_name);
|
variable_item_set_current_value_text(item, model_name);
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||||
|
|
||||||
return item_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Protocol protocol_fastpair = {
|
const Protocol protocol_fastpair = {
|
||||||
.icon = &I_android,
|
.icon = &I_android,
|
||||||
.get_name = fastpair_get_name,
|
.get_name = fastpair_get_name,
|
||||||
.make_packet = fastpair_make_packet,
|
.make_packet = fastpair_make_packet,
|
||||||
.config_list = fastpair_config_list,
|
.extra_config = fastpair_extra_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void model_id_callback(void* _ctx, uint32_t index) {
|
static void model_id_callback(void* _ctx, uint32_t index) {
|
||||||
|
|||||||
@@ -80,6 +80,7 @@ void smartthings_make_packet(uint8_t* out_size, uint8_t** out_packet, const Prot
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
_ConfigExtraStart = ConfigExtraStart,
|
||||||
ConfigData,
|
ConfigData,
|
||||||
};
|
};
|
||||||
static void config_callback(void* _ctx, uint32_t index) {
|
static void config_callback(void* _ctx, uint32_t index) {
|
||||||
@@ -104,14 +105,12 @@ static void data_changed(VariableItem* item) {
|
|||||||
variable_item_set_current_value_text(item, "Random");
|
variable_item_set_current_value_text(item, "Random");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static uint8_t smartthings_config_list(Ctx* ctx) {
|
static void smartthings_extra_config(Ctx* ctx) {
|
||||||
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings;
|
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings;
|
||||||
VariableItemList* list = ctx->variable_item_list;
|
VariableItemList* list = ctx->variable_item_list;
|
||||||
uint8_t item_count = 0;
|
|
||||||
VariableItem* item;
|
VariableItem* item;
|
||||||
size_t value_index;
|
size_t value_index;
|
||||||
|
|
||||||
item_count++;
|
|
||||||
item = variable_item_list_add(list, "Data", datas_count + 1, data_changed, cfg);
|
item = variable_item_list_add(list, "Data", datas_count + 1, data_changed, cfg);
|
||||||
const char* data_name = NULL;
|
const char* data_name = NULL;
|
||||||
char data_name_buf[9];
|
char data_name_buf[9];
|
||||||
@@ -136,15 +135,13 @@ static uint8_t smartthings_config_list(Ctx* ctx) {
|
|||||||
variable_item_set_current_value_text(item, data_name);
|
variable_item_set_current_value_text(item, data_name);
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||||
|
|
||||||
return item_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Protocol protocol_smartthings = {
|
const Protocol protocol_smartthings = {
|
||||||
.icon = &I_android,
|
.icon = &I_android,
|
||||||
.get_name = smartthings_get_name,
|
.get_name = smartthings_get_name,
|
||||||
.make_packet = smartthings_make_packet,
|
.make_packet = smartthings_make_packet,
|
||||||
.config_list = smartthings_config_list,
|
.extra_config = smartthings_extra_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void data_callback(void* _ctx, uint32_t index) {
|
static void data_callback(void* _ctx, uint32_t index) {
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ static void swiftpair_make_packet(uint8_t* _size, uint8_t** _packet, const Proto
|
|||||||
}
|
}
|
||||||
|
|
||||||
enum {
|
enum {
|
||||||
|
_ConfigExtraStart = ConfigExtraStart,
|
||||||
ConfigDisplayName,
|
ConfigDisplayName,
|
||||||
};
|
};
|
||||||
static void config_callback(void* _ctx, uint32_t index) {
|
static void config_callback(void* _ctx, uint32_t index) {
|
||||||
@@ -60,27 +61,23 @@ static void config_callback(void* _ctx, uint32_t index) {
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
static uint8_t swiftpair_config_list(Ctx* ctx) {
|
static void swiftpair_extra_config(Ctx* ctx) {
|
||||||
SwiftpairCfg* cfg = &ctx->attack->payload.cfg.swiftpair;
|
SwiftpairCfg* cfg = &ctx->attack->payload.cfg.swiftpair;
|
||||||
VariableItemList* list = ctx->variable_item_list;
|
VariableItemList* list = ctx->variable_item_list;
|
||||||
uint8_t item_count = 0;
|
|
||||||
VariableItem* item;
|
VariableItem* item;
|
||||||
|
|
||||||
item_count++;
|
|
||||||
item = variable_item_list_add(list, "Display Name", 0, NULL, NULL);
|
item = variable_item_list_add(list, "Display Name", 0, NULL, NULL);
|
||||||
variable_item_set_current_value_text(
|
variable_item_set_current_value_text(
|
||||||
item, cfg->display_name[0] != '\0' ? cfg->display_name : "Random");
|
item, cfg->display_name[0] != '\0' ? cfg->display_name : "Random");
|
||||||
|
|
||||||
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
variable_item_list_set_enter_callback(list, config_callback, ctx);
|
||||||
|
|
||||||
return item_count;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const Protocol protocol_swiftpair = {
|
const Protocol protocol_swiftpair = {
|
||||||
.icon = &I_windows,
|
.icon = &I_windows,
|
||||||
.get_name = swiftpair_get_name,
|
.get_name = swiftpair_get_name,
|
||||||
.make_packet = swiftpair_make_packet,
|
.make_packet = swiftpair_make_packet,
|
||||||
.config_list = swiftpair_config_list,
|
.extra_config = swiftpair_extra_config,
|
||||||
};
|
};
|
||||||
|
|
||||||
static void display_name_callback(void* _ctx) {
|
static void display_name_callback(void* _ctx) {
|
||||||
|
|||||||
@@ -15,16 +15,15 @@ void scene_config_on_enter(void* _ctx) {
|
|||||||
variable_item_list_reset(list);
|
variable_item_list_reset(list);
|
||||||
|
|
||||||
variable_item_list_set_header(list, ctx->attack->title);
|
variable_item_list_set_header(list, ctx->attack->title);
|
||||||
uint8_t item_count = 0;
|
|
||||||
if(ctx->attack->protocol && ctx->attack->protocol->config_list) {
|
|
||||||
item_count = ctx->attack->protocol->config_list(ctx);
|
|
||||||
}
|
|
||||||
UNUSED(item_count);
|
|
||||||
|
|
||||||
item = variable_item_list_add(list, "Random MAC", 2, random_mac_changed, ctx);
|
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_index(item, ctx->attack->payload.random_mac);
|
||||||
variable_item_set_current_value_text(item, ctx->attack->payload.random_mac ? "ON" : "OFF");
|
variable_item_set_current_value_text(item, ctx->attack->payload.random_mac ? "ON" : "OFF");
|
||||||
|
|
||||||
|
if(ctx->attack->protocol && ctx->attack->protocol->extra_config) {
|
||||||
|
ctx->attack->protocol->extra_config(ctx);
|
||||||
|
}
|
||||||
|
|
||||||
variable_item_list_set_selected_item(
|
variable_item_list_set_selected_item(
|
||||||
list, scene_manager_get_scene_state(ctx->scene_manager, SceneConfig));
|
list, scene_manager_get_scene_state(ctx->scene_manager, SceneConfig));
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user