]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmf.c
ADD: first try to implement crc-16 for Legic Advant *not working yet* Can't verify it.
[proxmark3-svn] / client / cmdhfmf.c
index 80c072f5033ee1154aad279b8440f605d8c80e5b..d6cae59f0bfa46101b142cbbc43c842ce4462067 100644 (file)
@@ -53,7 +53,7 @@ start:
 \r
        // wait cycle\r
        while (true) {\r
 \r
        // wait cycle\r
        while (true) {\r
-               printf(".");\r
+        printf(".");\r
                fflush(stdout);\r
                if (ukbhit()) {\r
                        tmpchar = getchar();\r
                fflush(stdout);\r
                if (ukbhit()) {\r
                        tmpchar = getchar();\r
@@ -63,17 +63,18 @@ start:
                }\r
                \r
                UsbCommand resp;\r
                }\r
                \r
                UsbCommand resp;\r
-               if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {\r
+               if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {\r
                        isOK  = resp.arg[0];\r
                        isOK  = resp.arg[0];\r
+                       printf("\n\n");\r
                        switch (isOK) {\r
                                case -1 : PrintAndLog("Button pressed. Aborted.\n"); break;\r
                                case -2 : PrintAndLog("Card is not vulnerable to Darkside attack (doesn't send NACK on authentication requests).\n"); break;\r
                                case -3 : PrintAndLog("Card is not vulnerable to Darkside attack (its random number generator is not predictable).\n"); break;\r
                                case -4 : PrintAndLog("Card is not vulnerable to Darkside attack (its random number generator seems to be based on the wellknown");\r
                        switch (isOK) {\r
                                case -1 : PrintAndLog("Button pressed. Aborted.\n"); break;\r
                                case -2 : PrintAndLog("Card is not vulnerable to Darkside attack (doesn't send NACK on authentication requests).\n"); break;\r
                                case -3 : PrintAndLog("Card is not vulnerable to Darkside attack (its random number generator is not predictable).\n"); break;\r
                                case -4 : PrintAndLog("Card is not vulnerable to Darkside attack (its random number generator seems to be based on the wellknown");\r
-                                         PrintAndLog("generating polynomial with 16 effective bits only, but shows unexpected behaviour.\n"); break;\r
+                                                 PrintAndLog("generating polynomial with 16 effective bits only, but shows unexpected behaviour.\n"); break;\r
                                default: ;\r
                        }\r
                                default: ;\r
                        }\r
-                       uid = (uint32_t)bytes_to_num(resp.d.asBytes, 4);\r
+                       uid = (uint32_t)bytes_to_num(resp.d.asBytes +  0, 4);\r
                        nt =  (uint32_t)bytes_to_num(resp.d.asBytes +  4, 4);\r
                        par_list = bytes_to_num(resp.d.asBytes +  8, 8);\r
                        ks_list = bytes_to_num(resp.d.asBytes +  16, 8);\r
                        nt =  (uint32_t)bytes_to_num(resp.d.asBytes +  4, 4);\r
                        par_list = bytes_to_num(resp.d.asBytes +  8, 8);\r
                        ks_list = bytes_to_num(resp.d.asBytes +  16, 8);\r
@@ -711,6 +712,7 @@ int CmdHF14AMfNested(const char *Cmd)
                \r
                // nested sectors\r
                iterations = 0;\r
                \r
                // nested sectors\r
                iterations = 0;\r
+               PrintAndLog("enter nested...");\r
                bool calibrate = true;\r
 \r
                for (i = 0; i < NESTED_SECTOR_RETRY; i++) {\r
                bool calibrate = true;\r
 \r
                for (i = 0; i < NESTED_SECTOR_RETRY; i++) {\r
@@ -731,7 +733,7 @@ int CmdHF14AMfNested(const char *Cmd)
                                                case -5 :\r
                                                        calibrate = false;\r
                                                        iterations++;\r
                                                case -5 :\r
                                                        calibrate = false;\r
                                                        iterations++;\r
-                                                       e_sector[sectorNo].foundKey[trgKeyType] = TRUE;\r
+                                                       e_sector[sectorNo].foundKey[trgKeyType] = 1;\r
                                                        e_sector[sectorNo].Key[trgKeyType] = bytes_to_num(keyBlock, 6);\r
                                                        continue;\r
                                                        \r
                                                        e_sector[sectorNo].Key[trgKeyType] = bytes_to_num(keyBlock, 6);\r
                                                        continue;\r
                                                        \r
@@ -763,7 +765,7 @@ int CmdHF14AMfNested(const char *Cmd)
                                SendCommand(&c);\r
 \r
                                UsbCommand resp;\r
                                SendCommand(&c);\r
 \r
                                UsbCommand resp;\r
-                               if ( !WaitForResponseTimeout(CMD_ACK, &resp, 1500)) continue;\r
+                               if ( !WaitForResponseTimeout(CMD_ACK,&resp,1500)) continue;\r
                                        \r
                                uint8_t isOK  = resp.arg[0] & 0xff;\r
                                if (!isOK) continue;\r
                                        \r
                                uint8_t isOK  = resp.arg[0] & 0xff;\r
                                if (!isOK) continue;\r
@@ -1132,6 +1134,7 @@ int CmdHF14AMfChk(const char *Cmd)
                        // skip already found keys.\r
                        if (e_sector[i].foundKey[trgKeyType]) continue;\r
                        \r
                        // skip already found keys.\r
                        if (e_sector[i].foundKey[trgKeyType]) continue;\r
                        \r
+                       \r
                        for (uint32_t c = 0; c < keycnt; c += max_keys) {\r
                                \r
                                uint32_t size = keycnt-c > max_keys ? max_keys : keycnt-c;\r
                        for (uint32_t c = 0; c < keycnt; c += max_keys) {\r
                                \r
                                uint32_t size = keycnt-c > max_keys ? max_keys : keycnt-c;\r
Impressum, Datenschutz