- if (isOK) {\r
- switch (isOK) {\r
- case -1 : PrintAndLog("Error: No response from Proxmark.\n"); break;\r
- case -2 : PrintAndLog("Button pressed. Aborted.\n"); break;\r
- case -3 : PrintAndLog("Tag isn't vulnerable to Nested Attack (random numbers are not predictable).\n"); break;\r
- default : PrintAndLog("Unknown Error.\n");\r
- }\r
- return 2;\r
- }\r
- key64 = bytes_to_num(keyBlock, 6);\r
- if (key64) {\r
- PrintAndLog("Found valid key:%012"llx, key64);\r
-\r
- // transfer key to the emulator\r
- if (transferToEml) {\r
- uint8_t sectortrailer;\r
- if (trgBlockNo < 32*4) { // 4 block sector\r
- sectortrailer = (trgBlockNo & 0x03) + 3;\r
- } else { // 16 block sector\r
- sectortrailer = (trgBlockNo & 0x0f) + 15;\r
+ switch (isOK) {\r
+ case -1 : PrintAndLog("Error: No response from Proxmark.\n"); break;\r
+ case -2 : PrintAndLog("Button pressed. Aborted.\n"); break;\r
+ case -3 : PrintAndLog("Tag isn't vulnerable to Nested Attack (random numbers are not predictable).\n"); break;\r
+ case -4 : PrintAndLog("No valid key found"); break;\r
+ case -5 : \r
+ key64 = bytes_to_num(keyBlock, 6);\r
+\r
+ // transfer key to the emulator\r
+ if (transferToEml) {\r
+ uint8_t sectortrailer;\r
+ if (trgBlockNo < 32*4) { // 4 block sector\r
+ sectortrailer = (trgBlockNo & 0x03) + 3;\r
+ } else { // 16 block sector\r
+ sectortrailer = (trgBlockNo & 0x0f) + 15;\r
+ }\r
+ mfEmlGetMem(keyBlock, sectortrailer, 1);\r
+ \r
+ if (!trgKeyType)\r
+ num_to_bytes(key64, 6, keyBlock);\r
+ else\r
+ num_to_bytes(key64, 6, &keyBlock[10]);\r
+ mfEmlSetMem(keyBlock, sectortrailer, 1); \r