fix: prevent hf mf mifare from always running twice 560/head
authorpwpiwi <pwpiwi@users.noreply.github.com>
Sat, 3 Feb 2018 17:24:32 +0000 (18:24 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Sat, 3 Feb 2018 17:26:09 +0000 (18:26 +0100)
(issue #510)

client/mifarehost.c

index d204bf12c87e9a3358eba16c392e05a80ae980dc..b6eb60f000d61281d9d88d656ae455acf4acca25 100644 (file)
@@ -178,12 +178,14 @@ int mfDarkside(uint64_t *key)
                        continue;\r
                }\r
 \r
                        continue;\r
                }\r
 \r
-               qsort(keylist, keycount, sizeof(*keylist), compare_uint64);\r
-               keycount = intersection(last_keylist, keylist);\r
-               if (keycount == 0) {\r
-                       free(last_keylist);\r
-                       last_keylist = keylist;\r
-                       continue;\r
+               if (par_list == 0) {\r
+                       qsort(keylist, keycount, sizeof(*keylist), compare_uint64);\r
+                       keycount = intersection(last_keylist, keylist);\r
+                       if (keycount == 0) {\r
+                               free(last_keylist);\r
+                               last_keylist = keylist;\r
+                               continue;\r
+                       }\r
                }\r
 \r
                if (keycount > 1) {\r
                }\r
 \r
                if (keycount > 1) {\r
@@ -198,10 +200,10 @@ int mfDarkside(uint64_t *key)
                for (int i = 0; i < keycount; i += max_keys) {\r
                        int size = keycount - i > max_keys ? max_keys : keycount - i;\r
                        for (int j = 0; j < size; j++) {\r
                for (int i = 0; i < keycount; i += max_keys) {\r
                        int size = keycount - i > max_keys ? max_keys : keycount - i;\r
                        for (int j = 0; j < size; j++) {\r
-                               if (last_keylist == NULL) {\r
-                                       num_to_bytes(keylist[i*max_keys + j], 6, keyBlock);\r
-                               } else {\r
+                               if (par_list == 0) {\r
                                        num_to_bytes(last_keylist[i*max_keys + j], 6, keyBlock);\r
                                        num_to_bytes(last_keylist[i*max_keys + j], 6, keyBlock);\r
+                               } else {\r
+                                       num_to_bytes(keylist[i*max_keys + j], 6, keyBlock);\r
                                }\r
                        }\r
                        if (!mfCheckKeys(0, 0, false, size, keyBlock, key)) {\r
                                }\r
                        }\r
                        if (!mfCheckKeys(0, 0, false, size, keyBlock, key)) {\r
Impressum, Datenschutz