prepare for LTO dump

This commit is contained in:
iceman1001 2020-01-28 08:28:36 +01:00
parent 5817cf1a79
commit aae8f6aebf

View file

@ -177,8 +177,8 @@ int infoLTO(bool verbose) {
if (ret_val == PM3_SUCCESS) {
PrintAndLogEx(NORMAL, "");
PrintAndLogEx(SUCCESS, "TYPE INFO: " _YELLOW_("%s"), sprint_hex_inrow(type_info, sizeof(type_info)));
PrintAndLogEx(SUCCESS, "UID: " _YELLOW_("%s"), sprint_hex_inrow(serial_number, sizeof(serial_number)));
PrintAndLogEx(SUCCESS, "TYPE INFO: " _YELLOW_("%s"), sprint_hex_inrow(type_info, sizeof(type_info)));
}
return ret_val;
@ -240,7 +240,7 @@ int rdblLTO(uint8_t st_blk, uint8_t end_blk, bool verbose) {
block_data[t + 16] = block_data_d16_d31[t];
}
PrintAndLogEx(SUCCESS, "BLK%03d: " _YELLOW_("%s"), i, sprint_hex_inrow(block_data, sizeof(block_data)));
PrintAndLogEx(SUCCESS, "BLK %03d: " _YELLOW_("%s"), i, sprint_hex_inrow(block_data, sizeof(block_data)));
} else {
lto_switch_off_field();
return ret_val;
@ -345,9 +345,9 @@ int wrblLTO(uint8_t blk, uint8_t *data, bool verbose) {
lto_switch_off_field();
if (ret_val == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "BLK%03d: " _YELLOW_("Write Success"), blk);
PrintAndLogEx(SUCCESS, "BLK %03d: " _YELLOW_("write success"), blk);
} else {
PrintAndLogEx(WARNING, "BLK%03d: Write Error. Maybe this is a read-only block address.", blk);
PrintAndLogEx(WARNING, "BLK %03d: write error. Maybe this is a read-only block address.", blk);
}
return ret_val;
@ -373,7 +373,7 @@ static int CmdHfLTOWriteBlock(const char *Cmd) {
break;
case 'd':
if (param_gethex(Cmd, cmdp+1, blkData, 64)) {
PrintAndLogEx(WARNING, "BlockData must include 64 HEX symbols");
PrintAndLogEx(WARNING, "block data must include 64 HEX symbols");
errors = true;
break;
}
@ -381,7 +381,7 @@ static int CmdHfLTOWriteBlock(const char *Cmd) {
cmdp += 2;
break;
default:
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
PrintAndLogEx(WARNING, "unknown parameter '%c'", param_getchar(Cmd, cmdp));
errors = true;
break;
}
@ -399,8 +399,49 @@ static int CmdHfLTOWriteBlock(const char *Cmd) {
return wrblLTO(blk, blkData, true);
}
/*
static int CmdHfLTODump(const char *Cmd) {
uint8_t cmdp = 0;
bool errors = false;
uint8_t blk = 128;
while (param_getchar(Cmd, cmdp) != 0x00 && !errors) {
switch (tolower(param_getchar(Cmd, cmdp))) {
case 'h':
return usage_lto_dump();
case 'b':
blk = param_get8(Cmd, cmdp+1);
b_opt_selected = true;
cmdp += 2;
break;
default:
PrintAndLogEx(WARNING, "unknown parameter '%c'", param_getchar(Cmd, cmdp));
errors = true;
break;
}
}
//Validations
if (errors) {
usage_lto_dump();
return PM3_EINVARG;
}
// alloc memory
// loop all blocks
// save to file
// free memory
return PM3_SUCCESS;
}
*/
static command_t CommandTable[] = {
{"help", CmdHelp, AlwaysAvailable, "This help"},
// {"dump", CmdHfLTDump, IfPm3Iso14443a, "Dump LTO-CM tag to file"},
// {"restore", CmdHfLTRestore, IfPm3Iso14443a, "Restore dump file to LTO-CM tag"},
{"info", CmdHfLTOInfo, IfPm3Iso14443a, "Tag information"},
{"rdbl", CmdHfLTOReadBlock, IfPm3Iso14443a, "Read block"},
{"wrbl", CmdHfLTOWriteBlock, IfPm3Iso14443a, "Write block"},