mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-05-14 12:38:35 -07:00
Fix compile errors
This commit is contained in:
@@ -4,17 +4,17 @@ App(
|
|||||||
apptype=FlipperAppType.METAPACKAGE,
|
apptype=FlipperAppType.METAPACKAGE,
|
||||||
provides=[
|
provides=[
|
||||||
"gpio",
|
"gpio",
|
||||||
"ibutton",
|
#"ibutton",
|
||||||
"infrared",
|
#"infrared",
|
||||||
"lfrfid",
|
#"lfrfid",
|
||||||
"nfc",
|
#"nfc",
|
||||||
"subghz",
|
"subghz",
|
||||||
"bad_usb",
|
#"bad_usb",
|
||||||
"u2f",
|
#"u2f",
|
||||||
"fap_loader",
|
"fap_loader",
|
||||||
"archive",
|
"archive",
|
||||||
"clock",
|
"clock",
|
||||||
"unirfremix",
|
#"unirfremix",
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@@ -34,7 +34,8 @@ void subbrute_scene_load_file_on_enter(void* context) {
|
|||||||
furi_string_get_cstr(app_folder));
|
furi_string_get_cstr(app_folder));
|
||||||
#endif
|
#endif
|
||||||
if(res) {
|
if(res) {
|
||||||
load_result = subbrute_device_load_from_file(instance->device, load_path);
|
load_result =
|
||||||
|
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);
|
load_result = subbrute_device_attack_set(instance->device, SubBruteAttackLoadFile);
|
||||||
if(load_result == SubBruteFileResultOk) {
|
if(load_result == SubBruteFileResultOk) {
|
||||||
@@ -51,8 +52,7 @@ void subbrute_scene_load_file_on_enter(void* context) {
|
|||||||
|
|
||||||
FuriString* dialog_msg;
|
FuriString* dialog_msg;
|
||||||
dialog_msg = furi_string_alloc();
|
dialog_msg = furi_string_alloc();
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(dialog_msg, "Cannot parse\nfile: %s", subbrute_device_error_get_desc(load_result));
|
||||||
dialog_msg, "Cannot parse\nfile: %s", subbrute_device_error_get_desc(load_result));
|
|
||||||
dialog_message_show_storage_error(instance->dialogs, furi_string_get_cstr(dialog_msg));
|
dialog_message_show_storage_error(instance->dialogs, furi_string_get_cstr(dialog_msg));
|
||||||
furi_string_free(dialog_msg);
|
furi_string_free(dialog_msg);
|
||||||
scene_manager_search_and_switch_to_previous_scene(
|
scene_manager_search_and_switch_to_previous_scene(
|
||||||
|
|||||||
@@ -7,9 +7,6 @@ void subbrute_scene_load_select_callback(SubBruteCustomEvent event, void* contex
|
|||||||
furi_assert(context);
|
furi_assert(context);
|
||||||
|
|
||||||
SubBruteState* instance = (SubBruteState*)context;
|
SubBruteState* instance = (SubBruteState*)context;
|
||||||
#ifdef FURI_DEBUG
|
|
||||||
FURI_LOG_D(TAG, "subbrute_scene_load_select_callback");
|
|
||||||
#endif
|
|
||||||
view_dispatcher_send_custom_event(instance->view_dispatcher, event);
|
view_dispatcher_send_custom_event(instance->view_dispatcher, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
#include "../subbrute_i.h"
|
#include "../subbrute_i.h"
|
||||||
#include "subbrute_scene.h"
|
#include "subbrute_scene.h"
|
||||||
|
#include <core/string.h>
|
||||||
#include <lib/toolbox/random_name.h>
|
#include <lib/toolbox/random_name.h>
|
||||||
|
|
||||||
#define TAG "SubBruteSceneSaveFile"
|
#define TAG "SubBruteSceneSaveFile"
|
||||||
@@ -20,10 +21,11 @@ void subbrute_scene_save_name_on_enter(void* context) {
|
|||||||
SUBBRUTE_MAX_LEN_NAME,
|
SUBBRUTE_MAX_LEN_NAME,
|
||||||
true);
|
true);
|
||||||
|
|
||||||
string_set_str(instance->file_path, SUBBRUTE_PATH);
|
furi_string_reset(instance->file_path);
|
||||||
|
furi_string_set_str(instance->file_path, SUBBRUTE_PATH);
|
||||||
|
|
||||||
ValidatorIsFile* validator_is_file =
|
ValidatorIsFile* validator_is_file = validator_is_file_alloc_init(
|
||||||
validator_is_file_alloc_init(string_get_cstr(instance->file_path), SUBBRUTE_FILE_EXT, "");
|
furi_string_get_cstr(instance->file_path), SUBBRUTE_FILE_EXT, "");
|
||||||
text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
|
text_input_set_validator(text_input, validator_is_file_callback, validator_is_file);
|
||||||
|
|
||||||
view_dispatcher_switch_to_view(instance->view_dispatcher, SubBruteViewTextInput);
|
view_dispatcher_switch_to_view(instance->view_dispatcher, SubBruteViewTextInput);
|
||||||
@@ -44,10 +46,11 @@ bool subbrute_scene_save_name_on_event(void* context, SceneManagerEvent event) {
|
|||||||
#endif
|
#endif
|
||||||
bool success = false;
|
bool success = false;
|
||||||
if(strcmp(instance->text_store, "")) {
|
if(strcmp(instance->text_store, "")) {
|
||||||
|
furi_string_reset(instance->file_path);
|
||||||
furi_string_cat_printf(
|
furi_string_cat_printf(
|
||||||
instance->file_path, "/%s%s", instance->text_store, SUBBRUTE_FILE_EXT);
|
instance->file_path, "/%s%s", instance->text_store, SUBBRUTE_FILE_EXT);
|
||||||
|
|
||||||
if(subbrute_device_save_file(instance->device, string_get_cstr(instance->file_path))) {
|
if(subbrute_device_save_file(instance->device, furi_string_get_cstr(instance->file_path))) {
|
||||||
scene_manager_next_scene(instance->scene_manager, SubBruteSceneSaveSuccess);
|
scene_manager_next_scene(instance->scene_manager, SubBruteSceneSaveSuccess);
|
||||||
success = true;
|
success = true;
|
||||||
consumed = true;
|
consumed = true;
|
||||||
@@ -73,5 +76,5 @@ void subbrute_scene_save_name_on_exit(void* context) {
|
|||||||
|
|
||||||
text_input_reset(instance->text_input);
|
text_input_reset(instance->text_input);
|
||||||
|
|
||||||
string_reset(instance->file_path);
|
furi_string_reset(instance->file_path);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -26,7 +26,7 @@ SubBruteState* subbrute_alloc() {
|
|||||||
SubBruteState* instance = malloc(sizeof(SubBruteState));
|
SubBruteState* instance = malloc(sizeof(SubBruteState));
|
||||||
|
|
||||||
memset(instance->text_store, 0, sizeof(instance->text_store));
|
memset(instance->text_store, 0, sizeof(instance->text_store));
|
||||||
string_init(instance->file_path);
|
instance->file_path = furi_string_alloc();
|
||||||
|
|
||||||
instance->scene_manager = scene_manager_alloc(&subbrute_scene_handlers, instance);
|
instance->scene_manager = scene_manager_alloc(&subbrute_scene_handlers, instance);
|
||||||
instance->view_dispatcher = view_dispatcher_alloc();
|
instance->view_dispatcher = view_dispatcher_alloc();
|
||||||
@@ -187,13 +187,9 @@ void subbrute_free(SubBruteState* instance) {
|
|||||||
furi_record_close(RECORD_GUI);
|
furi_record_close(RECORD_GUI);
|
||||||
instance->gui = NULL;
|
instance->gui = NULL;
|
||||||
|
|
||||||
string_clear(instance->file_path);
|
furi_string_free(instance->file_path);
|
||||||
string_init(instance->file_path);
|
|
||||||
|
|
||||||
// The rest
|
// The rest
|
||||||
#ifdef FURI_DEBUG
|
|
||||||
FURI_LOG_D(TAG, "free instance");
|
|
||||||
#endif
|
|
||||||
free(instance);
|
free(instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,8 +1,10 @@
|
|||||||
#include "subbrute_device.h"
|
#include "subbrute_device.h"
|
||||||
|
//#include "subbrute_device.h"
|
||||||
|
|
||||||
#include <lib/toolbox/stream/stream.h>
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <stream/buffered_file_stream.h>
|
#include <storage/storage.h>
|
||||||
|
#include <lib/toolbox/stream/stream.h>
|
||||||
|
#include <lib/flipper_format/flipper_format.h>
|
||||||
#include <lib/flipper_format/flipper_format_i.h>
|
#include <lib/flipper_format/flipper_format_i.h>
|
||||||
|
|
||||||
#define TAG "SubBruteDevice"
|
#define TAG "SubBruteDevice"
|
||||||
@@ -50,17 +52,11 @@ SubBruteDevice* subbrute_device_alloc() {
|
|||||||
|
|
||||||
void subbrute_device_free(SubBruteDevice* instance) {
|
void subbrute_device_free(SubBruteDevice* instance) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
#ifdef FURI_DEBUG
|
|
||||||
FURI_LOG_D(TAG, "subbrute_device_free");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// I don't know how to free this
|
// I don't know how to free this
|
||||||
instance->decoder_result = NULL;
|
instance->decoder_result = NULL;
|
||||||
|
|
||||||
if(instance->receiver != NULL) {
|
if(instance->receiver != NULL) {
|
||||||
#ifdef FURI_DEBUG
|
|
||||||
FURI_LOG_D(TAG, "subghz_receiver_free");
|
|
||||||
#endif
|
|
||||||
subghz_receiver_free(instance->receiver);
|
subghz_receiver_free(instance->receiver);
|
||||||
instance->receiver = NULL;
|
instance->receiver = NULL;
|
||||||
}
|
}
|
||||||
@@ -73,10 +69,6 @@ void subbrute_device_free(SubBruteDevice* instance) {
|
|||||||
subghz_environment_free(instance->environment);
|
subghz_environment_free(instance->environment);
|
||||||
instance->environment = NULL;
|
instance->environment = NULL;
|
||||||
|
|
||||||
#ifdef FURI_DEBUG
|
|
||||||
FURI_LOG_D(TAG, "before free");
|
|
||||||
#endif
|
|
||||||
|
|
||||||
furi_thread_free(instance->thread);
|
furi_thread_free(instance->thread);
|
||||||
subbrute_device_free_protocol_info(instance);
|
subbrute_device_free_protocol_info(instance);
|
||||||
|
|
||||||
@@ -186,6 +178,9 @@ SubBruteAttacks subbrute_device_get_attack(SubBruteDevice* instance) {
|
|||||||
bool subbrute_device_is_worker_running(SubBruteDevice* instance) {
|
bool subbrute_device_is_worker_running(SubBruteDevice* instance) {
|
||||||
return instance->worker_running;
|
return instance->worker_running;
|
||||||
}
|
}
|
||||||
|
uint64_t subbrute_device_get_max_value(SubBruteDevice* instance) {
|
||||||
|
return instance->max_value;
|
||||||
|
}
|
||||||
uint64_t subbrute_device_get_step(SubBruteDevice* instance) {
|
uint64_t subbrute_device_get_step(SubBruteDevice* instance) {
|
||||||
return instance->key_index;
|
return instance->key_index;
|
||||||
}
|
}
|
||||||
@@ -267,7 +262,7 @@ bool subbrute_device_transmit_current_key(SubBruteDevice* instance) {
|
|||||||
uint32_t ticks = furi_get_tick();
|
uint32_t ticks = furi_get_tick();
|
||||||
if((ticks - instance->last_time_tx_data) < SUBBRUTE_MANUAL_TRANSMIT_INTERVAL) {
|
if((ticks - instance->last_time_tx_data) < SUBBRUTE_MANUAL_TRANSMIT_INTERVAL) {
|
||||||
#if FURI_DEBUG
|
#if FURI_DEBUG
|
||||||
FURI_LOG_D(TAG, "Need to wait, current: %d", ticks - instance->last_time_tx_data);
|
FURI_LOG_D(TAG, "Need to wait, current: %ld", ticks - instance->last_time_tx_data);
|
||||||
#endif
|
#endif
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -403,7 +398,7 @@ bool subbrute_device_create_packet_parsed(
|
|||||||
stream,
|
stream,
|
||||||
subbrute_key_small_no_tail,
|
subbrute_key_small_no_tail,
|
||||||
instance->protocol_info->bits,
|
instance->protocol_info->bits,
|
||||||
string_get_cstr(candidate),
|
furi_string_get_cstr(candidate),
|
||||||
instance->protocol_info->repeat);
|
instance->protocol_info->repeat);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@@ -420,7 +415,7 @@ bool subbrute_device_create_packet_parsed(
|
|||||||
stream,
|
stream,
|
||||||
subbrute_key_file_key,
|
subbrute_key_file_key,
|
||||||
instance->file_template,
|
instance->file_template,
|
||||||
string_get_cstr(candidate),
|
furi_string_get_cstr(candidate),
|
||||||
instance->protocol_info->repeat);
|
instance->protocol_info->repeat);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -512,10 +507,10 @@ SubBruteFileResult subbrute_device_attack_set(SubBruteDevice* instance, SubBrute
|
|||||||
return SubBruteFileResultOk;
|
return SubBruteFileResultOk;
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t subbrute_device_load_from_file(SubBruteDevice* instance, FuriString* file_path) {
|
uint8_t subbrute_device_load_from_file(SubBruteDevice* instance, const char* file_path) {
|
||||||
furi_assert(instance);
|
furi_assert(instance);
|
||||||
#ifdef FURI_DEBUG
|
#ifdef FURI_DEBUG
|
||||||
FURI_LOG_D(TAG, "subbrute_device_load_from_file: %s", furi_string_get_cstr(file_path));
|
FURI_LOG_D(TAG, "subbrute_device_load_from_file: %s", file_path);
|
||||||
#endif
|
#endif
|
||||||
SubBruteFileResult result = SubBruteFileResultUnknown;
|
SubBruteFileResult result = SubBruteFileResultUnknown;
|
||||||
|
|
||||||
@@ -531,8 +526,8 @@ uint8_t subbrute_device_load_from_file(SubBruteDevice* instance, FuriString* fil
|
|||||||
furi_hal_subghz_reset();
|
furi_hal_subghz_reset();
|
||||||
|
|
||||||
do {
|
do {
|
||||||
if(!flipper_format_file_open_existing(fff_data_file, furi_string_get_cstr(file_path))) {
|
if(!flipper_format_file_open_existing(fff_data_file, file_path)) {
|
||||||
FURI_LOG_E(TAG, "Error open file %s", furi_string_get_cstr(file_path));
|
FURI_LOG_E(TAG, "Error open file %s", file_path);
|
||||||
result = SubBruteFileResultErrorOpenFile;
|
result = SubBruteFileResultErrorOpenFile;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -744,3 +739,10 @@ const char* subbrute_device_error_get_desc(SubBruteFileResult error_id) {
|
|||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void subbrute_device_free_protocol_info(SubBruteDevice* instance) {
|
||||||
|
furi_assert(instance);
|
||||||
|
|
||||||
|
free(instance->protocol_info);
|
||||||
|
instance->protocol_info = NULL;
|
||||||
|
}
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "subbrute_device_i.h"
|
#include "subbrute_protocols.h"
|
||||||
#include <lib/subghz/protocols/base.h>
|
#include <lib/subghz/protocols/base.h>
|
||||||
#include <lib/subghz/transmitter.h>
|
#include <lib/subghz/transmitter.h>
|
||||||
#include <lib/subghz/receiver.h>
|
#include <lib/subghz/receiver.h>
|
||||||
@@ -14,22 +14,6 @@
|
|||||||
|
|
||||||
#define SUBBRUTE_PAYLOAD_SIZE 16
|
#define SUBBRUTE_PAYLOAD_SIZE 16
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SubBruteAttackCAME12bit303,
|
|
||||||
SubBruteAttackCAME12bit307,
|
|
||||||
SubBruteAttackCAME12bit433,
|
|
||||||
SubBruteAttackCAME12bit868,
|
|
||||||
SubBruteAttackNICE12bit433,
|
|
||||||
SubBruteAttackNICE12bit868,
|
|
||||||
SubBruteAttackChamberlain9bit300,
|
|
||||||
SubBruteAttackChamberlain9bit315,
|
|
||||||
SubBruteAttackChamberlain9bit390,
|
|
||||||
SubBruteAttackLinear10bit300,
|
|
||||||
SubBruteAttackLinear10bit310,
|
|
||||||
SubBruteAttackLoadFile,
|
|
||||||
SubBruteAttackTotalCount,
|
|
||||||
} SubBruteAttacks;
|
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SubBruteFileResultUnknown,
|
SubBruteFileResultUnknown,
|
||||||
SubBruteFileResultOk,
|
SubBruteFileResultOk,
|
||||||
@@ -45,16 +29,16 @@ typedef enum {
|
|||||||
SubBruteFileResultMissingOrIncorrectBit,
|
SubBruteFileResultMissingOrIncorrectBit,
|
||||||
SubBruteFileResultMissingOrIncorrectKey,
|
SubBruteFileResultMissingOrIncorrectKey,
|
||||||
SubBruteFileResultMissingOrIncorrectTe,
|
SubBruteFileResultMissingOrIncorrectTe,
|
||||||
SubBruteFileResultBigBitSize,
|
|
||||||
} SubBruteFileResult;
|
} SubBruteFileResult;
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
SubBruteDeviceStateIDLE,
|
SubBruteDeviceStateIDLE,
|
||||||
SubBruteDeviceStateReady,
|
SubBruteDeviceStateReady,
|
||||||
SubBruteDeviceStateTx,
|
SubBruteDeviceStateTx,
|
||||||
SubBruteDeviceStateFinished,
|
SubBruteDeviceStateFinished
|
||||||
} SubBruteDeviceState;
|
} SubBruteDeviceState;
|
||||||
|
|
||||||
|
typedef void (*SubBruteDeviceWorkerCallback)(void* context, SubBruteDeviceState state);
|
||||||
typedef struct {
|
typedef struct {
|
||||||
SubBruteDeviceState state;
|
SubBruteDeviceState state;
|
||||||
SubBruteProtocol* protocol_info;
|
SubBruteProtocol* protocol_info;
|
||||||
@@ -88,11 +72,34 @@ typedef struct {
|
|||||||
// Callback for changed states
|
// Callback for changed states
|
||||||
SubBruteDeviceWorkerCallback callback;
|
SubBruteDeviceWorkerCallback callback;
|
||||||
void* context;
|
void* context;
|
||||||
};
|
} SubBruteDevice;
|
||||||
|
|
||||||
|
SubBruteDevice* subbrute_device_alloc();
|
||||||
|
void subbrute_device_free(SubBruteDevice* instance);
|
||||||
|
|
||||||
|
bool subbrute_device_save_file(SubBruteDevice* instance, const char* key_name);
|
||||||
|
const char* subbrute_device_error_get_desc(SubBruteFileResult error_id);
|
||||||
|
SubBruteFileResult subbrute_device_attack_set(SubBruteDevice* context, SubBruteAttacks type);
|
||||||
|
uint8_t subbrute_device_load_from_file(SubBruteDevice* context, const char* file_path);
|
||||||
|
|
||||||
|
bool subbrute_device_is_worker_running(SubBruteDevice* instance);
|
||||||
|
SubBruteAttacks subbrute_device_get_attack(SubBruteDevice* instance);
|
||||||
|
uint64_t subbrute_device_get_max_value(SubBruteDevice* instance);
|
||||||
|
uint64_t subbrute_device_get_step(SubBruteDevice* instance);
|
||||||
|
uint64_t subbrute_device_add_step(SubBruteDevice* instance, int8_t step);
|
||||||
|
void subbrute_device_set_load_index(SubBruteDevice* instance, uint64_t load_index);
|
||||||
|
void subbrute_device_reset_step(SubBruteDevice* instance);
|
||||||
|
const char* subbrute_device_get_file_key(SubBruteDevice* instance);
|
||||||
|
|
||||||
|
bool subbrute_worker_start(SubBruteDevice* instance);
|
||||||
|
void subbrute_worker_stop(SubBruteDevice* instance);
|
||||||
|
bool subbrute_device_transmit_current_key(SubBruteDevice* instance);
|
||||||
|
bool subbrute_device_can_manual_transmit(SubBruteDevice* instance);
|
||||||
|
void subbrute_device_set_callback(
|
||||||
|
SubBruteDevice* instance,
|
||||||
|
SubBruteDeviceWorkerCallback callback,
|
||||||
|
void* context);
|
||||||
|
|
||||||
/*
|
|
||||||
* PRIVATE METHODS
|
|
||||||
*/
|
|
||||||
void subbrute_device_free_protocol_info(SubBruteDevice* instance);
|
void subbrute_device_free_protocol_info(SubBruteDevice* instance);
|
||||||
int32_t subbrute_worker_thread(void* context);
|
int32_t subbrute_worker_thread(void* context);
|
||||||
void subbrute_device_attack_set_default_values(
|
void subbrute_device_attack_set_default_values(
|
||||||
|
|||||||
@@ -1,64 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
#include "subbrute_protocols.h"
|
|
||||||
|
|
||||||
#define SUBBRUTE_TEXT_STORE_SIZE 256
|
|
||||||
|
|
||||||
#define SUBBRUTE_MAX_LEN_NAME 64
|
|
||||||
#define SUBBRUTE_PATH EXT_PATH("subghz")
|
|
||||||
#define SUBBRUTE_FILE_EXT ".sub"
|
|
||||||
|
|
||||||
#define SUBBRUTE_PAYLOAD_SIZE 16
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SubBruteFileResultUnknown,
|
|
||||||
SubBruteFileResultOk,
|
|
||||||
SubBruteFileResultErrorOpenFile,
|
|
||||||
SubBruteFileResultMissingOrIncorrectHeader,
|
|
||||||
SubBruteFileResultFrequencyNotAllowed,
|
|
||||||
SubBruteFileResultMissingOrIncorrectFrequency,
|
|
||||||
SubBruteFileResultPresetInvalid,
|
|
||||||
SubBruteFileResultMissingProtocol,
|
|
||||||
SubBruteFileResultProtocolNotSupported,
|
|
||||||
SubBruteFileResultDynamicProtocolNotValid,
|
|
||||||
SubBruteFileResultProtocolNotFound,
|
|
||||||
SubBruteFileResultMissingOrIncorrectBit,
|
|
||||||
SubBruteFileResultMissingOrIncorrectKey,
|
|
||||||
SubBruteFileResultMissingOrIncorrectTe,
|
|
||||||
} SubBruteFileResult;
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SubBruteDeviceStateIDLE,
|
|
||||||
SubBruteDeviceStateReady,
|
|
||||||
SubBruteDeviceStateTx,
|
|
||||||
SubBruteDeviceStateFinished
|
|
||||||
} SubBruteDeviceState;
|
|
||||||
|
|
||||||
typedef void (*SubBruteDeviceWorkerCallback)(void* context, SubBruteDeviceState state);
|
|
||||||
typedef struct SubBruteDevice SubBruteDevice;
|
|
||||||
|
|
||||||
SubBruteDevice* subbrute_device_alloc();
|
|
||||||
void subbrute_device_free(SubBruteDevice* instance);
|
|
||||||
bool subbrute_device_save_file(SubBruteDevice* instance, const char* key_name);
|
|
||||||
const char* subbrute_device_error_get_desc(SubBruteFileResult error_id);
|
|
||||||
SubBruteFileResult subbrute_device_attack_set(SubBruteDevice* context, SubBruteAttacks type);
|
|
||||||
uint8_t subbrute_device_load_from_file(SubBruteDevice* context, string_t file_path);
|
|
||||||
|
|
||||||
|
|
||||||
bool subbrute_device_is_worker_running(SubBruteDevice* instance);
|
|
||||||
SubBruteAttacks subbrute_device_get_attack(SubBruteDevice* instance);
|
|
||||||
uint64_t subbrute_device_get_max_value(SubBruteDevice* instance);
|
|
||||||
uint64_t subbrute_device_get_step(SubBruteDevice* instance);
|
|
||||||
uint64_t subbrute_device_add_step(SubBruteDevice* instance, int8_t step);
|
|
||||||
void subbrute_device_set_load_index(SubBruteDevice* instance, uint64_t load_index);
|
|
||||||
void subbrute_device_reset_step(SubBruteDevice* instance);
|
|
||||||
const char* subbrute_device_get_file_key(SubBruteDevice* instance);
|
|
||||||
|
|
||||||
bool subbrute_worker_start(SubBruteDevice* instance);
|
|
||||||
void subbrute_worker_stop(SubBruteDevice* instance);
|
|
||||||
bool subbrute_device_transmit_current_key(SubBruteDevice* instance);
|
|
||||||
bool subbrute_device_can_manual_transmit(SubBruteDevice* instance);
|
|
||||||
void subbrute_device_set_callback(
|
|
||||||
SubBruteDevice* instance,
|
|
||||||
SubBruteDeviceWorkerCallback callback,
|
|
||||||
void* context);
|
|
||||||
@@ -22,7 +22,7 @@
|
|||||||
#include <notification/notification_messages.h>
|
#include <notification/notification_messages.h>
|
||||||
|
|
||||||
#include "subbrute.h"
|
#include "subbrute.h"
|
||||||
#include "subbrute_device_i.h"
|
#include "subbrute_device.h"
|
||||||
#include "views/subbrute_attack_view.h"
|
#include "views/subbrute_attack_view.h"
|
||||||
#include "views/subbrute_main_view.h"
|
#include "views/subbrute_main_view.h"
|
||||||
|
|
||||||
@@ -51,7 +51,7 @@ struct SubBruteState {
|
|||||||
|
|
||||||
// Text store
|
// Text store
|
||||||
char text_store[SUBBRUTE_MAX_LEN_NAME];
|
char text_store[SUBBRUTE_MAX_LEN_NAME];
|
||||||
string_t file_path;
|
FuriString* file_path;
|
||||||
|
|
||||||
// Views
|
// Views
|
||||||
SubBruteMainView* view_main;
|
SubBruteMainView* view_main;
|
||||||
|
|||||||
@@ -1,6 +1,8 @@
|
|||||||
#include "subbrute_protocols.h"
|
#include "subbrute_protocols.h"
|
||||||
|
|
||||||
static const SubBruteProtocol subbrute_protocols[SubBruteAttackTotalCount] = {
|
static const SubBruteProtocol subbrute_protocols[SubBruteAttackTotalCount] = {
|
||||||
|
[SubBruteAttackCAME12bit303] =
|
||||||
|
{303875000, 12, 0, 3, FuriHalSubGhzPresetOok650Async, CAMEFileProtocol},
|
||||||
[SubBruteAttackCAME12bit307] =
|
[SubBruteAttackCAME12bit307] =
|
||||||
{307800000, 12, 0, 3, FuriHalSubGhzPresetOok650Async, CAMEFileProtocol},
|
{307800000, 12, 0, 3, FuriHalSubGhzPresetOok650Async, CAMEFileProtocol},
|
||||||
[SubBruteAttackCAME12bit433] =
|
[SubBruteAttackCAME12bit433] =
|
||||||
@@ -38,6 +40,7 @@ static const SubBruteProtocol subbrute_protocols[SubBruteAttackTotalCount] = {
|
|||||||
//};
|
//};
|
||||||
|
|
||||||
static const char* subbrute_protocol_names[] = {
|
static const char* subbrute_protocol_names[] = {
|
||||||
|
[SubBruteAttackCAME12bit303] = "CAME 12bit 303MHz",
|
||||||
[SubBruteAttackCAME12bit307] = "CAME 12bit 307MHz",
|
[SubBruteAttackCAME12bit307] = "CAME 12bit 307MHz",
|
||||||
[SubBruteAttackCAME12bit433] = "CAME 12bit 433MHz",
|
[SubBruteAttackCAME12bit433] = "CAME 12bit 433MHz",
|
||||||
[SubBruteAttackCAME12bit868] = "CAME 12bit 868MHz",
|
[SubBruteAttackCAME12bit868] = "CAME 12bit 868MHz",
|
||||||
@@ -106,9 +109,9 @@ const char* subbrute_protocol_file(SubBruteFileProtocol protocol) {
|
|||||||
return subbrute_protocol_file_types[protocol];
|
return subbrute_protocol_file_types[protocol];
|
||||||
}
|
}
|
||||||
|
|
||||||
FuriHalSubGhzPreset subbrute_protocol_convert_preset(string_t preset_name) {
|
FuriHalSubGhzPreset subbrute_protocol_convert_preset(FuriString* preset_name) {
|
||||||
for(size_t i = FuriHalSubGhzPresetIDLE; i < FuriHalSubGhzPresetCustom; i++) {
|
for(size_t i = FuriHalSubGhzPresetIDLE; i < FuriHalSubGhzPresetCustom; i++) {
|
||||||
if(string_cmp_str(preset_name, subbrute_protocol_presets[i]) == 0) {
|
if(furi_string_cmp_str(preset_name, subbrute_protocol_presets[i]) == 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -116,9 +119,9 @@ FuriHalSubGhzPreset subbrute_protocol_convert_preset(string_t preset_name) {
|
|||||||
return FuriHalSubGhzPresetIDLE;
|
return FuriHalSubGhzPresetIDLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
SubBruteFileProtocol subbrute_protocol_file_protocol_name(string_t name) {
|
SubBruteFileProtocol subbrute_protocol_file_protocol_name(FuriString* name) {
|
||||||
for(size_t i = CAMEFileProtocol; i < TotalFileProtocol - 1; i++) {
|
for(size_t i = CAMEFileProtocol; i < TotalFileProtocol - 1; i++) {
|
||||||
if(string_cmp_str(name, subbrute_protocol_file_types[i]) == 0) {
|
if(furi_string_cmp_str(name, subbrute_protocol_file_types[i]) == 0) {
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,9 +1,8 @@
|
|||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include "subbrute_protocols_i.h"
|
|
||||||
#include <furi.h>
|
#include <furi.h>
|
||||||
#include <m-string.h>
|
|
||||||
#include <furi_hal_subghz.h>
|
#include <furi_hal_subghz.h>
|
||||||
|
#include <core/string.h>
|
||||||
|
|
||||||
//typedef enum {
|
//typedef enum {
|
||||||
// FrequencyProtocolField,
|
// FrequencyProtocolField,
|
||||||
@@ -25,6 +24,22 @@ typedef enum {
|
|||||||
TotalFileProtocol,
|
TotalFileProtocol,
|
||||||
} SubBruteFileProtocol;
|
} SubBruteFileProtocol;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SubBruteAttackCAME12bit303,
|
||||||
|
SubBruteAttackCAME12bit307,
|
||||||
|
SubBruteAttackCAME12bit433,
|
||||||
|
SubBruteAttackCAME12bit868,
|
||||||
|
SubBruteAttackNICE12bit433,
|
||||||
|
SubBruteAttackNICE12bit868,
|
||||||
|
SubBruteAttackChamberlain9bit300,
|
||||||
|
SubBruteAttackChamberlain9bit315,
|
||||||
|
SubBruteAttackChamberlain9bit390,
|
||||||
|
SubBruteAttackLinear10bit300,
|
||||||
|
SubBruteAttackLinear10bit310,
|
||||||
|
SubBruteAttackLoadFile,
|
||||||
|
SubBruteAttackTotalCount,
|
||||||
|
} SubBruteAttacks;
|
||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
uint32_t frequency;
|
uint32_t frequency;
|
||||||
uint8_t bits;
|
uint8_t bits;
|
||||||
@@ -38,5 +53,6 @@ SubBruteProtocol* subbrute_protocol_alloc(void);
|
|||||||
SubBruteProtocol* subbrute_protocol(SubBruteAttacks index);
|
SubBruteProtocol* subbrute_protocol(SubBruteAttacks index);
|
||||||
const char* subbrute_protocol_preset(FuriHalSubGhzPreset preset);
|
const char* subbrute_protocol_preset(FuriHalSubGhzPreset preset);
|
||||||
const char* subbrute_protocol_file(SubBruteFileProtocol protocol);
|
const char* subbrute_protocol_file(SubBruteFileProtocol protocol);
|
||||||
FuriHalSubGhzPreset subbrute_protocol_convert_preset(string_t preset_name);
|
FuriHalSubGhzPreset subbrute_protocol_convert_preset(FuriString* preset_name);
|
||||||
SubBruteFileProtocol subbrute_protocol_file_protocol_name(string_t name);
|
SubBruteFileProtocol subbrute_protocol_file_protocol_name(FuriString* name);
|
||||||
|
const char* subbrute_protocol_name(SubBruteAttacks index);
|
||||||
@@ -1,18 +0,0 @@
|
|||||||
#pragma once
|
|
||||||
|
|
||||||
typedef enum {
|
|
||||||
SubBruteAttackCAME12bit307,
|
|
||||||
SubBruteAttackCAME12bit433,
|
|
||||||
SubBruteAttackCAME12bit868,
|
|
||||||
SubBruteAttackNICE12bit433,
|
|
||||||
SubBruteAttackNICE12bit868,
|
|
||||||
SubBruteAttackChamberlain9bit300,
|
|
||||||
SubBruteAttackChamberlain9bit315,
|
|
||||||
SubBruteAttackChamberlain9bit390,
|
|
||||||
SubBruteAttackLinear10bit300,
|
|
||||||
SubBruteAttackLinear10bit310,
|
|
||||||
SubBruteAttackLoadFile,
|
|
||||||
SubBruteAttackTotalCount,
|
|
||||||
} SubBruteAttacks;
|
|
||||||
|
|
||||||
const char* subbrute_protocol_name(SubBruteAttacks index);
|
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "subbrute_attack_view.h"
|
#include "subbrute_attack_view.h"
|
||||||
#include "../subbrute_i.h"
|
#include "../subbrute_i.h"
|
||||||
#include "../subbrute_protocols_i.h"
|
#include "../subbrute_protocols.h"
|
||||||
|
|
||||||
#include "assets_icons.h"
|
#include "assets_icons.h"
|
||||||
#include <input/input.h>
|
#include <input/input.h>
|
||||||
@@ -299,10 +299,6 @@ void elements_button_top_left(Canvas* canvas, const char* str) {
|
|||||||
const uint8_t y = 0;
|
const uint8_t y = 0;
|
||||||
|
|
||||||
canvas_draw_box(canvas, x, y, button_width, button_height);
|
canvas_draw_box(canvas, x, y, button_width, button_height);
|
||||||
#ifdef FURI_DEBUG
|
|
||||||
FURI_LOG_D(
|
|
||||||
TAG, "lbox, x: %d, y: %d, width: %d, height: %d", x, y, button_width, button_height);
|
|
||||||
#endif
|
|
||||||
// canvas_draw_line(canvas, x + button_width + 0, y, x + button_width + 0, y + button_height - 0); //
|
// canvas_draw_line(canvas, x + button_width + 0, y, x + button_width + 0, y + button_height - 0); //
|
||||||
// canvas_draw_line(canvas, x + button_width + 1, y, x + button_width + 1, y + button_height - 1);
|
// canvas_draw_line(canvas, x + button_width + 1, y, x + button_width + 1, y + button_height - 1);
|
||||||
// canvas_draw_line(canvas, x + button_width + 2, y, x + button_width + 2, y + button_height - 2);
|
// canvas_draw_line(canvas, x + button_width + 2, y, x + button_width + 2, y + button_height - 2);
|
||||||
@@ -330,15 +326,6 @@ void elements_button_top_right(Canvas* canvas, const char* str) {
|
|||||||
const uint8_t y = 0;
|
const uint8_t y = 0;
|
||||||
|
|
||||||
canvas_draw_box(canvas, x - button_width, y, button_width, button_height);
|
canvas_draw_box(canvas, x - button_width, y, button_width, button_height);
|
||||||
#ifdef FURI_DEBUG
|
|
||||||
FURI_LOG_D(
|
|
||||||
TAG,
|
|
||||||
"rbox, x: %d, y: %d, width: %d, height: %d",
|
|
||||||
x - button_width,
|
|
||||||
y,
|
|
||||||
button_width,
|
|
||||||
button_height);
|
|
||||||
#endif
|
|
||||||
// canvas_draw_line(canvas, x - button_width - 1, y, x + button_width - 1, y + button_height - 0);
|
// canvas_draw_line(canvas, x - button_width - 1, y, x + button_width - 1, y + button_height - 0);
|
||||||
// canvas_draw_line(canvas, x - button_width - 2, y, x + button_width - 2, y + button_height - 1);
|
// canvas_draw_line(canvas, x - button_width - 2, y, x + button_width - 2, y + button_height - 1);
|
||||||
// canvas_draw_line(canvas, x - button_width - 3, y, x + button_width - 3, y + button_height - 2);
|
// canvas_draw_line(canvas, x - button_width - 3, y, x + button_width - 3, y + button_height - 2);
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
#include "subbrute_main_view.h"
|
#include "subbrute_main_view.h"
|
||||||
#include "../subbrute_i.h"
|
#include "../subbrute_i.h"
|
||||||
#include "../subbrute_protocols_i.h"
|
#include "../subbrute_protocols.h"
|
||||||
|
|
||||||
#include <input/input.h>
|
#include <input/input.h>
|
||||||
#include <gui/elements.h>
|
#include <gui/elements.h>
|
||||||
@@ -86,7 +86,7 @@ void subbrute_main_view_draw(Canvas* canvas, SubBruteMainViewModel* model) {
|
|||||||
canvas_set_font(canvas, FontPrimary);
|
canvas_set_font(canvas, FontPrimary);
|
||||||
canvas_draw_box(canvas, 0, 0, canvas_width(canvas), STATUS_BAR_Y_SHIFT);
|
canvas_draw_box(canvas, 0, 0, canvas_width(canvas), STATUS_BAR_Y_SHIFT);
|
||||||
canvas_invert_color(canvas);
|
canvas_invert_color(canvas);
|
||||||
canvas_draw_str_aligned(canvas, 64, 3, AlignCenter, AlignTop, "Sub-GHz Bruteforcer");
|
canvas_draw_str_aligned(canvas, 64, 3, AlignCenter, AlignTop, "Sub-GHz BruteForcer v3");
|
||||||
canvas_invert_color(canvas);
|
canvas_invert_color(canvas);
|
||||||
|
|
||||||
if(m->is_select_byte) {
|
if(m->is_select_byte) {
|
||||||
|
|||||||
Reference in New Issue
Block a user