Merge branch 'master' of https://github.com/Proxmark/proxmark3
Conflicts: armsrc/appmain.c armsrc/iclass.c
This commit is contained in:
@@ -157,9 +157,28 @@ NXP/Philips CUSTOM COMMANDS
|
||||
#define MIFARE_ULC_AUTH_1 0x1A
|
||||
#define MIFARE_ULC_AUTH_2 0xAF
|
||||
|
||||
/**
|
||||
06 00 = INITIATE
|
||||
0E xx = SELECT ID (xx = Chip-ID)
|
||||
0B = Get UID
|
||||
08 yy = Read Block (yy = block number)
|
||||
09 yy dd dd dd dd = Write Block (yy = block number; dd dd dd dd = data to be written)
|
||||
0C = Reset to Inventory
|
||||
0F = Completion
|
||||
0A 11 22 33 44 55 66 = Authenticate (11 22 33 44 55 66 = data to authenticate)
|
||||
**/
|
||||
|
||||
#define ISO14443B_REQB 0x05
|
||||
#define ISO14443B_ATTRIB 0x1D
|
||||
#define ISO14443B_HALT 0x50
|
||||
#define ISO14443B_INITIATE 0x06
|
||||
#define ISO14443B_SELECT 0x0E
|
||||
#define ISO14443B_GET_UID 0x0B
|
||||
#define ISO14443B_READ_BLK 0x08
|
||||
#define ISO14443B_WRITE_BLK 0x09
|
||||
#define ISO14443B_RESET 0x0C
|
||||
#define ISO14443B_COMPLETION 0x0F
|
||||
#define ISO14443B_AUTHENTICATE 0x0A
|
||||
|
||||
//First byte is 26
|
||||
#define ISO15693_INVENTORY 0x01
|
||||
@@ -287,13 +306,33 @@ void annotateIso15693(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
06 00 = INITIATE
|
||||
0E xx = SELECT ID (xx = Chip-ID)
|
||||
0B = Get UID
|
||||
08 yy = Read Block (yy = block number)
|
||||
09 yy dd dd dd dd = Write Block (yy = block number; dd dd dd dd = data to be written)
|
||||
0C = Reset to Inventory
|
||||
0F = Completion
|
||||
0A 11 22 33 44 55 66 = Authenticate (11 22 33 44 55 66 = data to authenticate)
|
||||
**/
|
||||
|
||||
void annotateIso14443b(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize)
|
||||
{
|
||||
switch(cmd[0]){
|
||||
case ISO14443B_REQB : snprintf(exp,size,"REQB");break;
|
||||
case ISO14443B_ATTRIB : snprintf(exp,size,"ATTRIB");break;
|
||||
case ISO14443B_HALT : snprintf(exp,size,"HALT");break;
|
||||
default: snprintf(exp,size ,"?");break;
|
||||
case ISO14443B_INITIATE : snprintf(exp,size,"INITIATE");break;
|
||||
case ISO14443B_SELECT : snprintf(exp,size,"SELECT(%d)",cmd[1]);break;
|
||||
case ISO14443B_GET_UID : snprintf(exp,size,"GET UID");break;
|
||||
case ISO14443B_READ_BLK : snprintf(exp,size,"READ_BLK(%d)", cmd[1]);break;
|
||||
case ISO14443B_WRITE_BLK : snprintf(exp,size,"WRITE_BLK(%d)",cmd[1]);break;
|
||||
case ISO14443B_RESET : snprintf(exp,size,"RESET");break;
|
||||
case ISO14443B_COMPLETION : snprintf(exp,size,"COMPLETION");break;
|
||||
case ISO14443B_AUTHENTICATE : snprintf(exp,size,"AUTHENTICATE");break;
|
||||
default : snprintf(exp,size ,"?");break;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -412,15 +451,18 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||
if (tracepos + data_len + parity_len > traceLen) {
|
||||
return traceLen;
|
||||
}
|
||||
|
||||
uint8_t *frame = trace + tracepos;
|
||||
tracepos += data_len;
|
||||
uint8_t *parityBytes = trace + tracepos;
|
||||
tracepos += parity_len;
|
||||
|
||||
|
||||
//--- Draw the data column
|
||||
//char line[16][110];
|
||||
char line[16][110];
|
||||
for (int j = 0; j < data_len; j++) {
|
||||
|
||||
for (int j = 0; j < data_len && j/16 < 16; j++) {
|
||||
|
||||
int oddparity = 0x01;
|
||||
int k;
|
||||
|
||||
@@ -429,11 +471,17 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||
}
|
||||
|
||||
uint8_t parityBits = parityBytes[j>>3];
|
||||
|
||||
if (isResponse && (oddparity != ((parityBits >> (7-(j&0x0007))) & 0x01))) {
|
||||
sprintf(line[j/16]+((j%16)*4), "%02x! ", frame[j]);
|
||||
snprintf(line[j/16]+(( j % 16) * 4),110, "%02x! ", frame[j]);
|
||||
|
||||
} else {
|
||||
sprintf(line[j/16]+((j%16)*4), "%02x ", frame[j]);
|
||||
snprintf(line[j/16]+(( j % 16) * 4),110, "%02x! ", frame[j]);
|
||||
}
|
||||
}
|
||||
if(data_len == 0)
|
||||
{
|
||||
if(data_len == 0){
|
||||
sprintf(line[0],"<empty trace - possible error>");
|
||||
}
|
||||
}
|
||||
//--- Draw the CRC column
|
||||
@@ -478,8 +526,8 @@ uint16_t printTraceLine(uint16_t tracepos, uint16_t traceLen, uint8_t *trace, ui
|
||||
annotateIso14443b(explanation,sizeof(explanation),frame,data_len);
|
||||
}
|
||||
|
||||
int num_lines = (data_len - 1)/16 + 1;
|
||||
for (int j = 0; j < num_lines; j++) {
|
||||
int num_lines = MIN((data_len - 1)/16 + 1, 16);
|
||||
for (int j = 0; j < num_lines ; j++) {
|
||||
if (j == 0) {
|
||||
PrintAndLog(" %9d | %9d | %s | %-64s| %s| %s",
|
||||
(timestamp - first_timestamp),
|
||||
|
||||
@@ -145,97 +145,10 @@ demodError:
|
||||
|
||||
int CmdHF14BList(const char *Cmd)
|
||||
{
|
||||
uint8_t *got = malloc(USB_CMD_DATA_SIZE);
|
||||
PrintAndLog("Deprecated command, use 'hf list 14b' instead");
|
||||
|
||||
// Query for the actual size of the trace
|
||||
UsbCommand response;
|
||||
GetFromBigBuf(got, USB_CMD_DATA_SIZE, 0);
|
||||
WaitForResponse(CMD_ACK, &response);
|
||||
uint16_t traceLen = response.arg[2];
|
||||
if (traceLen > USB_CMD_DATA_SIZE) {
|
||||
uint8_t *p = realloc(got, traceLen);
|
||||
if (p == NULL) {
|
||||
PrintAndLog("Cannot allocate memory for trace");
|
||||
free(got);
|
||||
return 2;
|
||||
}
|
||||
got = p;
|
||||
GetFromBigBuf(got, traceLen, 0);
|
||||
WaitForResponse(CMD_ACK,NULL);
|
||||
}
|
||||
PrintAndLog("recorded activity: (TraceLen = %d bytes)", traceLen);
|
||||
PrintAndLog(" time :rssi: who bytes");
|
||||
PrintAndLog("---------+----+----+-----------");
|
||||
|
||||
int i = 0;
|
||||
int prev = -1;
|
||||
|
||||
for(;;) {
|
||||
|
||||
if(i >= traceLen) { break; }
|
||||
|
||||
bool isResponse;
|
||||
int timestamp = *((uint32_t *)(got+i));
|
||||
if(timestamp & 0x80000000) {
|
||||
timestamp &= 0x7fffffff;
|
||||
isResponse = 1;
|
||||
} else {
|
||||
isResponse = 0;
|
||||
}
|
||||
int metric = *((uint32_t *)(got+i+4));
|
||||
|
||||
int len = got[i+8];
|
||||
|
||||
if(len > 100) {
|
||||
break;
|
||||
}
|
||||
if(i + len >= traceLen) {
|
||||
break;
|
||||
}
|
||||
|
||||
uint8_t *frame = (got+i+9);
|
||||
|
||||
// Break and stick with current result if buffer was not completely full
|
||||
if (frame[0] == 0x44 && frame[1] == 0x44 && frame[2] == 0x44 && frame[3] == 0x44) break;
|
||||
|
||||
char line[1000] = "";
|
||||
int j;
|
||||
for(j = 0; j < len; j++) {
|
||||
sprintf(line+(j*3), "%02x ", frame[j]);
|
||||
}
|
||||
|
||||
char *crc;
|
||||
if(len > 2) {
|
||||
uint8_t b1, b2;
|
||||
ComputeCrc14443(CRC_14443_B, frame, len-2, &b1, &b2);
|
||||
if(b1 != frame[len-2] || b2 != frame[len-1]) {
|
||||
crc = "**FAIL CRC**";
|
||||
} else {
|
||||
crc = "";
|
||||
}
|
||||
} else {
|
||||
crc = "(SHORT)";
|
||||
}
|
||||
|
||||
char metricString[100];
|
||||
if(isResponse) {
|
||||
sprintf(metricString, "%3d", metric);
|
||||
} else {
|
||||
strcpy(metricString, " ");
|
||||
}
|
||||
|
||||
PrintAndLog(" +%7d: %s: %s %s %s",
|
||||
(prev < 0 ? 0 : timestamp - prev),
|
||||
metricString,
|
||||
(isResponse ? "TAG" : " "), line, crc);
|
||||
|
||||
prev = timestamp;
|
||||
i += (len + 9);
|
||||
}
|
||||
free(got);
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHF14BRead(const char *Cmd)
|
||||
{
|
||||
UsbCommand c = {CMD_ACQUIRE_RAW_ADC_SAMPLES_ISO_14443, {strtol(Cmd, NULL, 0), 0, 0}};
|
||||
@@ -473,7 +386,7 @@ static command_t CommandTable[] =
|
||||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"demod", CmdHF14BDemod, 1, "Demodulate ISO14443 Type B from tag"},
|
||||
{"list", CmdHF14BList, 0, "List ISO 14443 history"},
|
||||
{"list", CmdHF14BList, 0, "[Deprecated] List ISO 14443b history"},
|
||||
{"read", CmdHF14BRead, 0, "Read HF tag (ISO 14443)"},
|
||||
{"sim", CmdHF14Sim, 0, "Fake ISO 14443 tag"},
|
||||
{"simlisten", CmdHFSimlisten, 0, "Get HF samples as fake tag"},
|
||||
|
||||
@@ -22,63 +22,101 @@
|
||||
#include "data.h"
|
||||
#include "lfdemod.h"
|
||||
|
||||
|
||||
#define LF_TRACE_BUFF_SIZE 20000 // 32 x 32 x 10 (32 bit times numofblock (7), times clock skip..)
|
||||
#define LF_BITSSTREAM_LEN 1000 // more then 1000 bits shouldn't happend.. 8block * 4 bytes * 8bits =
|
||||
|
||||
int usage_t55xx_rd(){
|
||||
PrintAndLog("Usage: lf t55xx rd <block> <password>");
|
||||
PrintAndLog(" <block>, block number to read. Between 0-7");
|
||||
PrintAndLog(" <password>, OPTIONAL password (8 hex characters)");
|
||||
PrintAndLog("");
|
||||
PrintAndLog(" sample: lf t55xx rd 0 = try reading data from block 0");
|
||||
PrintAndLog(" : lf t55xx rd 0 feedbeef = try reading data from block 0 using password");
|
||||
PrintAndLog("");
|
||||
return 0;
|
||||
}
|
||||
int usage_t55xx_wr(){
|
||||
PrintAndLog("Usage: lf t55xx wr <block> <data> [password]");
|
||||
PrintAndLog(" <block>, block number to read. Between 0-7");
|
||||
PrintAndLog(" <data>, 4 bytes of data to write (8 hex characters)");
|
||||
PrintAndLog(" [password], OPTIONAL password 4bytes (8 hex characters)");
|
||||
PrintAndLog("");
|
||||
PrintAndLog(" sample: lf t55xx wd 3 11223344 = try writing data 11223344 to block 3");
|
||||
PrintAndLog(" : lf t55xx wd 3 11223344 feedbeef = try writing data 11223344 to block 3 using password feedbeef");
|
||||
PrintAndLog("");
|
||||
return 0;
|
||||
}
|
||||
int usage_t55xx_trace() {
|
||||
PrintAndLog("Usage: lf t55xx trace [graph buffer data]");
|
||||
PrintAndLog(" [graph buffer data], if set, use Graphbuffer otherwise read data from tag.");
|
||||
PrintAndLog("");
|
||||
PrintAndLog(" sample: lf t55xx trace");
|
||||
PrintAndLog(" : lf t55xx trace 1");
|
||||
PrintAndLog("");
|
||||
return 0;
|
||||
}
|
||||
int usage_t55xx_info() {
|
||||
PrintAndLog("Usage: lf t55xx info [graph buffer data]");
|
||||
PrintAndLog(" [graph buffer data], if set, use Graphbuffer otherwise read data from tag.");
|
||||
PrintAndLog("");
|
||||
PrintAndLog(" sample: lf t55xx info");
|
||||
PrintAndLog(" : lf t55xx info 1");
|
||||
PrintAndLog("");
|
||||
return 0;
|
||||
}
|
||||
|
||||
int usage_t55xx_dump(){
|
||||
PrintAndLog("Usage: lf t55xx dump <password>");
|
||||
PrintAndLog(" <password>, OPTIONAL password 4bytes (8 hex characters)");
|
||||
PrintAndLog("");
|
||||
PrintAndLog(" sample: lf t55xx dump");
|
||||
PrintAndLog(" : lf t55xx dump feedbeef");
|
||||
PrintAndLog("");
|
||||
return 0;
|
||||
}
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
// int CmdReadBlk(const char *Cmd)
|
||||
// {
|
||||
// int block = -1;
|
||||
// sscanf(Cmd, "%d", &block);
|
||||
|
||||
// if ((block > 7) | (block < 0)) {
|
||||
// PrintAndLog("Block must be between 0 and 7");
|
||||
// return 1;
|
||||
// }
|
||||
|
||||
// UsbCommand c;
|
||||
// c.cmd = CMD_T55XX_READ_BLOCK;
|
||||
// c.d.asBytes[0] = 0x00;
|
||||
// c.arg[0] = 0;
|
||||
// c.arg[1] = block;
|
||||
// c.arg[2] = 0;
|
||||
// SendCommand(&c);
|
||||
// WaitForResponse(CMD_ACK, NULL);
|
||||
|
||||
// uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00};
|
||||
|
||||
// GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,0); //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();
|
||||
// return 0;
|
||||
// }
|
||||
|
||||
int CmdReadBlk(const char *Cmd)
|
||||
{
|
||||
int invert = 0;
|
||||
int clk = 0;
|
||||
int block = -1;
|
||||
int password = 0xFFFFFFFF; //default to blank Block 7
|
||||
int errCnt;
|
||||
size_t bitlen;
|
||||
//int decodedBitlen;
|
||||
int maxErr = 100;
|
||||
uint8_t askAmp = 0;
|
||||
uint32_t blockData;
|
||||
uint8_t bits[MAX_GRAPH_TRACE_LEN] = {0x00};
|
||||
|
||||
sscanf(Cmd, "%d", &block);
|
||||
|
||||
if ((block > 7) | (block < 0)) {
|
||||
PrintAndLog("Block must be between 0 and 7");
|
||||
return 1;
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
if (cmdp == 'h' || cmdp == 'H') {
|
||||
usage_t55xx_rd();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res = sscanf(Cmd, "%d %x", &block, &password);
|
||||
|
||||
if ( res < 1 || res > 2 ){
|
||||
usage_t55xx_rd();
|
||||
return 1;
|
||||
}
|
||||
|
||||
if ((block < 0) | (block > 7)) {
|
||||
PrintAndLog("Block must be between 0 and 7");
|
||||
return 1;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_T55XX_READ_BLOCK, {0, block, 0}};
|
||||
c.d.asBytes[0] = 0x0;
|
||||
|
||||
//Password mode
|
||||
if ( res == 2 ) {
|
||||
c.arg[2] = password;
|
||||
c.d.asBytes[0] = 0x1;
|
||||
}
|
||||
|
||||
UsbCommand c = { CMD_T55XX_READ_BLOCK, { 0, block, 0 } };
|
||||
SendCommand(&c);
|
||||
if ( !WaitForResponseTimeout(CMD_ACK,NULL,1500) ) {
|
||||
PrintAndLog("command execution time out");
|
||||
@@ -89,7 +127,7 @@ int CmdReadBlk(const char *Cmd)
|
||||
|
||||
bitlen = getFromGraphBuf(bits);
|
||||
|
||||
errCnt = askrawdemod(bits, &bitlen, &clk, &invert);
|
||||
errCnt = askrawdemod(bits, &bitlen, &clk, &invert, maxErr, askAmp);
|
||||
|
||||
//throw away static - allow 1 and -1 (in case of threshold command first)
|
||||
if ( errCnt == -1 || bitlen < 16 ){
|
||||
@@ -124,81 +162,44 @@ int CmdReadBlk(const char *Cmd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdReadBlkPWD(const char *Cmd)
|
||||
{
|
||||
int Block = -1; //default to invalid block
|
||||
int Password = 0xFFFFFFFF; //default to blank Block 7
|
||||
|
||||
|
||||
sscanf(Cmd, "%d %x", &Block, &Password);
|
||||
|
||||
if ((Block > 7) | (Block < 0)) {
|
||||
PrintAndLog("Block must be between 0 and 7");
|
||||
return 1;
|
||||
}
|
||||
|
||||
PrintAndLog("Reading page 0 block %d pwd %08X", Block, Password);
|
||||
|
||||
UsbCommand c = {CMD_T55XX_READ_BLOCK, {0, Block, Password} };
|
||||
c.d.asBytes[0] = 0x1; //Password mode
|
||||
SendCommand(&c);
|
||||
WaitForResponse(CMD_ACK, NULL);
|
||||
|
||||
uint8_t data[LF_TRACE_BUFF_SIZE] = {0x00};
|
||||
|
||||
GetFromBigBuf(data,LF_TRACE_BUFF_SIZE,0);
|
||||
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();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdWriteBlk(const char *Cmd)
|
||||
{
|
||||
int Block = 8; //default to invalid block
|
||||
int Data = 0xFFFFFFFF; //default to blank Block
|
||||
int block = 8; //default to invalid block
|
||||
int data = 0xFFFFFFFF; //default to blank Block
|
||||
int password = 0xFFFFFFFF; //default to blank Block 7
|
||||
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
if (cmdp == 'h' || cmdp == 'H') {
|
||||
usage_t55xx_wr();
|
||||
return 0;
|
||||
}
|
||||
|
||||
int res = sscanf(Cmd, "%d %x %x",&block, &data, &password);
|
||||
|
||||
if ( res < 2 || res > 3) {
|
||||
usage_t55xx_wr();
|
||||
return 1;
|
||||
}
|
||||
|
||||
sscanf(Cmd, "%d %x", &Block, &Data);
|
||||
if (block > 7) {
|
||||
PrintAndLog("Block must be between 0 and 7");
|
||||
return 1;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {data, block, 0}};
|
||||
c.d.asBytes[0] = 0x0;
|
||||
|
||||
if (Block > 7) {
|
||||
PrintAndLog("Block must be between 0 and 7");
|
||||
return 1;
|
||||
}
|
||||
|
||||
PrintAndLog("Writing block %d data %08X", Block, Data);
|
||||
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {Data, Block, 0}};
|
||||
c.d.asBytes[0] = 0x0; //Normal mode
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdWriteBlkPWD(const char *Cmd)
|
||||
{
|
||||
int Block = 8; //default to invalid block
|
||||
int Data = 0xFFFFFFFF; //default to blank Block
|
||||
int Password = 0xFFFFFFFF; //default to blank Block 7
|
||||
|
||||
|
||||
sscanf(Cmd, "%d %x %x",&Block, &Data, &Password);
|
||||
|
||||
if (Block > 7) {
|
||||
PrintAndLog("Block must be between 0 and 7");
|
||||
return 1;
|
||||
}
|
||||
|
||||
PrintAndLog("Writing block %d data %08X password %08X", Block, Data, Password);
|
||||
|
||||
UsbCommand c = {CMD_T55XX_WRITE_BLOCK, {Data, Block, Password}};
|
||||
c.d.asBytes[0] = 0x1; //Password mode
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
if (res == 2) {
|
||||
PrintAndLog("Writing block %d data %08X", block, data);
|
||||
} else {
|
||||
//Password mode
|
||||
c.arg[2] = password;
|
||||
c.d.asBytes[0] = 0x1;
|
||||
PrintAndLog("Writing block %d data %08X password %08X", block, data, password);
|
||||
}
|
||||
|
||||
SendCommand(&c);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdReadTrace(const char *Cmd)
|
||||
@@ -206,11 +207,7 @@ int CmdReadTrace(const char *Cmd)
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
|
||||
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(" : lf t55xx trace 1");
|
||||
usage_t55xx_trace();
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -297,15 +294,9 @@ int CmdInfo(const char *Cmd){
|
||||
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");
|
||||
usage_t55xx_info();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if ( strlen(Cmd) == 0 ){
|
||||
} else {
|
||||
CmdReadBlk("0");
|
||||
}
|
||||
|
||||
@@ -358,17 +349,16 @@ int CmdInfo(const char *Cmd){
|
||||
|
||||
int CmdDump(const char *Cmd){
|
||||
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
char s[20];
|
||||
char s[20] = {0x00};
|
||||
uint8_t pwd[4] = {0x00};
|
||||
bool hasPwd = ( strlen(Cmd) > 0);
|
||||
|
||||
|
||||
char cmdp = param_getchar(Cmd, 0);
|
||||
if ( cmdp == 'h' || cmdp == 'H') {
|
||||
PrintAndLog("Usage: lf t55xx dump <password>");
|
||||
PrintAndLog(" sample: lf t55xx dump FFFFFFFF");
|
||||
usage_t55xx_dump();
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
bool hasPwd = ( strlen(Cmd) > 0);
|
||||
if ( hasPwd ){
|
||||
if (param_gethex(Cmd, 0, pwd, 8)) {
|
||||
PrintAndLog("password must include 8 HEX symbols");
|
||||
@@ -380,11 +370,10 @@ int CmdDump(const char *Cmd){
|
||||
memset(s,0,sizeof(s));
|
||||
if ( hasPwd ) {
|
||||
sprintf(s,"%d %02x%02x%02x%02x", i, pwd[0],pwd[1],pwd[2],pwd[3]);
|
||||
CmdReadBlkPWD(s);
|
||||
} else {
|
||||
sprintf(s,"%d", i);
|
||||
CmdReadBlk(s);
|
||||
}
|
||||
CmdReadBlk(s);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -536,14 +525,11 @@ uint32_t PackBits(uint8_t start, uint8_t len, uint8_t* bits){
|
||||
static command_t CommandTable[] =
|
||||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"rd", CmdReadBlk, 0, "<block> -- Read T55xx block data (page 0)"},
|
||||
{"rdpwd", CmdReadBlkPWD, 0, "<block> <password> -- Read T55xx block data with password mode"},
|
||||
{"wr", CmdWriteBlk, 0, "<block> <data> -- Write T55xx block data (page 0)"},
|
||||
{"wrpwd", CmdWriteBlkPWD, 0, "<block> <password> <data> -- Write T55xx block data with password"},
|
||||
{"rd", CmdReadBlk, 0, "<block> [password] -- Read T55xx block data (page 0) [optional password]"},
|
||||
{"wr", CmdWriteBlk, 0, "<block> <data> [password] -- Write T55xx block data (page 0) [optional password]"},
|
||||
{"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"},
|
||||
{"dump", CmdDump, 0, "[password] Dump T55xx card block 0-7. [optional password]"},
|
||||
{"man", CmdIceManchester, 0, "Manchester demod (with SST)"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
@@ -108,7 +108,7 @@ int manchester_decode( int * data, const size_t len, uint8_t * dataout, size_t
|
||||
DetectHighLowInGraph(&high, &low, TRUE);
|
||||
|
||||
/* get clock */
|
||||
clock = GetClock("",0, 0);
|
||||
clock = GetAskClock("",false, false);
|
||||
|
||||
startindex = DetectFirstTransition(data, len, high);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user