X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/88c637e6cde839c8316800ab0d96301b61208b6d..b03c0f2d862edcf4db6587144af5cc198ea7dfbd:/client/cmdhfmf.c diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index adf456f8..6075db53 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -1194,7 +1194,7 @@ int CmdHF14AMf1kSim(const char *Cmd) PrintAndLog(" n (Optional) Automatically exit simulation after blocks have been read by reader. 0 = infinite"); PrintAndLog(" i (Optional) Interactive, means that console will not be returned until simulation finishes or is aborted"); PrintAndLog(" x (Optional) Crack, performs the 'reader attack', nr/ar attack against a legitimate reader, fishes out the key(s)"); - PrintAndLog(" sample: hf mf sim 0a0a0a0a "); + PrintAndLog(" sample: hf mf sim u 0a0a0a0a "); return 0; } uint8_t pnr = 0; @@ -1260,8 +1260,10 @@ int CmdHF14AMfDbg(const char *Cmd) PrintAndLog("Usage: hf mf dbg "); PrintAndLog(" 0 - no debug messages"); PrintAndLog(" 1 - error messages"); - PrintAndLog(" 2 - all messages"); - PrintAndLog(" 4 - extended debug mode"); + PrintAndLog(" 2 - plus information messages"); + PrintAndLog(" 3 - plus debug messages"); + PrintAndLog(" 4 - print even debug messages in timing critical functions"); + PrintAndLog(" Note: this option therefore may cause malfunction itself"); return 0; } @@ -1473,8 +1475,8 @@ int CmdHF14AMfECFill(const char *Cmd) uint8_t keyType = 0; if (strlen(Cmd) < 1 || param_getchar(Cmd, 0) == 'h') { - PrintAndLog("Usage: hf mf efill "); - PrintAndLog("sample: hf mf efill A"); + PrintAndLog("Usage: hf mf ecfill "); + PrintAndLog("sample: hf mf ecfill A"); PrintAndLog("Card data blocks transfers to card emulator memory."); PrintAndLog("Keys must be laid in the simulator memory. \n"); return 0; @@ -1848,7 +1850,8 @@ int CmdHF14AMfSniff(const char *Cmd){ int blockLen = 0; int num = 0; int pckNum = 0; - uint8_t uid[8]; + uint8_t uid[7]; + uint8_t uid_len; uint8_t atqa[2]; uint8_t sak; bool isTag; @@ -1883,8 +1886,9 @@ int CmdHF14AMfSniff(const char *Cmd){ printf("Press the key on pc keyboard to abort the client.\n"); printf("-------------------------------------------------------------------------\n"); - UsbCommand c = {CMD_MIFARE_SNIFFER, {0, 0, 0}}; - SendCommand(&c); + UsbCommand c = {CMD_MIFARE_SNIFFER, {0, 0, 0}}; + clearCommandBuffer(); + SendCommand(&c); // wait cycle while (true) { @@ -1925,14 +1929,19 @@ int CmdHF14AMfSniff(const char *Cmd){ bufPtr += 4; len = bufPtr[0]; bufPtr++; - if ((len == 14) && (bufPtr[0] = 0xff) && (bufPtr[1] = 0xff)) { + if ((len == 14) && (bufPtr[0] == 0xff) && (bufPtr[1] == 0xff)) { memcpy(uid, bufPtr + 2, 7); memcpy(atqa, bufPtr + 2 + 7, 2); + uid_len = (atqa[0] & 0xC0) == 0x40 ? 7 : 4; sak = bufPtr[11]; - 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", 7); + PrintAndLog("tag select uid:%s atqa:0x%02x%02x sak:0x%02x", + sprint_hex(uid + (7 - uid_len), uid_len), + atqa[1], + atqa[0], + sak); + if (wantLogToFile || wantDecrypt) { + FillFileNameByUID(logHexFileName, uid + (7 - uid_len), ".log", uid_len); AddLogCurrentDT(logHexFileName); } if (wantDecrypt) mfTraceInit(uid, atqa, sak, wantSaveToEmlFile); @@ -1947,7 +1956,8 @@ int CmdHF14AMfSniff(const char *Cmd){ } } // resp not NILL } // while (true) - return 0; + + return 0; } static command_t CommandTable[] =