mirror of
https://github.com/Next-Flip/Momentum-Firmware.git
synced 2026-07-11 23:38:11 -07:00
Merge branch '420' of https://github.com/RogueMaster/flipperzero-firmware-wPlugins into dev
This commit is contained in:
@@ -13,7 +13,7 @@
|
||||
#define CAME_ATOMO_DIR_NAME EXT_PATH("subghz/assets/came_atomo")
|
||||
#define NICE_FLOR_S_DIR_NAME EXT_PATH("subghz/assets/nice_flor_s")
|
||||
#define TEST_RANDOM_DIR_NAME EXT_PATH("unit_tests/subghz/test_random_raw.sub")
|
||||
#define TEST_RANDOM_COUNT_PARSE 253
|
||||
#define TEST_RANDOM_COUNT_PARSE 273
|
||||
#define TEST_TIMEOUT 10000
|
||||
|
||||
static SubGhzEnvironment* environment_handler;
|
||||
@@ -603,6 +603,13 @@ MU_TEST(subghz_decoder_smc5326_test) {
|
||||
"Test decoder " SUBGHZ_PROTOCOL_SMC5326_NAME " error\r\n");
|
||||
}
|
||||
|
||||
MU_TEST(subghz_decoder_holtek_ht12x_test) {
|
||||
mu_assert(
|
||||
subghz_decoder_test(
|
||||
EXT_PATH("unit_tests/subghz/holtek_ht12x_raw.sub"), SUBGHZ_PROTOCOL_HOLTEK_HT12X_NAME),
|
||||
"Test decoder " SUBGHZ_PROTOCOL_HOLTEK_HT12X_NAME " error\r\n");
|
||||
}
|
||||
|
||||
//test encoders
|
||||
MU_TEST(subghz_encoder_princeton_test) {
|
||||
mu_assert(
|
||||
@@ -736,6 +743,12 @@ MU_TEST(subghz_encoder_smc5326_test) {
|
||||
"Test encoder " SUBGHZ_PROTOCOL_SMC5326_NAME " error\r\n");
|
||||
}
|
||||
|
||||
MU_TEST(subghz_encoder_holtek_ht12x_test) {
|
||||
mu_assert(
|
||||
subghz_encoder_test(EXT_PATH("unit_tests/subghz/holtek_ht12x.sub")),
|
||||
"Test encoder " SUBGHZ_PROTOCOL_HOLTEK_HT12X_NAME " error\r\n");
|
||||
}
|
||||
|
||||
MU_TEST(subghz_random_test) {
|
||||
mu_assert(subghz_decode_random_test(TEST_RANDOM_DIR_NAME), "Random test error\r\n");
|
||||
}
|
||||
@@ -781,6 +794,7 @@ MU_TEST_SUITE(subghz) {
|
||||
MU_RUN_TEST(subghz_decoder_ansonic_test);
|
||||
MU_RUN_TEST(subghz_decoder_pocsag_test);
|
||||
MU_RUN_TEST(subghz_decoder_smc5326_test);
|
||||
MU_RUN_TEST(subghz_decoder_holtek_ht12x_test);
|
||||
|
||||
MU_RUN_TEST(subghz_encoder_princeton_test);
|
||||
MU_RUN_TEST(subghz_encoder_came_test);
|
||||
@@ -804,6 +818,7 @@ MU_TEST_SUITE(subghz) {
|
||||
MU_RUN_TEST(subghz_encoder_clemsa_test);
|
||||
MU_RUN_TEST(subghz_encoder_ansonic_test);
|
||||
MU_RUN_TEST(subghz_encoder_smc5326_test);
|
||||
MU_RUN_TEST(subghz_encoder_holtek_ht12x_test);
|
||||
|
||||
MU_RUN_TEST(subghz_random_test);
|
||||
subghz_test_deinit();
|
||||
|
||||
@@ -50,7 +50,7 @@ bool nfc_scene_extra_actions_on_event(void* context, SceneManagerEvent event) {
|
||||
|
||||
if(event.type == SceneManagerEventTypeCustom) {
|
||||
if(event.event == SubmenuIndexMfClassicKeys) {
|
||||
if(mf_classic_dict_check_presence(MfClassicDictTypeFlipper)) {
|
||||
if(mf_classic_dict_check_presence(MfClassicDictTypeSystem)) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicKeys);
|
||||
} else {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);
|
||||
|
||||
@@ -53,10 +53,10 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(Nfc* nfc, DictAttackSt
|
||||
// Setup view
|
||||
if(state == DictAttackStateUserDictInProgress) {
|
||||
worker_state = NfcWorkerStateMfClassicDictAttack;
|
||||
dict_attack_set_header(nfc->dict_attack, "Mf Classic User Dict.");
|
||||
dict_attack_set_header(nfc->dict_attack, "MF Classic User Dictionary");
|
||||
dict = mf_classic_dict_alloc(MfClassicDictTypeUser);
|
||||
|
||||
// If failed to load user dictionary - try flipper dictionary
|
||||
// If failed to load user dictionary - try the system dictionary
|
||||
if(!dict) {
|
||||
FURI_LOG_E(TAG, "User Dictionary Not Found");
|
||||
state = DictAttackStateFlipperDictInProgress;
|
||||
@@ -64,8 +64,8 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(Nfc* nfc, DictAttackSt
|
||||
}
|
||||
if(state == DictAttackStateFlipperDictInProgress) {
|
||||
worker_state = NfcWorkerStateMfClassicDictAttack;
|
||||
dict_attack_set_header(nfc->dict_attack, "Mf Classic Flipper Dict.");
|
||||
dict = mf_classic_dict_alloc(MfClassicDictTypeFlipper);
|
||||
dict_attack_set_header(nfc->dict_attack, "MF Classic System Dictionary");
|
||||
dict = mf_classic_dict_alloc(MfClassicDictTypeSystem);
|
||||
if(!dict) {
|
||||
FURI_LOG_E(TAG, "Flipper Dictionary Not Found");
|
||||
// Pass through to let worker handle the failure
|
||||
@@ -153,6 +153,15 @@ bool nfc_scene_mf_classic_dict_attack_on_event(void* context, SceneManagerEvent
|
||||
nfc_worker_stop(nfc->worker);
|
||||
consumed = true;
|
||||
}
|
||||
} else if(event.event == NfcWorkerEventKeyAttackStart) {
|
||||
dict_attack_set_key_attack(
|
||||
nfc->dict_attack,
|
||||
true,
|
||||
nfc->dev->dev_data.mf_classic_dict_attack_data.current_sector);
|
||||
} else if(event.event == NfcWorkerEventKeyAttackStop) {
|
||||
dict_attack_set_key_attack(nfc->dict_attack, false, 0);
|
||||
} else if(event.event == NfcWorkerEventKeyAttackNextSector) {
|
||||
dict_attack_inc_key_attack_current_sector(nfc->dict_attack);
|
||||
}
|
||||
} else if(event.type == SceneManagerEventTypeBack) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneExitConfirm);
|
||||
|
||||
@@ -12,7 +12,7 @@ void nfc_scene_mf_classic_keys_on_enter(void* context) {
|
||||
|
||||
// Load flipper dict keys total
|
||||
uint32_t flipper_dict_keys_total = 0;
|
||||
MfClassicDict* dict = mf_classic_dict_alloc(MfClassicDictTypeFlipper);
|
||||
MfClassicDict* dict = mf_classic_dict_alloc(MfClassicDictTypeSystem);
|
||||
if(dict) {
|
||||
flipper_dict_keys_total = mf_classic_dict_get_total_keys(dict);
|
||||
mf_classic_dict_free(dict);
|
||||
@@ -26,9 +26,9 @@ void nfc_scene_mf_classic_keys_on_enter(void* context) {
|
||||
}
|
||||
|
||||
widget_add_string_element(
|
||||
nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "Mifare Classic Keys");
|
||||
nfc->widget, 0, 0, AlignLeft, AlignTop, FontPrimary, "MIFARE Classic Keys");
|
||||
char temp_str[32];
|
||||
snprintf(temp_str, sizeof(temp_str), "Flipper Dict: %ld", flipper_dict_keys_total);
|
||||
snprintf(temp_str, sizeof(temp_str), "System Dict: %ld", flipper_dict_keys_total);
|
||||
widget_add_string_element(nfc->widget, 0, 20, AlignLeft, AlignTop, FontSecondary, temp_str);
|
||||
snprintf(temp_str, sizeof(temp_str), "User Dict: %ld", user_dict_keys_total);
|
||||
widget_add_string_element(nfc->widget, 0, 32, AlignLeft, AlignTop, FontSecondary, temp_str);
|
||||
|
||||
@@ -109,7 +109,7 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
|
||||
}
|
||||
consumed = true;
|
||||
} else if(event.event == NfcWorkerEventReadMfClassicDictAttackRequired) {
|
||||
if(mf_classic_dict_check_presence(MfClassicDictTypeFlipper)) {
|
||||
if(mf_classic_dict_check_presence(MfClassicDictTypeSystem)) {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicDictAttack);
|
||||
} else {
|
||||
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);
|
||||
|
||||
@@ -24,6 +24,8 @@ typedef struct {
|
||||
uint8_t keys_found;
|
||||
uint16_t dict_keys_total;
|
||||
uint16_t dict_keys_current;
|
||||
bool is_key_attack;
|
||||
uint8_t key_attack_current_sector;
|
||||
} DictAttackViewModel;
|
||||
|
||||
static void dict_attack_draw_callback(Canvas* canvas, void* model) {
|
||||
@@ -36,10 +38,19 @@ static void dict_attack_draw_callback(Canvas* canvas, void* model) {
|
||||
canvas, 64, 23, AlignCenter, AlignTop, "Make sure the tag is\npositioned correctly.");
|
||||
} else if(m->state == DictAttackStateRead) {
|
||||
char draw_str[32] = {};
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 64, 2, AlignCenter, AlignTop, furi_string_get_cstr(m->header));
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str_aligned(
|
||||
canvas, 64, 0, AlignCenter, AlignTop, furi_string_get_cstr(m->header));
|
||||
if(m->is_key_attack) {
|
||||
snprintf(
|
||||
draw_str,
|
||||
sizeof(draw_str),
|
||||
"Reuse key check for sector: %d",
|
||||
m->key_attack_current_sector);
|
||||
} else {
|
||||
snprintf(draw_str, sizeof(draw_str), "Unlocking sector: %d", m->sector_current);
|
||||
}
|
||||
canvas_draw_str_aligned(canvas, 0, 10, AlignLeft, AlignTop, draw_str);
|
||||
float dict_progress = m->dict_keys_total == 0 ?
|
||||
0 :
|
||||
(float)(m->dict_keys_current) / (float)(m->dict_keys_total);
|
||||
@@ -49,13 +60,14 @@ static void dict_attack_draw_callback(Canvas* canvas, void* model) {
|
||||
if(progress > 1.0) {
|
||||
progress = 1.0;
|
||||
}
|
||||
elements_progress_bar(canvas, 5, 15, 120, progress);
|
||||
snprintf(draw_str, sizeof(draw_str), "%d/%d", m->dict_keys_current, m->dict_keys_total);
|
||||
elements_progress_bar_with_text(canvas, 0, 20, 128, dict_progress, draw_str);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
snprintf(draw_str, sizeof(draw_str), "Keys Found: %d/%d", m->keys_found, m->keys_total);
|
||||
canvas_draw_str_aligned(canvas, 1, 28, AlignLeft, AlignTop, draw_str);
|
||||
canvas_draw_str_aligned(canvas, 0, 33, AlignLeft, AlignTop, draw_str);
|
||||
snprintf(
|
||||
draw_str, sizeof(draw_str), "Sectors Read: %d/%d", m->sectors_read, m->sectors_total);
|
||||
canvas_draw_str_aligned(canvas, 1, 40, AlignLeft, AlignTop, draw_str);
|
||||
canvas_draw_str_aligned(canvas, 0, 43, AlignLeft, AlignTop, draw_str);
|
||||
}
|
||||
elements_button_center(canvas, "Skip");
|
||||
}
|
||||
@@ -113,6 +125,7 @@ void dict_attack_reset(DictAttack* dict_attack) {
|
||||
model->keys_found = 0;
|
||||
model->dict_keys_total = 0;
|
||||
model->dict_keys_current = 0;
|
||||
model->is_key_attack = false;
|
||||
furi_string_reset(model->header);
|
||||
},
|
||||
false);
|
||||
@@ -235,3 +248,28 @@ void dict_attack_inc_current_dict_key(DictAttack* dict_attack, uint16_t keys_tri
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
void dict_attack_set_key_attack(DictAttack* dict_attack, bool is_key_attack, uint8_t sector) {
|
||||
furi_assert(dict_attack);
|
||||
with_view_model(
|
||||
dict_attack->view,
|
||||
DictAttackViewModel * model,
|
||||
{
|
||||
model->is_key_attack = is_key_attack;
|
||||
model->key_attack_current_sector = sector;
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
void dict_attack_inc_key_attack_current_sector(DictAttack* dict_attack) {
|
||||
furi_assert(dict_attack);
|
||||
with_view_model(
|
||||
dict_attack->view,
|
||||
DictAttackViewModel * model,
|
||||
{
|
||||
if(model->key_attack_current_sector < model->sectors_total) {
|
||||
model->key_attack_current_sector++;
|
||||
}
|
||||
},
|
||||
true);
|
||||
}
|
||||
|
||||
@@ -38,3 +38,7 @@ void dict_attack_inc_keys_found(DictAttack* dict_attack);
|
||||
void dict_attack_set_total_dict_keys(DictAttack* dict_attack, uint16_t dict_keys_total);
|
||||
|
||||
void dict_attack_inc_current_dict_key(DictAttack* dict_attack, uint16_t keys_tried);
|
||||
|
||||
void dict_attack_set_key_attack(DictAttack* dict_attack, bool is_key_attack, uint8_t sector);
|
||||
|
||||
void dict_attack_inc_key_attack_current_sector(DictAttack* dict_attack);
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 3.5 KiB After Width: | Height: | Size: 657 B |
@@ -42,10 +42,12 @@ static void bt_hid_connection_status_changed_callback(BtStatus status, void* con
|
||||
furi_assert(context);
|
||||
Hid* hid = context;
|
||||
bool connected = (status == BtStatusConnected);
|
||||
if(connected) {
|
||||
notification_internal_message(hid->notifications, &sequence_set_blue_255);
|
||||
} else {
|
||||
notification_internal_message(hid->notifications, &sequence_reset_blue);
|
||||
if(hid->transport == HidTransportBle) {
|
||||
if(connected) {
|
||||
notification_internal_message(hid->notifications, &sequence_set_blue_255);
|
||||
} else {
|
||||
notification_internal_message(hid->notifications, &sequence_reset_blue);
|
||||
}
|
||||
}
|
||||
hid_keynote_set_connected_status(hid->hid_keynote, connected);
|
||||
hid_keyboard_set_connected_status(hid->hid_keyboard, connected);
|
||||
@@ -186,7 +188,9 @@ void hid_free(Hid* app) {
|
||||
furi_assert(app);
|
||||
|
||||
// Reset notification
|
||||
notification_internal_message(app->notifications, &sequence_reset_blue);
|
||||
if(app->transport == HidTransportBle) {
|
||||
notification_internal_message(app->notifications, &sequence_reset_blue);
|
||||
}
|
||||
|
||||
// Free views
|
||||
view_dispatcher_remove_view(app->view_dispatcher, HidViewSubmenu);
|
||||
|
||||
@@ -25,6 +25,7 @@ typedef struct {
|
||||
bool back_pressed;
|
||||
bool connected;
|
||||
char key_string[5];
|
||||
HidTransport transport;
|
||||
} HidKeyboardModel;
|
||||
|
||||
typedef struct {
|
||||
@@ -207,7 +208,7 @@ static void hid_keyboard_draw_callback(Canvas* canvas, void* context) {
|
||||
HidKeyboardModel* model = context;
|
||||
|
||||
// Header
|
||||
if(!model->connected) {
|
||||
if((!model->connected) && (model->transport == HidTransportBle)) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keyboard");
|
||||
@@ -361,6 +362,12 @@ HidKeyboard* hid_keyboard_alloc(Hid* bt_hid) {
|
||||
view_set_draw_callback(hid_keyboard->view, hid_keyboard_draw_callback);
|
||||
view_set_input_callback(hid_keyboard->view, hid_keyboard_input_callback);
|
||||
|
||||
with_view_model(
|
||||
hid_keyboard->view,
|
||||
HidKeyboardModel * model,
|
||||
{ model->transport = bt_hid->transport; },
|
||||
true);
|
||||
|
||||
return hid_keyboard;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ typedef struct {
|
||||
bool ok_pressed;
|
||||
bool back_pressed;
|
||||
bool connected;
|
||||
HidTransport transport;
|
||||
} HidKeynoteModel;
|
||||
|
||||
static void hid_keynote_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) {
|
||||
@@ -39,11 +40,14 @@ static void hid_keynote_draw_callback(Canvas* canvas, void* context) {
|
||||
HidKeynoteModel* model = context;
|
||||
|
||||
// Header
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
if(model->transport == HidTransportBle) {
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
}
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Keynote");
|
||||
|
||||
@@ -186,6 +190,9 @@ HidKeynote* hid_keynote_alloc(Hid* hid) {
|
||||
view_set_draw_callback(hid_keynote->view, hid_keynote_draw_callback);
|
||||
view_set_input_callback(hid_keynote->view, hid_keynote_input_callback);
|
||||
|
||||
with_view_model(
|
||||
hid_keynote->view, HidKeynoteModel * model, { model->transport = hid->transport; }, true);
|
||||
|
||||
return hid_keynote;
|
||||
}
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ typedef struct {
|
||||
bool down_pressed;
|
||||
bool ok_pressed;
|
||||
bool connected;
|
||||
HidTransport transport;
|
||||
} HidMediaModel;
|
||||
|
||||
static void hid_media_draw_arrow(Canvas* canvas, uint8_t x, uint8_t y, CanvasDirection dir) {
|
||||
@@ -41,11 +42,14 @@ static void hid_media_draw_callback(Canvas* canvas, void* context) {
|
||||
HidMediaModel* model = context;
|
||||
|
||||
// Header
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
if(model->transport == HidTransportBle) {
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
}
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Media");
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
@@ -190,6 +194,9 @@ HidMedia* hid_media_alloc(Hid* hid) {
|
||||
view_set_draw_callback(hid_media->view, hid_media_draw_callback);
|
||||
view_set_input_callback(hid_media->view, hid_media_input_callback);
|
||||
|
||||
with_view_model(
|
||||
hid_media->view, HidMediaModel * model, { model->transport = hid->transport; }, true);
|
||||
|
||||
return hid_media;
|
||||
}
|
||||
|
||||
|
||||
@@ -20,6 +20,7 @@ typedef struct {
|
||||
bool left_mouse_held;
|
||||
bool right_mouse_pressed;
|
||||
bool connected;
|
||||
HidTransport transport;
|
||||
} HidMouseModel;
|
||||
|
||||
static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
|
||||
@@ -27,11 +28,14 @@ static void hid_mouse_draw_callback(Canvas* canvas, void* context) {
|
||||
HidMouseModel* model = context;
|
||||
|
||||
// Header
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
if(model->transport == HidTransportBle) {
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
}
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse");
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
@@ -198,6 +202,9 @@ HidMouse* hid_mouse_alloc(Hid* hid) {
|
||||
view_set_draw_callback(hid_mouse->view, hid_mouse_draw_callback);
|
||||
view_set_input_callback(hid_mouse->view, hid_mouse_input_callback);
|
||||
|
||||
with_view_model(
|
||||
hid_mouse->view, HidMouseModel * model, { model->transport = hid->transport; }, true);
|
||||
|
||||
return hid_mouse;
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ typedef struct {
|
||||
bool connected;
|
||||
bool running;
|
||||
uint8_t counter;
|
||||
HidTransport transport;
|
||||
} HidMouseJigglerModel;
|
||||
|
||||
static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) {
|
||||
@@ -23,11 +24,14 @@ static void hid_mouse_jiggler_draw_callback(Canvas* canvas, void* context) {
|
||||
HidMouseJigglerModel* model = context;
|
||||
|
||||
// Header
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
if(model->transport == HidTransportBle) {
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
}
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "Mouse Jiggler");
|
||||
|
||||
@@ -120,6 +124,12 @@ HidMouseJiggler* hid_mouse_jiggler_alloc(Hid* hid) {
|
||||
hid_mouse_jiggler->timer = furi_timer_alloc(
|
||||
hid_mouse_jiggler_timer_callback, FuriTimerTypePeriodic, hid_mouse_jiggler);
|
||||
|
||||
with_view_model(
|
||||
hid_mouse_jiggler->view,
|
||||
HidMouseJigglerModel * model,
|
||||
{ model->transport = hid->transport; },
|
||||
true);
|
||||
|
||||
return hid_mouse_jiggler;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,6 +19,7 @@ typedef struct {
|
||||
bool ok_pressed;
|
||||
bool connected;
|
||||
bool is_cursor_set;
|
||||
HidTransport transport;
|
||||
} HidTikTokModel;
|
||||
|
||||
static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
|
||||
@@ -26,11 +27,14 @@ static void hid_tiktok_draw_callback(Canvas* canvas, void* context) {
|
||||
HidTikTokModel* model = context;
|
||||
|
||||
// Header
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
if(model->transport == HidTransportBle) {
|
||||
if(model->connected) {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_connected_15x15);
|
||||
} else {
|
||||
canvas_draw_icon(canvas, 0, 0, &I_Ble_disconnected_15x15);
|
||||
}
|
||||
}
|
||||
|
||||
canvas_set_font(canvas, FontPrimary);
|
||||
elements_multiline_text_aligned(canvas, 17, 3, AlignLeft, AlignTop, "TikTok");
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
@@ -207,6 +211,9 @@ HidTikTok* hid_tiktok_alloc(Hid* bt_hid) {
|
||||
view_set_draw_callback(hid_tiktok->view, hid_tiktok_draw_callback);
|
||||
view_set_input_callback(hid_tiktok->view, hid_tiktok_input_callback);
|
||||
|
||||
with_view_model(
|
||||
hid_tiktok->view, HidTikTokModel * model, { model->transport = bt_hid->transport; }, true);
|
||||
|
||||
return hid_tiktok;
|
||||
}
|
||||
|
||||
|
||||
@@ -28,6 +28,10 @@ We do not condone illegal activity and strongly encourage keeping transmissions
|
||||
- Ansonic 12bit 433.920MHz
|
||||
- Ansonic 12bit 434.075MHz
|
||||
|
||||
#### Holtek
|
||||
|
||||
- Holtek HT12X 12bit 433.920MHz
|
||||
|
||||
#### Chamberlain
|
||||
|
||||
- Chamberlain 9bit 300MHz
|
||||
|
||||
@@ -334,6 +334,17 @@ const SubBruteProtocol subbrute_protocol_pt2260_24bit_433 = {
|
||||
.preset = FuriHalSubGhzPresetOok650Async,
|
||||
.file = PT2260FileProtocol};
|
||||
|
||||
/**
|
||||
* Holtek FM 12bit 433MHz
|
||||
*/
|
||||
const SubBruteProtocol subbrute_protocol_holtek_12bit_433 = {
|
||||
.frequency = 433920000,
|
||||
.bits = 12,
|
||||
.te = 204,
|
||||
.repeat = 4,
|
||||
.preset = FuriHalSubGhzPreset2FSKDev476Async,
|
||||
.file = HoltekFileProtocol};
|
||||
|
||||
/**
|
||||
* BF existing dump
|
||||
*/
|
||||
@@ -351,6 +362,7 @@ static const char* subbrute_protocol_names[] = {
|
||||
[SubBruteAttackAnsonic12bit433075] = "Ansonic 12bit 433.07MHz",
|
||||
[SubBruteAttackAnsonic12bit433] = "Ansonic 12bit 433.92MHz",
|
||||
[SubBruteAttackAnsonic12bit434] = "Ansonic 12bit 434.07MHz",
|
||||
[SubBruteAttackHoltek12bit433] = "Holtek FM 12bit 433MHz",
|
||||
[SubBruteAttackChamberlain9bit300] = "Chamberlain 9bit 300MHz",
|
||||
[SubBruteAttackChamberlain9bit315] = "Chamberlain 9bit 315MHz",
|
||||
[SubBruteAttackChamberlain9bit390] = "Chamberlain 9bit 390MHz",
|
||||
@@ -396,6 +408,7 @@ const SubBruteProtocol* subbrute_protocol_registry[] = {
|
||||
[SubBruteAttackAnsonic12bit433075] = &subbrute_protocol_ansonic_12bit_433075,
|
||||
[SubBruteAttackAnsonic12bit433] = &subbrute_protocol_ansonic_12bit_433,
|
||||
[SubBruteAttackAnsonic12bit434] = &subbrute_protocol_ansonic_12bit_434,
|
||||
[SubBruteAttackHoltek12bit433] = &subbrute_protocol_holtek_12bit_433,
|
||||
[SubBruteAttackChamberlain9bit300] = &subbrute_protocol_chamberlain_9bit_300,
|
||||
[SubBruteAttackChamberlain9bit315] = &subbrute_protocol_chamberlain_9bit_315,
|
||||
[SubBruteAttackChamberlain9bit390] = &subbrute_protocol_chamberlain_9bit_390,
|
||||
@@ -436,6 +449,7 @@ static const char* subbrute_protocol_file_types[] = {
|
||||
[UNILARMFileProtocol] = "SMC5326",
|
||||
[PT2260FileProtocol] = "Princeton",
|
||||
[HoneywellFileProtocol] = "Honeywell",
|
||||
[HoltekFileProtocol] = "Holtek_HT12X",
|
||||
[UnknownFileProtocol] = "Unknown"};
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,7 @@ typedef enum {
|
||||
UNILARMFileProtocol,
|
||||
PT2260FileProtocol,
|
||||
HoneywellFileProtocol,
|
||||
HoltekFileProtocol,
|
||||
UnknownFileProtocol,
|
||||
TotalFileProtocol,
|
||||
} SubBruteFileProtocol;
|
||||
@@ -38,6 +39,7 @@ typedef enum {
|
||||
SubBruteAttackAnsonic12bit433075,
|
||||
SubBruteAttackAnsonic12bit433,
|
||||
SubBruteAttackAnsonic12bit434,
|
||||
SubBruteAttackHoltek12bit433,
|
||||
SubBruteAttackChamberlain9bit300,
|
||||
SubBruteAttackChamberlain9bit315,
|
||||
SubBruteAttackChamberlain9bit390,
|
||||
|
||||
@@ -126,16 +126,30 @@ const UsbHidKeyboardKey usb_hid_keyboard_keyset[ROW_COUNT][COLUMN_COUNT] = {
|
||||
{.width = 3, .icon = NULL, .key = "Ctrl", .value = HID_KEYBOARD_L_CTRL},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_CTRL},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_CTRL},
|
||||
{.width = 3, .icon = NULL, .key = "Alt", .value = HID_KEYBOARD_L_ALT},
|
||||
{.width = 2, .icon = NULL, .key = "Alt", .value = HID_KEYBOARD_L_ALT},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_ALT},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_ALT},
|
||||
{.width = 3, .icon = NULL, .key = "Cmd", .value = HID_KEYBOARD_L_GUI},
|
||||
{.width = 2, .icon = NULL, .key = "Cmd", .value = HID_KEYBOARD_L_GUI},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_GUI},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_L_GUI},
|
||||
{.width = 3, .icon = NULL, .key = "Tab", .value = HID_KEYBOARD_TAB},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_TAB},
|
||||
{.width = 2, .icon = NULL, .key = "Tab", .value = HID_KEYBOARD_TAB},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_TAB},
|
||||
{.width = 3, .icon = NULL, .key = "Esc", .value = HID_KEYBOARD_ESCAPE},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_ESCAPE},
|
||||
{.width = 0, .icon = NULL, .value = HID_KEYBOARD_ESCAPE},
|
||||
},
|
||||
{
|
||||
{.width = 1, .icon = NULL, .key = "1", .shift_key = "1", .value = HID_KEYBOARD_F1},
|
||||
{.width = 1, .icon = NULL, .key = "2", .shift_key = "2", .value = HID_KEYBOARD_F2},
|
||||
{.width = 1, .icon = NULL, .key = "3", .shift_key = "3", .value = HID_KEYBOARD_F3},
|
||||
{.width = 1, .icon = NULL, .key = "4", .shift_key = "4", .value = HID_KEYBOARD_F4},
|
||||
{.width = 1, .icon = NULL, .key = "5", .shift_key = "5", .value = HID_KEYBOARD_F5},
|
||||
{.width = 1, .icon = NULL, .key = "6", .shift_key = "6", .value = HID_KEYBOARD_F6},
|
||||
{.width = 1, .icon = NULL, .key = "7", .shift_key = "7", .value = HID_KEYBOARD_F7},
|
||||
{.width = 1, .icon = NULL, .key = "8", .shift_key = "8", .value = HID_KEYBOARD_F8},
|
||||
{.width = 1, .icon = NULL, .key = "9", .shift_key = "9", .value = HID_KEYBOARD_F9},
|
||||
{.width = 1, .icon = NULL, .key = "0", .shift_key = "0", .value = HID_KEYBOARD_F10},
|
||||
{.width = 1, .icon = NULL, .key = "1", .shift_key = "1", .value = HID_KEYBOARD_F11},
|
||||
{.width = 1, .icon = NULL, .key = "2", .shift_key = "2", .value = HID_KEYBOARD_F12},
|
||||
}
|
||||
};
|
||||
|
||||
static void usb_hid_keyboard_to_upper(char* str) {
|
||||
@@ -217,6 +231,8 @@ static void usb_hid_keyboard_draw_callback(Canvas* canvas, void* context) {
|
||||
// Select if back is clicked and its the backspace key
|
||||
// Deselect when the button clicked or not hovered
|
||||
bool keySelected = (x <= model->x && model->x < (x + key.width)) && y == model->y;
|
||||
// Revert selection for function keys
|
||||
keySelected = y == ROW_COUNT - 1 ? !keySelected : keySelected;
|
||||
bool backSelected = model->back_pressed && key.value == HID_KEYBOARD_DELETE;
|
||||
usb_hid_keyboard_draw_key(
|
||||
canvas,
|
||||
|
||||
@@ -17,6 +17,7 @@ extern "C" {
|
||||
typedef enum {
|
||||
ColorWhite = 0x00,
|
||||
ColorBlack = 0x01,
|
||||
ColorXOR = 0x02,
|
||||
} Color;
|
||||
|
||||
/** Fonts enumeration */
|
||||
|
||||
@@ -41,6 +41,31 @@ void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width,
|
||||
canvas_draw_box(canvas, x + 1, y + 1, progress_length, height - 2);
|
||||
}
|
||||
|
||||
void elements_progress_bar_with_text(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
uint8_t width,
|
||||
float progress,
|
||||
const char* text) {
|
||||
furi_assert(canvas);
|
||||
furi_assert((progress >= 0.0f) && (progress <= 1.0f));
|
||||
uint8_t height = 11;
|
||||
|
||||
uint8_t progress_length = roundf(progress * (width - 2));
|
||||
|
||||
canvas_set_color(canvas, ColorWhite);
|
||||
canvas_draw_box(canvas, x + 1, y + 1, width - 2, height - 2);
|
||||
canvas_set_color(canvas, ColorBlack);
|
||||
canvas_draw_rframe(canvas, x, y, width, height, 3);
|
||||
|
||||
canvas_draw_box(canvas, x + 1, y + 1, progress_length, height - 2);
|
||||
|
||||
canvas_set_color(canvas, ColorXOR);
|
||||
canvas_set_font(canvas, FontSecondary);
|
||||
canvas_draw_str_aligned(canvas, x + width / 2, y + 2, AlignCenter, AlignTop, text);
|
||||
}
|
||||
|
||||
void elements_scrollbar_pos(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
|
||||
@@ -31,6 +31,23 @@ extern "C" {
|
||||
*/
|
||||
void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, float progress);
|
||||
|
||||
/** Draw progress bar with text.
|
||||
*
|
||||
* @param canvas Canvas instance
|
||||
* @param x progress bar position on X axis
|
||||
* @param y progress bar position on Y axis
|
||||
* @param width progress bar width
|
||||
* @param progress progress (0.0 - 1.0)
|
||||
* @param text text to draw
|
||||
*/
|
||||
void elements_progress_bar_with_text(
|
||||
Canvas* canvas,
|
||||
uint8_t x,
|
||||
uint8_t y,
|
||||
uint8_t width,
|
||||
float progress,
|
||||
const char* text);
|
||||
|
||||
/** Draw scrollbar on canvas at specific position.
|
||||
*
|
||||
* @param canvas Canvas instance
|
||||
|
||||
Reference in New Issue
Block a user