[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:
@@ -20,7 +20,7 @@ bool mf_classic_dict_check_presence(MfClassicDictType dict_type) {
|
||||
Storage* storage = furi_record_open(RECORD_STORAGE);
|
||||
|
||||
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;
|
||||
} else if(dict_type == MfClassicDictTypeUser) {
|
||||
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;
|
||||
do {
|
||||
if(dict_type == MfClassicDictTypeFlipper) {
|
||||
if(dict_type == MfClassicDictTypeSystem) {
|
||||
if(!buffered_file_stream_open(
|
||||
dict->stream,
|
||||
MF_CLASSIC_DICT_FLIPPER_PATH,
|
||||
|
@@ -8,7 +8,7 @@
|
||||
|
||||
typedef enum {
|
||||
MfClassicDictTypeUser,
|
||||
MfClassicDictTypeFlipper,
|
||||
MfClassicDictTypeSystem,
|
||||
MfClassicDictTypeUnitTest,
|
||||
} MfClassicDictType;
|
||||
|
||||
|
@@ -18,7 +18,7 @@ extern "C" {
|
||||
|
||||
#define NFC_DEV_NAME_MAX_LEN 22
|
||||
#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_SHADOW_EXTENSION ".shd"
|
||||
@@ -48,6 +48,7 @@ typedef struct {
|
||||
|
||||
typedef struct {
|
||||
MfClassicDict* dict;
|
||||
uint8_t current_sector;
|
||||
} NfcMfClassicDictAttackData;
|
||||
|
||||
typedef enum {
|
||||
|
@@ -573,17 +573,24 @@ static void nfc_worker_mf_classic_key_attack(
|
||||
FuriHalNfcTxRxContext* tx_rx,
|
||||
uint16_t start_sector) {
|
||||
furi_assert(nfc_worker);
|
||||
furi_assert(nfc_worker->callback);
|
||||
|
||||
bool card_found_notified = true;
|
||||
bool card_removed_notified = false;
|
||||
|
||||
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);
|
||||
|
||||
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
|
||||
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();
|
||||
if(furi_hal_nfc_activate_nfca(200, NULL)) {
|
||||
furi_hal_nfc_sleep();
|
||||
@@ -632,6 +639,7 @@ static void nfc_worker_mf_classic_key_attack(
|
||||
}
|
||||
if(nfc_worker->state != NfcWorkerStateMfClassicDictAttack) break;
|
||||
}
|
||||
nfc_worker->callback(NfcWorkerEventKeyAttackStop, nfc_worker->context);
|
||||
}
|
||||
|
||||
void nfc_worker_mf_classic_dict_attack(NfcWorker* nfc_worker) {
|
||||
|
@@ -55,6 +55,9 @@ typedef enum {
|
||||
NfcWorkerEventNewDictKeyBatch,
|
||||
NfcWorkerEventFoundKeyA,
|
||||
NfcWorkerEventFoundKeyB,
|
||||
NfcWorkerEventKeyAttackStart,
|
||||
NfcWorkerEventKeyAttackStop,
|
||||
NfcWorkerEventKeyAttackNextSector,
|
||||
|
||||
// Write Mifare Classic events
|
||||
NfcWorkerEventWrongCard,
|
||||
|
Reference in New Issue
Block a user