From fd2ac38ac311e2fb9c2055b7ef36fdad8944224c Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Sat, 8 Jun 2019 15:24:12 -0400 Subject: [PATCH] chg: lf em 4x05_info --- client/cmdlfem4x.c | 43 +++++++++++++++++++++++-------------------- 1 file changed, 23 insertions(+), 20 deletions(-) diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index 93f6b5b3e..6a5fae76f 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -884,9 +884,9 @@ int EM4x50Read(const char *Cmd, bool verbose) { if (start >= 0) { PrintAndLogEx(NORMAL, "\nNote: one block = 50 bits (32 data, 12 parity, 6 marker)"); } else { - PrintAndLogEx(NORMAL, "No data found!, clock tried:%d", clk); + PrintAndLogEx(NORMAL, "No data found!, clock tried: " _YELLOW_("%d"), clk); PrintAndLogEx(NORMAL, "Try again with more samples."); - PrintAndLogEx(NORMAL, " or after a 'data askedge' command to clean up the read"); + PrintAndLogEx(NORMAL, " or after a " _YELLOW_("'data askedge'") " command to clean up the read"); return PM3_ESOFT; } } else if (start < 0) return PM3_ESOFT; @@ -1372,19 +1372,19 @@ static void printEM4x05config(uint32_t wordData) { uint8_t pigeon = (wordData & (1 << 26)) >> 26; PrintAndLogEx(NORMAL, "ConfigWord: %08X (Word 4)\n", wordData); PrintAndLogEx(NORMAL, "Config Breakdown:"); - PrintAndLogEx(NORMAL, " Data Rate: %02u | RF/%u", wordData & 0x3F, datarate); - PrintAndLogEx(NORMAL, " Encoder: %u | %s", encoder, enc); + PrintAndLogEx(NORMAL, " Data Rate: %02u | "_YELLOW_("RF/%u"), wordData & 0x3F, datarate); + PrintAndLogEx(NORMAL, " Encoder: %u | " _YELLOW_("%s"), encoder, enc); PrintAndLogEx(NORMAL, " PSK CF: %u | %s", PSKcf, cf); PrintAndLogEx(NORMAL, " Delay: %u | %s", delay, cdelay); PrintAndLogEx(NORMAL, " LastWordR: %02u | Address of last word for default read - meaning %u blocks are output", LWR, numblks); - PrintAndLogEx(NORMAL, " ReadLogin: %u | Read Login is %s", readLogin, readLogin ? "Required" : "Not Required"); - PrintAndLogEx(NORMAL, " ReadHKL: %u | Read Housekeeping Words Login is %s", readHKL, readHKL ? "Required" : "Not Required"); - PrintAndLogEx(NORMAL, "WriteLogin: %u | Write Login is %s", writeLogin, writeLogin ? "Required" : "Not Required"); - PrintAndLogEx(NORMAL, " WriteHKL: %u | Write Housekeeping Words Login is %s", writeHKL, writeHKL ? "Required" : "Not Required"); - PrintAndLogEx(NORMAL, " R.A.W.: %u | Read After Write is %s", raw, raw ? "On" : "Off"); - PrintAndLogEx(NORMAL, " Disable: %u | Disable Command is %s", disable, disable ? "Accepted" : "Not Accepted"); - PrintAndLogEx(NORMAL, " R.T.F.: %u | Reader Talk First is %s", rtf, rtf ? "Enabled" : "Disabled"); - PrintAndLogEx(NORMAL, " Pigeon: %u | Pigeon Mode is %s\n", pigeon, pigeon ? "Enabled" : "Disabled"); + PrintAndLogEx(NORMAL, " ReadLogin: %u | Read login is %s", readLogin, readLogin ? _YELLOW_("required") : _GREEN_("not required") ); + PrintAndLogEx(NORMAL, " ReadHKL: %u | Read housekeeping words login is %s", readHKL, readHKL ? _YELLOW_("required") : _GREEN_("not required") ); + PrintAndLogEx(NORMAL, "WriteLogin: %u | Write login is %s", writeLogin, writeLogin ? _YELLOW_("required") : _GREEN_("not required") ); + PrintAndLogEx(NORMAL, " WriteHKL: %u | Write housekeeping words login is %s", writeHKL, writeHKL ? _YELLOW_("required") : _GREEN_("not Required") ); + PrintAndLogEx(NORMAL, " R.A.W.: %u | Read after write is %s", raw, raw ? "on" : "off"); + PrintAndLogEx(NORMAL, " Disable: %u | Disable command is %s", disable, disable ? "accepted" : "not accepted"); + PrintAndLogEx(NORMAL, " R.T.F.: %u | Reader talk first is %s", rtf, rtf ? _YELLOW_("enabled") : "disabled"); + PrintAndLogEx(NORMAL, " Pigeon: %u | Pigeon mode is %s\n", pigeon, pigeon ? _YELLOW_("enabled") : "disabled"); } static void printEM4x05info(uint32_t block0, uint32_t serial) { @@ -1393,24 +1393,27 @@ static void printEM4x05info(uint32_t block0, uint32_t serial) { uint8_t cap = (block0 >> 5) & 3; uint16_t custCode = (block0 >> 9) & 0x3FF; + char ctstr[50]; + snprintf(ctstr, sizeof(ctstr), "\n Chip Type: %u | ", chipType); switch (chipType) { case 9: - PrintAndLogEx(NORMAL, "\n Chip Type: %u | EM4305", chipType); + snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4305"); break; case 8: - PrintAndLogEx(NORMAL, "\n Chip Type: %u | EM4205", chipType); + snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4205"); break; case 4: - PrintAndLogEx(NORMAL, " Chip Type: %u | Unknown", chipType); + snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "Unknown"); break; case 2: - PrintAndLogEx(NORMAL, " Chip Type: %u | EM4469", chipType); + snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "EM4469"); break; //add more here when known default: - PrintAndLogEx(NORMAL, " Chip Type: %u Unknown", chipType); + snprintf(ctstr + strlen(ctstr), sizeof(ctstr) - strlen(ctstr), _YELLOW_("%s"), "Unknown"); break; } + PrintAndLogEx(NORMAL, "%s", ctstr); switch (cap) { case 3: @@ -1432,14 +1435,14 @@ static void printEM4x05info(uint32_t block0, uint32_t serial) { PrintAndLogEx(NORMAL, " Cust Code: %03u | %s", custCode, (custCode == 0x200) ? "Default" : "Unknown"); if (serial != 0) - PrintAndLogEx(NORMAL, "\n Serial #: %08X\n", serial); + PrintAndLogEx(NORMAL, "\n Serial #: " _YELLOW_("%08X") "\n", serial); } static void printEM4x05ProtectionBits(uint32_t word) { for (uint8_t i = 0; i < 15; i++) { - PrintAndLogEx(NORMAL, " Word: %02u | %s", i, (((1 << i) & word) || i < 2) ? "Is Write Locked" : "Is Not Write Locked"); + PrintAndLogEx(NORMAL, " Word: %02u | %s", i, (((1 << i) & word) || i < 2) ? _RED_("write Locked") : "unlocked"); if (i == 14) - PrintAndLogEx(NORMAL, " Word: %02u | %s", i + 1, (((1 << i) & word) || i < 2) ? "Is Write Locked" : "Is Not Write Locked"); + PrintAndLogEx(NORMAL, " Word: %02u | %s", i + 1, (((1 << i) & word) || i < 2) ? _RED_("write locked") : "unlocked"); } }