mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-22 07:04:13 +08:00
add: "lf t55xx info" option to use data from Graphbuffer.
add: "lf t55xx trace" option to use data from Graphbuffer.
This commit is contained in:
parent
7bd30f12ac
commit
fbceacc5b8
3 changed files with 71 additions and 41 deletions
|
@ -60,15 +60,7 @@ int CmdReadBlk(const char *Cmd)
|
|||
GraphBuffer[j] = ((int)data[j]) ;
|
||||
}
|
||||
GraphTraceLen = LF_TRACE_BUFF_SIZE;
|
||||
|
||||
uint8_t bits[1000] = {0x00};
|
||||
uint8_t * bitstream = bits;
|
||||
|
||||
manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream);
|
||||
|
||||
uint32_t bl0 = PackBits(5, 32, bitstream);
|
||||
PrintAndLog(" Block %d : 0x%08X %s", Block, bl0, sprint_bin(bitstream+5,32) );
|
||||
|
||||
CmdIceManchester(Cmd);
|
||||
RepaintGraphWindow();
|
||||
return 0;
|
||||
}
|
||||
|
@ -106,13 +98,7 @@ int CmdReadBlkPWD(const char *Cmd)
|
|||
}
|
||||
GraphTraceLen = LF_TRACE_BUFF_SIZE;
|
||||
|
||||
uint8_t bits[1000] = {0x00};
|
||||
uint8_t * bitstream = bits;
|
||||
|
||||
manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream);
|
||||
|
||||
uint32_t bl0 = PackBits(5, 32, bitstream);
|
||||
PrintAndLog(" Block %d : 0x%08X %s", Block, bl0, sprint_bin(bitstream+5,32) );
|
||||
CmdIceManchester(Cmd);
|
||||
|
||||
RepaintGraphWindow();
|
||||
return 0;
|
||||
|
@ -169,20 +155,32 @@ int CmdWriteBlkPWD(const char *Cmd)
|
|||
|
||||
int CmdReadTrace(const char *Cmd)
|
||||
{
|
||||
UsbCommand c = {CMD_T55XX_READ_TRACE, {0, 0, 0}};
|
||||
SendCommand(&c);
|
||||
WaitForResponse(CMD_ACK, NULL);
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
|
||||
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]);
|
||||
//GraphBuffer[j] = ((int)data[j]) - 128;
|
||||
if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') {
|
||||
PrintAndLog("Usage: lf t55xx trace [use data from Graphbuffer]");
|
||||
PrintAndLog(" [use data from Graphbuffer], if not set, try reading data from tag.");
|
||||
PrintAndLog("");
|
||||
PrintAndLog(" sample: lf t55xx trace");
|
||||
PrintAndLog(" sample: lf t55xx trace 1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( strlen(Cmd)==0){
|
||||
UsbCommand c = {CMD_T55XX_READ_TRACE, {0, 0, 0}};
|
||||
SendCommand(&c);
|
||||
WaitForResponse(CMD_ACK, NULL);
|
||||
|
||||
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;
|
||||
}
|
||||
GraphTraceLen = LF_TRACE_BUFF_SIZE;
|
||||
|
||||
uint8_t bits[1000] = {0x00};
|
||||
uint8_t * bitstream = bits;
|
||||
|
@ -247,9 +245,22 @@ int CmdInfo(const char *Cmd){
|
|||
Normal mode
|
||||
Extended mode
|
||||
*/
|
||||
// läs block 0 - data finns i graphbuff
|
||||
CmdReadBlk("0");
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
|
||||
if (strlen(Cmd) > 1 || cmdp == 'h' || cmdp == 'H') {
|
||||
PrintAndLog("Usage: lf t55xx info [use data from Graphbuffer]");
|
||||
PrintAndLog(" [use data from Graphbuffer], if not set, try reading data from tag.");
|
||||
PrintAndLog("");
|
||||
PrintAndLog(" sample: lf t55xx info");
|
||||
PrintAndLog(" sample: lf t55xx info 1");
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( strlen(Cmd)==0){
|
||||
CmdReadBlk("0");
|
||||
}
|
||||
|
||||
|
||||
uint8_t bits[1000] = {0x00};
|
||||
uint8_t * bitstream = bits;
|
||||
|
||||
|
@ -333,13 +344,27 @@ int CmdDump(const char *Cmd){
|
|||
}
|
||||
|
||||
int CmdIceFsk(const char *Cmd){
|
||||
//uint8_t bits[1000] = {0x00};
|
||||
//uint8_t * bitstream = bits;
|
||||
iceFsk3(GraphBuffer, LF_TRACE_BUFF_SIZE);
|
||||
|
||||
RepaintGraphWindow();
|
||||
return 0;
|
||||
}
|
||||
int CmdIceManchester(const char *Cmd){
|
||||
|
||||
int blockNum = -1;
|
||||
uint32_t blockData;
|
||||
uint8_t bits[1000] = {0x00};
|
||||
uint8_t * bitstream = bits;
|
||||
|
||||
manchester_decode(GraphBuffer, LF_TRACE_BUFF_SIZE, bitstream);
|
||||
blockData = PackBits(5, 32, bitstream);
|
||||
sscanf(Cmd, "%d", &blockNum);
|
||||
if ( blockNum > -1){
|
||||
PrintAndLog(" Block %d : 0x%08X %s", blockNum, blockData, sprint_bin(bitstream+5,32) );
|
||||
}else{
|
||||
PrintAndLog(" Decoded : 0x%08X %s", blockData, sprint_bin(bitstream+5,32) );
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
char * GetBitRateStr(uint32_t id){
|
||||
static char buf[40];
|
||||
|
@ -455,10 +480,11 @@ static command_t CommandTable[] =
|
|||
{"rdPWD", CmdReadBlkPWD, 0, "<block> <password> -- Read T55xx block data with password mode"},
|
||||
{"wr", CmdWriteBlk, 0, "<data> <block> -- Write T55xx block data (page 0)"},
|
||||
{"wrPWD", CmdWriteBlkPWD, 0, "<data> <block> <password> -- Write T55xx block data with password"},
|
||||
{"trace", CmdReadTrace, 0, "Read T55xx traceability data (page 1 / blk 0-1)"},
|
||||
{"info", CmdInfo, 0, "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 (page0 /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"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
|
|
|
@ -19,6 +19,7 @@ int CmdWriteBLkPWD(const char *Cmd);
|
|||
int CmdReadTrace(const char *Cmd);
|
||||
int CmdInfo(const char *Cmd);
|
||||
int CmdIceFsk(const char *Cmd);
|
||||
int CmdIceManchester(const char *Cmd);
|
||||
char * GetBitRateStr(uint32_t id);
|
||||
char * GetSaferStr(uint32_t id);
|
||||
char * GetModulationStr( uint32_t id);
|
||||
|
|
15
client/ui.c
15
client/ui.c
|
@ -116,17 +116,14 @@ int manchester_decode( int * data, const size_t len, uint8_t * dataout){
|
|||
clock = GetT55x7Clock( data, len, high );
|
||||
startindex = DetectFirstTransition(data, len, high);
|
||||
|
||||
//PrintAndLog(" Clock : %d", clock);
|
||||
//PrintAndLog(" startindex : %d", startindex);
|
||||
// PrintAndLog(" Clock : %d", clock);
|
||||
// PrintAndLog(" startindex : %d", startindex);
|
||||
|
||||
if (high != 1)
|
||||
bitlength = ManchesterConvertFrom255(data, len, bitStream, high, low, clock, startindex);
|
||||
else
|
||||
bitlength= ManchesterConvertFrom1(data, len, bitStream, clock, startindex);
|
||||
|
||||
//if ( bitlength > 0 )
|
||||
// PrintPaddedManchester(bitStream, bitlength, clock);
|
||||
|
||||
memcpy(dataout, bitStream, bitlength);
|
||||
return bitlength;
|
||||
}
|
||||
|
@ -558,8 +555,14 @@ void iceFsk3(int * data, const size_t len){
|
|||
int stopOne = j-1;
|
||||
|
||||
int fieldlen = stopOne-startOne;
|
||||
printf("FIELD Length: %d \n", fieldlen);
|
||||
|
||||
fieldlen = (fieldlen == 39 || fieldlen == 41)? 40 : fieldlen;
|
||||
fieldlen = (fieldlen == 59 || fieldlen == 51)? 50 : fieldlen;
|
||||
if ( fieldlen != 40 && fieldlen != 50){
|
||||
printf("Detected field Length: %d \n", fieldlen);
|
||||
printf("Can only handle len 40 or 50. Aborting...");
|
||||
return;
|
||||
}
|
||||
|
||||
// FSK sequence start == 000111
|
||||
int startPos = 0;
|
||||
|
|
Loading…
Reference in a new issue