X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/55acbb2a3903f7940d0db5fae2e8f4fdab51d1b8..b0127e65f1bef754e0ac72893e2ba99f9ca7f106:/client/cmdhfmf.c diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 6abfdda2..f3f243c4 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -984,10 +984,6 @@ int CmdHF14AMfEGet(const char *Cmd) } blockNo = param_get8(Cmd, 0); - if (blockNo >= 32 * 4 + 8 * 16) { - PrintAndLog("Block number must be in [0..255] as in MIFARE classic."); - return 1; - } PrintAndLog(" "); if (!mfEmlGetMem(data, blockNo, 3)) { @@ -1028,10 +1024,6 @@ int CmdHF14AMfESet(const char *Cmd) } blockNo = param_get8(Cmd, 0); - if (blockNo >= 32 * 4 + 8 * 16) { - PrintAndLog("Block number must be in [0..255] as in MIFARE classic."); - return 1; - } if (param_gethex(Cmd, 1, memBlock, 32)) { PrintAndLog("block data must include 32 HEX symbols"); @@ -1269,10 +1261,6 @@ int CmdHF14AMfCSetBlk(const char *Cmd) } blockNo = param_get8(Cmd, 0); - if (blockNo >= 32 * 4 + 8 * 16) { - PrintAndLog("Block number must be in [0..255] as in MIFARE classic."); - return 1; - } if (param_gethex(Cmd, 1, memBlock, 32)) { PrintAndLog("block data must include 32 HEX symbols"); @@ -1400,10 +1388,6 @@ int CmdHF14AMfCGetBlk(const char *Cmd) { } blockNo = param_get8(Cmd, 0); - if (blockNo >= 32 * 4 + 8 * 16) { - PrintAndLog("Block number must be in [0..255] as in MIFARE classic."); - return 1; - } PrintAndLog("--block number:%02x ", blockNo); @@ -1545,7 +1529,7 @@ int CmdHF14AMfSniff(const char *Cmd){ // params bool wantLogToFile = 0; bool wantDecrypt = 0; - bool wantSaveToEml = 0; + //bool wantSaveToEml = 0; TODO bool wantSaveToEmlFile = 0; //var @@ -1558,6 +1542,7 @@ int CmdHF14AMfSniff(const char *Cmd){ uint8_t atqa[2]; uint8_t sak; bool isTag; + uint32_t parity; uint8_t buf[3000]; uint8_t * bufPtr = buf; memset(buf, 0x00, 3000); @@ -1568,7 +1553,7 @@ int CmdHF14AMfSniff(const char *Cmd){ PrintAndLog(" l - save encrypted sequence to logfile `uid.log`"); PrintAndLog(" d - decrypt sequence and put it to log file `uid.log`"); PrintAndLog(" n/a e - decrypt sequence, collect read and write commands and save the result of the sequence to emulator memory"); - PrintAndLog(" n/a r - decrypt sequence, collect read and write commands and save the result of the sequence to emulator dump file `uid.eml`"); + PrintAndLog(" r - decrypt sequence, collect read and write commands and save the result of the sequence to emulator dump file `uid.eml`"); PrintAndLog("Usage: hf mf sniff [l][d][e][r]"); PrintAndLog(" sample: hf mf sniff l d e"); return 0; @@ -1578,7 +1563,7 @@ int CmdHF14AMfSniff(const char *Cmd){ char ctmp = param_getchar(Cmd, i); if (ctmp == 'l' || ctmp == 'L') wantLogToFile = true; if (ctmp == 'd' || ctmp == 'D') wantDecrypt = true; - if (ctmp == 'e' || ctmp == 'E') wantSaveToEml = true; + //if (ctmp == 'e' || ctmp == 'E') wantSaveToEml = true; TODO if (ctmp == 'f' || ctmp == 'F') wantSaveToEmlFile = true; } @@ -1625,7 +1610,9 @@ int CmdHF14AMfSniff(const char *Cmd){ num = 0; while (bufPtr - buf + 9 < blockLen) { isTag = bufPtr[3] & 0x80 ? true:false; - bufPtr += 8; + bufPtr += 4; + parity = *((uint32_t *)(bufPtr)); + bufPtr += 4; len = bufPtr[0]; bufPtr++; if ((len == 14) && (bufPtr[0] = 0xff) && (bufPtr[1] = 0xff)) { @@ -1635,14 +1622,14 @@ int CmdHF14AMfSniff(const char *Cmd){ PrintAndLog("tag select uid:%s atqa:%02x %02x sak:0x%02x", sprint_hex(uid, 7), atqa[0], atqa[1], sak); if (wantLogToFile) { - FillFileNameByUID(logHexFileName, uid, ".log"); + FillFileNameByUID(logHexFileName, uid, ".log", 7); AddLogCurrentDT(logHexFileName); } - if (wantDecrypt) mfTraceInit(uid, atqa, sak); + if (wantDecrypt) mfTraceInit(uid, atqa, sak, wantSaveToEmlFile); } else { PrintAndLog("%s(%d):%s", isTag ? "TAG":"RDR", num, sprint_hex(bufPtr, len)); if (wantLogToFile) AddLogHex(logHexFileName, isTag ? "TAG: ":"RDR: ", bufPtr, len); - if (wantDecrypt) mfTraceDecode(bufPtr, len); + if (wantDecrypt) mfTraceDecode(bufPtr, len, parity, wantSaveToEmlFile); } bufPtr += len; num++;