Samsung stuff is actually called EasySetup

This commit is contained in:
Willy-JL
2023-10-21 05:06:58 +01:00
parent 27a213869a
commit 9e64065f07
8 changed files with 73 additions and 73 deletions

View File

@@ -90,15 +90,15 @@ static Attack attacks[] = {
{ {
.title = "Samsung Buds Popup", .title = "Samsung Buds Popup",
.text = "No cooldown, long range", .text = "No cooldown, long range",
.protocol = &protocol_smartthings, .protocol = &protocol_easysetup,
.payload = .payload =
{ {
.random_mac = true, .random_mac = true,
.cfg = .cfg =
{ {
.smartthings = .easysetup =
{ {
.type = SmartthingsTypeBuds, .type = EasysetupTypeBuds,
.data = {}, .data = {},
}, },
}, },
@@ -107,15 +107,15 @@ static Attack attacks[] = {
{ {
.title = "Samsung Watch Pair", .title = "Samsung Watch Pair",
.text = "No cooldown, long range", .text = "No cooldown, long range",
.protocol = &protocol_smartthings, .protocol = &protocol_easysetup,
.payload = .payload =
{ {
.random_mac = true, .random_mac = true,
.cfg = .cfg =
{ {
.smartthings = .easysetup =
{ {
.type = SmartthingsTypeWatch, .type = EasysetupTypeWatch,
.data = {}, .data = {},
}, },
}, },

View File

@@ -3,7 +3,7 @@
const Protocol* protocols[] = { const Protocol* protocols[] = {
&protocol_continuity, &protocol_continuity,
&protocol_fastpair, &protocol_fastpair,
&protocol_smartthings, &protocol_easysetup,
&protocol_swiftpair, &protocol_swiftpair,
}; };

View File

@@ -2,13 +2,13 @@
#include "continuity.h" #include "continuity.h"
#include "fastpair.h" #include "fastpair.h"
#include "smartthings.h" #include "easysetup.h"
#include "swiftpair.h" #include "swiftpair.h"
union ProtocolCfg { union ProtocolCfg {
ContinuityCfg continuity; ContinuityCfg continuity;
FastpairCfg fastpair; FastpairCfg fastpair;
SmartthingsCfg smartthings; EasysetupCfg easysetup;
SwiftpairCfg swiftpair; SwiftpairCfg swiftpair;
}; };

View File

@@ -1,4 +1,4 @@
#include "continuity_scenes.h" #include "continuity_scenes.h"
#include "fastpair_scenes.h" #include "fastpair_scenes.h"
#include "smartthings_scenes.h" #include "easysetup_scenes.h"
#include "swiftpair_scenes.h" #include "swiftpair_scenes.h"

View File

@@ -1,4 +1,4 @@
#include "smartthings.h" #include "easysetup.h"
#include "_protocols.h" #include "_protocols.h"
// Hacked together by @Willy-JL and @Spooks4576 // Hacked together by @Willy-JL and @Spooks4576
@@ -64,27 +64,27 @@ const struct {
}; };
const uint8_t watch_models_count = COUNT_OF(watch_models); const uint8_t watch_models_count = COUNT_OF(watch_models);
static const char* type_names[SmartthingsTypeCOUNT] = { static const char* type_names[EasysetupTypeCOUNT] = {
[SmartthingsTypeBuds] = "SmartThings Buds", [EasysetupTypeBuds] = "EasySetup Buds",
[SmartthingsTypeWatch] = "SmartThings Watch", [EasysetupTypeWatch] = "EasySetup Watch",
}; };
static const char* smartthings_get_name(const ProtocolCfg* _cfg) { static const char* easysetup_get_name(const ProtocolCfg* _cfg) {
const SmartthingsCfg* cfg = &_cfg->smartthings; const EasysetupCfg* cfg = &_cfg->easysetup;
return type_names[cfg->type]; return type_names[cfg->type];
} }
static uint8_t packet_sizes[SmartthingsTypeCOUNT] = { static uint8_t packet_sizes[EasysetupTypeCOUNT] = {
[SmartthingsTypeBuds] = 31, [EasysetupTypeBuds] = 31,
[SmartthingsTypeWatch] = 15, [EasysetupTypeWatch] = 15,
}; };
void smartthings_make_packet(uint8_t* out_size, uint8_t** out_packet, const ProtocolCfg* _cfg) { void easysetup_make_packet(uint8_t* out_size, uint8_t** out_packet, const ProtocolCfg* _cfg) {
const SmartthingsCfg* cfg = _cfg ? &_cfg->smartthings : NULL; const EasysetupCfg* cfg = _cfg ? &_cfg->easysetup : NULL;
SmartthingsType type; EasysetupType type;
if(cfg) { if(cfg) {
type = cfg->type; type = cfg->type;
} else { } else {
type = rand() % SmartthingsTypeCOUNT; type = rand() % EasysetupTypeCOUNT;
} }
uint8_t size = packet_sizes[type]; uint8_t size = packet_sizes[type];
@@ -92,7 +92,7 @@ void smartthings_make_packet(uint8_t* out_size, uint8_t** out_packet, const Prot
uint8_t i = 0; uint8_t i = 0;
switch(type) { switch(type) {
case SmartthingsTypeBuds: { case EasysetupTypeBuds: {
uint32_t model; uint32_t model;
if(cfg && cfg->data.buds.model != 0x000000) { if(cfg && cfg->data.buds.model != 0x000000) {
model = cfg->data.buds.model; model = cfg->data.buds.model;
@@ -135,7 +135,7 @@ void smartthings_make_packet(uint8_t* out_size, uint8_t** out_packet, const Prot
// Truncated AD segment, Android seems to fill in the rest with zeros // Truncated AD segment, Android seems to fill in the rest with zeros
break; break;
} }
case SmartthingsTypeWatch: { case EasysetupTypeWatch: {
uint8_t model; uint8_t model;
if(cfg && cfg->data.watch.model != 0x00) { if(cfg && cfg->data.watch.model != 0x00) {
model = cfg->data.watch.model; model = cfg->data.watch.model;
@@ -178,23 +178,23 @@ enum {
}; };
static void config_callback(void* _ctx, uint32_t index) { static void config_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
scene_manager_set_scene_state(ctx->scene_manager, SceneConfig, index); scene_manager_set_scene_state(ctx->scene_manager, SceneConfig, index);
switch(cfg->type) { switch(cfg->type) {
case SmartthingsTypeBuds: { case EasysetupTypeBuds: {
switch(index) { switch(index) {
case ConfigBudsModel: case ConfigBudsModel:
scene_manager_next_scene(ctx->scene_manager, SceneSmartthingsBudsModel); scene_manager_next_scene(ctx->scene_manager, SceneEasysetupBudsModel);
break; break;
default: default:
break; break;
} }
break; break;
} }
case SmartthingsTypeWatch: { case EasysetupTypeWatch: {
switch(index) { switch(index) {
case ConfigWatchModel: case ConfigWatchModel:
scene_manager_next_scene(ctx->scene_manager, SceneSmartthingsWatchModel); scene_manager_next_scene(ctx->scene_manager, SceneEasysetupWatchModel);
break; break;
default: default:
break; break;
@@ -206,7 +206,7 @@ static void config_callback(void* _ctx, uint32_t index) {
} }
} }
static void buds_model_changed(VariableItem* item) { static void buds_model_changed(VariableItem* item) {
SmartthingsCfg* cfg = variable_item_get_context(item); EasysetupCfg* cfg = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item); uint8_t index = variable_item_get_current_value_index(item);
if(index) { if(index) {
index--; index--;
@@ -218,7 +218,7 @@ static void buds_model_changed(VariableItem* item) {
} }
} }
static void watch_model_changed(VariableItem* item) { static void watch_model_changed(VariableItem* item) {
SmartthingsCfg* cfg = variable_item_get_context(item); EasysetupCfg* cfg = variable_item_get_context(item);
uint8_t index = variable_item_get_current_value_index(item); uint8_t index = variable_item_get_current_value_index(item);
if(index) { if(index) {
index--; index--;
@@ -229,14 +229,14 @@ static void watch_model_changed(VariableItem* item) {
variable_item_set_current_value_text(item, "Random"); variable_item_set_current_value_text(item, "Random");
} }
} }
static void smartthings_extra_config(Ctx* ctx) { static void easysetup_extra_config(Ctx* ctx) {
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
VariableItemList* list = ctx->variable_item_list; VariableItemList* list = ctx->variable_item_list;
VariableItem* item; VariableItem* item;
size_t value_index; size_t value_index;
switch(cfg->type) { switch(cfg->type) {
case SmartthingsTypeBuds: { case EasysetupTypeBuds: {
item = variable_item_list_add( item = variable_item_list_add(
list, "Model Code", buds_models_count + 1, buds_model_changed, cfg); list, "Model Code", buds_models_count + 1, buds_model_changed, cfg);
const char* model_name = NULL; const char* model_name = NULL;
@@ -262,7 +262,7 @@ static void smartthings_extra_config(Ctx* ctx) {
variable_item_set_current_value_text(item, model_name); variable_item_set_current_value_text(item, model_name);
break; break;
} }
case SmartthingsTypeWatch: { case EasysetupTypeWatch: {
item = variable_item_list_add( item = variable_item_list_add(
list, "Model Code", watch_models_count + 1, watch_model_changed, cfg); list, "Model Code", watch_models_count + 1, watch_model_changed, cfg);
const char* model_name = NULL; const char* model_name = NULL;
@@ -295,23 +295,23 @@ static void smartthings_extra_config(Ctx* ctx) {
variable_item_list_set_enter_callback(list, config_callback, ctx); variable_item_list_set_enter_callback(list, config_callback, ctx);
} }
const Protocol protocol_smartthings = { const Protocol protocol_easysetup = {
.icon = &I_android, .icon = &I_android,
.get_name = smartthings_get_name, .get_name = easysetup_get_name,
.make_packet = smartthings_make_packet, .make_packet = easysetup_make_packet,
.extra_config = smartthings_extra_config, .extra_config = easysetup_extra_config,
}; };
static void buds_model_callback(void* _ctx, uint32_t index) { static void buds_model_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
switch(index) { switch(index) {
case 0: case 0:
cfg->data.buds.model = 0x000000; cfg->data.buds.model = 0x000000;
scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager);
break; break;
case buds_models_count + 1: case buds_models_count + 1:
scene_manager_next_scene(ctx->scene_manager, SceneSmartthingsBudsModelCustom); scene_manager_next_scene(ctx->scene_manager, SceneEasysetupBudsModelCustom);
break; break;
default: default:
cfg->data.buds.model = buds_models[index - 1].value; cfg->data.buds.model = buds_models[index - 1].value;
@@ -319,9 +319,9 @@ static void buds_model_callback(void* _ctx, uint32_t index) {
break; break;
} }
} }
void scene_smartthings_buds_model_on_enter(void* _ctx) { void scene_easysetup_buds_model_on_enter(void* _ctx) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
Submenu* submenu = ctx->submenu; Submenu* submenu = ctx->submenu;
uint32_t selected = 0; uint32_t selected = 0;
bool found = false; bool found = false;
@@ -349,12 +349,12 @@ void scene_smartthings_buds_model_on_enter(void* _ctx) {
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu); view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
} }
bool scene_smartthings_buds_model_on_event(void* _ctx, SceneManagerEvent event) { bool scene_easysetup_buds_model_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx); UNUSED(_ctx);
UNUSED(event); UNUSED(event);
return false; return false;
} }
void scene_smartthings_buds_model_on_exit(void* _ctx) { void scene_easysetup_buds_model_on_exit(void* _ctx) {
UNUSED(_ctx); UNUSED(_ctx);
} }
@@ -363,9 +363,9 @@ static void buds_model_custom_callback(void* _ctx) {
scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager);
scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager);
} }
void scene_smartthings_buds_model_custom_on_enter(void* _ctx) { void scene_easysetup_buds_model_custom_on_enter(void* _ctx) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
ByteInput* byte_input = ctx->byte_input; ByteInput* byte_input = ctx->byte_input;
byte_input_set_header_text(byte_input, "Enter custom Model Code"); byte_input_set_header_text(byte_input, "Enter custom Model Code");
@@ -379,28 +379,28 @@ void scene_smartthings_buds_model_custom_on_enter(void* _ctx) {
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput); view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
} }
bool scene_smartthings_buds_model_custom_on_event(void* _ctx, SceneManagerEvent event) { bool scene_easysetup_buds_model_custom_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx); UNUSED(_ctx);
UNUSED(event); UNUSED(event);
return false; return false;
} }
void scene_smartthings_buds_model_custom_on_exit(void* _ctx) { void scene_easysetup_buds_model_custom_on_exit(void* _ctx) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
cfg->data.buds.model = cfg->data.buds.model =
(ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00); (ctx->byte_store[0] << 0x10) + (ctx->byte_store[1] << 0x08) + (ctx->byte_store[2] << 0x00);
} }
static void watch_model_callback(void* _ctx, uint32_t index) { static void watch_model_callback(void* _ctx, uint32_t index) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
switch(index) { switch(index) {
case 0: case 0:
cfg->data.watch.model = 0x00; cfg->data.watch.model = 0x00;
scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager);
break; break;
case watch_models_count + 1: case watch_models_count + 1:
scene_manager_next_scene(ctx->scene_manager, SceneSmartthingsWatchModelCustom); scene_manager_next_scene(ctx->scene_manager, SceneEasysetupWatchModelCustom);
break; break;
default: default:
cfg->data.watch.model = watch_models[index - 1].value; cfg->data.watch.model = watch_models[index - 1].value;
@@ -408,9 +408,9 @@ static void watch_model_callback(void* _ctx, uint32_t index) {
break; break;
} }
} }
void scene_smartthings_watch_model_on_enter(void* _ctx) { void scene_easysetup_watch_model_on_enter(void* _ctx) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
Submenu* submenu = ctx->submenu; Submenu* submenu = ctx->submenu;
uint32_t selected = 0; uint32_t selected = 0;
bool found = false; bool found = false;
@@ -438,12 +438,12 @@ void scene_smartthings_watch_model_on_enter(void* _ctx) {
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu); view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewSubmenu);
} }
bool scene_smartthings_watch_model_on_event(void* _ctx, SceneManagerEvent event) { bool scene_easysetup_watch_model_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx); UNUSED(_ctx);
UNUSED(event); UNUSED(event);
return false; return false;
} }
void scene_smartthings_watch_model_on_exit(void* _ctx) { void scene_easysetup_watch_model_on_exit(void* _ctx) {
UNUSED(_ctx); UNUSED(_ctx);
} }
@@ -452,9 +452,9 @@ static void watch_model_custom_callback(void* _ctx) {
scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager);
scene_manager_previous_scene(ctx->scene_manager); scene_manager_previous_scene(ctx->scene_manager);
} }
void scene_smartthings_watch_model_custom_on_enter(void* _ctx) { void scene_easysetup_watch_model_custom_on_enter(void* _ctx) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
ByteInput* byte_input = ctx->byte_input; ByteInput* byte_input = ctx->byte_input;
byte_input_set_header_text(byte_input, "Enter custom Model Code"); byte_input_set_header_text(byte_input, "Enter custom Model Code");
@@ -466,13 +466,13 @@ void scene_smartthings_watch_model_custom_on_enter(void* _ctx) {
view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput); view_dispatcher_switch_to_view(ctx->view_dispatcher, ViewByteInput);
} }
bool scene_smartthings_watch_model_custom_on_event(void* _ctx, SceneManagerEvent event) { bool scene_easysetup_watch_model_custom_on_event(void* _ctx, SceneManagerEvent event) {
UNUSED(_ctx); UNUSED(_ctx);
UNUSED(event); UNUSED(event);
return false; return false;
} }
void scene_smartthings_watch_model_custom_on_exit(void* _ctx) { void scene_easysetup_watch_model_custom_on_exit(void* _ctx) {
Ctx* ctx = _ctx; Ctx* ctx = _ctx;
SmartthingsCfg* cfg = &ctx->attack->payload.cfg.smartthings; EasysetupCfg* cfg = &ctx->attack->payload.cfg.easysetup;
cfg->data.watch.model = (ctx->byte_store[0] << 0x00); cfg->data.watch.model = (ctx->byte_store[0] << 0x00);
} }

View File

@@ -5,13 +5,13 @@
// Research by @Spooks4576 // Research by @Spooks4576
typedef enum { typedef enum {
SmartthingsTypeBuds, EasysetupTypeBuds,
SmartthingsTypeWatch, EasysetupTypeWatch,
SmartthingsTypeCOUNT, EasysetupTypeCOUNT,
} SmartthingsType; } EasysetupType;
typedef struct { typedef struct {
SmartthingsType type; EasysetupType type;
union { union {
struct { struct {
uint32_t model; uint32_t model;
@@ -20,6 +20,6 @@ typedef struct {
uint8_t model; uint8_t model;
} watch; } watch;
} data; } data;
} SmartthingsCfg; } EasysetupCfg;
extern const Protocol protocol_smartthings; extern const Protocol protocol_easysetup;

View File

@@ -0,0 +1,4 @@
ADD_SCENE(easysetup_buds_model, EasysetupBudsModel)
ADD_SCENE(easysetup_buds_model_custom, EasysetupBudsModelCustom)
ADD_SCENE(easysetup_watch_model, EasysetupWatchModel)
ADD_SCENE(easysetup_watch_model_custom, EasysetupWatchModelCustom)

View File

@@ -1,4 +0,0 @@
ADD_SCENE(smartthings_buds_model, SmartthingsBudsModel)
ADD_SCENE(smartthings_buds_model_custom, SmartthingsBudsModelCustom)
ADD_SCENE(smartthings_watch_model, SmartthingsWatchModel)
ADD_SCENE(smartthings_watch_model_custom, SmartthingsWatchModelCustom)