[FL-3060] New MFC Bruteforce animation (#2190)

* Change the wording in the headers
* Add support for text in the progress bar
* New MFC key bruteforce screen
* Typo fix
* nfc: rename Flipper Dict to System Dict
* elements: fix types
* Display the correct key attack sector

Co-authored-by: gornekich <n.gorbadey@gmail.com>
Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
Astra 2022-12-27 11:14:03 +02:00 committed by GitHub
parent 08eb666f7b
commit ded7e727d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
15 changed files with 130 additions and 23 deletions

View File

@ -43,7 +43,7 @@ bool nfc_scene_extra_actions_on_event(void* context, SceneManagerEvent event) {
if(event.type == SceneManagerEventTypeCustom) { if(event.type == SceneManagerEventTypeCustom) {
if(event.event == SubmenuIndexMfClassicKeys) { 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); scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicKeys);
} else { } else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound); scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);

View File

@ -53,10 +53,10 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(Nfc* nfc, DictAttackSt
// Setup view // Setup view
if(state == DictAttackStateUserDictInProgress) { if(state == DictAttackStateUserDictInProgress) {
worker_state = NfcWorkerStateMfClassicDictAttack; 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); 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) { if(!dict) {
FURI_LOG_E(TAG, "User dictionary not found"); FURI_LOG_E(TAG, "User dictionary not found");
state = DictAttackStateFlipperDictInProgress; state = DictAttackStateFlipperDictInProgress;
@ -64,11 +64,11 @@ static void nfc_scene_mf_classic_dict_attack_prepare_view(Nfc* nfc, DictAttackSt
} }
if(state == DictAttackStateFlipperDictInProgress) { if(state == DictAttackStateFlipperDictInProgress) {
worker_state = NfcWorkerStateMfClassicDictAttack; worker_state = NfcWorkerStateMfClassicDictAttack;
dict_attack_set_header(nfc->dict_attack, "Mf Classic Flipper Dict."); dict_attack_set_header(nfc->dict_attack, "MF Classic System Dictionary");
dict = mf_classic_dict_alloc(MfClassicDictTypeFlipper); dict = mf_classic_dict_alloc(MfClassicDictTypeSystem);
if(!dict) { if(!dict) {
FURI_LOG_E(TAG, "Flipper dictionary not found"); FURI_LOG_E(TAG, "Flipper dictionary not found");
// Pass through to let worker handle the failure // Pass through to let the worker handle the failure
} }
} }
// Free previous dictionary // Free previous dictionary
@ -153,6 +153,15 @@ bool nfc_scene_mf_classic_dict_attack_on_event(void* context, SceneManagerEvent
nfc_worker_stop(nfc->worker); nfc_worker_stop(nfc->worker);
consumed = true; 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) { } else if(event.type == SceneManagerEventTypeBack) {
scene_manager_next_scene(nfc->scene_manager, NfcSceneExitConfirm); scene_manager_next_scene(nfc->scene_manager, NfcSceneExitConfirm);

View File

@ -12,7 +12,7 @@ void nfc_scene_mf_classic_keys_on_enter(void* context) {
// Load flipper dict keys total // Load flipper dict keys total
uint32_t flipper_dict_keys_total = 0; uint32_t flipper_dict_keys_total = 0;
MfClassicDict* dict = mf_classic_dict_alloc(MfClassicDictTypeFlipper); MfClassicDict* dict = mf_classic_dict_alloc(MfClassicDictTypeSystem);
if(dict) { if(dict) {
flipper_dict_keys_total = mf_classic_dict_get_total_keys(dict); flipper_dict_keys_total = mf_classic_dict_get_total_keys(dict);
mf_classic_dict_free(dict); mf_classic_dict_free(dict);
@ -26,11 +26,11 @@ void nfc_scene_mf_classic_keys_on_enter(void* context) {
} }
widget_add_string_element( 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]; char temp_str[32];
snprintf(temp_str, sizeof(temp_str), "Flipper list: %lu", flipper_dict_keys_total); snprintf(temp_str, sizeof(temp_str), "System dict: %lu", flipper_dict_keys_total);
widget_add_string_element(nfc->widget, 0, 20, AlignLeft, AlignTop, FontSecondary, temp_str); widget_add_string_element(nfc->widget, 0, 20, AlignLeft, AlignTop, FontSecondary, temp_str);
snprintf(temp_str, sizeof(temp_str), "User list: %lu", user_dict_keys_total); snprintf(temp_str, sizeof(temp_str), "User dict: %lu", user_dict_keys_total);
widget_add_string_element(nfc->widget, 0, 32, AlignLeft, AlignTop, FontSecondary, temp_str); widget_add_string_element(nfc->widget, 0, 32, AlignLeft, AlignTop, FontSecondary, temp_str);
widget_add_button_element( widget_add_button_element(
nfc->widget, GuiButtonTypeCenter, "Add", nfc_scene_mf_classic_keys_widget_callback, nfc); nfc->widget, GuiButtonTypeCenter, "Add", nfc_scene_mf_classic_keys_widget_callback, nfc);

View File

@ -91,7 +91,7 @@ bool nfc_scene_read_on_event(void* context, SceneManagerEvent event) {
DOLPHIN_DEED(DolphinDeedNfcReadSuccess); DOLPHIN_DEED(DolphinDeedNfcReadSuccess);
consumed = true; consumed = true;
} else if(event.event == NfcWorkerEventReadMfClassicDictAttackRequired) { } 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); scene_manager_next_scene(nfc->scene_manager, NfcSceneMfClassicDictAttack);
} else { } else {
scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound); scene_manager_next_scene(nfc->scene_manager, NfcSceneDictNotFound);

View File

@ -24,6 +24,8 @@ typedef struct {
uint8_t keys_found; uint8_t keys_found;
uint16_t dict_keys_total; uint16_t dict_keys_total;
uint16_t dict_keys_current; uint16_t dict_keys_current;
bool is_key_attack;
uint8_t key_attack_current_sector;
} DictAttackViewModel; } DictAttackViewModel;
static void dict_attack_draw_callback(Canvas* canvas, void* model) { 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."); canvas, 64, 23, AlignCenter, AlignTop, "Make sure the tag is\npositioned correctly.");
} else if(m->state == DictAttackStateRead) { } else if(m->state == DictAttackStateRead) {
char draw_str[32] = {}; 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_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 ? float dict_progress = m->dict_keys_total == 0 ?
0 : 0 :
(float)(m->dict_keys_current) / (float)(m->dict_keys_total); (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) { if(progress > 1.0) {
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); canvas_set_font(canvas, FontSecondary);
snprintf(draw_str, sizeof(draw_str), "Keys found: %d/%d", m->keys_found, m->keys_total); 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( snprintf(
draw_str, sizeof(draw_str), "Sectors Read: %d/%d", m->sectors_read, m->sectors_total); 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"); elements_button_center(canvas, "Skip");
} }
@ -113,6 +125,7 @@ void dict_attack_reset(DictAttack* dict_attack) {
model->keys_found = 0; model->keys_found = 0;
model->dict_keys_total = 0; model->dict_keys_total = 0;
model->dict_keys_current = 0; model->dict_keys_current = 0;
model->is_key_attack = false;
furi_string_reset(model->header); furi_string_reset(model->header);
}, },
false); false);
@ -235,3 +248,28 @@ void dict_attack_inc_current_dict_key(DictAttack* dict_attack, uint16_t keys_tri
}, },
true); 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);
}

