]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmf.c
Added block command for T55xx and support for cloning HID long format
[proxmark3-svn] / client / cmdhfmf.c
index 1fbeff4ae69cbf9a54233630312faf43ff9b2ca0..abb6f59ffb8476ad46f473aa3e10dbe9bd3227f1 100644 (file)
@@ -71,17 +71,22 @@ start:
        if (isOK != 1) return 1;\r
        \r
        // execute original function from util nonce2key\r
-       if (nonce2key(uid, nt, par_list, ks_list, &r_key)) return 2;\r
-       printf("------------------------------------------------------------------\n");\r
-       PrintAndLog("Key found:%012llx \n", r_key);\r
+       if (nonce2key(uid, nt, par_list, ks_list, &r_key))\r
+       {\r
+               isOK = 2;\r
+               PrintAndLog("Key not found (lfsr_common_prefix list is null). Nt=%08x", nt);    \r
+       } else {\r
+               printf("------------------------------------------------------------------\n");\r
+               PrintAndLog("Key found:%012I64x \n", r_key);\r
 \r
-       num_to_bytes(r_key, 6, keyBlock);\r
-       isOK = mfCheckKeys(0, 0, 1, keyBlock, &r_key);\r
+               num_to_bytes(r_key, 6, keyBlock);\r
+               isOK = mfCheckKeys(0, 0, 1, keyBlock, &r_key);\r
+       }\r
        if (!isOK) \r
-               PrintAndLog("Found valid key:%012llx", r_key);\r
+               PrintAndLog("Found valid key:%012I64x", r_key);\r
        else\r
        {\r
-               PrintAndLog("Found invalid key. ( Nt=%08x ,Trying use it to run again...", nt); \r
+               if (isOK != 2) PrintAndLog("Found invalid key. ( Nt=%08x ,Trying use it to run again...", nt);  \r
                c.arg[0] = nt;\r
                goto start;\r
        }\r
@@ -570,7 +575,7 @@ int CmdHF14AMfNested(const char *Cmd)
                if (res)\r
                        res = mfCheckKeys(trgBlockNo, trgKeyType, 8, &keyBlock[6 * 8], &key64);\r
                if (!res) {\r
-                       PrintAndLog("Found valid key:%012llx", key64);\r
+                       PrintAndLog("Found valid key:%012I64x", key64);\r
 \r
                        // transfer key to the emulator\r
                        if (transferToEml) {\r
@@ -630,7 +635,7 @@ int CmdHF14AMfNested(const char *Cmd)
                                        if (res)\r
                                                res = mfCheckKeys(trgBlockNo, trgKeyType, 8, &keyBlock[6 * 8], &key64);\r
                                        if (!res) {\r
-                                               PrintAndLog("Found valid key:%012llx", key64);  \r
+                                               PrintAndLog("Found valid key:%012I64x", key64); \r
                                                e_sector[trgBlockNo / 4].foundKey[trgKeyType] = 1;\r
                                                e_sector[trgBlockNo / 4].Key[trgKeyType] = key64;\r
                                        }\r
@@ -643,7 +648,7 @@ int CmdHF14AMfNested(const char *Cmd)
                PrintAndLog("|sec|key A           |res|key B           |res|");\r
                PrintAndLog("|---|----------------|---|----------------|---|");\r
                for (i = 0; i < SectorsCnt; i++) {\r
-                       PrintAndLog("|%03d|  %012llx  | %d |  %012llx  | %d |", i, \r
+                       PrintAndLog("|%03d|  %012I64x  | %d |  %012I64x  | %d |", i, \r
                                e_sector[i].Key[0], e_sector[i].foundKey[0], e_sector[i].Key[1], e_sector[i].foundKey[1]);\r
                }\r
                PrintAndLog("|---|----------------|---|----------------|---|");\r
@@ -840,7 +845,7 @@ int CmdHF14AMfChk(const char *Cmd)
                                        }\r
                                        memset(keyBlock + 6 * keycnt, 0, 6);\r
                                        num_to_bytes(strtoll(buf, NULL, 16), 6, keyBlock + 6*keycnt);\r
-                                       PrintAndLog("chk custom key[%d] %012llx", keycnt, bytes_to_num(keyBlock + 6*keycnt, 6));\r
+                                       PrintAndLog("chk custom key[%d] %012I64x", keycnt, bytes_to_num(keyBlock + 6*keycnt, 6));\r
                                        keycnt++;\r
                                }\r
                        } else {\r
@@ -870,7 +875,7 @@ int CmdHF14AMfChk(const char *Cmd)
                                res = mfCheckKeys(b, t, size, keyBlock +6*c, &key64);\r
                                if (res !=1) {\r
                                        if (!res) {\r
-                                               PrintAndLog("Found valid key:[%012llx]",key64);\r
+                                               PrintAndLog("Found valid key:[%012I64x]",key64);\r
                                                if (transferToEml) {\r
                                                        uint8_t block[16];\r
                                                        mfEmlGetMem(block, get_trailer_block(b), 1);\r
@@ -984,10 +989,6 @@ int CmdHF14AMfEGet(const char *Cmd)
        }       \r
        \r
        blockNo = param_get8(Cmd, 0);\r
-       if (blockNo >= 32 * 4 + 8 * 16) {\r
-               PrintAndLog("Block number must be in [0..255] as in MIFARE classic.");\r
-               return 1;\r
-       }\r
 \r
        PrintAndLog(" ");\r
        if (!mfEmlGetMem(data, blockNo, 3)) {\r
@@ -1028,10 +1029,6 @@ int CmdHF14AMfESet(const char *Cmd)
        }       \r
        \r
        blockNo = param_get8(Cmd, 0);\r
-       if (blockNo >= 32 * 4 + 8 * 16) {\r
-               PrintAndLog("Block number must be in [0..255] as in MIFARE classic.");\r
-               return 1;\r
-       }\r
        \r
        if (param_gethex(Cmd, 1, memBlock, 32)) {\r
                PrintAndLog("block data must include 32 HEX symbols");\r
@@ -1210,7 +1207,7 @@ int CmdHF14AMfEKeyPrn(const char *Cmd)
                }\r
                keyA = bytes_to_num(data, 6);\r
                keyB = bytes_to_num(data + 10, 6);\r
-               PrintAndLog("|%03d|  %012llx  |  %012llx  |", i, keyA, keyB);\r
+               PrintAndLog("|%03d|  %012I64x  |  %012I64x  |", i, keyA, keyB);\r
        }\r
        PrintAndLog("|---|----------------|----------------|");\r
        \r
@@ -1269,10 +1266,6 @@ int CmdHF14AMfCSetBlk(const char *Cmd)
        }       \r
 \r
        blockNo = param_get8(Cmd, 0);\r
-       if (blockNo >= 32 * 4 + 8 * 16) {\r
-               PrintAndLog("Block number must be in [0..255] as in MIFARE classic.");\r
-               return 1;\r
-       }\r
 \r
        if (param_gethex(Cmd, 1, memBlock, 32)) {\r
                PrintAndLog("block data must include 32 HEX symbols");\r
@@ -1400,10 +1393,6 @@ int CmdHF14AMfCGetBlk(const char *Cmd) {
        }       \r
 \r
        blockNo = param_get8(Cmd, 0);\r
-       if (blockNo >= 32 * 4 + 8 * 16) {\r
-               PrintAndLog("Block number must be in [0..255] as in MIFARE classic.");\r
-               return 1;\r
-       }\r
 \r
        PrintAndLog("--block number:%02x ", blockNo);\r
 \r
Impressum, Datenschutz