X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/28415b5d902e391b5bbfd615b3a42d8cffbb0ce3..05fd71264a25efd6d29d82d94bb7ddc447251fc0:/client/mifarehost.c?ds=inline diff --git a/client/mifarehost.c b/client/mifarehost.c index 1cb228bb..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,23 +77,19 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t * key, uint8_t trgBlockNo struct Crypto1State *p1, *p2, *p3, *p4; // flush queue - clearCommandBuffer(); - //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;