X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/c2731f37bef482bde1a87d79566c0b3bde658c98..4c0cf2d215529456c239b921b082ebb1a56bb98a:/client/mifarehost.c diff --git a/client/mifarehost.c b/client/mifarehost.c index e6ad6016..431db9dc 100644 --- a/client/mifarehost.c +++ b/client/mifarehost.c @@ -15,8 +15,6 @@ #include "mifarehost.h" #include "proxmark3.h" -#define llx PRIx64 - // MIFARE int compar_int(const void * a, const void * b) { // didn't work: (the result is truncated to 32 bits) @@ -79,22 +77,19 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo struct Crypto1State *p1, *p2, *p3, *p4; // flush queue - WaitForResponseTimeout(CMD_ACK,NULL,100); UsbCommand c = {CMD_MIFARE_NESTED, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, calibrate}}; memcpy(c.d.asBytes, key, 6); + clearCommandBuffer(); SendCommand(&c); - if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) { - return -1; - } + if (!WaitForResponseTimeout(CMD_ACK, &resp, 1500)) return -1; - if (resp.arg[0]) { - return resp.arg[0]; // error during nested - } - + // error during nested + if (resp.arg[0]) return resp.arg[0]; + memcpy(&uid, resp.d.asBytes, 4); - PrintAndLog("uid:%08x trgbl=%d trgkey=%x", uid, (uint16_t)resp.arg[2] & 0xff, (uint16_t)resp.arg[2] >> 8); + PrintAndLog("UID: %08x Block:%d Key: %c", uid, (uint16_t)resp.arg[2] & 0xff, (resp.arg[2] >> 8) ?'A':'B' ); for (i = 0; i < 2; i++) { statelists[i].blockNo = resp.arg[2] & 0xff;