AloneLiberty 2 лет назад
Родитель
Сommit
f9df9e8dce
2 измененных файлов с 11 добавлено и 10 удалено
  1. 1 1
      mifare_nested_i.h
  2. 10 9
      mifare_nested_worker.c

+ 1 - 1
mifare_nested_i.h

@@ -21,7 +21,7 @@
 #include <gui/modules/variable_item_list.h>
 #include <gui/modules/variable_item_list.h>
 #include "mifare_nested_icons.h"
 #include "mifare_nested_icons.h"
 
 
-#define NESTED_VERSION_APP "1.4.2"
+#define NESTED_VERSION_APP "1.4.3"
 #define NESTED_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNested"
 #define NESTED_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNested"
 #define NESTED_RECOVER_KEYS_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNestedRecovery"
 #define NESTED_RECOVER_KEYS_GITHUB_LINK "https://github.com/AloneLiberty/FlipperNestedRecovery"
 #define NESTED_NONCE_FORMAT_VERSION "3"
 #define NESTED_NONCE_FORMAT_VERSION "3"

+ 10 - 9
mifare_nested_worker.c

@@ -453,6 +453,7 @@ void mifare_nested_worker_write_nonces(
     Storage* storage,
     Storage* storage,
     NonceList_t* nonces,
     NonceList_t* nonces,
     uint8_t tries_count,
     uint8_t tries_count,
+    uint8_t free_tries_count,
     uint8_t sector_count,
     uint8_t sector_count,
     uint32_t delay,
     uint32_t delay,
     uint32_t distance) {
     uint32_t distance) {
@@ -527,7 +528,7 @@ void mifare_nested_worker_write_nonces(
         furi_string_free(str);
         furi_string_free(str);
     }
     }
 
 
-    free_nonces(nonces, sector_count, tries_count);
+    free_nonces(nonces, sector_count, free_tries_count);
     furi_string_free(path);
     furi_string_free(path);
     file_stream_close(file_stream);
     file_stream_close(file_stream);
     free(file_stream);
     free(file_stream);
@@ -816,7 +817,7 @@ void mifare_nested_worker_collect_nonces_static(MifareNestedWorker* mifare_neste
         break;
         break;
     }
     }
 
 
-    mifare_nested_worker_write_nonces(&data, storage, &nonces, 1, sector_count, 0, 0);
+    mifare_nested_worker_write_nonces(&data, storage, &nonces, 1, 1, sector_count, 0, 0);
 
 
     free(mf_data);
     free(mf_data);
 
 
@@ -1053,7 +1054,7 @@ void mifare_nested_worker_collect_nonces_hard(MifareNestedWorker* mifare_nested_
         }
         }
     }
     }
 
 
-    mifare_nested_worker_write_nonces(&data, storage, &nonces, 1, sector_count, 0, 0);
+    mifare_nested_worker_write_nonces(&data, storage, &nonces, 1, 1, sector_count, 0, 0);
 
 
     free(mf_data);
     free(mf_data);
 
 
@@ -1103,13 +1104,13 @@ void mifare_nested_worker_collect_nonces(MifareNestedWorker* mifare_nested_worke
 
 
     if(!mifare_nested_worker_read_key_cache(&data, mf_data) ||
     if(!mifare_nested_worker_read_key_cache(&data, mf_data) ||
        !mifare_nested_worker_check_initial_keys(
        !mifare_nested_worker_check_initial_keys(
-           &nonces, mf_data, tries_count, sector_count, &key, &key_block, &found_key_type)) {
+           &nonces, mf_data, 3, sector_count, &key, &key_block, &found_key_type)) {
         mifare_nested_worker->callback(
         mifare_nested_worker->callback(
             MifareNestedWorkerEventNeedKey, mifare_nested_worker->context);
             MifareNestedWorkerEventNeedKey, mifare_nested_worker->context);
         nfc_deactivate();
         nfc_deactivate();
 
 
         free(mf_data);
         free(mf_data);
-        free_nonces(&nonces, sector_count, tries_count);
+        free_nonces(&nonces, sector_count, 3);
 
 
         return;
         return;
     }
     }
@@ -1141,7 +1142,7 @@ void mifare_nested_worker_collect_nonces(MifareNestedWorker* mifare_nested_worke
             nfc_deactivate();
             nfc_deactivate();
 
 
             free(mf_data);
             free(mf_data);
-            free_nonces(&nonces, sector_count, tries_count);
+            free_nonces(&nonces, sector_count, 3);
 
 
             mifare_nested_worker_collect_nonces_hard(mifare_nested_worker);
             mifare_nested_worker_collect_nonces_hard(mifare_nested_worker);
             return;
             return;
@@ -1222,7 +1223,7 @@ void mifare_nested_worker_collect_nonces(MifareNestedWorker* mifare_nested_worke
                 nfc_deactivate();
                 nfc_deactivate();
 
 
                 free(mf_data);
                 free(mf_data);
-                free_nonces(&nonces, sector_count, tries_count);
+                free_nonces(&nonces, sector_count, 3);
 
 
                 mifare_nested_worker_collect_nonces_hard(mifare_nested_worker);
                 mifare_nested_worker_collect_nonces_hard(mifare_nested_worker);
                 return;
                 return;
@@ -1246,7 +1247,7 @@ void mifare_nested_worker_collect_nonces(MifareNestedWorker* mifare_nested_worke
                     MifareNestedWorkerEventAttackFailed, mifare_nested_worker->context);
                     MifareNestedWorkerEventAttackFailed, mifare_nested_worker->context);
 
 
                 free(mf_data);
                 free(mf_data);
-                free_nonces(&nonces, sector_count, tries_count);
+                free_nonces(&nonces, sector_count, 3);
 
 
                 return;
                 return;
             }
             }
@@ -1356,7 +1357,7 @@ void mifare_nested_worker_collect_nonces(MifareNestedWorker* mifare_nested_worke
     }
     }
 
 
     mifare_nested_worker_write_nonces(
     mifare_nested_worker_write_nonces(
-        &data, storage, &nonces, tries_count, sector_count, delay, distance);
+        &data, storage, &nonces, tries_count, 3, sector_count, delay, distance);
 
 
     free(mf_data);
     free(mf_data);