X-Git-Url: http://cvs.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/e67b06b7067c55f12bbdf72c5f9f00dec11e99fd..389d0360e1b4960f556a696aa97a0703e1815a86:/client/cmdlfem4x.c diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index 862f20bd..f29da8e0 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -22,6 +22,20 @@ static int CmdHelp(const char *Cmd); + + +int CmdEMdemodASK(const char *Cmd) +{ + int findone=0; + UsbCommand c={CMD_EM410X_DEMOD}; + if(Cmd[0]=='1') findone=1; + c.arg[0]=findone; + SendCommand(&c); + return 0; +} + + + /* Read the ID of an EM410x tag. * Format: * 1111 1111 1 <-- standard non-repeatable header @@ -35,6 +49,7 @@ int CmdEM410xRead(const char *Cmd) int i, j, clock, header, rows, bit, hithigh, hitlow, first, bit2idx, high, low; int parity[4]; char id[11]; + char id2[11]; int retested = 0; uint8_t BitStream[MAX_GRAPH_TRACE_LEN]; high = low = 0; @@ -101,6 +116,7 @@ retest: { /* Read another byte! */ sprintf(id+rows, "%x", (8 * BitStream[i]) + (4 * BitStream[i+1]) + (2 * BitStream[i+2]) + (1 * BitStream[i+3])); + sprintf(id2+rows, "%x", (8 * BitStream[i+3]) + (4 * BitStream[i+2]) + (2 * BitStream[i+1]) + (1 * BitStream[i])); rows++; /* Keep parity info */ @@ -135,6 +151,7 @@ retest: { /* Sweet! */ PrintAndLog("EM410x Tag ID: %s", id); + PrintAndLog("Unique Tag ID: %s", id2); /* Stop any loops */ return 1; @@ -257,8 +274,11 @@ int CmdEM410xWatch(const char *Cmd) // is very slow // TBD: Auto-grow sample size based on detected sample rate. IE: If the // rate gets lower, then grow the number of samples - CmdSamples("4000"); - } while ( ! CmdEM410xRead("")); + + // Changed by martin, 4000 x 4 = 16000, + // see http://www.proxmark.org/forum/viewtopic.php?pid=7235#p7235 + CmdSamples("16000"); + } while ( ! CmdEM410xRead("")); return 0; } @@ -313,7 +333,7 @@ int CmdEM4x50Read(const char *Cmd) ++i; while ((GraphBuffer[i] > low) && (i(MAX_GRAPH_TRACE_LEN/64)) { + if (j>=(MAX_GRAPH_TRACE_LEN/64)) { break; } tmpbuff[j++]= i - start; @@ -409,7 +429,7 @@ int CmdEM4x50Read(const char *Cmd) int CmdEM410xWrite(const char *Cmd) { uint64_t id = 0xFFFFFFFFFFFFFFFF; // invalid id value - unsigned int card = 0xFF; // invalid card value + int card = 0xFF; // invalid card value unsigned int clock = 0; // invalid clock value sscanf(Cmd, "%" PRIx64 " %d %d", &id, &card, &clock); @@ -575,6 +595,7 @@ int CmdWriteWordPWD(const char *Cmd) static command_t CommandTable[] = { {"help", CmdHelp, 1, "This help"}, + {"em410xdemod", CmdEMdemodASK, 0, "[findone] -- Extract ID from EM410x tag (option 0 for continuous loop, 1 for only 1 tag)"}, {"em410xread", CmdEM410xRead, 1, "[clock rate] -- Extract ID from EM410x tag"}, {"em410xsim", CmdEM410xSim, 0, " -- Simulate EM410x tag"}, {"em410xwatch", CmdEM410xWatch, 0, "['h'] -- Watches for EM410x 125/134 kHz tags (option 'h' for 134)"},