This commit is contained in:
iceman1001 2022-08-24 07:25:10 +02:00
parent 811f76785d
commit e18194028b
15 changed files with 792 additions and 792 deletions

View file

@ -1646,7 +1646,7 @@ void SimulateIso14443aTag(uint8_t tagType, uint16_t flags, uint8_t *data, uint8_
emlGetMemBt(pwd, (pages - 1) * 4 + MFU_DUMP_PREFIX_LENGTH, sizeof(pwd)); emlGetMemBt(pwd, (pages - 1) * 4 + MFU_DUMP_PREFIX_LENGTH, sizeof(pwd));
if (memcmp(pwd, "\x00\x00\x00\x00", 4) == 0) { if (memcmp(pwd, "\x00\x00\x00\x00", 4) == 0) {
Uint4byteToMemLe(pwd, ul_ev1_pwdgenB(data)); Uint4byteToMemLe(pwd, ul_ev1_pwdgenB(data));
Dbprintf("Calc pwd... %02X %02X %02X %02X", pwd[0], pwd[1], pwd[2] ,pwd[3]); Dbprintf("Calc pwd... %02X %02X %02X %02X", pwd[0], pwd[1], pwd[2], pwd[3]);
} }
if (memcmp(receivedCmd + 1, pwd, 4) == 0) { if (memcmp(receivedCmd + 1, pwd, 4) == 0) {

View file

@ -191,7 +191,7 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i
return PM3_SUCCESS; return PM3_SUCCESS;
} else if (cmd[1] == 0x02 && cmdsize == (cmd[2] & 0x0f) + 7) { } else if (cmd[1] == 0x02 && cmdsize == (cmd[2] & 0x0f) + 7) {
// Byte 3 is the reader type // Byte 3 is the reader type
switch(cmd[3]) { switch (cmd[3]) {
case 0x01: case 0x01:
snprintf(exp, size, "ECP2 (Transit)"); snprintf(exp, size, "ECP2 (Transit)");
break; break;

View file

@ -397,7 +397,7 @@ static int topaz_print_CC(uint8_t *data) {
PrintAndLogEx(SUCCESS, " ....x... - %02X: %s lock block", lb, (lb) ? "support" : "don\'t support"); PrintAndLogEx(SUCCESS, " ....x... - %02X: %s lock block", lb, (lb) ? "support" : "don\'t support");
PrintAndLogEx(SUCCESS, " .....xx. - %02X: RFU ( %s )", mlrule, (mlrule == 0) ? _GREEN_("ok") : _RED_("fail")); PrintAndLogEx(SUCCESS, " .....xx. - %02X: RFU ( %s )", mlrule, (mlrule == 0) ? _GREEN_("ok") : _RED_("fail"));
PrintAndLogEx(SUCCESS, " .......x - %02X: IC %s multiple block reads", mbread, (mbread) ? "support" : "don\'t support"); PrintAndLogEx(SUCCESS, " .......x - %02X: IC %s multiple block reads", mbread, (mbread) ? "support" : "don\'t support");
PrintAndLogEx(SUCCESS,""); PrintAndLogEx(SUCCESS, "");
return PM3_SUCCESS; return PM3_SUCCESS;
} }
@ -692,7 +692,7 @@ int CmdHFTopazInfo(const char *Cmd) {
(topaz_tag.HR01[0] & 0xF0) == 0x10 ? _GREEN_("TOPAZ tag") : "", (topaz_tag.HR01[0] & 0xF0) == 0x10 ? _GREEN_("TOPAZ tag") : "",
(topaz_tag.HR01[0] & 0xF0) == 0x10 ? _GREEN_("Type 1 NDEF") : "" (topaz_tag.HR01[0] & 0xF0) == 0x10 ? _GREEN_("Type 1 NDEF") : ""
); );
PrintAndLogEx(SUCCESS, " .......x - %s memory map", ((topaz_tag.HR01[0] & 0x0F) == 0x01) ? "Static" : "Dynamic" ); PrintAndLogEx(SUCCESS, " .......x - %s memory map", ((topaz_tag.HR01[0] & 0x0F) == 0x01) ? "Static" : "Dynamic");
PrintAndLogEx(SUCCESS, ""); PrintAndLogEx(SUCCESS, "");
PrintAndLogEx(SUCCESS, " Lock bytes... %02X%02X", PrintAndLogEx(SUCCESS, " Lock bytes... %02X%02X",
topaz_tag.data_blocks[0x0e][0], topaz_tag.data_blocks[0x0e][0],
@ -797,7 +797,7 @@ static int CmdHFTopazDump(const char *Cmd) {
if (status != PM3_SUCCESS) { if (status != PM3_SUCCESS) {
return status; return status;
} }
printTopazDumpContents((uint8_t*)&topaz_tag, sizeof(topaz_tag_t)); printTopazDumpContents((uint8_t *)&topaz_tag, sizeof(topaz_tag_t));
bool set_dynamic = false; bool set_dynamic = false;
if (topaz_set_cc_dynamic(&topaz_tag.data_blocks[1][0]) == PM3_SUCCESS) { if (topaz_set_cc_dynamic(&topaz_tag.data_blocks[1][0]) == PM3_SUCCESS) {
@ -873,7 +873,7 @@ static int CmdHFTopazView(const char *Cmd) {
, true , true
); );
PrintAndLogEx(INFO, "%s", sprint_hex(&topaz_tag.data_blocks[1][4], (12*8))); PrintAndLogEx(INFO, "%s", sprint_hex(&topaz_tag.data_blocks[1][4], (12 * 8)));
free(topaz_tag.dynamic_memory); free(topaz_tag.dynamic_memory);
} }
@ -946,7 +946,7 @@ static int CmdHFTopazWrBl(const char *Cmd) {
return PM3_EINVARG; return PM3_EINVARG;
} }
if (dlen != 8 ) { if (dlen != 8) {
PrintAndLogEx(WARNING, "Wrong data length. Expect 8, got %d", dlen); PrintAndLogEx(WARNING, "Wrong data length. Expect 8, got %d", dlen);
return PM3_EINVARG; return PM3_EINVARG;
} }
@ -957,9 +957,9 @@ static int CmdHFTopazWrBl(const char *Cmd) {
int res = topaz_write_erase8_block(blockno, data); int res = topaz_write_erase8_block(blockno, data);
if (res == PM3_SUCCESS) { if (res == PM3_SUCCESS) {
PrintAndLogEx(SUCCESS, "Write ( " _GREEN_("ok") " )" ); PrintAndLogEx(SUCCESS, "Write ( " _GREEN_("ok") " )");
} else { } else {
PrintAndLogEx(WARNING, "Write ( " _RED_("fail") " )" ); PrintAndLogEx(WARNING, "Write ( " _RED_("fail") " )");
} }
topaz_switch_off_field(); topaz_switch_off_field();

View file

@ -638,7 +638,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
JsonSaveStr(root, "FileType", "topaz"); JsonSaveStr(root, "FileType", "topaz");
JsonSaveBufAsHexCompact(root, "$.Card.UID", tag->uid, sizeof(tag->uid)); JsonSaveBufAsHexCompact(root, "$.Card.UID", tag->uid, sizeof(tag->uid));
JsonSaveBufAsHexCompact(root, "$.Card.H0R1", tag->HR01, sizeof(tag->HR01)); JsonSaveBufAsHexCompact(root, "$.Card.H0R1", tag->HR01, sizeof(tag->HR01));
JsonSaveBufAsHexCompact(root, "$.Card.Size", (uint8_t *)&(tag->size), 2); JsonSaveBufAsHexCompact(root, "$.Card.Size", (uint8_t *) & (tag->size), 2);
for (size_t i = 0; i < TOPAZ_STATIC_MEMORY / 8; i++) { for (size_t i = 0; i < TOPAZ_STATIC_MEMORY / 8; i++) {
char path[PATH_MAX_LENGTH] = {0}; char path[PATH_MAX_LENGTH] = {0};
snprintf(path, sizeof(path), "$.blocks.%zu", i); snprintf(path, sizeof(path), "$.blocks.%zu", i);
@ -1302,7 +1302,7 @@ int loadFileJSONex(const char *preferredName, void *data, size_t maxdatalen, siz
topaz_tag_t *mem = (topaz_tag_t *)udata; topaz_tag_t *mem = (topaz_tag_t *)udata;
JsonLoadBufAsHex(root, "$.Card.UID", mem->uid, sizeof(mem->uid), datalen); JsonLoadBufAsHex(root, "$.Card.UID", mem->uid, sizeof(mem->uid), datalen);
JsonLoadBufAsHex(root, "$.Card.HR01", mem->HR01, sizeof(mem->HR01), datalen); JsonLoadBufAsHex(root, "$.Card.HR01", mem->HR01, sizeof(mem->HR01), datalen);
JsonLoadBufAsHex(root, "$.Card.Size", (uint8_t *)&(mem->size), 2, datalen); JsonLoadBufAsHex(root, "$.Card.Size", (uint8_t *) & (mem->size), 2, datalen);
size_t sptr = 0; size_t sptr = 0;
for (int i = 0; i < (TOPAZ_STATIC_MEMORY / 8); i++) { for (int i = 0; i < (TOPAZ_STATIC_MEMORY / 8); i++) {