]> cvs.zerfleddert.de Git - proxmark3-svn/commitdiff
fix: (issue #73) hf mf cload didn't work. Add more annotations for Magic Cards operation.
authorpwpiwi <pwpiwi@users.noreply.github.com>
Mon, 9 Mar 2015 20:36:27 +0000 (21:36 +0100)
committerpwpiwi <pwpiwi@users.noreply.github.com>
Mon, 9 Mar 2015 20:36:27 +0000 (21:36 +0100)
client/cmdhf.c
client/cmdhfmf.c
common/protocols.h

index 074a37e288efcc53adfbc0f1ff65d0b2b09a703a..22063bbbe566e22e139524ad98ba2cc817c9b641 100644 (file)
@@ -62,19 +62,21 @@ void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize)
                        snprintf(exp,size,"ANTICOLL-2"); break;
                }
        }
-       case ISO14443A_CMD_REQA:       snprintf(exp,size,"REQA"); break;
-       case ISO14443A_CMD_READBLOCK:  snprintf(exp,size,"READBLOCK(%d)",cmd[1]); break;
-       case ISO14443A_CMD_WRITEBLOCK: snprintf(exp,size,"WRITEBLOCK(%d)",cmd[1]); break;
-       case ISO14443A_CMD_HALT:       snprintf(exp,size,"HALT"); break;
-       case ISO14443A_CMD_RATS:       snprintf(exp,size,"RATS"); break;
-       case MIFARE_CMD_INC:          snprintf(exp,size,"INC(%d)",cmd[1]); break;
-       case MIFARE_CMD_DEC:          snprintf(exp,size,"DEC(%d)",cmd[1]); break;
-       case MIFARE_CMD_RESTORE:      snprintf(exp,size,"RESTORE(%d)",cmd[1]); break;
-       case MIFARE_CMD_TRANSFER:     snprintf(exp,size,"TRANSFER(%d)",cmd[1]); break;
-       case MIFARE_AUTH_KEYA:        snprintf(exp,size,"AUTH-A(%d)",cmd[1]); break;
-       case MIFARE_AUTH_KEYB:        snprintf(exp,size,"AUTH-B(%d)",cmd[1]); break;
-       case MIFARE_MAGICMODE:        snprintf(exp,size,"MAGIC"); break;
-       default:                      snprintf(exp,size,"?"); break;
+       case ISO14443A_CMD_REQA:                snprintf(exp,size,"REQA"); break;
+       case ISO14443A_CMD_READBLOCK:   snprintf(exp,size,"READBLOCK(%d)",cmd[1]); break;
+       case ISO14443A_CMD_WRITEBLOCK:  snprintf(exp,size,"WRITEBLOCK(%d)",cmd[1]); break;
+       case ISO14443A_CMD_HALT:                snprintf(exp,size,"HALT"); break;
+       case ISO14443A_CMD_RATS:                snprintf(exp,size,"RATS"); break;
+       case MIFARE_CMD_INC:                    snprintf(exp,size,"INC(%d)",cmd[1]); break;
+       case MIFARE_CMD_DEC:                    snprintf(exp,size,"DEC(%d)",cmd[1]); break;
+       case MIFARE_CMD_RESTORE:                snprintf(exp,size,"RESTORE(%d)",cmd[1]); break;
+       case MIFARE_CMD_TRANSFER:               snprintf(exp,size,"TRANSFER(%d)",cmd[1]); break;
+       case MIFARE_AUTH_KEYA:                  snprintf(exp,size,"AUTH-A(%d)",cmd[1]); break;
+       case MIFARE_AUTH_KEYB:                  snprintf(exp,size,"AUTH-B(%d)",cmd[1]); break;
+       case MIFARE_MAGICWUPC1:                 snprintf(exp,size,"MAGIC WUPC1"); break;
+       case MIFARE_MAGICWUPC2:                 snprintf(exp,size,"MAGIC WUPC2"); break;
+       case MIFARE_MAGICWIPEC:                 snprintf(exp,size,"MAGIC WIPEC"); break;
+       default:                                                snprintf(exp,size,"?"); break;
        }
        return;
 }
