mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-29 19:39:17 +08:00
style
This commit is contained in:
parent
811f76785d
commit
e18194028b
15 changed files with 792 additions and 792 deletions
|
@ -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));
|
||||
if (memcmp(pwd, "\x00\x00\x00\x00", 4) == 0) {
|
||||
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) {
|
||||
|
|
|
@ -191,7 +191,7 @@ int applyIso14443a(char *exp, size_t size, uint8_t *cmd, uint8_t cmdsize, bool i
|
|||
return PM3_SUCCESS;
|
||||
} else if (cmd[1] == 0x02 && cmdsize == (cmd[2] & 0x0f) + 7) {
|
||||
// Byte 3 is the reader type
|
||||
switch(cmd[3]) {
|
||||
switch (cmd[3]) {
|
||||
case 0x01:
|
||||
snprintf(exp, size, "ECP2 (Transit)");
|
||||
break;
|
||||
|
|
|
@ -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, " .....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,"");
|
||||
PrintAndLogEx(SUCCESS, "");
|
||||
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
@ -606,12 +606,12 @@ static void printTopazDumpContents(uint8_t *dump, size_t size) {
|
|||
const char *lockstr = (topaz_byte_is_locked(i * 8)) ? _RED_("x") : " ";
|
||||
|
||||
PrintAndLogEx(SUCCESS, " %3u / 0x%02x | %s| %s | %s",
|
||||
i,
|
||||
i,
|
||||
sprint_hex(&t->data_blocks[i][0], 8),
|
||||
lockstr,
|
||||
block_info
|
||||
);
|
||||
i,
|
||||
i,
|
||||
sprint_hex(&t->data_blocks[i][0], 8),
|
||||
lockstr,
|
||||
block_info
|
||||
);
|
||||
}
|
||||
|
||||
PrintAndLogEx(SUCCESS, " %3u / 0x%02x | %s| | %s", 0x0D, 0x0D, sprint_hex(&t->data_blocks[0x0D][0], 8), topaz_ks[2]);
|
||||
|
@ -626,7 +626,7 @@ static int CmdHFTopazReader(const char *Cmd) {
|
|||
"Read UID from Topaz tags",
|
||||
"hf topaz reader\n"
|
||||
"hf topaz reader -@ -> Continuous mode\n"
|
||||
);
|
||||
);
|
||||
|
||||
void *argtable[] = {
|
||||
arg_param_begin,
|
||||
|
@ -689,15 +689,15 @@ int CmdHFTopazInfo(const char *Cmd) {
|
|||
|
||||
PrintAndLogEx(SUCCESS, " %s", sprint_bin(topaz_tag.HR01, 1));
|
||||
PrintAndLogEx(SUCCESS, " ...x.... - %s / %s",
|
||||
(topaz_tag.HR01[0] & 0xF0) == 0x10 ? _GREEN_("TOPAZ tag") : "",
|
||||
(topaz_tag.HR01[0] & 0xF0) == 0x10 ? _GREEN_("Type 1 NDEF") : ""
|
||||
);
|
||||
PrintAndLogEx(SUCCESS, " .......x - %s memory map", ((topaz_tag.HR01[0] & 0x0F) == 0x01) ? "Static" : "Dynamic" );
|
||||
(topaz_tag.HR01[0] & 0xF0) == 0x10 ? _GREEN_("TOPAZ tag") : "",
|
||||
(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, "");
|
||||
PrintAndLogEx(SUCCESS, " Lock bytes... %02X%02X",
|
||||
topaz_tag.data_blocks[0x0e][0],
|
||||
topaz_tag.data_blocks[0x0e][1]
|
||||
);
|
||||
topaz_tag.data_blocks[0x0e][0],
|
||||
topaz_tag.data_blocks[0x0e][1]
|
||||
);
|
||||
|
||||
PrintAndLogEx(SUCCESS, " OTP.......... %s", sprint_hex(&topaz_tag.data_blocks[0x0e][2], 6));
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
|
@ -797,7 +797,7 @@ static int CmdHFTopazDump(const char *Cmd) {
|
|||
if (status != PM3_SUCCESS) {
|
||||
return status;
|
||||
}
|
||||
printTopazDumpContents((uint8_t*)&topaz_tag, sizeof(topaz_tag_t));
|
||||
printTopazDumpContents((uint8_t *)&topaz_tag, sizeof(topaz_tag_t));
|
||||
|
||||
bool set_dynamic = false;
|
||||
if (topaz_set_cc_dynamic(&topaz_tag.data_blocks[1][0]) == PM3_SUCCESS) {
|
||||
|
@ -808,9 +808,9 @@ static int CmdHFTopazDump(const char *Cmd) {
|
|||
topaz_print_lifecycle_state(&topaz_tag.data_blocks[1][0]);
|
||||
|
||||
NDEFDecodeAndPrint(&topaz_tag.data_blocks[1][4],
|
||||
(topaz_tag.HR01[0] == 1) ? (12 * 8) : 476
|
||||
, true
|
||||
);
|
||||
(topaz_tag.HR01[0] == 1) ? (12 * 8) : 476
|
||||
, true
|
||||
);
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "-------------------------------------------------------------");
|
||||
|
@ -869,11 +869,11 @@ static int CmdHFTopazView(const char *Cmd) {
|
|||
topaz_print_lifecycle_state(&topaz_tag.data_blocks[1][0]);
|
||||
|
||||
NDEFDecodeAndPrint(&topaz_tag.data_blocks[1][4],
|
||||
(topaz_tag.HR01[0] == 1) ? (12 * 8) : 476
|
||||
, true
|
||||
);
|
||||
(topaz_tag.HR01[0] == 1) ? (12 * 8) : 476
|
||||
, 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);
|
||||
}
|
||||
|
@ -946,7 +946,7 @@ static int CmdHFTopazWrBl(const char *Cmd) {
|
|||
return PM3_EINVARG;
|
||||
}
|
||||
|
||||
if (dlen != 8 ) {
|
||||
if (dlen != 8) {
|
||||
PrintAndLogEx(WARNING, "Wrong data length. Expect 8, got %d", dlen);
|
||||
return PM3_EINVARG;
|
||||
}
|
||||
|
@ -957,9 +957,9 @@ static int CmdHFTopazWrBl(const char *Cmd) {
|
|||
int res = topaz_write_erase8_block(blockno, data);
|
||||
|
||||
if (res == PM3_SUCCESS) {
|
||||
PrintAndLogEx(SUCCESS, "Write ( " _GREEN_("ok") " )" );
|
||||
PrintAndLogEx(SUCCESS, "Write ( " _GREEN_("ok") " )");
|
||||
} else {
|
||||
PrintAndLogEx(WARNING, "Write ( " _RED_("fail") " )" );
|
||||
PrintAndLogEx(WARNING, "Write ( " _RED_("fail") " )");
|
||||
}
|
||||
|
||||
topaz_switch_off_field();
|
||||
|
@ -1055,20 +1055,20 @@ int readTopazUid(bool loop, bool verbose) {
|
|||
// printing
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%02X %02X %02X %02X %02X %02X %02X"),
|
||||
topaz_tag.uid[6],
|
||||
topaz_tag.uid[5],
|
||||
topaz_tag.uid[4],
|
||||
topaz_tag.uid[3],
|
||||
topaz_tag.uid[2],
|
||||
topaz_tag.uid[1],
|
||||
topaz_tag.uid[0]);
|
||||
topaz_tag.uid[6],
|
||||
topaz_tag.uid[5],
|
||||
topaz_tag.uid[4],
|
||||
topaz_tag.uid[3],
|
||||
topaz_tag.uid[2],
|
||||
topaz_tag.uid[1],
|
||||
topaz_tag.uid[0]);
|
||||
|
||||
PrintAndLogEx(SUCCESS, "ATQA: " _GREEN_("%02X %02X"), atqa[1], atqa[0]);
|
||||
|
||||
topaz_tag.HR01[0] = rid_response[0];
|
||||
topaz_tag.HR01[1] = rid_response[1];
|
||||
|
||||
} while (loop && kbd_enter_pressed() == false);
|
||||
} while (loop && kbd_enter_pressed() == false);
|
||||
|
||||
topaz_switch_off_field();
|
||||
return res;
|
||||
|
|
|
@ -638,7 +638,7 @@ int saveFileJSONex(const char *preferredName, JSONFileType ftype, uint8_t *data,
|
|||
JsonSaveStr(root, "FileType", "topaz");
|
||||
JsonSaveBufAsHexCompact(root, "$.Card.UID", tag->uid, sizeof(tag->uid));
|
||||
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++) {
|
||||
char path[PATH_MAX_LENGTH] = {0};
|
||||
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;
|
||||
JsonLoadBufAsHex(root, "$.Card.UID", mem->uid, sizeof(mem->uid), 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;
|
||||
for (int i = 0; i < (TOPAZ_STATIC_MEMORY / 8); i++) {
|
||||
|
|
|
@ -2440,7 +2440,7 @@ static void DesfirePrintShortFileTypeSettings(FileSettings_t *fsettings) {
|
|||
fsettings->limitedCredit,
|
||||
fsettings->value,
|
||||
fsettings->value
|
||||
);
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
|
@ -2450,7 +2450,7 @@ static void DesfirePrintShortFileTypeSettings(FileSettings_t *fsettings) {
|
|||
fsettings->maxRecordCount,
|
||||
fsettings->recordSize,
|
||||
fsettings->recordSize
|
||||
);
|
||||
);
|
||||
break;
|
||||
}
|
||||
case 0x05: {
|
||||
|
@ -2568,16 +2568,16 @@ static void DesfirePrintFileSettDynPart(uint8_t filetype, uint8_t *data, size_t
|
|||
if (create) {
|
||||
PrintAndLogEx(INFO, "Value............ %d / 0x%08X", value, value);
|
||||
PrintAndLogEx(INFO, "Limited credit... %d - %s"
|
||||
, limited_credit_enabled
|
||||
, ((limited_credit_enabled & 1) != 0) ? "enabled" : "disabled"
|
||||
);
|
||||
, limited_credit_enabled
|
||||
, ((limited_credit_enabled & 1) != 0) ? "enabled" : "disabled"
|
||||
);
|
||||
} else {
|
||||
PrintAndLogEx(INFO, "Limited credit... %d - %s %d (0x%08X)"
|
||||
, limited_credit_enabled
|
||||
, ((limited_credit_enabled & 1) != 0) ? "enabled" : "disabled"
|
||||
, value
|
||||
, value
|
||||
);
|
||||
, limited_credit_enabled
|
||||
, ((limited_credit_enabled & 1) != 0) ? "enabled" : "disabled"
|
||||
, value
|
||||
, value
|
||||
);
|
||||
}
|
||||
PrintAndLogEx(INFO, "GetValue access... %s", ((limited_credit_enabled & 0x02) != 0) ? "Free" : "Not Free");
|
||||
|
||||
|
|
Loading…
Reference in a new issue