mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-13 09:08:35 -07:00
brute upd
This commit is contained in:
@@ -123,7 +123,8 @@ bool subbrute_worker_init_file_attack(
|
|||||||
uint64_t step,
|
uint64_t step,
|
||||||
uint8_t load_index,
|
uint8_t load_index,
|
||||||
const char* file_key,
|
const char* file_key,
|
||||||
SubBruteProtocol* protocol) {
|
SubBruteProtocol* protocol,
|
||||||
|
uint8_t extra_repeats) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
|
|
||||||
if(instance->worker_running) {
|
if(instance->worker_running) {
|
||||||
@@ -139,7 +140,7 @@ bool subbrute_worker_init_file_attack(
|
|||||||
instance->bits = protocol->bits;
|
instance->bits = protocol->bits;
|
||||||
instance->te = protocol->te;
|
instance->te = protocol->te;
|
||||||
instance->load_index = load_index;
|
instance->load_index = load_index;
|
||||||
instance->repeat = protocol->repeat;
|
instance->repeat = protocol->repeat + extra_repeats;
|
||||||
instance->file_key = file_key;
|
instance->file_key = file_key;
|
||||||
instance->max_value = subbrute_protocol_calc_max_value(instance->attack, instance->bits);
|
instance->max_value = subbrute_protocol_calc_max_value(instance->attack, instance->bits);
|
||||||
|
|
||||||
|
|||||||
@@ -29,7 +29,8 @@ bool subbrute_worker_init_file_attack(
|
|||||||
uint64_t step,
|
uint64_t step,
|
||||||
uint8_t load_index,
|
uint8_t load_index,
|
||||||
const char* file_key,
|
const char* file_key,
|
||||||
SubBruteProtocol* protocol);
|
SubBruteProtocol* protocol,
|
||||||
|
uint8_t extra_repeats);
|
||||||
bool subbrute_worker_start(SubBruteWorker* instance);
|
bool subbrute_worker_start(SubBruteWorker* instance);
|
||||||
void subbrute_worker_stop(SubBruteWorker* instance);
|
void subbrute_worker_stop(SubBruteWorker* instance);
|
||||||
bool subbrute_worker_transmit_current_key(SubBruteWorker* instance, uint64_t step);
|
bool subbrute_worker_transmit_current_key(SubBruteWorker* instance, uint64_t step);
|
||||||
|
|||||||
@@ -37,14 +37,18 @@ void subbrute_scene_load_file_on_enter(void* context) {
|
|||||||
load_result =
|
load_result =
|
||||||
subbrute_device_load_from_file(instance->device, furi_string_get_cstr(load_path));
|
subbrute_device_load_from_file(instance->device, furi_string_get_cstr(load_path));
|
||||||
if(load_result == SubBruteFileResultOk) {
|
if(load_result == SubBruteFileResultOk) {
|
||||||
load_result = subbrute_device_attack_set(instance->device, SubBruteAttackLoadFile, 0);
|
uint8_t extra_repeats = subbrute_main_view_get_extra_repeats(instance->view_main);
|
||||||
|
|
||||||
|
load_result = subbrute_device_attack_set(
|
||||||
|
instance->device, SubBruteAttackLoadFile, extra_repeats);
|
||||||
if(load_result == SubBruteFileResultOk) {
|
if(load_result == SubBruteFileResultOk) {
|
||||||
if(!subbrute_worker_init_file_attack(
|
if(!subbrute_worker_init_file_attack(
|
||||||
instance->worker,
|
instance->worker,
|
||||||
instance->device->key_index,
|
instance->device->key_index,
|
||||||
instance->device->load_index,
|
instance->device->load_index,
|
||||||
instance->device->file_key,
|
instance->device->file_key,
|
||||||
instance->device->file_protocol_info)) {
|
instance->device->file_protocol_info,
|
||||||
|
extra_repeats)) {
|
||||||
furi_crash("Invalid attack set!");
|
furi_crash("Invalid attack set!");
|
||||||
}
|
}
|
||||||
// Ready to run!
|
// Ready to run!
|
||||||
|
|||||||
@@ -39,12 +39,15 @@ bool subbrute_scene_load_select_on_event(void* context, SceneManagerEvent event)
|
|||||||
if(event.type == SceneManagerEventTypeCustom) {
|
if(event.type == SceneManagerEventTypeCustom) {
|
||||||
if(event.event == SubBruteCustomEventTypeIndexSelected) {
|
if(event.event == SubBruteCustomEventTypeIndexSelected) {
|
||||||
instance->device->load_index = subbrute_main_view_get_index(instance->view_main);
|
instance->device->load_index = subbrute_main_view_get_index(instance->view_main);
|
||||||
|
uint8_t extra_repeats = subbrute_main_view_get_extra_repeats(instance->view_main);
|
||||||
|
|
||||||
if(!subbrute_worker_init_file_attack(
|
if(!subbrute_worker_init_file_attack(
|
||||||
instance->worker,
|
instance->worker,
|
||||||
instance->device->key_index,
|
instance->device->key_index,
|
||||||
instance->device->load_index,
|
instance->device->load_index,
|
||||||
instance->device->file_key,
|
instance->device->file_key,
|
||||||
instance->device->file_protocol_info)) {
|
instance->device->file_protocol_info,
|
||||||
|
extra_repeats)) {
|
||||||
furi_crash("Invalid attack set!");
|
furi_crash("Invalid attack set!");
|
||||||
}
|
}
|
||||||
scene_manager_next_scene(instance->scene_manager, SubBruteSceneSetupAttack);
|
scene_manager_next_scene(instance->scene_manager, SubBruteSceneSetupAttack);
|
||||||
|
|||||||
@@ -52,21 +52,23 @@ bool subbrute_scene_start_on_event(void* context, SceneManagerEvent event) {
|
|||||||
SubBruteAttacks attack = subbrute_main_view_get_index(instance->view_main);
|
SubBruteAttacks attack = subbrute_main_view_get_index(instance->view_main);
|
||||||
uint8_t extra_repeats = subbrute_main_view_get_extra_repeats(instance->view_main);
|
uint8_t extra_repeats = subbrute_main_view_get_extra_repeats(instance->view_main);
|
||||||
|
|
||||||
if(subbrute_device_attack_set(instance->device, attack, extra_repeats) !=
|
if((subbrute_device_attack_set(instance->device, attack, extra_repeats) !=
|
||||||
SubBruteFileResultOk ||
|
SubBruteFileResultOk) ||
|
||||||
!subbrute_worker_init_default_attack(
|
(!subbrute_worker_init_default_attack(
|
||||||
instance->worker,
|
instance->worker,
|
||||||
attack,
|
attack,
|
||||||
instance->device->key_index,
|
instance->device->key_index,
|
||||||
instance->device->protocol_info,
|
instance->device->protocol_info,
|
||||||
instance->device->extra_repeats)) {
|
instance->device->extra_repeats))) {
|
||||||
furi_crash("Invalid attack set!");
|
furi_crash("Invalid attack set!");
|
||||||
}
|
}
|
||||||
scene_manager_next_scene(instance->scene_manager, SubBruteSceneSetupAttack);
|
scene_manager_next_scene(instance->scene_manager, SubBruteSceneSetupAttack);
|
||||||
|
|
||||||
consumed = true;
|
consumed = true;
|
||||||
} else if(event.event == SubBruteCustomEventTypeLoadFile) {
|
} else if(event.event == SubBruteCustomEventTypeLoadFile) {
|
||||||
instance->device->extra_repeats = 0;
|
//uint8_t extra_repeats = subbrute_main_view_get_extra_repeats(instance->view_main);
|
||||||
|
|
||||||
|
//instance->device->extra_repeats = extra_repeats;
|
||||||
scene_manager_next_scene(instance->scene_manager, SubBruteSceneLoadFile);
|
scene_manager_next_scene(instance->scene_manager, SubBruteSceneLoadFile);
|
||||||
consumed = true;
|
consumed = true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -146,9 +146,10 @@ SubBruteFileResult subbrute_device_attack_set(
|
|||||||
if(type != SubBruteAttackLoadFile) {
|
if(type != SubBruteAttackLoadFile) {
|
||||||
subbrute_device_free_protocol_info(instance);
|
subbrute_device_free_protocol_info(instance);
|
||||||
instance->protocol_info = subbrute_protocol(type);
|
instance->protocol_info = subbrute_protocol(type);
|
||||||
instance->extra_repeats = extra_repeats;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
instance->extra_repeats = extra_repeats;
|
||||||
|
|
||||||
// For non-file types we didn't set SubGhzProtocolDecoderBase
|
// For non-file types we didn't set SubGhzProtocolDecoderBase
|
||||||
instance->receiver = subghz_receiver_alloc_init(instance->environment);
|
instance->receiver = subghz_receiver_alloc_init(instance->environment);
|
||||||
subghz_receiver_set_filter(instance->receiver, SubGhzProtocolFlag_Decodable);
|
subghz_receiver_set_filter(instance->receiver, SubGhzProtocolFlag_Decodable);
|
||||||
@@ -290,11 +291,12 @@ uint8_t subbrute_device_load_from_file(SubBruteDevice* instance, const char* fil
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
instance->decoder_result =
|
instance->decoder_result = subghz_receiver_search_decoder_base_by_name(
|
||||||
subghz_receiver_search_decoder_base_by_name(instance->receiver, protocol_file);
|
instance->receiver, furi_string_get_cstr(temp_str));
|
||||||
|
|
||||||
if(!instance->decoder_result || strcmp(protocol_file, "RAW") == 0) {
|
if((!instance->decoder_result) || (strcmp(protocol_file, "RAW") == 0) ||
|
||||||
FURI_LOG_E(TAG, "RAW unsupported");
|
(strcmp(protocol_file, "Unknown") == 0)) {
|
||||||
|
FURI_LOG_E(TAG, "Protocol unsupported");
|
||||||
result = SubBruteFileResultProtocolNotSupported;
|
result = SubBruteFileResultProtocolNotSupported;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -429,7 +431,7 @@ const char* subbrute_device_error_get_desc(SubBruteFileResult error_id) {
|
|||||||
result = "Missing Protocol";
|
result = "Missing Protocol";
|
||||||
break;
|
break;
|
||||||
case(SubBruteFileResultProtocolNotSupported):
|
case(SubBruteFileResultProtocolNotSupported):
|
||||||
result = "RAW unsupported";
|
result = "Protocol unsupported";
|
||||||
break;
|
break;
|
||||||
case(SubBruteFileResultDynamicProtocolNotValid):
|
case(SubBruteFileResultDynamicProtocolNotValid):
|
||||||
result = "Dynamic protocol unsupported";
|
result = "Dynamic protocol unsupported";
|
||||||
|
|||||||
@@ -205,7 +205,7 @@ const SubBruteProtocol subbrute_protocol_linear_10bit_310 = {
|
|||||||
* BF existing dump
|
* BF existing dump
|
||||||
*/
|
*/
|
||||||
const SubBruteProtocol subbrute_protocol_load_file =
|
const SubBruteProtocol subbrute_protocol_load_file =
|
||||||
{0, 0, 0, 3, FuriHalSubGhzPresetOok650Async, RAWFileProtocol};
|
{0, 0, 0, 3, FuriHalSubGhzPresetOok650Async, UnknownFileProtocol};
|
||||||
|
|
||||||
static const char* subbrute_protocol_names[] = {
|
static const char* subbrute_protocol_names[] = {
|
||||||
[SubBruteAttackCAME12bit303] = "CAME 12bit 303MHz",
|
[SubBruteAttackCAME12bit303] = "CAME 12bit 303MHz",
|
||||||
@@ -267,7 +267,14 @@ static const char* subbrute_protocol_file_types[] = {
|
|||||||
[ChamberlainFileProtocol] = "Cham_Code",
|
[ChamberlainFileProtocol] = "Cham_Code",
|
||||||
[LinearFileProtocol] = "Linear",
|
[LinearFileProtocol] = "Linear",
|
||||||
[PrincetonFileProtocol] = "Princeton",
|
[PrincetonFileProtocol] = "Princeton",
|
||||||
[RAWFileProtocol] = "RAW"};
|
[RAWFileProtocol] = "RAW",
|
||||||
|
[BETTFileProtocol] = "BETT",
|
||||||
|
[ClemsaFileProtocol] = "Clemsa",
|
||||||
|
[DoitrandFileProtocol] = "Doitrand",
|
||||||
|
[GateTXFileProtocol] = "GateTX",
|
||||||
|
[MagellanFileProtocol] = "Magellan",
|
||||||
|
[IntertechnoV3FileProtocol] = "Intertechno_V3",
|
||||||
|
[UnknownFileProtocol] = "Unknown"};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Values to not use less memory for packet parse operations
|
* Values to not use less memory for packet parse operations
|
||||||
@@ -316,7 +323,7 @@ SubBruteFileProtocol subbrute_protocol_file_protocol_name(FuriString* name) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return RAWFileProtocol;
|
return UnknownFileProtocol;
|
||||||
}
|
}
|
||||||
|
|
||||||
void subbrute_protocol_default_payload(
|
void subbrute_protocol_default_payload(
|
||||||
|
|||||||
@@ -12,6 +12,13 @@ typedef enum {
|
|||||||
LinearFileProtocol,
|
LinearFileProtocol,
|
||||||
PrincetonFileProtocol,
|
PrincetonFileProtocol,
|
||||||
RAWFileProtocol,
|
RAWFileProtocol,
|
||||||
|
BETTFileProtocol,
|
||||||
|
ClemsaFileProtocol,
|
||||||
|
DoitrandFileProtocol,
|
||||||
|
GateTXFileProtocol,
|
||||||
|
MagellanFileProtocol,
|
||||||
|
IntertechnoV3FileProtocol,
|
||||||
|
UnknownFileProtocol,
|
||||||
TotalFileProtocol,
|
TotalFileProtocol,
|
||||||
} SubBruteFileProtocol;
|
} SubBruteFileProtocol;
|
||||||
|
|
||||||
|
|||||||
@@ -200,7 +200,6 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
|||||||
const uint8_t min_value = 0;
|
const uint8_t min_value = 0;
|
||||||
const uint8_t correct_total = SubBruteAttackTotalCount - 1;
|
const uint8_t correct_total = SubBruteAttackTotalCount - 1;
|
||||||
uint8_t max_repeats = 9 - subbrute_protocol_repeats_count(instance->index);
|
uint8_t max_repeats = 9 - subbrute_protocol_repeats_count(instance->index);
|
||||||
uint8_t index = 0;
|
|
||||||
|
|
||||||
bool updated = false;
|
bool updated = false;
|
||||||
bool consumed = false;
|
bool consumed = false;
|
||||||
@@ -227,14 +226,16 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
|||||||
consumed = true;
|
consumed = true;
|
||||||
} else if(event->key == InputKeyLeft && is_short) {
|
} else if(event->key == InputKeyLeft && is_short) {
|
||||||
instance->extra_repeats = CLAMP(instance->extra_repeats - 1, max_repeats, 0);
|
instance->extra_repeats = CLAMP(instance->extra_repeats - 1, max_repeats, 0);
|
||||||
|
|
||||||
updated = true;
|
updated = true;
|
||||||
consumed = true;
|
consumed = true;
|
||||||
} else if(event->key == InputKeyRight && is_short) {
|
} else if(event->key == InputKeyRight && is_short) {
|
||||||
instance->extra_repeats = CLAMP(instance->extra_repeats + 1, max_repeats, 0);
|
instance->extra_repeats = CLAMP(instance->extra_repeats + 1, max_repeats, 0);
|
||||||
|
|
||||||
updated = true;
|
updated = true;
|
||||||
consumed = true;
|
consumed = true;
|
||||||
} else if(event->key == InputKeyOk && is_short) {
|
} else if(event->key == InputKeyOk && is_short) {
|
||||||
if(index == SubBruteAttackLoadFile) {
|
if(instance->index == SubBruteAttackLoadFile) {
|
||||||
instance->callback(SubBruteCustomEventTypeLoadFile, instance->context);
|
instance->callback(SubBruteCustomEventTypeLoadFile, instance->context);
|
||||||
} else {
|
} else {
|
||||||
instance->callback(SubBruteCustomEventTypeMenuSelected, instance->context);
|
instance->callback(SubBruteCustomEventTypeMenuSelected, instance->context);
|
||||||
@@ -293,16 +294,6 @@ bool subbrute_main_view_input(InputEvent* event, void* context) {
|
|||||||
|
|
||||||
void subbrute_main_view_enter(void* context) {
|
void subbrute_main_view_enter(void* context) {
|
||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
SubBruteMainView* instance = context;
|
|
||||||
|
|
||||||
with_view_model(
|
|
||||||
instance->view,
|
|
||||||
SubBruteMainViewModel * model,
|
|
||||||
{
|
|
||||||
model->key_field = NULL;
|
|
||||||
model->is_select_byte = false;
|
|
||||||
},
|
|
||||||
true);
|
|
||||||
|
|
||||||
#ifdef FURI_DEBUG
|
#ifdef FURI_DEBUG
|
||||||
FURI_LOG_D(TAG, "subbrute_main_view_enter");
|
FURI_LOG_D(TAG, "subbrute_main_view_enter");
|
||||||
@@ -368,7 +359,7 @@ void subbrute_main_view_set_index(
|
|||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
furi_assert(idx < SubBruteAttackTotalCount);
|
furi_assert(idx < SubBruteAttackTotalCount);
|
||||||
#ifdef FURI_DEBUG
|
#ifdef FURI_DEBUG
|
||||||
FURI_LOG_I(TAG, "Set index: %d", idx);
|
FURI_LOG_I(TAG, "Set index: %d, IS_SELECT_BYTE: %d", idx, is_select_byte);
|
||||||
#endif
|
#endif
|
||||||
instance->is_select_byte = is_select_byte;
|
instance->is_select_byte = is_select_byte;
|
||||||
instance->key_field = key_field;
|
instance->key_field = key_field;
|
||||||
|
|||||||
Reference in New Issue
Block a user