X-Git-Url: http://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/blobdiff_plain/1010aacca01ea823e5265babefa0d325863a2ba3..1b492a97af74c0cb6c9886bce8b777d6bb50798d:/client/cmdlft55xx.c diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index b4f884fe..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; } @@ -316,12 +315,12 @@ int CmdDump(const char *Cmd){ } if ( hasPwd ){ - if (param_gethex(Cmd, 0, pwd, 4)) { - PrintAndLog("password must include 4 HEX symbols"); + if (param_gethex(Cmd, 0, pwd, 8)) { + PrintAndLog("password must include 8 HEX symbols"); 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)"},