Skip to content

Commit eba6163

Browse files
committed
1.5.2 - Show correct amount of nonces to collect
1 parent bcad035 commit eba6163

5 files changed

+14
-7
lines changed

application.fam

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,5 @@ App(
2121
fap_author="AloneLiberty",
2222
fap_description="Recover Mifare Classic keys",
2323
fap_weburl="https://github.com/AloneLiberty/FlipperNested",
24-
fap_version="1.5.1"
24+
fap_version="1.5.2"
2525
)

mifare_nested_i.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121
#include <gui/modules/variable_item_list.h>
2222
#include "mifare_nested_icons.h"
2323

24-
#define NESTED_VERSION_APP "1.5.1"
24+
#define NESTED_VERSION_APP "1.5.2"
2525
#define NESTED_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNested"
2626
#define NESTED_RECOVER_KEYS_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNestedRecovery"
2727
#define NESTED_NONCE_FORMAT_VERSION "3"

mifare_nested_worker.c

+5-2
Original file line numberDiff line numberDiff line change
@@ -478,11 +478,11 @@ SaveNoncesResult_t* mifare_nested_worker_write_nonces(
478478
for(uint8_t sector = 0; sector < sector_count; sector++) {
479479
for(uint8_t key_type = 0; key_type < 2; key_type++) {
480480
if(nonces->nonces[sector][key_type][tries]->invalid) {
481-
if (tries == 0) {
481+
if(tries == 0) {
482482
result->invalid++;
483483
}
484484
} else if(nonces->nonces[sector][key_type][tries]->skipped) {
485-
if (tries == 0) {
485+
if(tries == 0) {
486486
result->skipped++;
487487
}
488488
} else if(nonces->nonces[sector][key_type][tries]->collected) {
@@ -578,6 +578,7 @@ bool mifare_nested_worker_check_initial_keys(
578578
info->block = mifare_nested_worker_get_block_by_sector(sector);
579579
info->collected = false;
580580
info->skipped = true;
581+
info->from_start = false;
581582

582583
nonces->nonces[sector][key_type][tries] = info;
583584
}
@@ -595,6 +596,7 @@ bool mifare_nested_worker_check_initial_keys(
595596
Nonces* info = nonces->nonces[sector][0][tries];
596597
info->collected = true;
597598
info->skipped = true;
599+
info->from_start = true;
598600

599601
nonces->nonces[sector][0][tries] = info;
600602
}
@@ -616,6 +618,7 @@ bool mifare_nested_worker_check_initial_keys(
616618
Nonces* info = nonces->nonces[sector][1][tries];
617619
info->collected = true;
618620
info->skipped = true;
621+
info->from_start = true;
619622

620623
nonces->nonces[sector][1][tries] = info;
621624
}

mifare_nested_worker.h

+1
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,7 @@ typedef struct {
6666
uint32_t target_ks[2];
6767
uint8_t parity[2][4];
6868
bool skipped;
69+
bool from_start;
6970
bool invalid;
7071
bool collected;
7172
bool hardnested;

scenes/mifare_nested_scene_collecting.c

+6-3
Original file line numberDiff line numberDiff line change
@@ -18,12 +18,15 @@ bool mifare_nested_collecting_worker_callback(MifareNestedWorkerEvent event, voi
1818
mifare_nested_blink_nonce_collection_start(mifare_nested);
1919

2020
uint8_t collected = 0;
21+
uint8_t skip = 0;
2122
NonceList_t* nonces = mifare_nested->nonces;
2223
for(uint8_t tries = 0; tries < nonces->tries; tries++) {
2324
for(uint8_t sector = 0; sector < nonces->sector_count; sector++) {
2425
for(uint8_t keyType = 0; keyType < 2; keyType++) {
2526
Nonces* info = nonces->nonces[sector][keyType][tries];
26-
if(info->collected) {
27+
if(info->from_start) {
28+
skip++;
29+
} else if(info->collected) {
2730
collected++;
2831
}
2932
}
@@ -37,7 +40,7 @@ bool mifare_nested_collecting_worker_callback(MifareNestedWorkerEvent event, voi
3740
model->calibrating = false;
3841
model->lost_tag = false;
3942
model->nonces_collected = collected;
40-
model->keys_count = nonces->sector_count * nonces->tries * 2;
43+
model->keys_count = (nonces->sector_count * nonces->tries * 2) - skip;
4144
},
4245
true);
4346
} else if(event == MifareNestedWorkerEventNoTagDetected) {
@@ -155,4 +158,4 @@ void mifare_nested_scene_collecting_on_exit(void* context) {
155158
mifare_nested_blink_stop(mifare_nested);
156159
popup_reset(mifare_nested->popup);
157160
widget_reset(mifare_nested->widget);
158-
}
161+
}

0 commit comments

Comments
 (0)