X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/39864b0bd41dd5e896bcb8eeabcf2c3932f2203a..55acbb2a3903f7940d0db5fae2e8f4fdab51d1b8:/client/cmdhfmf.c diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 98006d41..6abfdda2 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -1542,6 +1542,13 @@ int CmdHF14AMfCSave(const char *Cmd) { } int CmdHF14AMfSniff(const char *Cmd){ + // params + bool wantLogToFile = 0; + bool wantDecrypt = 0; + bool wantSaveToEml = 0; + bool wantSaveToEmlFile = 0; + + //var int res = 0; int len = 0; int blockLen = 0; @@ -1556,11 +1563,25 @@ int CmdHF14AMfSniff(const char *Cmd){ memset(buf, 0x00, 3000); if (param_getchar(Cmd, 0) == 'h') { - PrintAndLog("Usage: hf mf sniff "); - PrintAndLog(" sample: hf mf sniff "); + PrintAndLog("It continuously get data from the field and saves it to: log, emulator, emulator file."); + PrintAndLog("You can specify:"); + 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("Usage: hf mf sniff [l][d][e][r]"); + PrintAndLog(" sample: hf mf sniff l d e"); return 0; } + for (int i = 0; i < 4; i++) { + 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 == 'f' || ctmp == 'F') wantSaveToEmlFile = true; + } + printf("-------------------------------------------------------------------------\n"); printf("Executing command. \n"); printf("Press the key on the proxmark3 device to abort both proxmark3 and client.\n"); @@ -1611,9 +1632,17 @@ int CmdHF14AMfSniff(const char *Cmd){ memcpy(uid, bufPtr + 2, 7); memcpy(atqa, bufPtr + 2 + 7, 2); 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"); + AddLogCurrentDT(logHexFileName); + } + if (wantDecrypt) mfTraceInit(uid, atqa, sak); } 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); } bufPtr += len; num++;