From e7439272e6a861b94c933ff608ba82ee79364351 Mon Sep 17 00:00:00 2001 From: MX <10697207+xMasterX@users.noreply.github.com> Date: Tue, 11 Jul 2023 03:46:12 +0300 Subject: [PATCH] Update mifare nested --- applications/external/mifare_nested/application.fam | 2 +- applications/external/mifare_nested/mifare_nested_i.h | 2 +- .../external/mifare_nested/mifare_nested_worker.c | 3 +++ .../external/mifare_nested/mifare_nested_worker.h | 1 + .../scenes/mifare_nested_scene_collecting.c | 9 ++++++--- 5 files changed, 12 insertions(+), 5 deletions(-) diff --git a/applications/external/mifare_nested/application.fam b/applications/external/mifare_nested/application.fam index 36dfb2673..b06c4fa3e 100644 --- a/applications/external/mifare_nested/application.fam +++ b/applications/external/mifare_nested/application.fam @@ -21,5 +21,5 @@ App( fap_author="AloneLiberty", fap_description="Recover Mifare Classic keys", fap_weburl="https://github.com/AloneLiberty/FlipperNested", - fap_version="1.5.1" + fap_version="1.5.2" ) diff --git a/applications/external/mifare_nested/mifare_nested_i.h b/applications/external/mifare_nested/mifare_nested_i.h index b99f785c6..b13a6c098 100644 --- a/applications/external/mifare_nested/mifare_nested_i.h +++ b/applications/external/mifare_nested/mifare_nested_i.h @@ -21,7 +21,7 @@ #include #include "mifare_nested_icons.h" -#define NESTED_VERSION_APP "1.5.1" +#define NESTED_VERSION_APP "1.5.2" #define NESTED_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNested" #define NESTED_RECOVER_KEYS_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNestedRecovery" #define NESTED_NONCE_FORMAT_VERSION "3" diff --git a/applications/external/mifare_nested/mifare_nested_worker.c b/applications/external/mifare_nested/mifare_nested_worker.c index 60540c74b..0b8097653 100644 --- a/applications/external/mifare_nested/mifare_nested_worker.c +++ b/applications/external/mifare_nested/mifare_nested_worker.c @@ -578,6 +578,7 @@ bool mifare_nested_worker_check_initial_keys( info->block = mifare_nested_worker_get_block_by_sector(sector); info->collected = false; info->skipped = true; + info->from_start = false; nonces->nonces[sector][key_type][tries] = info; } @@ -595,6 +596,7 @@ bool mifare_nested_worker_check_initial_keys( Nonces* info = nonces->nonces[sector][0][tries]; info->collected = true; info->skipped = true; + info->from_start = true; nonces->nonces[sector][0][tries] = info; } @@ -616,6 +618,7 @@ bool mifare_nested_worker_check_initial_keys( Nonces* info = nonces->nonces[sector][1][tries]; info->collected = true; info->skipped = true; + info->from_start = true; nonces->nonces[sector][1][tries] = info; } diff --git a/applications/external/mifare_nested/mifare_nested_worker.h b/applications/external/mifare_nested/mifare_nested_worker.h index 2421b35eb..99c691749 100644 --- a/applications/external/mifare_nested/mifare_nested_worker.h +++ b/applications/external/mifare_nested/mifare_nested_worker.h @@ -66,6 +66,7 @@ typedef struct { uint32_t target_ks[2]; uint8_t parity[2][4]; bool skipped; + bool from_start; bool invalid; bool collected; bool hardnested; diff --git a/applications/external/mifare_nested/scenes/mifare_nested_scene_collecting.c b/applications/external/mifare_nested/scenes/mifare_nested_scene_collecting.c index 281210107..0e319bbcf 100644 --- a/applications/external/mifare_nested/scenes/mifare_nested_scene_collecting.c +++ b/applications/external/mifare_nested/scenes/mifare_nested_scene_collecting.c @@ -18,12 +18,15 @@ bool mifare_nested_collecting_worker_callback(MifareNestedWorkerEvent event, voi mifare_nested_blink_nonce_collection_start(mifare_nested); uint8_t collected = 0; + uint8_t skip = 0; NonceList_t* nonces = mifare_nested->nonces; for(uint8_t tries = 0; tries < nonces->tries; tries++) { for(uint8_t sector = 0; sector < nonces->sector_count; sector++) { for(uint8_t keyType = 0; keyType < 2; keyType++) { Nonces* info = nonces->nonces[sector][keyType][tries]; - if(info->collected) { + if(info->from_start) { + skip++; + } else if(info->collected) { collected++; } } @@ -37,7 +40,7 @@ bool mifare_nested_collecting_worker_callback(MifareNestedWorkerEvent event, voi model->calibrating = false; model->lost_tag = false; model->nonces_collected = collected; - model->keys_count = nonces->sector_count * nonces->tries * 2; + model->keys_count = (nonces->sector_count * nonces->tries * 2) - skip; }, true); } else if(event == MifareNestedWorkerEventNoTagDetected) { @@ -155,4 +158,4 @@ void mifare_nested_scene_collecting_on_exit(void* context) { mifare_nested_blink_stop(mifare_nested); popup_reset(mifare_nested->popup); widget_reset(mifare_nested->widget); -} +} \ No newline at end of file