]> git.zerfleddert.de Git - proxmark3-svn/blobdiff - client/cmdhfmf.c
Code cleanup:
[proxmark3-svn] / client / cmdhfmf.c
index cdac64764dd33dd554c6dbd1a7c785f7038db7ef..54c5fc87788192c3ad7936e1de36bc818ce17435 100644 (file)
@@ -8,6 +8,7 @@
 // High frequency MIFARE commands\r
 //-----------------------------------------------------------------------------\r
 \r
 // High frequency MIFARE commands\r
 //-----------------------------------------------------------------------------\r
 \r
+#include <inttypes.h>\r
 #include "cmdhfmf.h"\r
 #include "./nonce2key/nonce2key.h"\r
 \r
 #include "cmdhfmf.h"\r
 #include "./nonce2key/nonce2key.h"\r
 \r
@@ -82,7 +83,7 @@ int CmdHF14AMifare(const char *Cmd)
        } else {\r
                isOK = 0;\r
                printf("------------------------------------------------------------------\n");\r
        } else {\r
                isOK = 0;\r
                printf("------------------------------------------------------------------\n");\r
-               PrintAndLog("Found valid key:%012"llx" \n", r_key);\r
+               PrintAndLog("Found valid key:%012" PRIx64 " \n", r_key);\r
        }\r
        \r
        PrintAndLog("");\r
        }\r
        \r
        PrintAndLog("");\r
@@ -632,7 +633,7 @@ int CmdHF14AMfNested(const char *Cmd)
                }\r
                key64 = bytes_to_num(keyBlock, 6);\r
                if (key64) {\r
                }\r
                key64 = bytes_to_num(keyBlock, 6);\r
                if (key64) {\r
-                       PrintAndLog("Found valid key:%012"llx, key64);\r
+                       PrintAndLog("Found valid key:%012" PRIx64, key64);\r
 \r
                        // transfer key to the emulator\r
                        if (transferToEml) {\r
 \r
                        // transfer key to the emulator\r
                        if (transferToEml) {\r
@@ -718,7 +719,7 @@ int CmdHF14AMfNested(const char *Cmd)
 \r
                                        key64 = bytes_to_num(keyBlock, 6);\r
                                        if (key64) {\r
 \r
                                        key64 = bytes_to_num(keyBlock, 6);\r
                                        if (key64) {\r
-                                               PrintAndLog("Found valid key:%012"llx, key64);\r
+                                               PrintAndLog("Found valid key:%012" PRIx64, key64);\r
                                                e_sector[sectorNo].foundKey[trgKeyType] = 1;\r
                                                e_sector[sectorNo].Key[trgKeyType] = key64;\r
                                        }\r
                                                e_sector[sectorNo].foundKey[trgKeyType] = 1;\r
                                                e_sector[sectorNo].Key[trgKeyType] = key64;\r
                                        }\r
@@ -734,7 +735,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("|sec|key A           |res|key B           |res|");\r
                PrintAndLog("|---|----------------|---|----------------|---|");\r
                for (i = 0; i < SectorsCnt; i++) {\r
-                       PrintAndLog("|%03d|  %012"llx"  | %d |  %012"llx"  | %d |", i,\r
+                       PrintAndLog("|%03d|  %012" PRIx64 "  | %d |  %012" PRIx64 "  | %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
                                e_sector[i].Key[0], e_sector[i].foundKey[0], e_sector[i].Key[1], e_sector[i].foundKey[1]);\r
                }\r
                PrintAndLog("|---|----------------|---|----------------|---|");\r
@@ -925,7 +926,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
                                        }\r
                                        memset(keyBlock + 6 * keycnt, 0, 6);\r
                                        num_to_bytes(strtoll(buf, NULL, 16), 6, keyBlock + 6*keycnt);\r
-                                       PrintAndLog("chk custom key[%2d] %012"llx, keycnt, bytes_to_num(keyBlock + 6*keycnt, 6));\r
+                                       PrintAndLog("chk custom key[%2d] %012" PRIx64 , keycnt, bytes_to_num(keyBlock + 6*keycnt, 6));\r
                                        keycnt++;\r
                                        memset(buf, 0, sizeof(buf));\r
                                }\r
                                        keycnt++;\r
                                        memset(buf, 0, sizeof(buf));\r
                                }\r
@@ -969,7 +970,7 @@ int CmdHF14AMfChk(const char *Cmd)
                                res = mfCheckKeys(b, t, true, size, &keyBlock[6*c], &key64);\r
                                if (res != 1) {\r
                                        if (!res) {\r
                                res = mfCheckKeys(b, t, true, size, &keyBlock[6*c], &key64);\r
                                if (res != 1) {\r
                                        if (!res) {\r
-                                               PrintAndLog("Found valid key:[%012"llx"]",key64);\r
+                                               PrintAndLog("Found valid key:[%012" PRIx64 "]",key64);\r
                                                num_to_bytes(key64, 6, foundKey[t][i]);\r
                                                validKey[t][i] = true;\r
                                        } \r
                                                num_to_bytes(key64, 6, foundKey[t][i]);\r
                                                validKey[t][i] = true;\r
                                        } \r
@@ -1058,7 +1059,7 @@ void readerAttack(nonces_t ar_resp[], bool setEmulatorMem, bool doStandardAttack
                                uint8_t sectorNum = ar_resp[i+ATTACK_KEY_COUNT].sector;\r
                                uint8_t keyType = ar_resp[i+ATTACK_KEY_COUNT].keytype;\r
 \r
                                uint8_t sectorNum = ar_resp[i+ATTACK_KEY_COUNT].sector;\r
                                uint8_t keyType = ar_resp[i+ATTACK_KEY_COUNT].keytype;\r
 \r
-                               PrintAndLog("M-Found Key%s for sector %02d: [%012"llx"]"\r
+                               PrintAndLog("M-Found Key%s for sector %02d: [%012" PRIx64 "]"\r
                                        , keyType ? "B" : "A"\r
                                        , sectorNum\r
                                        , key\r
                                        , keyType ? "B" : "A"\r
                                        , sectorNum\r
                                        , key\r
@@ -1670,7 +1671,7 @@ int CmdHF14AMfEKeyPrn(const char *Cmd)
                }\r
                keyA = bytes_to_num(data, 6);\r
                keyB = bytes_to_num(data + 10, 6);\r
                }\r
                keyA = bytes_to_num(data, 6);\r
                keyB = bytes_to_num(data + 10, 6);\r
-               PrintAndLog("|%03d|  %012"llx"  |  %012"llx"  |", i, keyA, keyB);\r
+               PrintAndLog("|%03d|  %012" PRIx64 "  |  %012" PRIx64 "  |", i, keyA, keyB);\r
        }\r
        PrintAndLog("|---|----------------|----------------|");\r
        \r
        }\r
        PrintAndLog("|---|----------------|----------------|");\r
        \r
Impressum, Datenschutz