Merge branch 'UNLEASHED' into 420

This commit is contained in:
RogueMaster
2022-09-20 17:56:54 -04:00
31 changed files with 408 additions and 151 deletions

View File

@@ -42,10 +42,7 @@ ARRAY_DEF(
#pragma GCC diagnostic push #pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wunused-function" #pragma GCC diagnostic ignored "-Wunused-function"
// Using in applications/archive/views/archive_browser_view.c // Using in applications/archive/views/archive_browser_view.c
static void archive_menu_add_item( static void archive_menu_add_item(ArchiveContextMenuItem_t* obj, string_t text, uint32_t event) {
ArchiveContextMenuItem_t* obj,
string_t text,
uint32_t event) {
string_init_move(obj->text, text); string_init_move(obj->text, text);
obj->event = event; obj->event = event;
} }

View File

@@ -133,7 +133,7 @@ bool archive_scene_browser_on_event(void* context, SceneManagerEvent event) {
case ArchiveBrowserEventFileMenuRename: case ArchiveBrowserEventFileMenuRename:
if(favorites) { if(favorites) {
browser->callback(ArchiveBrowserEventEnterFavMove, browser->context); 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 { } else {
// Added ability to rename files and folders // Added ability to rename files and folders
archive_show_file_menu(browser, false); archive_show_file_menu(browser, false);

View File

@@ -17,10 +17,13 @@ void nfc_scene_mf_classic_keys_list_on_enter(void* context) {
if(dict) { if(dict) {
mf_classic_dict_rewind(dict); mf_classic_dict_rewind(dict);
while(mf_classic_dict_get_next_key_str(dict, temp_key)) { while(mf_classic_dict_get_next_key_str(dict, temp_key)) {
if(index > 200) {
break;
}
char* current_key = (char*)malloc(sizeof(char) * 13); char* current_key = (char*)malloc(sizeof(char) * 13);
strncpy(current_key, string_get_cstr(temp_key), 12); strncpy(current_key, string_get_cstr(temp_key), 12);
MfClassicUserKeys_push_back(nfc->mfc_key_strs, current_key); MfClassicUserKeys_push_back(nfc->mfc_key_strs, current_key);
FURI_LOG_D("ListKeys", "Key %d: %s", index, current_key); FURI_LOG_T("ListKeys", "Key %d: %s", index, current_key);
submenu_add_item( submenu_add_item(
submenu, submenu,
current_key, current_key,

View File

@@ -45,7 +45,7 @@ void subghz_view_transmitter_add_data_to_show(
} }
static void subghz_view_transmitter_button_right(Canvas* canvas, const char* str) { static void subghz_view_transmitter_button_right(Canvas* canvas, const char* str) {
const uint8_t button_height = 13; const uint8_t button_height = 12;
const uint8_t vertical_offset = 3; const uint8_t vertical_offset = 3;
const uint8_t horizontal_offset = 1; const uint8_t horizontal_offset = 1;
const uint8_t string_width = canvas_string_width(canvas, str); const uint8_t string_width = canvas_string_width(canvas, str);
@@ -69,7 +69,10 @@ static void subghz_view_transmitter_button_right(Canvas* canvas, const char* str
canvas_invert_color(canvas); canvas_invert_color(canvas);
canvas_draw_icon( canvas_draw_icon(
canvas, x + horizontal_offset, y - button_height + vertical_offset, &I_ButtonCenter_7x7); canvas,
x + horizontal_offset,
y - button_height + vertical_offset - 1,
&I_ButtonCenter_7x7);
canvas_draw_str( canvas_draw_str(
canvas, x + horizontal_offset + icon_width_with_offset, y - vertical_offset, str); canvas, x + horizontal_offset + icon_width_with_offset, y - vertical_offset, str);
canvas_invert_color(canvas); canvas_invert_color(canvas);

View File

@@ -1,21 +1,35 @@
# Flipfrid # Flipfrid
Basic EM4100 Fuzzer Basic EM4100 and HIDProx Fuzzer.
## Why ## Why
Flipfrid is a simple Rfid fuzzer using EM4100 protocol (125khz). 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. 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 ## How
There is 4 modes : 1) Select the Protocol with the left and right arrows
- Default key loop over 16 factory/default keys and emulate each one after one ; 2) Select the Mode with the up and down arrows
- 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; ### Info
- Uids list: loop over a text file (one uid per line)
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 : TODO :
- blank screen on back press - blank screen on back press
- Add second byte test to `BF customer id`

View File

@@ -64,6 +64,7 @@ FlipFridState* flipfrid_alloc() {
flipfrid->is_attacking = false; flipfrid->is_attacking = false;
flipfrid->key_index = 0; flipfrid->key_index = 0;
flipfrid->menu_index = 0; flipfrid->menu_index = 0;
flipfrid->menu_proto_index = 0;
flipfrid->attack = FlipFridAttackDefaultValues; flipfrid->attack = FlipFridAttackDefaultValues;
flipfrid->notify = furi_record_open(RECORD_NOTIFICATION); flipfrid->notify = furi_record_open(RECORD_NOTIFICATION);
@@ -73,12 +74,14 @@ FlipFridState* flipfrid_alloc() {
flipfrid->data[2] = 0x00; flipfrid->data[2] = 0x00;
flipfrid->data[3] = 0x00; flipfrid->data[3] = 0x00;
flipfrid->data[4] = 0x00; flipfrid->data[4] = 0x00;
flipfrid->data[5] = 0x00;
flipfrid->payload[0] = 0x00; flipfrid->payload[0] = 0x00;
flipfrid->payload[1] = 0x00; flipfrid->payload[1] = 0x00;
flipfrid->payload[2] = 0x00; flipfrid->payload[2] = 0x00;
flipfrid->payload[3] = 0x00; flipfrid->payload[3] = 0x00;
flipfrid->payload[4] = 0x00; flipfrid->payload[4] = 0x00;
flipfrid->payload[5] = 0x00;
//Dialog //Dialog
flipfrid->dialogs = furi_record_open(RECORD_DIALOGS); flipfrid->dialogs = furi_record_open(RECORD_DIALOGS);

View File

@@ -28,6 +28,11 @@ typedef enum {
FlipFridAttackLoadFileCustomUids, FlipFridAttackLoadFileCustomUids,
} FlipFridAttacks; } FlipFridAttacks;
typedef enum {
EM4100,
HIDProx,
} FlipFridProtos;
typedef enum { typedef enum {
NoneScene, NoneScene,
SceneEntryPoint, SceneEntryPoint,
@@ -56,13 +61,16 @@ typedef struct {
FlipFridScene previous_scene; FlipFridScene previous_scene;
NotificationApp* notify; NotificationApp* notify;
u_int8_t menu_index; u_int8_t menu_index;
u_int8_t menu_proto_index;
string_t data_str; string_t data_str;
uint8_t data[5]; uint8_t data[6];
uint8_t payload[5]; uint8_t payload[6];
uint8_t attack_step; uint8_t attack_step;
FlipFridAttacks attack; FlipFridAttacks attack;
FlipFridProtos proto;
string_t attack_name; string_t attack_name;
string_t proto_name;
DialogsApp* dialogs; DialogsApp* dialogs;
string_t notification_msg; string_t notification_msg;

View File

@@ -1,8 +1,12 @@
#include "flipfrid_scene_entrypoint.h" #include "flipfrid_scene_entrypoint.h"
string_t menu_items[4]; 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) { switch(index) {
case FlipFridAttackDefaultValues: case FlipFridAttackDefaultValues:
context->attack = FlipFridAttackDefaultValues; context->attack = FlipFridAttackDefaultValues;
@@ -27,6 +31,19 @@ void flipfrid_scene_entrypoint_menu_callback(FlipFridState* context, uint32_t in
default: default:
break; 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) { 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[2] = 0x00;
context->payload[3] = 0x00; context->payload[3] = 0x00;
context->payload[4] = 0x00; context->payload[4] = 0x00;
context->payload[5] = 0x00;
context->menu_index = 0; context->menu_index = 0;
for(uint32_t i = 0; i < 4; i++) { 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[1], "BF Customer ID");
string_set(menu_items[2], "Load File"); string_set(menu_items[2], "Load File");
string_set(menu_items[3], "Load uids from 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) { 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++) { for(uint32_t i = 0; i < 4; i++) {
string_clear(menu_items[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) { void flipfrid_scene_entrypoint_on_tick(FlipFridState* context) {
@@ -74,10 +104,18 @@ void flipfrid_scene_entrypoint_on_event(FlipFridEvent event, FlipFridState* cont
} }
break; break;
case InputKeyLeft: case InputKeyLeft:
if(context->menu_proto_index > EM4100) {
context->menu_proto_index--;
}
break;
case InputKeyRight: case InputKeyRight:
if(context->menu_proto_index < HIDProx) {
context->menu_proto_index++;
}
break; break;
case InputKeyOk: 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; break;
case InputKeyBack: case InputKeyBack:
context->is_running = false; context->is_running = false;
@@ -91,10 +129,6 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) {
canvas_clear(canvas); canvas_clear(canvas);
canvas_set_color(canvas, ColorBlack); 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) { if(context->menu_index > FlipFridAttackDefaultValues) {
canvas_set_font(canvas, FontSecondary); canvas_set_font(canvas, FontSecondary);
canvas_draw_str_aligned( canvas_draw_str_aligned(
@@ -120,4 +154,41 @@ void flipfrid_scene_entrypoint_on_draw(Canvas* canvas, FlipFridState* context) {
AlignTop, AlignTop,
string_get_cstr(menu_items[context->menu_index + 1])); 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]));
}
} }

View File

@@ -36,11 +36,21 @@ bool flipfrid_load(FlipFridState* context, const char* file_path) {
break; break;
} else { } else {
FURI_LOG_I(TAG, "Key type: %s", string_get_cstr(temp_str)); 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"); if(context->proto == EM4100) {
string_reset(context->notification_msg); if(strcmp(string_get_cstr(temp_str), "EM4100") != 0) {
string_set_str(context->notification_msg, "Unsupported Key type"); FURI_LOG_E(TAG, "Unsupported Key type");
break; 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 { } else {
FURI_LOG_I(TAG, "Key: %s", string_get_cstr(context->data_str)); FURI_LOG_I(TAG, "Key: %s", string_get_cstr(context->data_str));
// Check data size if(context->proto == EM4100) {
if(string_size(context->data_str) != 14) { if(string_size(context->data_str) != 14) {
FURI_LOG_E(TAG, "Incorrect Key length"); FURI_LOG_E(TAG, "Incorrect Key length");
string_reset(context->notification_msg); string_reset(context->notification_msg);
string_set_str(context->notification_msg, "Incorrect Key length"); string_set_str(context->notification_msg, "Incorrect Key length");
break; 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 // String to uint8_t
for(uint8_t i = 0; i < 5; i++) { for(uint8_t i = 0; i < 6; i++) {
char temp_str2[3]; char temp_str2[3];
temp_str2[0] = string_get_cstr(context->data_str)[i * 3]; temp_str2[0] = string_get_cstr(context->data_str)[i * 3];
temp_str2[1] = string_get_cstr(context->data_str)[i * 3 + 1]; temp_str2[1] = string_get_cstr(context->data_str)[i * 3 + 1];

View File

@@ -2,8 +2,8 @@
#include <gui/elements.h> #include <gui/elements.h>
uint8_t counter = 0; uint8_t counter = 0;
#define TIME_BETWEEN_CARDS 5 #define TIME_BETWEEN_CARDS 6
uint8_t id_list[16][5] = { uint8_t id_list[17][5] = {
{0x00, 0x00, 0x00, 0x00, 0x00}, // Null bytes {0x00, 0x00, 0x00, 0x00, 0x00}, // Null bytes
{0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, // Only FF {0xFF, 0xFF, 0xFF, 0xFF, 0xFF}, // Only FF
{0x11, 0x11, 0x11, 0x11, 0x11}, // Only 11 {0x11, 0x11, 0x11, 0x11, 0x11}, // Only 11
@@ -16,17 +16,34 @@ uint8_t id_list[16][5] = {
{0x88, 0x88, 0x88, 0x88, 0x88}, // Only 88 {0x88, 0x88, 0x88, 0x88, 0x88}, // Only 88
{0x99, 0x99, 0x99, 0x99, 0x99}, // Only 99 {0x99, 0x99, 0x99, 0x99, 0x99}, // Only 99
{0x12, 0x34, 0x56, 0x78, 0x9A}, // Incremental UID {0x12, 0x34, 0x56, 0x78, 0x9A}, // Incremental UID
{0x9A, 0x78, 0x56, 0x34, 0x12}, // Decremental UID
{0x04, 0xd0, 0x9b, 0x0d, 0x6a}, // From arha {0x04, 0xd0, 0x9b, 0x0d, 0x6a}, // From arha
{0x34, 0x00, 0x29, 0x3d, 0x9e}, // From arha {0x34, 0x00, 0x29, 0x3d, 0x9e}, // From arha
{0x04, 0xdf, 0x00, 0x00, 0x01}, // From arha {0x04, 0xdf, 0x00, 0x00, 0x01}, // From arha
{0xCA, 0xCA, 0xCA, 0xCA, 0xCA}, // 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) { void flipfrid_scene_run_attack_on_enter(FlipFridState* context) {
context->attack_step = 0; context->attack_step = 0;
context->dict = protocol_dict_alloc(lfrfid_protocols, LFRFIDProtocolMax); context->dict = protocol_dict_alloc(lfrfid_protocols, LFRFIDProtocolMax);
context->worker = lfrfid_worker_alloc(context->dict); 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) { 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) { void flipfrid_scene_run_attack_on_tick(FlipFridState* context) {
if(context->is_attacking) { if(context->is_attacking) {
if(1 == counter) { 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); lfrfid_worker_free(context->worker);
context->worker = lfrfid_worker_alloc(context->dict); context->worker = lfrfid_worker_alloc(context->dict);
lfrfid_worker_start_thread(context->worker); 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); lfrfid_worker_stop_thread(context->worker);
switch(context->attack) { switch(context->attack) {
case FlipFridAttackDefaultValues: case FlipFridAttackDefaultValues:
context->payload[0] = id_list[context->attack_step][0]; if(context->proto == EM4100) {
context->payload[1] = id_list[context->attack_step][1]; context->protocol =
context->payload[2] = id_list[context->attack_step][2]; protocol_dict_get_protocol_by_name(context->dict, "EM4100");
context->payload[3] = id_list[context->attack_step][3];
context->payload[4] = id_list[context->attack_step][4];
if(context->attack_step == 15) { context->payload[0] = id_list[context->attack_step][0];
context->attack_step = 0; context->payload[1] = id_list[context->attack_step][1];
counter = 0; context->payload[2] = id_list[context->attack_step][2];
context->is_attacking = false; context->payload[3] = id_list[context->attack_step][3];
notification_message(context->notify, &sequence_blink_stop); context->payload[4] = id_list[context->attack_step][4];
notification_message(context->notify, &sequence_single_vibro);
} else { if(context->attack_step == 15) {
context->attack_step++; context->attack_step = 0;
} counter = 0;
break; context->is_attacking = false;
notification_message(context->notify, &sequence_blink_stop);
case FlipFridAttackBfCustomerId: notification_message(context->notify, &sequence_single_vibro);
context->payload[0] = context->attack_step; } else {
context->payload[1] = 0x00; context->attack_step++;
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);
break; break;
} else { } 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: case FlipFridAttackBfCustomerId:
while(true) { if(context->proto == EM4100) {
string_reset(context->data_str); context->protocol =
if(!stream_read_line(context->uids_stream, context->data_str)) { 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; context->attack_step = 0;
counter = 0; counter = 0;
context->is_attacking = false; context->is_attacking = false;
notification_message(context->notify, &sequence_blink_stop); notification_message(context->notify, &sequence_blink_stop);
notification_message(context->notify, &sequence_single_vibro); notification_message(context->notify, &sequence_single_vibro);
break; break;
}; } else {
if(string_get_char(context->data_str, 0) == '#') continue; context->attack_step++;
if(string_size(context->data_str) != 11) continue; }
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; break;
} }
FURI_LOG_D(TAG, string_get_cstr(context->data_str));
// string is valid, parse it in context->payload case FlipFridAttackLoadFileCustomUids:
for(uint8_t i = 0; i < 5; i++) { if(context->proto == EM4100) {
char temp_str[3]; context->protocol =
temp_str[0] = string_get_cstr(context->data_str)[i * 2]; protocol_dict_get_protocol_by_name(context->dict, "EM4100");
temp_str[1] = string_get_cstr(context->data_str)[i * 2 + 1];
temp_str[2] = '\0'; while(true) {
context->payload[i] = (uint8_t)strtol(temp_str, NULL, 16); 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_draw_str_aligned(
canvas, 64, 8, AlignCenter, AlignTop, string_get_cstr(context->attack_name)); canvas, 64, 8, AlignCenter, AlignTop, string_get_cstr(context->attack_name));
char uid[16]; char uid[18];
snprintf( if(context->protocol == protocol_dict_get_protocol_by_name(context->dict, "HIDProx")) {
uid, snprintf(
sizeof(uid), uid,
"%02X:%02X:%02X:%02X:%02X", sizeof(uid),
context->payload[0], "%02X:%02X:%02X:%02X:%02X:%02X",
context->payload[1], context->payload[0],
context->payload[2], context->payload[1],
context->payload[3], context->payload[2],
context->payload[4]); 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_draw_str_aligned(canvas, 64, 24, AlignCenter, AlignTop, uid);
canvas_set_font(canvas, FontSecondary); canvas_set_font(canvas, FontSecondary);

View File

@@ -60,19 +60,8 @@ const char* const delay_text[DELAY_COUNT] = {
"10min", "10min",
"30min", "30min",
}; };
const uint32_t delay_value[DELAY_COUNT] = { const uint32_t delay_value[DELAY_COUNT] =
1000, {1000, 5000, 10000, 15000, 30000, 60000, 90000, 120000, 300000, 600000, 1800000};
5000,
10000,
15000,
30000,
60000,
90000,
120000,
300000,
600000,
1800000
};
#define VIBRO_COUNT 2 #define VIBRO_COUNT 2
const char* const vibro_text[VIBRO_COUNT] = { const char* const vibro_text[VIBRO_COUNT] = {

View File

@@ -39,7 +39,8 @@ struct ReaderAnalyzer {
NfcDebugPcap* pcap; NfcDebugPcap* pcap;
}; };
static FuriHalNfcDevData reader_analyzer_nfc_data[] = { //XXX static FuriHalNfcDevData reader_analyzer_nfc_data[] = {
//XXX
[ReaderAnalyzerNfcDataMfClassic] = [ReaderAnalyzerNfcDataMfClassic] =
{.sak = 0x08, {.sak = 0x08,
.atqa = {0x44, 0x00}, .atqa = {0x44, 0x00},
@@ -101,7 +102,8 @@ int32_t reader_analyzer_thread(void* context) {
ReaderAnalyzer* reader_analyzer_alloc() { ReaderAnalyzer* reader_analyzer_alloc() {
ReaderAnalyzer* instance = malloc(sizeof(ReaderAnalyzer)); ReaderAnalyzer* instance = malloc(sizeof(ReaderAnalyzer));
reader_analyzer_nfc_data[ReaderAnalyzerNfcDataMfClassic].cuid = rand(); //XXX 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->nfc_data = reader_analyzer_nfc_data[ReaderAnalyzerNfcDataMfClassic];
instance->alive = false; instance->alive = false;
instance->stream = instance->stream =

View File

@@ -173,7 +173,7 @@ bool subghz_protocol_encoder_bett_deserialize(void* context, FlipperFormat* flip
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_bett_get_upload(instance); if(!subghz_protocol_encoder_bett_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -162,7 +162,7 @@ bool subghz_protocol_encoder_came_deserialize(void* context, FlipperFormat* flip
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_came_get_upload(instance); if(!subghz_protocol_encoder_came_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -155,7 +155,7 @@ static bool
break; break;
default: default:
furi_crash(TAG " unknown protocol."); FURI_LOG_E(TAG, "Invalid bits count");
return false; return false;
break; break;
} }
@@ -224,7 +224,7 @@ bool subghz_protocol_encoder_chamb_code_deserialize(void* context, FlipperFormat
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_chamb_code_get_upload(instance); if(!subghz_protocol_encoder_chamb_code_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -173,7 +173,7 @@ bool subghz_protocol_encoder_clemsa_deserialize(void* context, FlipperFormat* fl
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_clemsa_get_upload(instance); if(!subghz_protocol_encoder_clemsa_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -154,7 +154,7 @@ bool subghz_protocol_encoder_doitrand_deserialize(void* context, FlipperFormat*
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_doitrand_get_upload(instance); if(!subghz_protocol_encoder_doitrand_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -147,7 +147,7 @@ bool subghz_protocol_encoder_gate_tx_deserialize(void* context, FlipperFormat* f
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_gate_tx_get_upload(instance); if(!subghz_protocol_encoder_gate_tx_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -160,7 +160,7 @@ bool subghz_protocol_encoder_holtek_deserialize(void* context, FlipperFormat* fl
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_holtek_get_upload(instance); if(!subghz_protocol_encoder_holtek_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -162,7 +162,7 @@ bool subghz_protocol_encoder_honeywell_wdb_deserialize(
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_honeywell_wdb_get_upload(instance); if(!subghz_protocol_encoder_honeywell_wdb_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -163,7 +163,7 @@ bool subghz_protocol_encoder_hormann_deserialize(void* context, FlipperFormat* f
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_hormann_get_upload(instance); if(!subghz_protocol_encoder_hormann_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -179,7 +179,7 @@ bool subghz_protocol_encoder_intertechno_v3_deserialize(
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_intertechno_v3_get_upload(instance); if(!subghz_protocol_encoder_intertechno_v3_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -359,7 +359,7 @@ bool subghz_protocol_encoder_keeloq_deserialize(void* context, FlipperFormat* fl
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_keeloq_get_upload(instance, instance->generic.btn); if(!subghz_protocol_encoder_keeloq_get_upload(instance, instance->generic.btn)) break;
if(!flipper_format_rewind(flipper_format)) { if(!flipper_format_rewind(flipper_format)) {
FURI_LOG_E(TAG, "Rewind error"); FURI_LOG_E(TAG, "Rewind error");

View File

@@ -165,7 +165,7 @@ bool subghz_protocol_encoder_linear_deserialize(void* context, FlipperFormat* fl
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_linear_get_upload(instance); if(!subghz_protocol_encoder_linear_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -168,7 +168,7 @@ bool subghz_protocol_encoder_magellen_deserialize(void* context, FlipperFormat*
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_magellen_get_upload(instance); if(!subghz_protocol_encoder_magellen_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;
@@ -381,7 +381,7 @@ static void subghz_protocol_magellen_get_event_serialize(uint8_t event, string_t
"%s%s%s%s%s%s%s%s", "%s%s%s%s%s%s%s%s",
((event >> 4) & 0x1 ? (event & 0x1 ? " Open" : " Close") : ((event >> 4) & 0x1 ? (event & 0x1 ? " Open" : " Close") :
(event & 0x1 ? " Motion" : " Ok")), (event & 0x1 ? " Motion" : " Ok")),
((event >> 1) & 0x1 ? ", Tamper On (Alarm)" : ""), ((event >> 1) & 0x1 ? ", Tamper On\n(Alarm)" : ""),
((event >> 2) & 0x1 ? ", ?" : ""), ((event >> 2) & 0x1 ? ", ?" : ""),
((event >> 3) & 0x1 ? ", Power On" : ""), ((event >> 3) & 0x1 ? ", Power On" : ""),
((event >> 4) & 0x1 ? ", MT:Wireless_Reed" : ""), ((event >> 4) & 0x1 ? ", MT:Wireless_Reed" : ""),

View File

@@ -193,7 +193,7 @@ bool subghz_protocol_encoder_megacode_deserialize(void* context, FlipperFormat*
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_megacode_get_upload(instance); if(!subghz_protocol_encoder_megacode_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -172,7 +172,7 @@ bool subghz_protocol_encoder_nero_radio_deserialize(void* context, FlipperFormat
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_nero_radio_get_upload(instance); if(!subghz_protocol_encoder_nero_radio_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -166,7 +166,7 @@ bool subghz_protocol_encoder_nero_sketch_deserialize(void* context, FlipperForma
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_nero_sketch_get_upload(instance); if(!subghz_protocol_encoder_nero_sketch_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -149,7 +149,7 @@ bool subghz_protocol_encoder_nice_flo_deserialize(void* context, FlipperFormat*
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_nice_flo_get_upload(instance); if(!subghz_protocol_encoder_nice_flo_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -150,7 +150,7 @@ bool subghz_protocol_encoder_phoenix_v2_deserialize(void* context, FlipperFormat
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_phoenix_v2_get_upload(instance); if(!subghz_protocol_encoder_phoenix_v2_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;

View File

@@ -167,7 +167,7 @@ bool subghz_protocol_encoder_princeton_deserialize(void* context, FlipperFormat*
flipper_format_read_uint32( flipper_format_read_uint32(
flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1); flipper_format, "Repeat", (uint32_t*)&instance->encoder.repeat, 1);
subghz_protocol_encoder_princeton_get_upload(instance); if(!subghz_protocol_encoder_princeton_get_upload(instance)) break;
instance->encoder.is_running = true; instance->encoder.is_running = true;
res = true; res = true;