diff --git a/applications/main/archive/helpers/archive_menu.h b/applications/main/archive/helpers/archive_menu.h index 5df6a1ca2..201333987 100644 --- a/applications/main/archive/helpers/archive_menu.h +++ b/applications/main/archive/helpers/archive_menu.h @@ -42,10 +42,7 @@ ARRAY_DEF( #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wunused-function" // Using in applications/archive/views/archive_browser_view.c -static void archive_menu_add_item( - ArchiveContextMenuItem_t* obj, - string_t text, - uint32_t event) { +static void archive_menu_add_item(ArchiveContextMenuItem_t* obj, string_t text, uint32_t event) { string_init_move(obj->text, text); obj->event = event; } diff --git a/applications/main/archive/scenes/archive_scene_browser.c b/applications/main/archive/scenes/archive_scene_browser.c index 23722e30b..552a6557e 100644 --- a/applications/main/archive/scenes/archive_scene_browser.c +++ b/applications/main/archive/scenes/archive_scene_browser.c @@ -133,7 +133,7 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) { case ArchiveBrowserEventFileMenuRename: if(favorites) { browser->callback(ArchiveBrowserEventEnterFavMove, browser->context); - //} else if((archive_is_known_app(selected->type)) && (selected->is_app == false)) { + //} else if((archive_is_known_app(selected->type)) && (selected->is_app == false)) { } else { // Added ability to rename files and folders archive_show_file_menu(browser, false); diff --git a/applications/plugins/flipfrid/README.md b/applications/plugins/flipfrid/README.md index 51ed2fa67..69fdb3e66 100644 --- a/applications/plugins/flipfrid/README.md +++ b/applications/plugins/flipfrid/README.md @@ -1,21 +1,35 @@ # Flipfrid -Basic EM4100 Fuzzer +Basic EM4100 and HIDProx Fuzzer. ## Why Flipfrid is a simple Rfid fuzzer using EM4100 protocol (125khz). Objective is to provide a simple to use fuzzer to test readers by emulating various cards. -EM4100 cards use a 1 byte customer id and 4 bytes card id. +- EM4100 cards use a 1 byte customer id and 4 bytes card id. +- HIDProx cards use a 2 byte customer id and 3 byte card id. ## How -There is 4 modes : -- Default key loop over 16 factory/default keys and emulate each one after one ; -- BF customer id. just an iteration from 0X00 to 0XFF on the first byte ; -- Load Dump file : Load an existing EM4100 dump generated by Flipperzero, select an index and bruteforce from 0X00 to 0XFF; -- Uids list: loop over a text file (one uid per line) +1) Select the Protocol with the left and right arrows +2) Select the Mode with the up and down arrows + +### Info + +There are 2 Protocols: +- EM4100 +- HIDProx + +There are 4 modes: +- Default Values: Try factory/default keys and emulate one after the other. +- BF customer id: An iteration from 0X00 to 0XFF on the first byte. +- Load Dump file: Load an existing dump (.rfid) generated by Flipperzero, select an index and bruteforce from 0X00 to 0XFF; +- Uids list: Iterate over an input text file (one uid per line) and emulate one after the other. + + + TODO : - blank screen on back press +- Add second byte test to `BF customer id` diff --git a/applications/plugins/flipfrid/flipfrid.c b/applications/plugins/flipfrid/flipfrid.c index 1dab3cae1..ba059ff7f 100644 --- a/applications/plugins/flipfrid/flipfrid.c +++ b/applications/plugins/flipfrid/flipfrid.c @@ -64,6 +64,7 @@ FlipFridState* flipfrid_alloc() { flipfrid->is_attacking = false; flipfrid->key_index = 0; flipfrid->menu_index = 0; + flipfrid->menu_proto_index = 0; flipfrid->attack = FlipFridAttackDefaultValues; flipfrid->notify = furi_record_open(RECORD_NOTIFICATION); @@ -73,12 +74,14 @@ FlipFridState* flipfrid_alloc() { flipfrid->data[2] = 0x00; flipfrid->data[3] = 0x00; flipfrid->data[4] = 0x00; + flipfrid->data[5] = 0x00; flipfrid->payload[0] = 0x00; flipfrid->payload[1] = 0x00; flipfrid->payload[2] = 0x00; flipfrid->payload[3] = 0x00; flipfrid->payload[4] = 0x00; + flipfrid->payload[5] = 0x00; //Dialog flipfrid->dialogs = furi_record_open(RECORD_DIALOGS); diff --git a/applications/plugins/flipfrid/flipfrid.h b/applications/plugins/flipfrid/flipfrid.h index 44756f26e..5417817e9 100644 --- a/applications/plugins/flipfrid/flipfrid.h +++ b/applications/plugins/flipfrid/flipfrid.h @@ -28,6 +28,11 @@ typedef enum { FlipFridAttackLoadFileCustomUids, } FlipFridAttacks; +typedef enum { + EM4100, + HIDProx, +} FlipFridProtos; + typedef enum { NoneScene, SceneEntryPoint, @@ -56,13 +61,16 @@ typedef struct { FlipFridScene previous_scene; NotificationApp* notify; u_int8_t menu_index; + u_int8_t menu_proto_index; string_t data_str; - uint8_t data[5]; - uint8_t payload[5]; + uint8_t data[6]; + uint8_t payload[6]; uint8_t attack_step; FlipFridAttacks attack; + FlipFridProtos proto; string_t attack_name; + string_t proto_name; DialogsApp* dialogs; string_t notification_msg; diff --git a/applications/plugins/flipfrid/scene/flipfrid_scene_entrypoint.c b/applications/plugins/flipfrid/scene/flipfrid_scene_entrypoint.c index f30bb8e1d..c709572e3 100644 --- a/applications/plugins/flipfrid/scene/flipfrid_scene_entrypoint.c +++ b/applications/plugins/flipfrid/scene/flipfrid_scene_entrypoint.c @@ -1,8 +1,12 @@ #include "flipfrid_scene_entrypoint.h" string_t menu_items[4]; +string_t menu_proto_items[2]; -void flipfrid_scene_entrypoint_menu_callback(FlipFridState* context, uint32_t index) { +void flipfrid_scene_entrypoint_menu_callback( + FlipFridState* context, + uint32_t index, + uint32_t proto_index) { switch(index) { case FlipFridAttackDefaultValues: context->attack = FlipFridAttackDefaultValues; @@ -27,6 +31,19 @@ void flipfrid_scene_entrypoint_menu_callback(FlipFridState* context, uint32_t in default: break; } + + switch(proto_index) { + case EM4100: + context->proto = EM4100; + string_set_str(context->proto_name, "EM4100"); + break; + case HIDProx: + context->proto = HIDProx; + string_set_str(context->proto_name, "HIDProx"); + break; + default: + break; + } } void flipfrid_scene_entrypoint_on_enter(FlipFridState* context) { @@ -36,6 +53,7 @@ void flipfrid_scene_entrypoint_on_enter(FlipFridState* context) { context->payload[2] = 0x00; context->payload[3] = 0x00; context->payload[4] = 0x00; + context->payload[5] = 0x00; context->menu_index = 0; for(uint32_t i = 0; i < 4; i++) { @@ -46,6 +64,14 @@ void flipfrid_scene_entrypoint_on_enter(FlipFridState* context) { string_set(menu_items[1], "BF Customer ID"); string_set(menu_items[2], "Load File"); string_set(menu_items[3], "Load uids from file"); + + context->menu_proto_index = 0; + for(uint32_t i = 0; i < 2; i++) { + string_init(menu_proto_items[i]); + } + + string_set(menu_proto_items[0], "EM4100"); + string_set(menu_proto_items[1], "HIDProx"); } void flipfrid_scene_entrypoint_on_exit(FlipFridState* context) { @@ -53,6 +79,10 @@ void flipfrid_scene_entrypoint_on_exit(FlipFridState* context) { for(uint32_t i = 0; i < 4; i++) { string_clear(menu_items[i]); } + + for(uint32_t i = 0; i < 2; i++) { + string_clear(menu_proto_items[i]); + } } void flipfrid_scene_entrypoint_on_tick(FlipFridState* context) { @@ -74,10 +104,18 @@ void flipfrid_scene_entrypoint_on_event(FlipFridEvent event, FlipFridState* cont } break; case InputKeyLeft: + if(context->menu_proto_index > EM4100) { + context->menu_proto_index--; + } + break; case InputKeyRight: + if(context->menu_proto_index < HIDProx) { + context->menu_proto_index++; + } break; case InputKeyOk: - flipfrid_scene_entrypoint_menu_callback(context, context->menu_index); + flipfrid_scene_entrypoint_menu_callback( + context, context->menu_index, context->menu_proto_index); break; case InputKeyBack: context->is_running = false; @@ -91,10 +129,6 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) { canvas_clear(canvas); canvas_set_color(canvas, ColorBlack); - // Title - canvas_set_font(canvas, FontPrimary); - canvas_draw_str_aligned(canvas, 64, 6, AlignCenter, AlignTop, "RFID Fuzzer"); - if(context->menu_index > FlipFridAttackDefaultValues) { canvas_set_font(canvas, FontSecondary); canvas_draw_str_aligned( @@ -120,4 +154,41 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) { AlignTop, string_get_cstr(menu_items[context->menu_index + 1])); } + + if(context->menu_proto_index > EM4100) { + canvas_set_font(canvas, FontSecondary); + canvas_draw_str_aligned( + canvas, + 64, + -12, + AlignCenter, + AlignTop, + string_get_cstr(menu_proto_items[context->menu_proto_index - 1])); + } + + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 34, 4, AlignCenter, AlignTop, "<"); + + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned( + canvas, + 64, + 4, + AlignCenter, + AlignTop, + string_get_cstr(menu_proto_items[context->menu_proto_index])); + + canvas_set_font(canvas, FontPrimary); + canvas_draw_str_aligned(canvas, 94, 4, AlignCenter, AlignTop, ">"); + + if(context->menu_proto_index < HIDProx) { + canvas_set_font(canvas, FontSecondary); + canvas_draw_str_aligned( + canvas, + 64, + -12, + AlignCenter, + AlignTop, + string_get_cstr(menu_proto_items[context->menu_proto_index + 1])); + } } \ No newline at end of file diff --git a/applications/plugins/flipfrid/scene/flipfrid_scene_load_file.c b/applications/plugins/flipfrid/scene/flipfrid_scene_load_file.c index 072185ccf..687a861c9 100644 --- a/applications/plugins/flipfrid/scene/flipfrid_scene_load_file.c +++ b/applications/plugins/flipfrid/scene/flipfrid_scene_load_file.c @@ -36,11 +36,21 @@ bool flipfrid_load(FlipFridState* context, const char* file_path) { break; } else { FURI_LOG_I(TAG, "Key type: %s", string_get_cstr(temp_str)); - if(strcmp(string_get_cstr(temp_str), "EM4100") != 0) { - FURI_LOG_E(TAG, "Unsupported Key type"); - string_reset(context->notification_msg); - string_set_str(context->notification_msg, "Unsupported Key type"); - break; + + if(context->proto == EM4100) { + if(strcmp(string_get_cstr(temp_str), "EM4100") != 0) { + FURI_LOG_E(TAG, "Unsupported Key type"); + string_reset(context->notification_msg); + string_set_str(context->notification_msg, "Unsupported Key type"); + break; + } + } else { + if(strcmp(string_get_cstr(temp_str), "HIDProx") != 0) { + FURI_LOG_E(TAG, "Unsupported Key type"); + string_reset(context->notification_msg); + string_set_str(context->notification_msg, "Unsupported Key type"); + break; + } } } @@ -53,15 +63,24 @@ bool flipfrid_load(FlipFridState* context, const char* file_path) { } else { FURI_LOG_I(TAG, "Key: %s", string_get_cstr(context->data_str)); - // Check data size - if(string_size(context->data_str) != 14) { - FURI_LOG_E(TAG, "Incorrect Key length"); - string_reset(context->notification_msg); - string_set_str(context->notification_msg, "Incorrect Key length"); - break; + if(context->proto == EM4100) { + if(string_size(context->data_str) != 14) { + FURI_LOG_E(TAG, "Incorrect Key length"); + string_reset(context->notification_msg); + string_set_str(context->notification_msg, "Incorrect Key length"); + break; + } + } else { + if(string_size(context->data_str) != 17) { + FURI_LOG_E(TAG, "Incorrect Key length"); + string_reset(context->notification_msg); + string_set_str(context->notification_msg, "Incorrect Key length"); + break; + } } + // String to uint8_t - for(uint8_t i = 0; i < 5; i++) { + for(uint8_t i = 0; i < 6; i++) { char temp_str2[3]; temp_str2[0] = string_get_cstr(context->data_str)[i * 3]; temp_str2[1] = string_get_cstr(context->data_str)[i * 3 + 1]; diff --git a/applications/plugins/flipfrid/scene/flipfrid_scene_run_attack.c b/applications/plugins/flipfrid/scene/flipfrid_scene_run_attack.c index e34cb8986..f7776fb4d 100644 --- a/applications/plugins/flipfrid/scene/flipfrid_scene_run_attack.c +++ b/applications/plugins/flipfrid/scene/flipfrid_scene_run_attack.c @@ -2,8 +2,8 @@ #include uint8_t counter = 0; -#define TIME_BETWEEN_CARDS 5 -uint8_t id_list[16][5] = { +#define TIME_BETWEEN_CARDS 6 +uint8_t id_list[17][5] = { {0x00, 0x00, 0x00, 0x00, 0x00}, // Null bytes {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, // Only FF {0x11, 0x11, 0x11, 0x11, 0x11}, // Only 11 @@ -16,17 +16,34 @@ uint8_t id_list[16][5] = { {0x88, 0x88, 0x88, 0x88, 0x88}, // Only 88 {0x99, 0x99, 0x99, 0x99, 0x99}, // Only 99 {0x12, 0x34, 0x56, 0x78, 0x9A}, // Incremental UID + {0x9A, 0x78, 0x56, 0x34, 0x12}, // Decremental UID {0x04, 0xd0, 0x9b, 0x0d, 0x6a}, // From arha {0x34, 0x00, 0x29, 0x3d, 0x9e}, // From arha {0x04, 0xdf, 0x00, 0x00, 0x01}, // From arha {0xCA, 0xCA, 0xCA, 0xCA, 0xCA}, // From arha }; +uint8_t id_list_hid[14][6] = { + {0x00, 0x00, 0x00, 0x00, 0x00, 0x00}, // Null bytes + {0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, // Only FF + {0x11, 0x11, 0x11, 0x11, 0x11, 0x11}, // Only 11 + {0x22, 0x22, 0x22, 0x22, 0x22, 0x22}, // Only 22 + {0x33, 0x33, 0x33, 0x33, 0x33, 0x33}, // Only 33 + {0x44, 0x44, 0x44, 0x44, 0x44, 0x44}, // Only 44 + {0x55, 0x55, 0x55, 0x55, 0x55, 0x55}, // Only 55 + {0x66, 0x66, 0x66, 0x66, 0x66, 0x66}, // Only 66 + {0x77, 0x77, 0x77, 0x77, 0x77, 0x77}, // Only 77 + {0x88, 0x88, 0x88, 0x88, 0x88, 0x88}, // Only 88 + {0x99, 0x99, 0x99, 0x99, 0x99, 0x99}, // Only 99 + {0x12, 0x34, 0x56, 0x78, 0x9A, 0xBC}, // Incremental UID + {0xBC, 0x9A, 0x78, 0x56, 0x34, 0x12}, // Decremental UID + {0xCA, 0xCA, 0xCA, 0xCA, 0xCA, 0xCA}, // From arha +}; + void flipfrid_scene_run_attack_on_enter(FlipFridState* context) { context->attack_step = 0; context->dict = protocol_dict_alloc(lfrfid_protocols, LFRFIDProtocolMax); context->worker = lfrfid_worker_alloc(context->dict); - context->protocol = protocol_dict_get_protocol_by_name(context->dict, "EM4100"); } void flipfrid_scene_run_attack_on_exit(FlipFridState* context) { @@ -40,7 +57,7 @@ void flipfrid_scene_run_attack_on_exit(FlipFridState* context) { void flipfrid_scene_run_attack_on_tick(FlipFridState* context) { if(context->is_attacking) { if(1 == counter) { - protocol_dict_set_data(context->dict, context->protocol, context->payload, 5); + protocol_dict_set_data(context->dict, context->protocol, context->payload, 6); lfrfid_worker_free(context->worker); context->worker = lfrfid_worker_alloc(context->dict); lfrfid_worker_start_thread(context->worker); @@ -50,87 +67,204 @@ void flipfrid_scene_run_attack_on_tick(FlipFridState* context) { lfrfid_worker_stop_thread(context->worker); switch(context->attack) { case FlipFridAttackDefaultValues: - context->payload[0] = id_list[context->attack_step][0]; - context->payload[1] = id_list[context->attack_step][1]; - context->payload[2] = id_list[context->attack_step][2]; - context->payload[3] = id_list[context->attack_step][3]; - context->payload[4] = id_list[context->attack_step][4]; + if(context->proto == EM4100) { + context->protocol = + protocol_dict_get_protocol_by_name(context->dict, "EM4100"); - if(context->attack_step == 15) { - context->attack_step = 0; - counter = 0; - context->is_attacking = false; - notification_message(context->notify, &sequence_blink_stop); - notification_message(context->notify, &sequence_single_vibro); + context->payload[0] = id_list[context->attack_step][0]; + context->payload[1] = id_list[context->attack_step][1]; + context->payload[2] = id_list[context->attack_step][2]; + context->payload[3] = id_list[context->attack_step][3]; + context->payload[4] = id_list[context->attack_step][4]; - } else { - context->attack_step++; - } - break; - - case FlipFridAttackBfCustomerId: - context->payload[0] = context->attack_step; - context->payload[1] = 0x00; - context->payload[2] = 0x00; - context->payload[3] = 0x00; - context->payload[4] = 0x00; - - if(context->attack_step == 255) { - context->attack_step = 0; - counter = 0; - context->is_attacking = false; - notification_message(context->notify, &sequence_blink_stop); - notification_message(context->notify, &sequence_single_vibro); - } else { - context->attack_step++; - } - break; - case FlipFridAttackLoadFile: - context->payload[0] = context->data[0]; - context->payload[1] = context->data[1]; - context->payload[2] = context->data[2]; - context->payload[3] = context->data[3]; - context->payload[4] = context->data[4]; - - context->payload[context->key_index] = context->attack_step; - - if(context->attack_step == 255) { - context->attack_step = 0; - counter = 0; - context->is_attacking = false; - notification_message(context->notify, &sequence_blink_stop); - notification_message(context->notify, &sequence_single_vibro); + if(context->attack_step == 15) { + context->attack_step = 0; + counter = 0; + context->is_attacking = false; + notification_message(context->notify, &sequence_blink_stop); + notification_message(context->notify, &sequence_single_vibro); + } else { + context->attack_step++; + } break; } else { - context->attack_step++; + context->protocol = + protocol_dict_get_protocol_by_name(context->dict, "HIDProx"); + + context->payload[0] = id_list_hid[context->attack_step][0]; + context->payload[1] = id_list_hid[context->attack_step][1]; + context->payload[2] = id_list_hid[context->attack_step][2]; + context->payload[3] = id_list_hid[context->attack_step][3]; + context->payload[4] = id_list_hid[context->attack_step][4]; + context->payload[5] = id_list_hid[context->attack_step][5]; + + if(context->attack_step == 15) { + context->attack_step = 0; + counter = 0; + context->is_attacking = false; + notification_message(context->notify, &sequence_blink_stop); + notification_message(context->notify, &sequence_single_vibro); + + } else { + context->attack_step++; + } + break; } - break; - case FlipFridAttackLoadFileCustomUids: - while(true) { - string_reset(context->data_str); - if(!stream_read_line(context->uids_stream, context->data_str)) { + + case FlipFridAttackBfCustomerId: + if(context->proto == EM4100) { + context->protocol = + protocol_dict_get_protocol_by_name(context->dict, "EM4100"); + + context->payload[0] = context->attack_step; + context->payload[1] = 0x00; + context->payload[2] = 0x00; + context->payload[3] = 0x00; + context->payload[4] = 0x00; + + if(context->attack_step == 255) { + context->attack_step = 0; + counter = 0; + context->is_attacking = false; + notification_message(context->notify, &sequence_blink_stop); + notification_message(context->notify, &sequence_single_vibro); + } else { + context->attack_step++; + } + break; + } else { + context->protocol = + protocol_dict_get_protocol_by_name(context->dict, "HIDProx"); + + context->payload[0] = context->attack_step; + context->payload[1] = 0x00; + context->payload[2] = 0x00; + context->payload[3] = 0x00; + context->payload[4] = 0x00; + context->payload[5] = 0x00; + + if(context->attack_step == 255) { + context->attack_step = 0; + counter = 0; + context->is_attacking = false; + notification_message(context->notify, &sequence_blink_stop); + notification_message(context->notify, &sequence_single_vibro); + } else { + context->attack_step++; + } + break; + } + + case FlipFridAttackLoadFile: + if(context->proto == EM4100) { + context->protocol = + protocol_dict_get_protocol_by_name(context->dict, "EM4100"); + + context->payload[0] = context->data[0]; + context->payload[1] = context->data[1]; + context->payload[2] = context->data[2]; + context->payload[3] = context->data[3]; + context->payload[4] = context->data[4]; + + context->payload[context->key_index] = context->attack_step; + + if(context->attack_step == 255) { context->attack_step = 0; counter = 0; context->is_attacking = false; notification_message(context->notify, &sequence_blink_stop); notification_message(context->notify, &sequence_single_vibro); break; - }; - if(string_get_char(context->data_str, 0) == '#') continue; - if(string_size(context->data_str) != 11) continue; + } else { + context->attack_step++; + } + break; + } else { + context->protocol = + protocol_dict_get_protocol_by_name(context->dict, "HIDProx"); + + context->payload[0] = context->data[0]; + context->payload[1] = context->data[1]; + context->payload[2] = context->data[2]; + context->payload[3] = context->data[3]; + context->payload[4] = context->data[4]; + context->payload[5] = context->data[5]; + + context->payload[context->key_index] = context->attack_step; + + if(context->attack_step == 255) { + context->attack_step = 0; + counter = 0; + context->is_attacking = false; + notification_message(context->notify, &sequence_blink_stop); + notification_message(context->notify, &sequence_single_vibro); + break; + } else { + context->attack_step++; + } break; } - FURI_LOG_D(TAG, string_get_cstr(context->data_str)); - // string is valid, parse it in context->payload - for(uint8_t i = 0; i < 5; i++) { - char temp_str[3]; - temp_str[0] = string_get_cstr(context->data_str)[i * 2]; - temp_str[1] = string_get_cstr(context->data_str)[i * 2 + 1]; - temp_str[2] = '\0'; - context->payload[i] = (uint8_t)strtol(temp_str, NULL, 16); + case FlipFridAttackLoadFileCustomUids: + if(context->proto == EM4100) { + context->protocol = + protocol_dict_get_protocol_by_name(context->dict, "EM4100"); + + while(true) { + string_reset(context->data_str); + if(!stream_read_line(context->uids_stream, context->data_str)) { + context->attack_step = 0; + counter = 0; + context->is_attacking = false; + notification_message(context->notify, &sequence_blink_stop); + notification_message(context->notify, &sequence_single_vibro); + break; + }; + if(string_get_char(context->data_str, 0) == '#') continue; + if(string_size(context->data_str) != 11) continue; + break; + } + FURI_LOG_D(TAG, string_get_cstr(context->data_str)); + + // string is valid, parse it in context->payload + for(uint8_t i = 0; i < 5; i++) { + char temp_str[3]; + temp_str[0] = string_get_cstr(context->data_str)[i * 2]; + temp_str[1] = string_get_cstr(context->data_str)[i * 2 + 1]; + temp_str[2] = '\0'; + context->payload[i] = (uint8_t)strtol(temp_str, NULL, 16); + } + break; + } else { + context->protocol = + protocol_dict_get_protocol_by_name(context->dict, "HIDProx"); + + while(true) { + string_reset(context->data_str); + if(!stream_read_line(context->uids_stream, context->data_str)) { + context->attack_step = 0; + counter = 0; + context->is_attacking = false; + notification_message(context->notify, &sequence_blink_stop); + notification_message(context->notify, &sequence_single_vibro); + break; + }; + if(string_get_char(context->data_str, 0) == '#') continue; + if(string_size(context->data_str) != 13) continue; + break; + } + FURI_LOG_D(TAG, string_get_cstr(context->data_str)); + + // string is valid, parse it in context->payload + for(uint8_t i = 0; i < 6; i++) { + char temp_str[3]; + temp_str[0] = string_get_cstr(context->data_str)[i * 2]; + temp_str[1] = string_get_cstr(context->data_str)[i * 2 + 1]; + temp_str[2] = '\0'; + context->payload[i] = (uint8_t)strtol(temp_str, NULL, 16); + } + break; } - break; } } @@ -190,16 +324,30 @@ void flipfrid_scene_run_attack_on_draw(Canvas* canvas, FlipFridState* context) { canvas_draw_str_aligned( canvas, 64, 8, AlignCenter, AlignTop, string_get_cstr(context->attack_name)); - char uid[16]; - snprintf( - uid, - sizeof(uid), - "%02X:%02X:%02X:%02X:%02X", - context->payload[0], - context->payload[1], - context->payload[2], - context->payload[3], - context->payload[4]); + char uid[18]; + if(context->protocol == protocol_dict_get_protocol_by_name(context->dict, "HIDProx")) { + snprintf( + uid, + sizeof(uid), + "%02X:%02X:%02X:%02X:%02X:%02X", + context->payload[0], + context->payload[1], + context->payload[2], + context->payload[3], + context->payload[4], + context->payload[5]); + } else { + snprintf( + uid, + sizeof(uid), + "%02X:%02X:%02X:%02X:%02X", + context->payload[0], + context->payload[1], + context->payload[2], + context->payload[3], + context->payload[4]); + } + canvas_draw_str_aligned(canvas, 64, 24, AlignCenter, AlignTop, uid); canvas_set_font(canvas, FontSecondary); diff --git a/applications/settings/notification_settings/notification_settings_app.c b/applications/settings/notification_settings/notification_settings_app.c index bfda689ea..db9a1a01f 100644 --- a/applications/settings/notification_settings/notification_settings_app.c +++ b/applications/settings/notification_settings/notification_settings_app.c @@ -60,19 +60,8 @@ const char* const delay_text[DELAY_COUNT] = { "10min", "30min", }; -const uint32_t delay_value[DELAY_COUNT] = { - 1000, - 5000, - 10000, - 15000, - 30000, - 60000, - 90000, - 120000, - 300000, - 600000, - 1800000 -}; +const uint32_t delay_value[DELAY_COUNT] = + {1000, 5000, 10000, 15000, 30000, 60000, 90000, 120000, 300000, 600000, 1800000}; #define VIBRO_COUNT 2 const char* const vibro_text[VIBRO_COUNT] = { diff --git a/lib/nfc/helpers/reader_analyzer.c b/lib/nfc/helpers/reader_analyzer.c index 90b917296..3d065d144 100644 --- a/lib/nfc/helpers/reader_analyzer.c +++ b/lib/nfc/helpers/reader_analyzer.c @@ -39,7 +39,8 @@ struct ReaderAnalyzer { NfcDebugPcap* pcap; }; -static FuriHalNfcDevData reader_analyzer_nfc_data[] = { //XXX +static FuriHalNfcDevData reader_analyzer_nfc_data[] = { + //XXX [ReaderAnalyzerNfcDataMfClassic] = {.sak = 0x08, .atqa = {0x44, 0x00}, @@ -101,7 +102,8 @@ int32_t reader_analyzer_thread(void* context) { ReaderAnalyzer* reader_analyzer_alloc() { ReaderAnalyzer* instance = malloc(sizeof(ReaderAnalyzer)); reader_analyzer_nfc_data[ReaderAnalyzerNfcDataMfClassic].cuid = rand(); //XXX - furi_hal_random_fill_buf((uint8_t*) &reader_analyzer_nfc_data[ReaderAnalyzerNfcDataMfClassic].uid, 7); + furi_hal_random_fill_buf( + (uint8_t*)&reader_analyzer_nfc_data[ReaderAnalyzerNfcDataMfClassic].uid, 7); instance->nfc_data = reader_analyzer_nfc_data[ReaderAnalyzerNfcDataMfClassic]; instance->alive = false; instance->stream =