index d0852ea5bdf16fd05f69180fcbdd26125d0a8a8b..c16b9674137d8c74441d86b325bdd72e692fc287 100644 (file)
@@ -1554,15 +1554,14 @@ int CmdHF14AMfCLoad(const char *Cmd)
        if (ctmp == 'e' || ctmp == 'E') fillFromEmulator = 1;\r
        \r
        if (fillFromEmulator) {\r
-               flags = CSETBLOCK_INIT_FIELD + CSETBLOCK_WUPC;\r
                for (blockNum = 0; blockNum < 16 * 4; blockNum += 1) {\r
                        if (mfEmlGetMem(buf8, blockNum, 1)) {\r
                                PrintAndLog("Cant get block: %d", blockNum);\r
                                return 2;\r
                        }\r
-                       \r
-                       if (blockNum == 2) flags = 0;\r
-                       if (blockNum == 16 * 4 - 1) flags = CSETBLOCK_HALT + CSETBLOCK_RESET_FIELD;\r
+                       if (blockNum == 0) flags = CSETBLOCK_INIT_FIELD + CSETBLOCK_WUPC;                               // switch on field and send magic sequence\r
+                       if (blockNum == 1) flags = 0;                                                                                                   // just write\r
+                       if (blockNum == 16 * 4 - 1) flags = CSETBLOCK_HALT + CSETBLOCK_RESET_FIELD;             // Done. Magic Halt and switch off field.\r
 \r
                        if (mfCSetBlock(blockNum, buf8, NULL, 0, flags)) {\r
                                PrintAndLog("Cant set magic card block: %d", blockNum);\r
@@ -1587,7 +1586,6 @@ int CmdHF14AMfCLoad(const char *Cmd)
                }\r
        \r
                blockNum = 0;\r
-               flags = CSETBLOCK_INIT_FIELD + CSETBLOCK_WUPC;\r
                while(!feof(f)){\r
                \r
                        memset(buf, 0, sizeof(buf));\r
@@ -1597,7 +1595,7 @@ int CmdHF14AMfCLoad(const char *Cmd)
                                return 2;\r
                        }\r
 \r
-                       if (strlen(buf) < 32){\r
+                       if (strlen(buf) < 32) {\r
                                if(strlen(buf) && feof(f))\r
                                        break;\r
                                PrintAndLog("File content error. Block data must include 32 HEX symbols");\r
@@ -1606,8 +1604,9 @@ int CmdHF14AMfCLoad(const char *Cmd)
                        for (i = 0; i < 32; i += 2)\r
                                sscanf(&buf[i], "%02x", (unsigned int *)&buf8[i / 2]);\r
 \r
-                       if (blockNum == 2) flags = 0;\r
-                       if (blockNum == 16 * 4 - 1) flags = CSETBLOCK_HALT + CSETBLOCK_RESET_FIELD;\r
+                       if (blockNum == 0) flags = CSETBLOCK_INIT_FIELD + CSETBLOCK_WUPC;                               // switch on field and send magic sequence\r
+                       if (blockNum == 1) flags = 0;                                                                                                   // just write\r
+                       if (blockNum == 16 * 4 - 1) flags = CSETBLOCK_HALT + CSETBLOCK_RESET_FIELD;             // Done. Switch off field.\r
 \r
                        if (mfCSetBlock(blockNum, buf8, NULL, 0, flags)) {\r
                                PrintAndLog("Can't set magic card block: %d", blockNum);\r
index 1dd6618506c716518476f591d9c822667bc275bd..01b738c2b6076ec1fed19d7d47dd2b2033683442 100644 (file)
@@ -115,7 +115,9 @@ NXP/Philips CUSTOM COMMANDS
 
 #define MIFARE_AUTH_KEYA           0x60
 #define MIFARE_AUTH_KEYB           0x61
-#define MIFARE_MAGICMODE           0x40
+#define MIFARE_MAGICWUPC1          0x40
+#define MIFARE_MAGICWUPC2              0x43
+#define MIFARE_MAGICWIPEC              0x41
 #define MIFARE_CMD_INC          0xC0
 #define MIFARE_CMD_DEC          0xC1
 #define MIFARE_CMD_RESTORE      0xC2
Impressum, Datenschutz