X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/2ae8a312e058f71d0f02be4f2f9cc6f284ebbf34..3bc3598e880b68870cfcc55fbdda443d77395809:/client/cmdlft55xx.c?ds=sidebyside diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index 9eaa6463..6ea9d2d3 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -46,18 +46,17 @@ int CmdReadBlk(const char *Cmd) SendCommand(&c); WaitForResponse(CMD_ACK, NULL); -// uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00}; + uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00}; - // GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,3560); //3560 -- should be offset.. - // WaitForResponseTimeout(CMD_ACK,NULL, 1500); - - // for (int j = 0; j < LF_TRACE_BUFF_SIZE; j++) { - // GraphBuffer[j] = (int)data[j]; - // } - // GraphTraceLen = LF_TRACE_BUFF_SIZE; - CmdSamples("12000"); + GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,3560); //3560 -- should be offset.. + WaitForResponseTimeout(CMD_ACK,NULL, 1500); + + for (int j = 0; j < LF_TRACE_BUFF_SIZE; j++) { + GraphBuffer[j] = (int)data[j]; + } + GraphTraceLen = LF_TRACE_BUFF_SIZE; ManchesterDemod(block); - // RepaintGraphWindow(); + RepaintGraphWindow(); return 0; } @@ -321,7 +320,7 @@ int CmdDump(const char *Cmd){ return 0; } } - + for ( int i = 0; i <8; ++i){ memset(s,0,sizeof(s)); if ( hasPwd ) { @@ -352,6 +351,7 @@ int ManchesterDemod(int blockNum){ if (!HasGraphData()) return 0; uint8_t sizebyte = 32; + // the value 5 was selected during empirical studies of the decoded data. Some signal noise to skip. uint8_t offset = 5; uint32_t blockData; uint8_t bits[LF_BITSSTREAM_LEN] = {0x00}; @@ -468,6 +468,9 @@ uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits){ int i = start; int j = len-1; + if (len > 32) { + return 0; + } uint32_t tmp = 0; for (; j >= 0; --j, ++i){ tmp |= bits[i] << j; @@ -482,8 +485,8 @@ static command_t CommandTable[] = {"rdpwd", CmdReadBlkPWD, 0, " -- Read T55xx block data with password mode"}, {"wr", CmdWriteBlk, 0, " -- Write T55xx block data (page 0)"}, {"wrpwd", CmdWriteBlkPWD, 0, " -- Write T55xx block data with password"}, - {"trace", CmdReadTrace, 0, "[1] Read T55xx traceability data (page 1 / blk 0-1) "}, - {"info", CmdInfo, 0, "[1] Read T55xx configuration data (page0 /blk 0)"}, + {"trace", CmdReadTrace, 0, "[1] Read T55xx traceability data (page 1/ blk 0-1)"}, + {"info", CmdInfo, 0, "[1] Read T55xx configuration data (page 0/ blk 0)"}, {"dump", CmdDump, 0, "[password] Dump T55xx card block 0-7. optional with password"}, {"fsk", CmdIceFsk, 0, "FSK demod"}, {"man", CmdIceManchester, 0, "Manchester demod (with SST)"},