View File

@ -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_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_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);

View File

@ -17,6 +17,7 @@ extern "C" {
typedef enum { typedef enum {
ColorWhite = 0x00, ColorWhite = 0x00,
ColorBlack = 0x01, ColorBlack = 0x01,
ColorXOR = 0x02,
} Color; } Color;
/** Fonts enumeration */ /** Fonts enumeration */

View File

@ -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); 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( void elements_scrollbar_pos(
Canvas* canvas, Canvas* canvas,
uint8_t x, uint8_t x,

View File

@ -31,6 +31,23 @@ extern "C" {
*/ */
void elements_progress_bar(Canvas* canvas, uint8_t x, uint8_t y, uint8_t width, float progress); 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. /** Draw scrollbar on canvas at specific position.
* *
* @param canvas Canvas instance * @param canvas Canvas instance

View File

@ -1,5 +1,5 @@
entry,status,name,type,params entry,status,name,type,params
Version,+,11.2,, Version,+,11.3,,
Header,+,applications/services/bt/bt_service/bt.h,, Header,+,applications/services/bt/bt_service/bt.h,,
Header,+,applications/services/cli/cli.h,, Header,+,applications/services/cli/cli.h,,
Header,+,applications/services/cli/cli_vcp.h,, Header,+,applications/services/cli/cli_vcp.h,,
@ -562,8 +562,8 @@ Function,+,ble_glue_wait_for_c2_start,_Bool,int32_t
Function,-,bsearch,void*,"const void*, const void*, size_t, size_t, __compar_fn_t" Function,-,bsearch,void*,"const void*, const void*, size_t, size_t, __compar_fn_t"
Function,+,bt_disconnect,void,Bt* Function,+,bt_disconnect,void,Bt*
Function,+,bt_forget_bonded_devices,void,Bt* Function,+,bt_forget_bonded_devices,void,Bt*
Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*"
Function,+,bt_keys_storage_set_default_path,void,Bt* Function,+,bt_keys_storage_set_default_path,void,Bt*
Function,+,bt_keys_storage_set_storage_path,void,"Bt*, const char*"
Function,+,bt_set_profile,_Bool,"Bt*, BtProfile" Function,+,bt_set_profile,_Bool,"Bt*, BtProfile"
Function,+,bt_set_status_changed_callback,void,"Bt*, BtStatusChangedCallback, void*" Function,+,bt_set_status_changed_callback,void,"Bt*, BtStatusChangedCallback, void*"
Function,+,buffered_file_stream_alloc,Stream*,Storage* Function,+,buffered_file_stream_alloc,Stream*,Storage*
@ -754,6 +754,7 @@ Function,+,elements_multiline_text,void,"Canvas*, uint8_t, uint8_t, const char*"
Function,+,elements_multiline_text_aligned,void,"Canvas*, uint8_t, uint8_t, Align, Align, const char*" Function,+,elements_multiline_text_aligned,void,"Canvas*, uint8_t, uint8_t, Align, Align, const char*"
Function,+,elements_multiline_text_framed,void,"Canvas*, uint8_t, uint8_t, const char*" Function,+,elements_multiline_text_framed,void,"Canvas*, uint8_t, uint8_t, const char*"
Function,+,elements_progress_bar,void,"Canvas*, uint8_t, uint8_t, uint8_t, float" Function,+,elements_progress_bar,void,"Canvas*, uint8_t, uint8_t, uint8_t, float"
Function,+,elements_progress_bar_with_text,void,"Canvas*, uint8_t, uint8_t, uint8_t, float, const char*"
Function,+,elements_scrollable_text_line,void,"Canvas*, uint8_t, uint8_t, uint8_t, FuriString*, size_t, _Bool" Function,+,elements_scrollable_text_line,void,"Canvas*, uint8_t, uint8_t, uint8_t, FuriString*, size_t, _Bool"
Function,+,elements_scrollbar,void,"Canvas*, uint16_t, uint16_t" Function,+,elements_scrollbar,void,"Canvas*, uint16_t, uint16_t"
Function,+,elements_scrollbar_pos,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint16_t, uint16_t" Function,+,elements_scrollbar_pos,void,"Canvas*, uint8_t, uint8_t, uint8_t, uint16_t, uint16_t"

1 entry status name type params
2 Version + 11.2 11.3
3 Header + applications/services/bt/bt_service/bt.h
4 Header + applications/services/cli/cli.h
5 Header + applications/services/cli/cli_vcp.h
562 Function - bsearch void* const void*, const void*, size_t, size_t, __compar_fn_t
563 Function + bt_disconnect void Bt*
564 Function + bt_forget_bonded_devices void Bt*
Function + bt_keys_storage_set_storage_path void Bt*, const char*
565 Function + bt_keys_storage_set_default_path void Bt*
566 Function + bt_keys_storage_set_storage_path void Bt*, const char*
567 Function + bt_set_profile _Bool Bt*, BtProfile
568 Function + bt_set_status_changed_callback void Bt*, BtStatusChangedCallback, void*
569 Function + buffered_file_stream_alloc Stream* Storage*
754 Function + elements_multiline_text_aligned void Canvas*, uint8_t, uint8_t, Align, Align, const char*
755 Function + elements_multiline_text_framed void Canvas*, uint8_t, uint8_t, const char*
756 Function + elements_progress_bar void Canvas*, uint8_t, uint8_t, uint8_t, float
757 Function + elements_progress_bar_with_text void Canvas*, uint8_t, uint8_t, uint8_t, float, const char*
758 Function + elements_scrollable_text_line void Canvas*, uint8_t, uint8_t, uint8_t, FuriString*, size_t, _Bool
759 Function + elements_scrollbar void Canvas*, uint16_t, uint16_t
760 Function + elements_scrollbar_pos void Canvas*, uint8_t, uint8_t, uint8_t, uint16_t, uint16_t

View File

@ -20,7 +20,7 @@ bool mf_classic_dict_check_presence(MfClassicDictType dict_type) {
Storage* storage = furi_record_open(RECORD_STORAGE); Storage* storage = furi_record_open(RECORD_STORAGE);
bool dict_present = false; bool dict_present = false;
if(dict_type == MfClassicDictTypeFlipper) { if(dict_type == MfClassicDictTypeSystem) {
dict_present = storage_common_stat(storage, MF_CLASSIC_DICT_FLIPPER_PATH, NULL) == FSE_OK; dict_present = storage_common_stat(storage, MF_CLASSIC_DICT_FLIPPER_PATH, NULL) == FSE_OK;
} else if(dict_type == MfClassicDictTypeUser) { } else if(dict_type == MfClassicDictTypeUser) {
dict_present = storage_common_stat(storage, MF_CLASSIC_DICT_USER_PATH, NULL) == FSE_OK; dict_present = storage_common_stat(storage, MF_CLASSIC_DICT_USER_PATH, NULL) == FSE_OK;
@ -42,7 +42,7 @@ MfClassicDict* mf_classic_dict_alloc(MfClassicDictType dict_type) {
bool dict_loaded = false; bool dict_loaded = false;
do { do {
if(dict_type == MfClassicDictTypeFlipper) { if(dict_type == MfClassicDictTypeSystem) {
if(!buffered_file_stream_open( if(!buffered_file_stream_open(
dict->stream, dict->stream,
MF_CLASSIC_DICT_FLIPPER_PATH, MF_CLASSIC_DICT_FLIPPER_PATH,

View File

@ -8,7 +8,7 @@
typedef enum { typedef enum {
MfClassicDictTypeUser, MfClassicDictTypeUser,
MfClassicDictTypeFlipper, MfClassicDictTypeSystem,
MfClassicDictTypeUnitTest, MfClassicDictTypeUnitTest,
} MfClassicDictType; } MfClassicDictType;

View File

@ -18,7 +18,7 @@ extern "C" {
#define NFC_DEV_NAME_MAX_LEN 22 #define NFC_DEV_NAME_MAX_LEN 22
#define NFC_READER_DATA_MAX_SIZE 64 #define NFC_READER_DATA_MAX_SIZE 64
#define NFC_DICT_KEY_BATCH_SIZE 50 #define NFC_DICT_KEY_BATCH_SIZE 10
#define NFC_APP_EXTENSION ".nfc" #define NFC_APP_EXTENSION ".nfc"
#define NFC_APP_SHADOW_EXTENSION ".shd" #define NFC_APP_SHADOW_EXTENSION ".shd"
@ -48,6 +48,7 @@ typedef struct {
typedef struct { typedef struct {
MfClassicDict* dict; MfClassicDict* dict;
uint8_t current_sector;
} NfcMfClassicDictAttackData; } NfcMfClassicDictAttackData;
typedef enum { typedef enum {

View File

@ -573,17 +573,24 @@ static void nfc_worker_mf_classic_key_attack(
FuriHalNfcTxRxContext* tx_rx, FuriHalNfcTxRxContext* tx_rx,
uint16_t start_sector) { uint16_t start_sector) {
furi_assert(nfc_worker); furi_assert(nfc_worker);
furi_assert(nfc_worker->callback);
bool card_found_notified = true; bool card_found_notified = true;
bool card_removed_notified = false; bool card_removed_notified = false;
MfClassicData* data = &nfc_worker->dev_data->mf_classic_data; MfClassicData* data = &nfc_worker->dev_data->mf_classic_data;
NfcMfClassicDictAttackData* dict_attack_data =
&nfc_worker->dev_data->mf_classic_dict_attack_data;
uint32_t total_sectors = mf_classic_get_total_sectors_num(data->type); uint32_t total_sectors = mf_classic_get_total_sectors_num(data->type);
furi_assert(start_sector < total_sectors); furi_assert(start_sector < total_sectors);
nfc_worker->callback(NfcWorkerEventKeyAttackStart, nfc_worker->context);
// Check every sector's A and B keys with the given key // Check every sector's A and B keys with the given key
for(size_t i = start_sector; i < total_sectors; i++) { for(size_t i = start_sector; i < total_sectors; i++) {
nfc_worker->callback(NfcWorkerEventKeyAttackNextSector, nfc_worker->context);
dict_attack_data->current_sector = i;
furi_hal_nfc_sleep(); furi_hal_nfc_sleep();
if(furi_hal_nfc_activate_nfca(200, NULL)) { if(furi_hal_nfc_activate_nfca(200, NULL)) {
furi_hal_nfc_sleep(); furi_hal_nfc_sleep();
@ -632,6 +639,7 @@ static void nfc_worker_mf_classic_key_attack(
} }
if(nfc_worker->state != NfcWorkerStateMfClassicDictAttack) break; if(nfc_worker->state != NfcWorkerStateMfClassicDictAttack) break;
} }
nfc_worker->callback(NfcWorkerEventKeyAttackStop, nfc_worker->context);
} }
void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) { void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {

View File

@ -55,6 +55,9 @@ typedef enum {
NfcWorkerEventNewDictKeyBatch, NfcWorkerEventNewDictKeyBatch,
NfcWorkerEventFoundKeyA, NfcWorkerEventFoundKeyA,
NfcWorkerEventFoundKeyB, NfcWorkerEventFoundKeyB,
NfcWorkerEventKeyAttackStart,
NfcWorkerEventKeyAttackStop,
NfcWorkerEventKeyAttackNextSector,
// Write Mifare Classic events // Write Mifare Classic events
NfcWorkerEventWrongCard, NfcWorkerEventWrongCard,