From 8bdda551158b05edd84be59e0cf221b5060cb757 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Wed, 22 Apr 2020 02:22:55 +0200 Subject: [PATCH] Fix prompt colors in log -> spurious space in color macros -> adjust lots of files... --- armsrc/Standalone/hf_legic.c | 4 +- armsrc/Standalone/lf_icehid.c | 6 +-- armsrc/appmain.c | 2 +- armsrc/flashmem.c | 6 +-- armsrc/legicrfsim.c | 2 +- armsrc/lfops.c | 12 +++--- armsrc/lfsampling.c | 2 +- armsrc/spiffs.c | 10 ++--- client/src/cmddata.c | 24 +++++------ client/src/cmdflashmem.c | 4 +- client/src/cmdflashmemspiffs.c | 4 +- client/src/cmdhf.c | 22 +++++----- client/src/cmdhf14a.c | 2 +- client/src/cmdhf15.c | 2 +- client/src/cmdhficlass.c | 14 +++--- client/src/cmdhflegic.c | 8 ++-- client/src/cmdhflto.c | 2 +- client/src/cmdhfmf.c | 54 +++++++++++------------ client/src/cmdhfmfdes.c | 38 ++++++++-------- client/src/cmdhfmfp.c | 46 ++++++++++---------- client/src/cmdhfmfu.c | 30 ++++++------- client/src/cmdhfthinfilm.c | 6 +-- client/src/cmdhftopaz.c | 4 +- client/src/cmdhw.c | 6 +-- client/src/cmdlf.c | 74 ++++++++++++++++---------------- client/src/cmdlfawid.c | 2 +- client/src/cmdlfem4x.c | 10 ++--- client/src/cmdlffdx.c | 4 +- client/src/cmdlfgallagher.c | 2 +- client/src/cmdlfguard.c | 2 +- client/src/cmdlfhid.c | 10 ++--- client/src/cmdlfhitag.c | 6 +-- client/src/cmdlfindala.c | 2 +- client/src/cmdlfio.c | 2 +- client/src/cmdlfjablotron.c | 2 +- client/src/cmdlfkeri.c | 2 +- client/src/cmdlfmotorola.c | 2 +- client/src/cmdlfnedap.c | 2 +- client/src/cmdlfnexwatch.c | 2 +- client/src/cmdlfnoralsy.c | 2 +- client/src/cmdlfpac.c | 2 +- client/src/cmdlfparadox.c | 2 +- client/src/cmdlfpcf7931.c | 2 +- client/src/cmdlfpresco.c | 2 +- client/src/cmdlfpyramid.c | 2 +- client/src/cmdlfsecurakey.c | 2 +- client/src/cmdlft55xx.c | 18 ++++---- client/src/cmdlfti.c | 2 +- client/src/cmdlfverichip.c | 2 +- client/src/cmdlfviking.c | 2 +- client/src/cmdlfvisa2000.c | 2 +- client/src/cmdmain.c | 4 +- client/src/cmdparser.c | 2 +- client/src/cmdtrace.c | 4 +- client/src/cmdusart.c | 2 +- client/src/comms.c | 6 +-- client/src/fileutils.c | 18 ++++---- client/src/flash.c | 20 ++++----- client/src/loclass/elite_crack.c | 4 +- client/src/mifare/mifarehost.c | 10 ++--- client/src/proxmark3.c | 61 +++++++++++++------------- client/src/proxmark3.h | 12 ++---- client/src/ui.c | 14 +++--- include/ansi.h | 4 +- 64 files changed, 315 insertions(+), 320 deletions(-) diff --git a/armsrc/Standalone/hf_legic.c b/armsrc/Standalone/hf_legic.c index 8b00766d5..d72c8148e 100644 --- a/armsrc/Standalone/hf_legic.c +++ b/armsrc/Standalone/hf_legic.c @@ -47,10 +47,10 @@ void DownloadLogInstructions() { Dbprintf(""); Dbprintf("[=] List all dumps from flash:"); - Dbprintf("[=] " _YELLOW_("-") "mem spiffs tree"); + Dbprintf("[=] " _YELLOW_("-") " mem spiffs tree"); Dbprintf(""); Dbprintf("[=] To save a dump file from flash to client:"); - Dbprintf("[=] " _YELLOW_("-") "mem spiffs dump o hf-legic-UID-dump.bin f hf-legic-UID-dump.bin"); + Dbprintf("[=] " _YELLOW_("-") " mem spiffs dump o hf-legic-UID-dump.bin f hf-legic-UID-dump.bin"); } void save_dump_to_file(legic_card_select_t *p_card) { diff --git a/armsrc/Standalone/lf_icehid.c b/armsrc/Standalone/lf_icehid.c index 33d4ed764..c71ff344d 100644 --- a/armsrc/Standalone/lf_icehid.c +++ b/armsrc/Standalone/lf_icehid.c @@ -57,9 +57,9 @@ void DownloadLogInstructions() { Dbprintf(""); Dbprintf("[=] To get the logfile from flash and display it:"); - Dbprintf("[=] " _YELLOW_("1.") "mem spiffs dump o "LF_HIDCOLLECT_LOGFILE" f "LF_HIDCOLLECT_LOGFILE); - Dbprintf("[=] " _YELLOW_("2.") "exit proxmark3 client"); - Dbprintf("[=] " _YELLOW_("3.") "cat "LF_HIDCOLLECT_LOGFILE); + Dbprintf("[=] " _YELLOW_("1.") " mem spiffs dump o "LF_HIDCOLLECT_LOGFILE" f "LF_HIDCOLLECT_LOGFILE); + Dbprintf("[=] " _YELLOW_("2.") " exit proxmark3 client"); + Dbprintf("[=] " _YELLOW_("3.") " cat "LF_HIDCOLLECT_LOGFILE); } bool log_exists; diff --git a/armsrc/appmain.c b/armsrc/appmain.c index 587347390..b05a143f0 100644 --- a/armsrc/appmain.c +++ b/armsrc/appmain.c @@ -333,7 +333,7 @@ void printConnSpeed(void) { Dbprintf(" Time elapsed............%dms", delta_time); Dbprintf(" Bytes transferred.......%d", bytes_transferred); - Dbprintf(" Transfer Speed PM3 -> Client = " _YELLOW_("%d") "bytes/s", 1000 * bytes_transferred / delta_time); + Dbprintf(" Transfer Speed PM3 -> Client = " _YELLOW_("%d") " bytes/s", 1000 * bytes_transferred / delta_time); } /** diff --git a/armsrc/flashmem.c b/armsrc/flashmem.c index fb69dee01..e3a20cacc 100644 --- a/armsrc/flashmem.c +++ b/armsrc/flashmem.c @@ -573,7 +573,7 @@ void Flashmem_print_info(void) { if (isok == 2) { num = ((keysum[1] << 8) | keysum[0]); if (num != 0xFFFF && num != 0x0) - Dbprintf(" Mifare.................."_YELLOW_("%d")"keys", num); + Dbprintf(" Mifare.................."_YELLOW_("%d")" keys", num); } Flash_CheckBusy(BUSY_TIMEOUT); @@ -581,7 +581,7 @@ void Flashmem_print_info(void) { if (isok == 2) { num = ((keysum[1] << 8) | keysum[0]); if (num != 0xFFFF && num != 0x0) - Dbprintf(" T55x7..................."_YELLOW_("%d")"keys", num); + Dbprintf(" T55x7..................."_YELLOW_("%d")" keys", num); } Flash_CheckBusy(BUSY_TIMEOUT); @@ -589,7 +589,7 @@ void Flashmem_print_info(void) { if (isok == 2) { num = ((keysum[1] << 8) | keysum[0]); if (num != 0xFFFF && num != 0x0) - Dbprintf(" iClass.................."_YELLOW_("%d")"keys", num); + Dbprintf(" iClass.................."_YELLOW_("%d")" keys", num); } FlashStop(); diff --git a/armsrc/legicrfsim.c b/armsrc/legicrfsim.c index bbec86fa5..ee658f4bd 100644 --- a/armsrc/legicrfsim.c +++ b/armsrc/legicrfsim.c @@ -465,7 +465,7 @@ void LegicRfSimulate(uint8_t cardtype) { } LED_A_ON(); - DbpString("[=] Starting Legic emulator, press " _YELLOW_("button") "to end"); + DbpString("[=] Starting Legic emulator, press " _YELLOW_("button") " to end"); while (!BUTTON_PRESS() && !data_available()) { WDT_HIT(); diff --git a/armsrc/lfops.c b/armsrc/lfops.c index aa2f68e2a..c65696d1a 100644 --- a/armsrc/lfops.c +++ b/armsrc/lfops.c @@ -196,7 +196,7 @@ static uint32_t GetT55xxClockBit(uint32_t clock) { void printT55xxConfig(void) { -#define PRN_NA sprintf(s + strlen(s), _RED_("N/A") "| "); +#define PRN_NA sprintf(s + strlen(s), _RED_("N/A") " | "); DbpString(_BLUE_("LF T55XX config")); Dbprintf(" [r] [a] [b] [c] [d] [e] [f] [g]"); @@ -211,16 +211,16 @@ void printT55xxConfig(void) { switch (i) { case T55XX_DLMODE_FIXED : - sprintf(s, _YELLOW_("fixed bit length") _GREEN_("(default)") "|"); + sprintf(s, _YELLOW_("fixed bit length") _GREEN_(" (default)") " |"); break; case T55XX_DLMODE_LLR : - sprintf(s, _YELLOW_(" long leading reference") "|"); + sprintf(s, _YELLOW_(" long leading reference") " |"); break; case T55XX_DLMODE_LEADING_ZERO : - sprintf(s, _YELLOW_(" leading zero") "|"); + sprintf(s, _YELLOW_(" leading zero") " |"); break; case T55XX_DLMODE_1OF4 : - sprintf(s, _YELLOW_(" 1 of 4 coding reference") "|"); + sprintf(s, _YELLOW_(" 1 of 4 coding reference") " |"); break; default: break; @@ -1291,7 +1291,7 @@ void CmdHIDdemodFSK(int findone, uint32_t *high, uint32_t *low, int ledcontrol) cardnum = (lo >> 1) & 0x7FFFF; fac = ((hi & 0xF) << 12) | (lo >> 20); } - Dbprintf("TAG ID: " _GREEN_("%x%08x (%d)") "- Format Len: " _GREEN_("%d") "bit - FC: " _GREEN_("%d") "- Card: "_GREEN_("%d"), + Dbprintf("TAG ID: " _GREEN_("%x%08x (%d)") " - Format Len: " _GREEN_("%d") " bit - FC: " _GREEN_("%d") " - Card: "_GREEN_("%d"), hi, lo, (lo >> 1) & 0xFFFF, diff --git a/armsrc/lfsampling.c b/armsrc/lfsampling.c index 3769e3565..2851dc08b 100644 --- a/armsrc/lfsampling.c +++ b/armsrc/lfsampling.c @@ -307,7 +307,7 @@ uint32_t DoAcquisition(uint8_t decimation, uint8_t bits_per_sample, bool avg, in } if (verbose) { - Dbprintf("Done, saved " _YELLOW_("%d")"out of " _YELLOW_("%d")"seen samples at " _YELLOW_("%d")"bits/sample", samples.total_saved, samples.counter, bits_per_sample); + Dbprintf("Done, saved " _YELLOW_("%d")" out of " _YELLOW_("%d")" seen samples at " _YELLOW_("%d")" bits/sample", samples.total_saved, samples.counter, bits_per_sample); } // Ensure that DC offset removal and noise check is performed for any device-side processing diff --git a/armsrc/spiffs.c b/armsrc/spiffs.c index 81172476f..3db0e3c27 100644 --- a/armsrc/spiffs.c +++ b/armsrc/spiffs.c @@ -545,14 +545,14 @@ void rdv40_spiffs_safe_print_fsinfo() { DbpString(_BLUE_("Flash Memory FileSystem Info (SPIFFS)")); - Dbprintf(" Logical Block Size........." _YELLOW_("%d")"bytes", fsinfo.blockSize); - Dbprintf(" Logical Page Size.........." _YELLOW_("%d")"bytes", fsinfo.pageSize); + Dbprintf(" Logical Block Size........." _YELLOW_("%d")" bytes", fsinfo.blockSize); + Dbprintf(" Logical Page Size.........." _YELLOW_("%d")" bytes", fsinfo.pageSize); Dbprintf(""); - Dbprintf(" Max Open Files............." _YELLOW_("%d")"file descriptors", fsinfo.maxOpenFiles); - Dbprintf(" Max Path Length............" _YELLOW_("%d")"chars", fsinfo.maxPathLength); + Dbprintf(" Max Open Files............." _YELLOW_("%d")" file descriptors", fsinfo.maxOpenFiles); + Dbprintf(" Max Path Length............" _YELLOW_("%d")" chars", fsinfo.maxPathLength); DbpString(""); Dbprintf(" filesystem size used available use% mounted"); - Dbprintf(" spiffs %6d B %6d B %6d B"_YELLOW_("%2d%")" /" + Dbprintf(" spiffs %6d B %6d B %6d B"_YELLOW_("%2d%")" /" , fsinfo.totalBytes , fsinfo.usedBytes , fsinfo.freeBytes diff --git a/client/src/cmddata.c b/client/src/cmddata.c index 205e6e957..9a809f603 100644 --- a/client/src/cmddata.c +++ b/client/src/cmddata.c @@ -101,13 +101,13 @@ static int usage_data_biphaserawdecode(void) { static int usage_data_rawdemod(void) { PrintAndLogEx(NORMAL, "Usage: data rawdemod [modulation] |"); PrintAndLogEx(NORMAL, " [modulation] as 2 char,"); - PrintAndLogEx(NORMAL, " "_YELLOW_("ab")"- ask/biphase"); - PrintAndLogEx(NORMAL, " "_YELLOW_("am")"- ask/manchester"); - PrintAndLogEx(NORMAL, " "_YELLOW_("ar")"- ask/raw"); - PrintAndLogEx(NORMAL, " "_YELLOW_("fs")"- fsk"); - PrintAndLogEx(NORMAL, " "_YELLOW_("nr")"- nrz/direct"); - PrintAndLogEx(NORMAL, " "_YELLOW_("p1")"- psk1"); - PrintAndLogEx(NORMAL, " "_YELLOW_("p2")"- psk2"); + PrintAndLogEx(NORMAL, " "_YELLOW_("ab")" - ask/biphase"); + PrintAndLogEx(NORMAL, " "_YELLOW_("am")" - ask/manchester"); + PrintAndLogEx(NORMAL, " "_YELLOW_("ar")" - ask/raw"); + PrintAndLogEx(NORMAL, " "_YELLOW_("fs")" - fsk"); + PrintAndLogEx(NORMAL, " "_YELLOW_("nr")" - nrz/direct"); + PrintAndLogEx(NORMAL, " "_YELLOW_("p1")" - psk1"); + PrintAndLogEx(NORMAL, " "_YELLOW_("p2")" - psk2"); PrintAndLogEx(NORMAL, " as 'h', prints the help for the specific modulation"); PrintAndLogEx(NORMAL, " see specific modulation help for optional parameters"); PrintAndLogEx(NORMAL, ""); @@ -843,7 +843,7 @@ int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveG // sanity check if (window > len) window = len; - if (verbose) PrintAndLogEx(INFO, "performing " _YELLOW_("%zu") "correlations", GraphTraceLen - window); + if (verbose) PrintAndLogEx(INFO, "performing " _YELLOW_("%zu") " correlations", GraphTraceLen - window); //test double autocv = 0.0; // Autocovariance value @@ -899,9 +899,9 @@ int AutoCorrelate(const int *in, int *out, size_t len, size_t window, bool SaveG if (verbose && foo < bar) { distance = idx_1 - idx; - PrintAndLogEx(SUCCESS, "possible visible correlation "_YELLOW_("%4d") "samples", distance); + PrintAndLogEx(SUCCESS, "possible visible correlation "_YELLOW_("%4d") " samples", distance); } else if (verbose && (correlation > 1)) { - PrintAndLogEx(SUCCESS, "possible correlation " _YELLOW_("%4zu") "samples", correlation); + PrintAndLogEx(SUCCESS, "possible correlation " _YELLOW_("%4zu") " samples", correlation); } else { PrintAndLogEx(FAILED, "no repeating pattern found, try increasing window size"); } @@ -1599,7 +1599,7 @@ int getSamples(uint32_t n, bool verbose) { if (n == 0 || n > sizeof(got)) n = sizeof(got); - if (verbose) PrintAndLogEx(INFO, "Reading " _YELLOW_("%u") "bytes from device memory", n); + if (verbose) PrintAndLogEx(INFO, "Reading " _YELLOW_("%u") " bytes from device memory", n); PacketResponseNG response; if (!GetFromDevice(BIG_BUF, got, n, 0, NULL, 0, &response, 10000, true)) { @@ -1614,7 +1614,7 @@ int getSamples(uint32_t n, bool verbose) { //Old devices without this feature would send 0 at arg[0] if (response.oldarg[0] > 0) { sample_config *sc = (sample_config *) response.data.asBytes; - if (verbose) PrintAndLogEx(INFO, "Samples @ " _YELLOW_("%d") "bits/smpl, decimation 1:%d ", sc->bits_per_sample, sc->decimation); + if (verbose) PrintAndLogEx(INFO, "Samples @ " _YELLOW_("%d") " bits/smpl, decimation 1:%d ", sc->bits_per_sample, sc->decimation); bits_per_sample = sc->bits_per_sample; } diff --git a/client/src/cmdflashmem.c b/client/src/cmdflashmem.c index ab104276d..8d19c3888 100644 --- a/client/src/cmdflashmem.c +++ b/client/src/cmdflashmem.c @@ -266,7 +266,7 @@ static int CmdFlashMemLoad(const char *Cmd) { conn.block_after_ACK = false; free(data); - PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%zu")"bytes to offset "_GREEN_("%u"), datalen, start_index); + PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%zu")" bytes to offset "_GREEN_("%u"), datalen, start_index); return PM3_SUCCESS; } static int CmdFlashMemDump(const char *Cmd) { @@ -321,7 +321,7 @@ static int CmdFlashMemDump(const char *Cmd) { return PM3_EMALLOC; } - PrintAndLogEx(INFO, "downloading "_YELLOW_("%u")"bytes from flashmem", len); + PrintAndLogEx(INFO, "downloading "_YELLOW_("%u")" bytes from flashmem", len); if (!GetFromDevice(FLASH_MEM, dump, len, start_index, NULL, 0, NULL, -1, true)) { PrintAndLogEx(FAILED, "ERROR; downloading from flashmemory"); free(dump); diff --git a/client/src/cmdflashmemspiffs.c b/client/src/cmdflashmemspiffs.c index 8ec0fe8e1..b994ea56c 100644 --- a/client/src/cmdflashmemspiffs.c +++ b/client/src/cmdflashmemspiffs.c @@ -308,7 +308,7 @@ static int CmdFlashMemSpiFFSDump(const char *Cmd) { return PM3_EMALLOC; } - PrintAndLogEx(INFO, "downloading "_YELLOW_("%u") "bytes from spiffs (flashmem)", len); + PrintAndLogEx(INFO, "downloading "_YELLOW_("%u") " bytes from spiffs (flashmem)", len); if (!GetFromDevice(SPIFFS, dump, len, start_index, (uint8_t *)destfilename, 32, NULL, -1, true)) { PrintAndLogEx(FAILED, "ERROR; downloading from spiffs(flashmemory)"); free(dump); @@ -449,7 +449,7 @@ static int CmdFlashMemSpiFFSLoad(const char *Cmd) { free(data); if (res == PM3_SUCCESS) - PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%zu") "bytes to file "_GREEN_("%s"), datalen, destfilename); + PrintAndLogEx(SUCCESS, "Wrote "_GREEN_("%zu") " bytes to file "_GREEN_("%s"), datalen, destfilename); return res; } diff --git a/client/src/cmdhf.c b/client/src/cmdhf.c index bb6c022c4..fbc99dbd5 100644 --- a/client/src/cmdhf.c +++ b/client/src/cmdhf.c @@ -92,7 +92,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for ThinFilm tag..."); if (IfPm3NfcBarcode()) { if (infoThinFilm(false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Thinfilm tag") " found\n"); res = PM3_SUCCESS; } } @@ -101,7 +101,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for LTO-CM tag..."); if (IfPm3Iso14443a()) { if (infoLTO(false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LTO-CM tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LTO-CM tag") " found\n"); res = PM3_SUCCESS; } } @@ -110,7 +110,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for ISO14443-A tag..."); if (IfPm3Iso14443a()) { if (infoHF14A(false, false, false) > 0) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-A tag") " found\n"); res = PM3_SUCCESS; } } @@ -119,7 +119,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for ISO15693 tag..."); if (IfPm3Iso15693()) { if (readHF15Uid(false)) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO15693 tag") " found\n"); res = PM3_SUCCESS; } } @@ -128,7 +128,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for LEGIC tag..."); if (IfPm3Legicrf()) { if (readLegicUid(false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC Prime tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("LEGIC Prime tag") " found\n"); res = PM3_SUCCESS; } } @@ -137,7 +137,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for Topaz tag..."); if (IfPm3Iso14443a()) { if (readTopazUid(false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Topaz tag") " found\n"); res = PM3_SUCCESS; } } @@ -146,7 +146,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for FeliCa tag..."); if (IfPm3Felica()) { if (readFelicaUid(false) == PM3_SUCCESS) { - PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") "found\n"); + PrintAndLogEx(NORMAL, "\nValid " _GREEN_("ISO18092 / FeliCa tag") " found\n"); res = PM3_SUCCESS; } } @@ -156,7 +156,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for CryptoRF tag..."); if (IfPm3Iso14443b()) { if (readHFCryptoRF(false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("CryptoRF tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("CryptoRF tag") " found\n"); res = PM3_SUCCESS; } } @@ -167,7 +167,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for ISO14443-B tag..."); if (IfPm3Iso14443b()) { if (readHF14B(false) == 1) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("ISO14443-B tag") " found\n"); res = PM3_SUCCESS; } } @@ -176,7 +176,7 @@ int CmdHFSearch(const char *Cmd) { PrintAndLogEx(INPLACE, "Searching for iClass / PicoPass tag..."); if (IfPm3Iclass()) { if (readIclass(false, false) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") "found\n"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("iClass tag / PicoPass tag") " found\n"); res = PM3_SUCCESS; } } @@ -196,7 +196,7 @@ int CmdHFTune(const char *Cmd) { if (cmdp == 'h') return usage_hf_tune(); int iter = param_get32ex(Cmd, 0, 0, 10); - PrintAndLogEx(INFO, "Measuring HF antenna, click " _GREEN_("pm3 button") "or press " _GREEN_("Enter") "to exit"); + PrintAndLogEx(INFO, "Measuring HF antenna, click " _GREEN_("pm3 button") " or press " _GREEN_("Enter") " to exit"); PacketResponseNG resp; clearCommandBuffer(); diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index 50af60cfc..c53bc08b6 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -466,7 +466,7 @@ int CmdHF14ASim(const char *Cmd) { break; } if (!errors) { - PrintAndLogEx(SUCCESS, "Emulating " _YELLOW_("ISO/IEC 14443 type A tag")"with " _GREEN_("%d byte UID (%s)"), uidlen, sprint_hex(uid, uidlen)); + PrintAndLogEx(SUCCESS, "Emulating " _YELLOW_("ISO/IEC 14443 type A tag")" with " _GREEN_("%d byte UID (%s)"), uidlen, sprint_hex(uid, uidlen)); useUIDfromEML = false; } cmdp += 2; diff --git a/client/src/cmdhf15.c b/client/src/cmdhf15.c index 4d2e5c544..620a75bd7 100644 --- a/client/src/cmdhf15.c +++ b/client/src/cmdhf15.c @@ -928,7 +928,7 @@ static int CmdHF15Info(const char *Cmd) { memcpy(uid, recv + 2, sizeof(uid)); PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------"); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); PrintAndLogEx(INFO, "-------------------------------------------------------------"); PrintAndLogEx(SUCCESS, " TYPE: " _YELLOW_("%s"), getTagInfo_15(recv + 2)); PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), iso15693_sprintUID(NULL, uid)); diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index a9d8c1f9c..c687e316d 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -927,7 +927,7 @@ static int CmdHFiClassDecrypt(const char *Cmd) { uint32_t limit = MIN(applimit, decryptedlen / 8); if (decryptedlen / 8 != applimit) { - PrintAndLogEx(WARNING, "Actual file len " _YELLOW_("%zu") "vs HID app-limit len " _YELLOW_("%u"), decryptedlen, applimit * 8); + PrintAndLogEx(WARNING, "Actual file len " _YELLOW_("%zu") " vs HID app-limit len " _YELLOW_("%u"), decryptedlen, applimit * 8); PrintAndLogEx(INFO, "Setting limit to " _GREEN_("%u"), limit * 8); } uint8_t numblocks4userid = GetNumberBlocksForUserId(decrypted + (6 * 8)); @@ -1415,7 +1415,7 @@ static int CmdHFiClassReader_Dump(const char *Cmd) { // print the dump PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "------+--+-------------------------+----------"); - PrintAndLogEx(INFO, " CSN |00| " _GREEN_("%s") "|", sprint_hex(tag_data, 8)); + PrintAndLogEx(INFO, " CSN |00| " _GREEN_("%s") " |", sprint_hex(tag_data, 8)); printIclassDumpContents(tag_data, 1, (gotBytes / 8), gotBytes); if (filename[0] == 0) { @@ -2052,11 +2052,11 @@ static int CmdHFiClassReadTagFile(const char *Cmd) { PrintAndLogEx(INFO, "File: " _YELLOW_("%s"), filename); PrintAndLogEx(INFO, "File size %zu bytes, file blocks %d (0x%x)", bytes_read, (uint16_t)(bytes_read >> 3), (uint16_t)(bytes_read >> 3)); PrintAndLogEx(INFO, "Printing blocks from"); - PrintAndLogEx(INFO, "start " _YELLOW_("0x%02x") "end " _YELLOW_("0x%02x"), (startblock == 0) ? 6 : startblock, endblock); + PrintAndLogEx(INFO, "start " _YELLOW_("0x%02x") " end " _YELLOW_("0x%02x"), (startblock == 0) ? 6 : startblock, endblock); } uint8_t *csn = dump; PrintAndLogEx(INFO, "------+--+-------------------------+----------"); - PrintAndLogEx(INFO, " CSN |00| " _GREEN_("%s") "|", sprint_hex(csn, 8)); + PrintAndLogEx(INFO, " CSN |00| " _GREEN_("%s") " |", sprint_hex(csn, 8)); printIclassDumpContents(dump, startblock, endblock, bytes_read); free(dump); return PM3_SUCCESS; @@ -2223,7 +2223,7 @@ static int loadKeys(char *filename) { memcpy(iClass_Key_Table[i], dump + (i * 8), 8); free(dump); - PrintAndLogEx(SUCCESS, "Loaded " _GREEN_("%2d") "keys from %s", i, filename); + PrintAndLogEx(SUCCESS, "Loaded " _GREEN_("%2d") " keys from %s", i, filename); return PM3_SUCCESS; } @@ -2440,7 +2440,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) { if (use_raw) PrintAndLogEx(SUCCESS, "Using " _YELLOW_(" raw mode")); - PrintAndLogEx(SUCCESS, "Searching for " _YELLOW_("%s") "key", (use_credit_key) ? "CREDIT" : "DEBIT"); + PrintAndLogEx(SUCCESS, "Searching for " _YELLOW_("%s") " key", (use_credit_key) ? "CREDIT" : "DEBIT"); PrintAndLogEx(SUCCESS, "Tag info"); PrintAndLogEx(SUCCESS, "CSN | %s", sprint_hex(CSN, sizeof(CSN))); PrintAndLogEx(SUCCESS, "CCNR | %s", sprint_hex(CCNR, sizeof(CCNR))); @@ -2714,7 +2714,7 @@ static int CmdHFiClassLookUp(const char *Cmd) { if (memcmp(iClass_Key_Table[i], "\x00\x00\x00\x00\x00\x00\x00\x00", 8) == 0) { memcpy(iClass_Key_Table[i], item->key, 8); - PrintAndLogEx(SUCCESS, "Added key to keyslot [%d] - "_YELLOW_("`hf iclass managekeys p`")"to view", i); + PrintAndLogEx(SUCCESS, "Added key to keyslot [%d] - "_YELLOW_("`hf iclass managekeys p`")" to view", i); break; } } diff --git a/client/src/cmdhflegic.c b/client/src/cmdhflegic.c index 04bd692aa..7507e326b 100644 --- a/client/src/cmdhflegic.c +++ b/client/src/cmdhflegic.c @@ -55,7 +55,7 @@ static int usage_legic_rdbl(void) { } static int usage_legic_sim(void) { PrintAndLogEx(NORMAL, "Simulates a LEGIC Prime tag. MIM22, MIM256, MIM1024 types can be emulated"); - PrintAndLogEx(NORMAL, "Use " _YELLOW_("`hf legic eload`") "to upload a dump into emulator memory\n"); + PrintAndLogEx(NORMAL, "Use " _YELLOW_("`hf legic eload`") " to upload a dump into emulator memory\n"); PrintAndLogEx(NORMAL, "Usage: hf legic sim [h] \n"); PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, " h : this help"); @@ -217,7 +217,7 @@ static int CmdLegicInfo(const char *Cmd) { return PM3_ESOFT; } - PrintAndLogEx(SUCCESS, "Reading full tag memory of " _YELLOW_("%d") "bytes...", card.cardsize); + PrintAndLogEx(SUCCESS, "Reading full tag memory of " _YELLOW_("%d") " bytes...", card.cardsize); // allocate receiver buffer uint8_t *data = calloc(card.cardsize, sizeof(uint8_t)); @@ -239,7 +239,7 @@ static int CmdLegicInfo(const char *Cmd) { PrintAndLogEx(SUCCESS, " " _CYAN_("CDF: System Area")); PrintAndLogEx(NORMAL, "------------------------------------------------------"); - PrintAndLogEx(SUCCESS, "MCD: " _GREEN_("%02X") " MSN: " _GREEN_("%s") " MCC: " _GREEN_("%02X") " ( %s)", + PrintAndLogEx(SUCCESS, "MCD: " _GREEN_("%02X") " MSN: " _GREEN_("%s") " MCC: " _GREEN_("%02X") " (%s)", data[0], sprint_hex(data + 1, 3), data[4], @@ -394,7 +394,7 @@ static int CmdLegicInfo(const char *Cmd) { (segment_flag & 0x4) >> 2, (segment_flag & 0x8) >> 3 ); - PrintAndLogEx(SUCCESS, " | WRP: %02u, WRC: %02u, RD: %01u, CRC: 0x%02X ( %s)", + PrintAndLogEx(SUCCESS, " | WRP: %02u, WRC: %02u, RD: %01u, CRC: 0x%02X (%s)", wrp, wrc, ((data[i + 3] ^ crc) & 0x80) >> 7, diff --git a/client/src/cmdhflto.c b/client/src/cmdhflto.c index c5b73c0c6..6434a9e88 100644 --- a/client/src/cmdhflto.c +++ b/client/src/cmdhflto.c @@ -616,7 +616,7 @@ static int CmdHfLTRestore(const char *Cmd) { is_data_loaded = loadFileEML(filename, (uint8_t *)dump_data, &dump_datalen); } else - PrintAndLogEx(WARNING, "\nWarning: invalid dump filename "_YELLOW_("%s")"to restore!\n", filename); + PrintAndLogEx(WARNING, "\nWarning: invalid dump filename "_YELLOW_("%s")" to restore!\n", filename); } if (is_data_loaded == PM3_SUCCESS) { diff --git a/client/src/cmdhfmf.c b/client/src/cmdhfmf.c index d6ce07592..8c6247614 100644 --- a/client/src/cmdhfmf.c +++ b/client/src/cmdhfmf.c @@ -249,10 +249,10 @@ static int usage_hf14_chk(void) { PrintAndLogEx(NORMAL, " t write keys to emulator memory\n"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf chk 0 A 1234567890ab")" -- target block 0, Key A using key 1234567890ab"); - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf chk 0 A mfc_default_keys.dic")" -- target block 0, Key A using default dictionary file"); - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf chk *1 ? t")" -- target all blocks, all keys, 1K, write to emulator memory"); - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf chk *1 ? d")" -- target all blocks, all keys, 1K, write to file"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf chk 0 A 1234567890ab")" -- target block 0, Key A using key 1234567890ab"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf chk 0 A mfc_default_keys.dic")" -- target block 0, Key A using default dictionary file"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf chk *1 ? t")" -- target all blocks, all keys, 1K, write to emulator memory"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf chk *1 ? d")" -- target all blocks, all keys, 1K, write to file"); return PM3_SUCCESS; } static int usage_hf14_chk_fast(void) { @@ -270,12 +270,12 @@ static int usage_hf14_chk_fast(void) { PrintAndLogEx(NORMAL, " m use dictionary from flashmemory\n"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 1234567890ab")" -- target 1K using key 1234567890ab"); - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 mfc_default_keys.dic")" -- target 1K using default dictionary file"); - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 t")" -- target 1K, write to emulator memory"); - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 d")" -- target 1K, write to file"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 1234567890ab")" -- target 1K using key 1234567890ab"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 mfc_default_keys.dic")" -- target 1K using default dictionary file"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 t")" -- target 1K, write to emulator memory"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 d")" -- target 1K, write to file"); if (IfPm3Flash()) - PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 m")" -- target 1K, use dictionary from flashmemory"); + PrintAndLogEx(NORMAL, _YELLOW_(" hf mf fchk 1 m")" -- target 1K, use dictionary from flashmemory"); return PM3_SUCCESS; } /* @@ -1361,7 +1361,7 @@ static int CmdHF14AMfNested(const char *Cmd) { } uint64_t t2 = msclock() - t1; - PrintAndLogEx(SUCCESS, "Time to check " _YELLOW_("%zu") "known keys: %.0f seconds\n", ARRAYLEN(g_mifare_default_keys), (float)t2 / 1000.0); + PrintAndLogEx(SUCCESS, "Time to check " _YELLOW_("%zu") " known keys: %.0f seconds\n", ARRAYLEN(g_mifare_default_keys), (float)t2 / 1000.0); PrintAndLogEx(SUCCESS, "enter nested key recovery"); // nested sectors @@ -1408,7 +1408,7 @@ static int CmdHF14AMfNested(const char *Cmd) { } t1 = msclock() - t1; - PrintAndLogEx(SUCCESS, "time in nested: " _YELLOW_("%.0f") "seconds\n", (float)t1 / 1000.0); + PrintAndLogEx(SUCCESS, "time in nested: " _YELLOW_("%.0f") " seconds\n", (float)t1 / 1000.0); // 20160116 If Sector A is found, but not Sector B, try just reading it of the tag? @@ -1576,7 +1576,7 @@ static int CmdHF14AMfNestedStatic(const char *Cmd) { } uint64_t t2 = msclock() - t1; - PrintAndLogEx(SUCCESS, "Time to check "_YELLOW_("%zu") "known keys: %.0f seconds\n", ARRAYLEN(g_mifare_default_keys), (float)t2 / 1000.0); + PrintAndLogEx(SUCCESS, "Time to check "_YELLOW_("%zu") " known keys: %.0f seconds\n", ARRAYLEN(g_mifare_default_keys), (float)t2 / 1000.0); PrintAndLogEx(SUCCESS, "enter static nested key recovery"); // nested sectors @@ -1613,7 +1613,7 @@ static int CmdHF14AMfNestedStatic(const char *Cmd) { } t1 = msclock() - t1; - PrintAndLogEx(SUCCESS, "time in static nested: " _YELLOW_("%.0f") "seconds\n", (float)t1 / 1000.0); + PrintAndLogEx(SUCCESS, "time in static nested: " _YELLOW_("%.0f") " seconds\n", (float)t1 / 1000.0); // 20160116 If Sector A is found, but not Sector B, try just reading it of the tag? @@ -2060,7 +2060,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) { PrintAndLogEx(INFO, _YELLOW_("======================= START KNOWN KEY ATTACK =======================")); } if (mfCheckKeys(FirstBlockOfSector(blockNo), keyType, true, 1, key, &key64) == PM3_SUCCESS) { - PrintAndLogEx(INFO, "target sector:%3u key type: %c -- using valid key [ " _YELLOW_("%s") "] (used for nested / hardnested attack)", + PrintAndLogEx(INFO, "target sector:%3u key type: %c -- using valid key [" _YELLOW_("%s") "] (used for nested / hardnested attack)", blockNo, keyType ? 'B' : 'A', sprint_hex(key, sizeof(key)) @@ -2095,13 +2095,13 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) { know_target_key = true; blockNo = i; keyType = j; - PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "] (used for nested / hardnested attack)", + PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key ["_YELLOW_("%s") "] (used for nested / hardnested attack)", i, j ? 'B' : 'A', sprint_hex(key, sizeof(key)) ); } else { - PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "]", + PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key ["_YELLOW_("%s") "]", i, j ? 'B' : 'A', sprint_hex(key, sizeof(key)) @@ -2141,7 +2141,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) { num_to_bytes(g_mifare_default_keys[cnt], 6, keyBlock + cnt * 6); } key_cnt = ARRAYLEN(g_mifare_default_keys); - PrintAndLogEx(SUCCESS, "loaded " _GREEN_("%2d") "keys from hardcoded default array", key_cnt); + PrintAndLogEx(SUCCESS, "loaded " _GREEN_("%2d") " keys from hardcoded default array", key_cnt); } // Use the dictionary to find sector keys on the card @@ -2219,13 +2219,13 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) { know_target_key = true; blockNo = i; keyType = j; - PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "] (used for nested / hardnested attack)", + PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [" _YELLOW_("%s") "] (used for nested / hardnested attack)", i, j ? 'B' : 'A', sprint_hex(tmp_key, sizeof(tmp_key)) ); } else { - PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "]", + PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [" _YELLOW_("%s") "]", i, j ? 'B' : 'A', sprint_hex(tmp_key, sizeof(tmp_key)) @@ -2267,7 +2267,7 @@ static int CmdHF14AMfAutoPWN(const char *Cmd) { // Store the keys e_sector[blockNo].Key[keyType] = key64; e_sector[blockNo].foundKey[keyType] = 'S'; - PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "] (used for nested / hardnested attack)", + PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [" _YELLOW_("%s") "] (used for nested / hardnested attack)", blockNo, keyType ? 'B' : 'A', sprint_hex(key, sizeof(key)) @@ -2307,7 +2307,7 @@ noValidKeyFound: if (mfCheckKeys(FirstBlockOfSector(i), j, true, 1, tmp_key, &key64) == PM3_SUCCESS) { e_sector[i].Key[j] = bytes_to_num(tmp_key, 6); e_sector[i].foundKey[j] = 'R'; - PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "]", + PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [" _YELLOW_("%s") "]", i, j ? 'B' : 'A', sprint_hex(tmp_key, sizeof(tmp_key)) @@ -2349,7 +2349,7 @@ noValidKeyFound: e_sector[current_sector_i].foundKey[current_key_type_i] = 'A'; e_sector[current_sector_i].Key[current_key_type_i] = key64; num_to_bytes(key64, 6, tmp_key); - PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "]", + PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [" _YELLOW_("%s") "]", current_sector_i, current_key_type_i ? 'B' : 'A', sprint_hex(tmp_key, sizeof(tmp_key)) @@ -2449,7 +2449,7 @@ tryHardnested: // If the nested attack fails then we try the hardnested attack } // Check if the key was found if (e_sector[current_sector_i].foundKey[current_key_type_i]) { - PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "]", + PrintAndLogEx(SUCCESS, "target sector:%3u key type: %c -- found valid key [" _YELLOW_("%s") "]", current_sector_i, current_key_type_i ? 'B' : 'A', sprint_hex(tmp_key, sizeof(tmp_key)) @@ -2522,7 +2522,7 @@ all_found: // Generate and show statistics t1 = msclock() - t1; - PrintAndLogEx(INFO, "autopwn execution time: " _YELLOW_("%.0f") "seconds", (float)t1 / 1000.0); + PrintAndLogEx(INFO, "autopwn execution time: " _YELLOW_("%.0f") " seconds", (float)t1 / 1000.0); free(dump); free(e_sector); @@ -3565,7 +3565,7 @@ void printKeyTableEx(uint8_t sectorscnt, sector_t *e_sector, uint8_t start_secto snprintf(strB, sizeof(strB), "%012" PRIx64, e_sector[i].Key[1]); if (e_sector[i].foundKey[0] > 1) { - PrintAndLogEx(SUCCESS, "| "_YELLOW_("%03d")"| " _GREEN_("%s")" | " _YELLOW_("%c")"| " _GREEN_("%s")" | " _YELLOW_("%c")"|" + PrintAndLogEx(SUCCESS, "| "_YELLOW_("%03d")" | " _GREEN_("%s")" | " _YELLOW_("%c")" | " _GREEN_("%s")" | " _YELLOW_("%c")" |" , i , strA, e_sector[i].foundKey[0] , strB, e_sector[i].foundKey[1] @@ -3577,7 +3577,7 @@ void printKeyTableEx(uint8_t sectorscnt, sector_t *e_sector, uint8_t start_secto if (start_sector == 0) s = i; - PrintAndLogEx(SUCCESS, "| "_YELLOW_("%03d")"| " _GREEN_("%s")" | " _YELLOW_("%d")"| " _GREEN_("%s")" | " _YELLOW_("%d")"|" + PrintAndLogEx(SUCCESS, "| "_YELLOW_("%03d")" | " _GREEN_("%s")" | " _YELLOW_("%d")" | " _GREEN_("%s")" | " _YELLOW_("%d")" |" , s , strA, e_sector[i].foundKey[0] , strB, e_sector[i].foundKey[1] @@ -4520,7 +4520,7 @@ static int CmdHF14AMfice(const char *Cmd) { strcpy(filename, fptr); } - PrintAndLogEx(NORMAL, "Collecting "_YELLOW_("%u")"nonces \n", limit); + PrintAndLogEx(NORMAL, "Collecting "_YELLOW_("%u")" nonces \n", limit); if ((fnonces = fopen(filename, "wb")) == NULL) { PrintAndLogEx(WARNING, "Could not create file " _YELLOW_("%s"), filename); diff --git a/client/src/cmdhfmfdes.c b/client/src/cmdhfmfdes.c index d225a7e3e..4b091343b 100644 --- a/client/src/cmdhfmfdes.c +++ b/client/src/cmdhfmfdes.c @@ -330,9 +330,9 @@ static char *getCardSizeStr(uint8_t fsize) { // is LSB set? if (fsize & 1) - sprintf(retStr, "0x%02X ( " _YELLOW_("%d - %d bytes") ")", fsize, usize, lsize); + sprintf(retStr, "0x%02X (" _YELLOW_("%d - %d bytes") ")", fsize, usize, lsize); else - sprintf(retStr, "0x%02X ( " _YELLOW_("%d bytes") ")", fsize, lsize); + sprintf(retStr, "0x%02X (" _YELLOW_("%d bytes") ")", fsize, lsize); return buf; } @@ -342,14 +342,14 @@ static char *getProtocolStr(uint8_t id, bool hw) { char *retStr = buf; if (id == 0x04) { - sprintf(retStr, "0x%02X ( " _YELLOW_("ISO 14443-3 MIFARE, 14443-4") ")", id); + sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-3 MIFARE, 14443-4") ")", id); } else if (id == 0x05) { if (hw) - sprintf(retStr, "0x%02X ( " _YELLOW_("ISO 14443-2, 14443-3") ")", id); + sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-2, 14443-3") ")", id); else - sprintf(retStr, "0x%02X ( " _YELLOW_("ISO 14443-3, 14443-4") ")", id); + sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-3, 14443-4") ")", id); } else { - sprintf(retStr, "0x%02X ( " _YELLOW_("Unknown") ")", id); + sprintf(retStr, "0x%02X (" _YELLOW_("Unknown") ")", id); } return buf; } @@ -360,17 +360,17 @@ static char *getVersionStr(uint8_t major, uint8_t minor) { char *retStr = buf; if (major == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire MF3ICD40") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("DESFire MF3ICD40") ")", major, minor); else if (major == 0x01 && minor == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire EV1") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV1") ")", major, minor); else if (major == 0x12 && minor == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire EV2") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV2") ")", major, minor); // else if (major == 0x13 && minor == 0x00) -// sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire EV3") ")", major, minor); +// sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV3") ")", major, minor); else if (major == 0x30 && minor == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire Light") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("DESFire Light") ")", major, minor); else - sprintf(retStr, "%x.%x ( " _YELLOW_("Unknown") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("Unknown") ")", major, minor); return buf; } @@ -2853,11 +2853,11 @@ static int CmdHF14ADesInfo(const char *Cmd) { } PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------------------------"); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); PrintAndLogEx(INFO, "-------------------------------------------------------------"); PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(package->uid, sizeof(package->uid))); PrintAndLogEx(SUCCESS, " Batch number: " _GREEN_("%s"), sprint_hex(package->details + 7, 5)); - PrintAndLogEx(SUCCESS, " Production date: week " _GREEN_("%02x") "/ " _GREEN_("20%02x"), package->details[12], package->details[13]); + PrintAndLogEx(SUCCESS, " Production date: week " _GREEN_("%02x") " / " _GREEN_("20%02x"), package->details[12], package->details[13]); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "--- " _CYAN_("Hardware Information")); PrintAndLogEx(INFO, " Vendor Id: " _YELLOW_("%s"), getTagInfo(package->versionHW[0])); @@ -3239,7 +3239,7 @@ static int CmdHF14ADesEnumApplications(const char *Cmd) { PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "-- Mifare DESFire Enumerate applications --------------------"); PrintAndLogEx(INFO, "-------------------------------------------------------------"); - PrintAndLogEx(SUCCESS, " Tag report " _GREEN_("%d") "application%c", app_ids_len / 3, (app_ids_len == 3) ? ' ' : 's'); + PrintAndLogEx(SUCCESS, " Tag report " _GREEN_("%d") " application%c", app_ids_len / 3, (app_ids_len == 3) ? ' ' : 's'); for (int i = 0; i < app_ids_len; i += 3) { @@ -3273,7 +3273,7 @@ static int CmdHF14ADesEnumApplications(const char *Cmd) { // Get File IDs if (handler_desfire_fileids(file_ids, &file_ids_len) == PM3_SUCCESS) { - PrintAndLogEx(SUCCESS, " Tag report " _GREEN_("%d") "file%c", file_ids_len, (file_ids_len == 1) ? ' ' : 's'); + PrintAndLogEx(SUCCESS, " Tag report " _GREEN_("%d") " file%c", file_ids_len, (file_ids_len == 1) ? ' ' : 's'); for (int j = file_ids_len - 1; j >= 0; j--) { PrintAndLogEx(SUCCESS, " Fileid %d (0x%02x)", file_ids[j], file_ids[j]); @@ -3876,21 +3876,21 @@ static int CmdHF14aDesChk(const char *Cmd) { PrintAndLogEx(ERR, "Aes key list is empty. Nothing to check."); return PM3_EINVARG; } else { - PrintAndLogEx(INFO, "Loaded " _YELLOW_("%zu") "aes keys", aeskeyListLen); + PrintAndLogEx(INFO, "Loaded " _YELLOW_("%zu") " aes keys", aeskeyListLen); } if (deskeyListLen == 0) { PrintAndLogEx(ERR, "Des key list is empty. Nothing to check."); return PM3_EINVARG; } else { - PrintAndLogEx(INFO, "Loaded " _YELLOW_("%zu") "des keys", deskeyListLen); + PrintAndLogEx(INFO, "Loaded " _YELLOW_("%zu") " des keys", deskeyListLen); } if (k3kkeyListLen == 0) { PrintAndLogEx(ERR, "K3k key list is empty. Nothing to check."); return PM3_EINVARG; } else { - PrintAndLogEx(INFO, "Loaded " _YELLOW_("%zu") "k3kdes keys", k3kkeyListLen); + PrintAndLogEx(INFO, "Loaded " _YELLOW_("%zu") " k3kdes keys", k3kkeyListLen); } if (!verbose) diff --git a/client/src/cmdhfmfp.c b/client/src/cmdhfmfp.c index b2b4e368e..728101ce7 100644 --- a/client/src/cmdhfmfp.c +++ b/client/src/cmdhfmfp.c @@ -58,9 +58,9 @@ static char *getCardSizeStr(uint8_t fsize) { // is LSB set? if (fsize & 1) - sprintf(retStr, "0x%02X ( " _YELLOW_("%d - %d bytes") ")", fsize, usize, lsize); + sprintf(retStr, "0x%02X (" _YELLOW_("%d - %d bytes") ")", fsize, usize, lsize); else - sprintf(retStr, "0x%02X ( " _YELLOW_("%d bytes") ")", fsize, lsize); + sprintf(retStr, "0x%02X (" _YELLOW_("%d bytes") ")", fsize, lsize); return buf; } @@ -70,14 +70,14 @@ static char *getProtocolStr(uint8_t id, bool hw) { char *retStr = buf; if (id == 0x04) { - sprintf(retStr, "0x%02X ( " _YELLOW_("ISO 14443-3 MIFARE, 14443-4") ")", id); + sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-3 MIFARE, 14443-4") ")", id); } else if (id == 0x05) { if (hw) - sprintf(retStr, "0x%02X ( " _YELLOW_("ISO 14443-2, 14443-3") ")", id); + sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-2, 14443-3") ")", id); else - sprintf(retStr, "0x%02X ( " _YELLOW_("ISO 14443-3, 14443-4") ")", id); + sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-3, 14443-4") ")", id); } else { - sprintf(retStr, "0x%02X ( " _YELLOW_("Unknown") ")", id); + sprintf(retStr, "0x%02X (" _YELLOW_("Unknown") ")", id); } return buf; } @@ -88,20 +88,20 @@ static char *getVersionStr(uint8_t major, uint8_t minor) { char *retStr = buf; if (major == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire MF3ICD40") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("DESFire MF3ICD40") ")", major, minor); else if (major == 0x01 && minor == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire EV1") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV1") ")", major, minor); else if (major == 0x12 && minor == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire EV2") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV2") ")", major, minor); // else if (major == 0x13 && minor == 0x00) -// sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire EV3") ")", major, minor); +// sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV3") ")", major, minor); else if (major == 0x30 && minor == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("DESFire Light") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("DESFire Light") ")", major, minor); else if (major == 0x11 && minor == 0x00) - sprintf(retStr, "%x.%x ( " _YELLOW_("Plus EV1") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("Plus EV1") ")", major, minor); else - sprintf(retStr, "%x.%x ( " _YELLOW_("Unknown") ")", major, minor); + sprintf(retStr, "%x.%x (" _YELLOW_("Unknown") ")", major, minor); return buf; } @@ -112,16 +112,16 @@ static char *getTypeStr(uint8_t type) { switch (type) { case 1: - sprintf(retStr, "0x%02X ( " _YELLOW_("DESFire") ")", type); + sprintf(retStr, "0x%02X (" _YELLOW_("DESFire") ")", type); break; case 2: - sprintf(retStr, "0x%02X ( " _YELLOW_("Plus") ")", type); + sprintf(retStr, "0x%02X (" _YELLOW_("Plus") ")", type); break; case 3: - sprintf(retStr, "0x%02X ( " _YELLOW_("Ultralight") ")", type); + sprintf(retStr, "0x%02X (" _YELLOW_("Ultralight") ")", type); break; case 4: - sprintf(retStr, "0x%02X ( " _YELLOW_("NTAG") ")", type); + sprintf(retStr, "0x%02X (" _YELLOW_("NTAG") ")", type); break; default: break; @@ -227,7 +227,7 @@ static int get_plus_signature(uint8_t *signature, int *signature_len) { static int plus_print_version(uint8_t *version) { PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%s"), sprint_hex(version + 14, 7)); PrintAndLogEx(SUCCESS, " Batch number: " _GREEN_("%s"), sprint_hex(version + 21, 5)); - PrintAndLogEx(SUCCESS, " Production date: week " _GREEN_("%02x") "/ " _GREEN_("20%02x"), version[7 + 7 + 7 + 5], version[7 + 7 + 7 + 5 + 1]); + PrintAndLogEx(SUCCESS, " Production date: week " _GREEN_("%02x") " / " _GREEN_("20%02x"), version[7 + 7 + 7 + 5], version[7 + 7 + 7 + 5 + 1]); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(INFO, "--- " _CYAN_("Hardware Information")); PrintAndLogEx(INFO, " Vendor Id: " _YELLOW_("%s"), getTagInfo(version[0])); @@ -266,7 +266,7 @@ static int CmdHFMFPInfo(const char *Cmd) { PrintAndLogEx(WARNING, "command don't have any parameters.\n"); PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------------------------"); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); PrintAndLogEx(INFO, "-------------------------------------------------------------"); bool supportVersion = false; @@ -328,11 +328,11 @@ static int CmdHFMFPInfo(const char *Cmd) { uint16_t ATQA = card.atqa[0] + (card.atqa[1] << 8); if (ATQA & 0x0004) { - PrintAndLogEx(INFO, " SIZE: " _GREEN_("2K") "(%s UID)", (ATQA & 0x0040) ? "7" : "4"); + PrintAndLogEx(INFO, " SIZE: " _GREEN_("2K") " (%s UID)", (ATQA & 0x0040) ? "7" : "4"); isPlus = true; } if (ATQA & 0x0002) { - PrintAndLogEx(INFO, " SIZE: " _GREEN_("4K") "(%s UID)", (ATQA & 0x0040) ? "7" : "4"); + PrintAndLogEx(INFO, " SIZE: " _GREEN_("4K") " (%s UID)", (ATQA & 0x0040) ? "7" : "4"); isPlus = true; } @@ -357,7 +357,7 @@ static int CmdHFMFPInfo(const char *Cmd) { } if (card.sak == 0x20) { - PrintAndLogEx(INFO, " SAK: " _GREEN_("MIFARE Plus SL0/SL3") "or " _GREEN_("MIFARE DESFire")); + PrintAndLogEx(INFO, " SAK: " _GREEN_("MIFARE Plus SL0/SL3") " or " _GREEN_("MIFARE DESFire")); if (card.ats_len > 0) { @@ -1190,7 +1190,7 @@ static int CmdHFMFPChk(const char *Cmd) { PrintAndLogEx(ERR, "Key list is empty. Nothing to check."); return PM3_EINVARG; } else { - PrintAndLogEx(INFO, "Loaded " _YELLOW_("%zu") "keys", keyListLen); + PrintAndLogEx(INFO, "Loaded " _YELLOW_("%zu") " keys", keyListLen); } if (!verbose) diff --git a/client/src/cmdhfmfu.c b/client/src/cmdhfmfu.c index 0bfb73b65..9bdd9b814 100644 --- a/client/src/cmdhfmfu.c +++ b/client/src/cmdhfmfu.c @@ -64,13 +64,13 @@ static int usage_hf_mfu_info(void) { static int usage_hf_mfu_dump(void) { PrintAndLogEx(NORMAL, "Reads all pages from Ultralight, Ultralight-C, Ultralight EV1"); PrintAndLogEx(NORMAL, "NTAG 203, NTAG 210, NTAG 212, NTAG 213, NTAG 215, NTAG 216"); - PrintAndLogEx(NORMAL, "and saves binary dump into the file " _YELLOW_("`filename.bin`") "or " _YELLOW_("`cardUID.bin`")); + PrintAndLogEx(NORMAL, "and saves binary dump into the file " _YELLOW_("`filename.bin`") " or " _YELLOW_("`cardUID.bin`")); PrintAndLogEx(NORMAL, "It autodetects card type.\n"); PrintAndLogEx(NORMAL, "Usage: hf mfu dump k l f p q <#pages>"); PrintAndLogEx(NORMAL, " Options :"); PrintAndLogEx(NORMAL, " k : (optional) key for authentication [UL-C 16bytes, EV1/NTAG 4bytes]"); PrintAndLogEx(NORMAL, " l : (optional) swap entered key's endianness"); - PrintAndLogEx(NORMAL, " f : " _YELLOW_("filename w/o .bin") "to save the dump as"); + PrintAndLogEx(NORMAL, " f : " _YELLOW_("filename w/o .bin") " to save the dump as"); PrintAndLogEx(NORMAL, " p : starting Page number to manually set a page to start the dump at"); PrintAndLogEx(NORMAL, " q : number of Pages to manually set how many pages to dump"); PrintAndLogEx(NORMAL, ""); @@ -91,8 +91,8 @@ static int usage_hf_mfu_restore(void) { PrintAndLogEx(NORMAL, " l : (optional) swap entered key's endianness"); PrintAndLogEx(NORMAL, " s : (optional) enable special write UID " _BLUE_("-MAGIC TAG ONLY-")); PrintAndLogEx(NORMAL, " e : (optional) enable special write version/signature " _BLUE_("-MAGIC NTAG 21* ONLY-")); - PrintAndLogEx(NORMAL, " r : (optional) use the password found in dumpfile to configure tag. requires " _YELLOW_("'e'") "parameter to work"); - PrintAndLogEx(NORMAL, " f : " _YELLOW_("filename w .bin") "to restore"); + PrintAndLogEx(NORMAL, " r : (optional) use the password found in dumpfile to configure tag. requires " _YELLOW_("'e'") " parameter to work"); + PrintAndLogEx(NORMAL, " f : " _YELLOW_("filename w .bin") " to restore"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" hf mfu restore s f myfile")); @@ -136,7 +136,7 @@ static int usage_hf_mfu_wrbl(void) { static int usage_hf_mfu_eload(void) { PrintAndLogEx(NORMAL, "It loads emul dump from the file " _YELLOW_("`filename.eml`")); - PrintAndLogEx(NORMAL, "Hint: See " _YELLOW_("`script run dumptoemul-mfu`") "to convert the .bin to the eml"); + PrintAndLogEx(NORMAL, "Hint: See " _YELLOW_("`script run dumptoemul-mfu`") " to convert the .bin to the eml"); PrintAndLogEx(NORMAL, "Usage: hf mfu eload u [numblocks]"); PrintAndLogEx(NORMAL, " Options:"); PrintAndLogEx(NORMAL, " h : this help"); @@ -198,7 +198,7 @@ static int usage_hf_mfu_ucsetuid(void) { PrintAndLogEx(NORMAL, "Usage: hf mfu setuid "); PrintAndLogEx(NORMAL, " [uid] - (14 hex symbols)"); PrintAndLogEx(NORMAL, "\n"); - PrintAndLogEx(NORMAL, "This only works for " _BLUE_("Magic Ultralight") "tags."); + PrintAndLogEx(NORMAL, "This only works for " _BLUE_("Magic Ultralight") " tags."); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, _YELLOW_(" hf mfu setuid 11223344556677")); @@ -524,17 +524,17 @@ static int ul_print_default(uint8_t *data) { // CT (cascade tag byte) 0x88 xor SN0 xor SN1 xor SN2 int crc0 = 0x88 ^ uid[0] ^ uid[1] ^ uid[2]; if (data[3] == crc0) - PrintAndLogEx(SUCCESS, " BCC0: %02X ( " _GREEN_("ok") ")", data[3]); + PrintAndLogEx(SUCCESS, " BCC0: %02X (" _GREEN_("ok") ")", data[3]); else PrintAndLogEx(NORMAL, " BCC0: %02X, crc should be %02X", data[3], crc0); int crc1 = uid[3] ^ uid[4] ^ uid[5] ^ uid[6]; if (data[8] == crc1) - PrintAndLogEx(SUCCESS, " BCC1: %02X ( " _GREEN_("ok") ")", data[8]); + PrintAndLogEx(SUCCESS, " BCC1: %02X (" _GREEN_("ok") ")", data[8]); else PrintAndLogEx(NORMAL, " BCC1: %02X, crc should be %02X", data[8], crc1); - PrintAndLogEx(SUCCESS, " Internal: %02X ( %s)", data[9], (data[9] == 0x48) ? _GREEN_("default") : _RED_("not default")); + PrintAndLogEx(SUCCESS, " Internal: %02X (%s)", data[9], (data[9] == 0x48) ? _GREEN_("default") : _RED_("not default")); PrintAndLogEx(SUCCESS, " Lock: %s - %s", sprint_hex(data + 10, 2), @@ -643,10 +643,10 @@ static int ndef_print_CC(uint8_t *data) { PrintAndLogEx(SUCCESS, " Additional feature information"); PrintAndLogEx(SUCCESS, " %02X", data[3]); PrintAndLogEx(SUCCESS, " 00000000"); - PrintAndLogEx(SUCCESS, " xxx - %02X: RFU ( %s)", msb3, (msb3 == 0) ? _GREEN_("ok") : _RED_("fail")); + PrintAndLogEx(SUCCESS, " xxx - %02X: RFU (%s)", msb3, (msb3 == 0) ? _GREEN_("ok") : _RED_("fail")); PrintAndLogEx(SUCCESS, " x - %02X: %s special frame", sf, (sf) ? "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"); return PM3_SUCCESS; } @@ -1195,7 +1195,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { if (tagtype == UL_ERROR) return PM3_ESOFT; PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------"); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " --------------------------"); PrintAndLogEx(INFO, "-------------------------------------------------------------"); ul_print_type(tagtype, 6); @@ -1361,7 +1361,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { num_to_bytes(ul_ev1_pwdgenB(card.uid), 4, key); len = ulev1_requestAuthentication(key, pack, sizeof(pack)); if (len > -1) { - PrintAndLogEx(SUCCESS, "Found a default password: " _GREEN_("%s") "|| Pack: %02X %02X", sprint_hex(key, 4), pack[0], pack[1]); + PrintAndLogEx(SUCCESS, "Found a default password: " _GREEN_("%s") " || Pack: %02X %02X", sprint_hex(key, 4), pack[0], pack[1]); goto out; } @@ -1371,7 +1371,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { num_to_bytes(ul_ev1_pwdgenC(card.uid), 4, key); len = ulev1_requestAuthentication(key, pack, sizeof(pack)); if (len > -1) { - PrintAndLogEx(SUCCESS, "Found a default password: " _GREEN_("%s") "|| Pack: %02X %02X", sprint_hex(key, 4), pack[0], pack[1]); + PrintAndLogEx(SUCCESS, "Found a default password: " _GREEN_("%s") " || Pack: %02X %02X", sprint_hex(key, 4), pack[0], pack[1]); goto out; } @@ -1391,7 +1391,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { key = default_pwd_pack[i]; len = ulev1_requestAuthentication(key, pack, sizeof(pack)); if (len > -1) { - PrintAndLogEx(SUCCESS, "Found a default password: " _GREEN_("%s") "|| Pack: %02X %02X", sprint_hex(key, 4), pack[0], pack[1]); + PrintAndLogEx(SUCCESS, "Found a default password: " _GREEN_("%s") " || Pack: %02X %02X", sprint_hex(key, 4), pack[0], pack[1]); break; } else { if (ul_auth_select(&card, tagtype, hasAuthKey, authkeyptr, pack, sizeof(pack)) == PM3_ESOFT) return PM3_ESOFT; diff --git a/client/src/cmdhfthinfilm.c b/client/src/cmdhfthinfilm.c index dad67509b..0ef62411a 100644 --- a/client/src/cmdhfthinfilm.c +++ b/client/src/cmdhfthinfilm.c @@ -61,11 +61,11 @@ static int print_barcode(uint8_t *barcode, const size_t barcode_len, bool verbos compute_crc(CRC_14443_A, barcode, barcode_len - 2, &b1, &b2); bool isok = (barcode[barcode_len - 1] == b1 && barcode[barcode_len - 2] == b2); - PrintAndLogEx(SUCCESS, " Checksum : "_YELLOW_("%02X %02X")"- %s", b2, b1, (isok) ? _GREEN_("OK") : _RED_("fail")); + PrintAndLogEx(SUCCESS, " Checksum : "_YELLOW_("%02X %02X")" - %s", b2, b1, (isok) ? _GREEN_("OK") : _RED_("fail")); } else { - PrintAndLogEx(SUCCESS, " Checksum : "_YELLOW_("too few data for checksum")"- " _RED_("fail")); + PrintAndLogEx(SUCCESS, " Checksum : "_YELLOW_("too few data for checksum")" - " _RED_("fail")); } - PrintAndLogEx(SUCCESS, " Data len (bits) : "_YELLOW_("%zu")"- %s", barcode_len * 8, (barcode_len == 16 || barcode_len == 32) ? _GREEN_("OK") : _YELLOW_("warning")); + PrintAndLogEx(SUCCESS, " Data len (bits) : "_YELLOW_("%zu")" - %s", barcode_len * 8, (barcode_len == 16 || barcode_len == 32) ? _GREEN_("OK") : _YELLOW_("warning")); PrintAndLogEx(SUCCESS, " Raw data : "_YELLOW_("%s"), sprint_hex(barcode, barcode_len)); if (barcode_len < 4) // too few to go to next decoding stages return PM3_ESOFT; diff --git a/client/src/cmdhftopaz.c b/client/src/cmdhftopaz.c index 5b797b85c..1408a6e46 100644 --- a/client/src/cmdhftopaz.c +++ b/client/src/cmdhftopaz.c @@ -414,7 +414,7 @@ static int CmdHFTopazInfo(const char *Cmd) { return status; PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(SUCCESS, "Static Data blocks " _YELLOW_("0x00") "to " _YELLOW_("0x0C")":"); + PrintAndLogEx(SUCCESS, "Static Data blocks " _YELLOW_("0x00") " to " _YELLOW_("0x0C")":"); PrintAndLogEx(NORMAL, "block# | offset | Data | Locked"); PrintAndLogEx(NORMAL, "-------+--------+-------------------------+------------"); char line[80]; @@ -547,7 +547,7 @@ int readTopazUid(bool verbose) { // printing PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------------------------"); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); PrintAndLogEx(INFO, "-------------------------------------------------------------"); PrintAndLogEx(SUCCESS, " UID: %02x %02x %02x %02x %02x %02x %02x", topaz_tag.uid[6], diff --git a/client/src/cmdhw.c b/client/src/cmdhw.c index b71512432..cb48188a0 100644 --- a/client/src/cmdhw.c +++ b/client/src/cmdhw.c @@ -68,7 +68,7 @@ static int usage_hw_setmux(void) { static int usage_hw_connect(void) { PrintAndLogEx(NORMAL, "Connects to a Proxmark3 device via specified serial port"); - PrintAndLogEx(NORMAL, "Baudrate here is only for physical UART or UART-BT, " _YELLOW_("not")"for USB-CDC or blue shark add-on"); + PrintAndLogEx(NORMAL, "Baudrate here is only for physical UART or UART-BT, " _YELLOW_("not")" for USB-CDC or blue shark add-on"); PrintAndLogEx(NORMAL, ""); PrintAndLogEx(NORMAL, "Usage: hw connect [h] [p ] [b ]"); PrintAndLogEx(NORMAL, "Options:"); @@ -541,7 +541,7 @@ static int CmdPing(const char *Cmd) { if (WaitForResponseTimeout(CMD_PING, &resp, 1000)) { if (len) { bool error = (memcmp(data, resp.data.asBytes, len) != 0); - PrintAndLogEx((error) ? ERR : SUCCESS, "Ping response " _GREEN_("received") "and content is %s", error ? _RED_("NOT ok") : _GREEN_("OK")); + PrintAndLogEx((error) ? ERR : SUCCESS, "Ping response " _GREEN_("received") " and content is %s", error ? _RED_("NOT ok") : _GREEN_("OK")); } else { PrintAndLogEx(SUCCESS, "Ping response " _GREEN_("received")); } @@ -593,7 +593,7 @@ static int CmdConnect(const char *Cmd) { OpenProxmark(port, false, 10, false, baudrate); if (session.pm3_present && (TestProxmark() != PM3_SUCCESS)) { - PrintAndLogEx(ERR, _RED_("ERROR:") "cannot communicate with the Proxmark3\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " cannot communicate with the Proxmark3\n"); CloseProxmark(); return PM3_ENOTTY; } diff --git a/client/src/cmdlf.c b/client/src/cmdlf.c index 18b055b8c..1443a5d6a 100644 --- a/client/src/cmdlf.c +++ b/client/src/cmdlf.c @@ -71,7 +71,7 @@ static int usage_lf_cmdread(void) { PrintAndLogEx(NORMAL, "Examples:"); PrintAndLogEx(NORMAL, " lf cmdread d 80 z 100 o 200 c 11000"); PrintAndLogEx(NORMAL, "Extras:"); - PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")"to set parameters."); + PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")" to set parameters."); return PM3_SUCCESS; } static int usage_lf_read(void) { @@ -85,7 +85,7 @@ static int usage_lf_read(void) { PrintAndLogEx(NORMAL, " lf read s d 12000 - collects 12000 samples silent"); PrintAndLogEx(NORMAL, " lf read"); PrintAndLogEx(NORMAL, "Extras:"); - PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")"to set parameters."); + PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")" to set parameters."); return PM3_SUCCESS; } static int usage_lf_sim(void) { @@ -98,7 +98,7 @@ static int usage_lf_sim(void) { PrintAndLogEx(NORMAL, " lf sim 240 - start simulating with 240ms gap"); PrintAndLogEx(NORMAL, " lf sim"); PrintAndLogEx(NORMAL, "Extras:"); - PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")"to set parameters."); + PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")" to set parameters."); return PM3_SUCCESS; } static int usage_lf_sniff(void) { @@ -107,9 +107,9 @@ static int usage_lf_sniff(void) { PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, " h This help"); PrintAndLogEx(NORMAL, "Extras:"); - PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")"to set parameters."); - PrintAndLogEx(NORMAL, " use " _YELLOW_("'data samples'")"command to download from device"); - PrintAndLogEx(NORMAL, " use " _YELLOW_("'data plot'")"to look at it"); + PrintAndLogEx(NORMAL, " use " _YELLOW_("'lf config'")" to set parameters."); + PrintAndLogEx(NORMAL, " use " _YELLOW_("'data samples'")" command to download from device"); + PrintAndLogEx(NORMAL, " use " _YELLOW_("'data plot'")" to look at it"); return PM3_SUCCESS; } static int usage_lf_config(void) { @@ -253,7 +253,7 @@ static int CmdLFTune(const char *Cmd) { //Validations if (errors) return usage_lf_tune(); - PrintAndLogEx(INFO, "Measuring LF antenna at " _YELLOW_("%.2f") "kHz, click " _GREEN_("pm3 button") "or press " _GREEN_("Enter") "to exit", LF_DIV2FREQ(divisor)); + PrintAndLogEx(INFO, "Measuring LF antenna at " _YELLOW_("%.2f") " kHz, click " _GREEN_("pm3 button") " or press " _GREEN_("Enter") " to exit", LF_DIV2FREQ(divisor)); uint8_t params[] = {1, 0}; params[1] = divisor; @@ -1189,7 +1189,7 @@ static bool CheckChipType(bool getDeviceData) { uint32_t word = 0; if (EM4x05IsBlock0(&word)) { PrintAndLogEx(SUCCESS, "Chipset detection: " _GREEN_("EM4x05/EM4x69")); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 4x05`") "commands"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 4x05`") " commands"); retval = true; goto out; } @@ -1197,7 +1197,7 @@ static bool CheckChipType(bool getDeviceData) { //check for t55xx chip... if (tryDetectP1(true)) { PrintAndLogEx(SUCCESS, "Chipset detection: " _GREEN_("T55xx")); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf t55xx`") "commands"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf t55xx`") " commands"); retval = true; } @@ -1230,7 +1230,7 @@ int CmdLFfind(const char *Cmd) { PrintAndLogEx(INFO, "NOTE: some demods output possible binary"); PrintAndLogEx(INFO, "if it finds something that looks like a tag"); - PrintAndLogEx(INFO, "False Positives " _YELLOW_("ARE") "possible"); + PrintAndLogEx(INFO, "False Positives " _YELLOW_("ARE") " possible"); PrintAndLogEx(INFO, ""); PrintAndLogEx(INFO, "Checking for known tags..."); PrintAndLogEx(INFO, ""); @@ -1240,7 +1240,7 @@ int CmdLFfind(const char *Cmd) { if (IfPm3Hitag()) { if (readHitagUid()) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Hitag") "found!"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Hitag") " found!"); return PM3_SUCCESS; } } @@ -1250,12 +1250,12 @@ int CmdLFfind(const char *Cmd) { if (getSignalProperties()->isnoise) { if (readMotorolaUid()) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Motorola FlexPass ID") "found!"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Motorola FlexPass ID") " found!"); return PM3_SUCCESS; } if (readCOTAGUid()) { - PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("COTAG ID") "found!"); + PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("COTAG ID") " found!"); return PM3_SUCCESS; } @@ -1265,33 +1265,33 @@ int CmdLFfind(const char *Cmd) { } } - if (EM4x50Read("", false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("EM4x50 ID") "found!"); return PM3_SUCCESS;} + if (EM4x50Read("", false) == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("EM4x50 ID") " found!"); return PM3_SUCCESS;} - if (demodHID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("HID Prox ID") "found!"); goto out;} - if (demodAWID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("AWID ID") "found!"); goto out;} - if (demodParadox() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Paradox ID") "found!"); goto out;} + if (demodHID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("HID Prox ID") " found!"); goto out;} + if (demodAWID() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("AWID ID") " found!"); goto out;} + if (demodParadox() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Paradox ID") " found!"); goto out;} - if (demodEM410x() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("EM410x ID") "found!"); goto out;} - if (demodFDX() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("FDX-B ID") "found!"); goto out;} - if (demodGuard() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Guardall G-Prox II ID") "found!"); goto out; } - if (demodIdteck() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Idteck ID") "found!"); goto out;} - if (demodIndala() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Indala ID") "found!"); goto out;} - if (demodIOProx() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") "found!"); goto out;} - if (demodJablotron() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Jablotron ID") "found!"); goto out;} - if (demodNedap() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NEDAP ID") "found!"); goto out;} - if (demodNexWatch() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NexWatch ID") "found!"); goto out;} - if (demodNoralsy() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Noralsy ID") "found!"); goto out;} - if (demodKeri() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("KERI ID") "found!"); goto out;} - if (demodPac() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("PAC/Stanley ID") "found!"); goto out;} + if (demodEM410x() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("EM410x ID") " found!"); goto out;} + if (demodFDX() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("FDX-B ID") " found!"); goto out;} + if (demodGuard() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Guardall G-Prox II ID") " found!"); goto out; } + if (demodIdteck() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Idteck ID") " found!"); goto out;} + if (demodIndala() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Indala ID") " found!"); goto out;} + if (demodIOProx() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("IO Prox ID") " found!"); goto out;} + if (demodJablotron() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Jablotron ID") " found!"); goto out;} + if (demodNedap() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NEDAP ID") " found!"); goto out;} + if (demodNexWatch() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("NexWatch ID") " found!"); goto out;} + if (demodNoralsy() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Noralsy ID") " found!"); goto out;} + if (demodKeri() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("KERI ID") " found!"); goto out;} + if (demodPac() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("PAC/Stanley ID") " found!"); goto out;} - if (demodPresco() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Presco ID") "found!"); goto out;} - if (demodPyramid() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Pyramid ID") "found!"); goto out;} - if (demodSecurakey() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Securakey ID") "found!"); goto out;} - if (demodViking() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Viking ID") "found!"); goto out;} - if (demodVisa2k() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Visa2000 ID") "found!"); goto out;} - if (demodGallagher() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("GALLAGHER ID") "found!"); goto out;} -// if (demodTI() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Texas Instrument ID") "found!"); goto out;} - //if (demodFermax() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Fermax ID") "found!"); goto out;} + if (demodPresco() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Presco ID") " found!"); goto out;} + if (demodPyramid() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Pyramid ID") " found!"); goto out;} + if (demodSecurakey() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Securakey ID") " found!"); goto out;} + if (demodViking() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Viking ID") " found!"); goto out;} + if (demodVisa2k() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Visa2000 ID") " found!"); goto out;} + if (demodGallagher() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("GALLAGHER ID") " found!"); goto out;} +// if (demodTI() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Texas Instrument ID") " found!"); goto out;} + //if (demodFermax() == PM3_SUCCESS) { PrintAndLogEx(SUCCESS, "\nValid " _GREEN_("Fermax ID") " found!"); goto out;} PrintAndLogEx(FAILED, _RED_("No known 125/134 kHz tags found!")); diff --git a/client/src/cmdlfawid.c b/client/src/cmdlfawid.c index 468941022..36658bbdf 100644 --- a/client/src/cmdlfawid.c +++ b/client/src/cmdlfawid.c @@ -424,7 +424,7 @@ static int CmdAWIDClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf awid read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf awid read`") " to verify"); return res; } diff --git a/client/src/cmdlfem4x.c b/client/src/cmdlfem4x.c index 841f26652..734626700 100644 --- a/client/src/cmdlfem4x.c +++ b/client/src/cmdlfem4x.c @@ -489,7 +489,7 @@ static int CmdEM410xSim(const char *Cmd) { param_getdec(Cmd, 1, &clk); - PrintAndLogEx(SUCCESS, "Starting simulating UID "_YELLOW_("%02X%02X%02X%02X%02X")"clock: "_YELLOW_("%d"), uid[0], uid[1], uid[2], uid[3], uid[4], clk); + PrintAndLogEx(SUCCESS, "Starting simulating UID "_YELLOW_("%02X%02X%02X%02X%02X")" clock: "_YELLOW_("%d"), uid[0], uid[1], uid[2], uid[3], uid[4], clk); PrintAndLogEx(SUCCESS, "Press pm3-button to abort simulation"); ConstructEM410xEmulGraph(Cmd, clk); @@ -580,7 +580,7 @@ static int CmdEM410xBrute(const char *Cmd) { return PM3_ESOFT; } - PrintAndLogEx(SUCCESS, "Loaded "_YELLOW_("%d")" UIDs from "_YELLOW_("%s")", pause delay:"_YELLOW_("%d")"ms", uidcnt, filename, delay); + PrintAndLogEx(SUCCESS, "Loaded "_YELLOW_("%d")" UIDs from "_YELLOW_("%s")", pause delay:"_YELLOW_("%d")" ms", uidcnt, filename, delay); // loop for (uint32_t c = 0; c < uidcnt; ++c) { @@ -701,7 +701,7 @@ static int CmdEM410xWrite(const char *Cmd) { SendCommandMIX(CMD_LF_EM410X_WRITE, card, (uint32_t)(id >> 32), (uint32_t)id, NULL, 0); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 410x_read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 410x_read`") " to verify"); return PM3_SUCCESS; } @@ -1041,7 +1041,7 @@ static int CmdEM4x50Write(const char *Cmd) { PrintAndLogEx(NORMAL, "no implemented yet"); // // PrintAndLogEx(SUCCESS, "Done"); -// PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 4x50_read`") "to verify"); +// PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 4x50_read`") " to verify"); return PM3_SUCCESS; } @@ -1442,7 +1442,7 @@ static int CmdEM4x05Write(const char *Cmd) { PrintAndLogEx(SUCCESS, "Success writing to tag"); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 4x05_read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf em 4x05_read`") " to verify"); return status; } static int CmdEM4x05Wipe(const char *Cmd) { diff --git a/client/src/cmdlffdx.c b/client/src/cmdlffdx.c index 58f427a3d..93420ac28 100644 --- a/client/src/cmdlffdx.c +++ b/client/src/cmdlffdx.c @@ -243,7 +243,7 @@ static int CmdFdxDemod(const char *Cmd) { uint8_t c[] = {0, 0}; compute_crc(CRC_11784, raw, sizeof(raw), &c[0], &c[1]); - PrintAndLogEx(SUCCESS, "CRC-16 0x%04X [ %s] ", crc, (crc == (c[1] << 8 | c[0])) ? _GREEN_("OK") : _RED_("Fail")); + PrintAndLogEx(SUCCESS, "CRC-16 0x%04X [%s] ", crc, (crc == (c[1] << 8 | c[0])) ? _GREEN_("OK") : _RED_("Fail")); if (g_debugMode) { PrintAndLogEx(DEBUG, "Start marker %d; Size %zu", preambleIndex, size); @@ -303,7 +303,7 @@ static int CmdFdxClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf fdx read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf fdx read`") " to verify"); return res; } diff --git a/client/src/cmdlfgallagher.c b/client/src/cmdlfgallagher.c index 97a7e0e09..30d836072 100644 --- a/client/src/cmdlfgallagher.c +++ b/client/src/cmdlfgallagher.c @@ -180,7 +180,7 @@ static int CmdGallagherClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf gallagher read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf gallagher read`") " to verify"); return res; } diff --git a/client/src/cmdlfguard.c b/client/src/cmdlfguard.c index a1dbf0587..22579a54b 100644 --- a/client/src/cmdlfguard.c +++ b/client/src/cmdlfguard.c @@ -189,7 +189,7 @@ static int CmdGuardClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf gprox read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf gprox read`") " to verify"); return res; } diff --git a/client/src/cmdlfhid.c b/client/src/cmdlfhid.c index 53af57ab7..5c88c881b 100644 --- a/client/src/cmdlfhid.c +++ b/client/src/cmdlfhid.c @@ -86,7 +86,7 @@ static int usage_lf_hid_brute(void) { PrintAndLogEx(NORMAL, "Usage: lf hid brute [h] [v] w [ (decimal)>] [up|down] {...}"); PrintAndLogEx(NORMAL, "Options:"); PrintAndLogEx(NORMAL, " h : This help"); - PrintAndLogEx(NORMAL, " w : see " _YELLOW_("`wiegand list`") "for available formats"); + PrintAndLogEx(NORMAL, " w : see " _YELLOW_("`wiegand list`") " for available formats"); PrintAndLogEx(NORMAL, " f : facility code"); PrintAndLogEx(NORMAL, " c : card number to start with"); PrintAndLogEx(NORMAL, " i : issue level"); @@ -241,9 +241,9 @@ static int CmdHIDDemod(const char *Cmd) { fc = ((hi & 0xF) << 12) | (lo >> 20); } if (fmtLen == 32 && (lo & 0x40000000)) { //if 32 bit and Kastle bit set - PrintAndLogEx(SUCCESS, "HID Prox TAG (Kastle format) ID: " _GREEN_("%x%08x (%u)")"- Format Len: 32bit - CC: %u - FC: %u - Card: %u", hi, lo, (lo >> 1) & 0xFFFF, cc, fc, cardnum); + PrintAndLogEx(SUCCESS, "HID Prox TAG (Kastle format) ID: " _GREEN_("%x%08x (%u)")" - Format Len: 32bit - CC: %u - FC: %u - Card: %u", hi, lo, (lo >> 1) & 0xFFFF, cc, fc, cardnum); } else { - PrintAndLogEx(SUCCESS, "HID Prox TAG ID: " _GREEN_("%x%08x (%u)")"- Format Len: " _GREEN_("%u bit")"- OEM: %03u - FC: " _GREEN_("%u")"- Card: " _GREEN_("%u"), + PrintAndLogEx(SUCCESS, "HID Prox TAG ID: " _GREEN_("%x%08x (%u)")" - Format Len: " _GREEN_("%u bit")" - OEM: %03u - FC: " _GREEN_("%u")" - Card: " _GREEN_("%u"), hi, lo, cardnum, fmtLen, oem, fc, cardnum); } } @@ -348,7 +348,7 @@ static int CmdHIDClone(const char *Cmd) { clearCommandBuffer(); SendCommandMIX(CMD_LF_HID_CLONE, hi2, hi, lo, longid, sizeof(longid)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf hid read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf hid read`") " to verify"); return PM3_SUCCESS; } @@ -440,7 +440,7 @@ static int CmdHIDBrute(const char *Cmd) { } if (format_idx == -1) { - PrintAndLogEx(ERR, "You must select a wiegand format. See " _YELLOW_("`wiegand list`") "for available formats\n"); + PrintAndLogEx(ERR, "You must select a wiegand format. See " _YELLOW_("`wiegand list`") " for available formats\n"); errors = true; } diff --git a/client/src/cmdlfhitag.c b/client/src/cmdlfhitag.c index 0d33fc281..47971c713 100644 --- a/client/src/cmdlfhitag.c +++ b/client/src/cmdlfhitag.c @@ -111,9 +111,9 @@ static int usage_hitag_reader(void) { PrintAndLogEx(NORMAL, " Hitag1 (1*)"); PrintAndLogEx(NORMAL, " Not implemented"); PrintAndLogEx(NORMAL, " Hitag2 (2*)"); - PrintAndLogEx(NORMAL, " 21 Read all pages, password mode. Default: " _YELLOW_("4D494B52") "(\"MIKR\")"); + PrintAndLogEx(NORMAL, " 21 Read all pages, password mode. Default: " _YELLOW_("4D494B52") " (\"MIKR\")"); PrintAndLogEx(NORMAL, " 22 Read all pages, challenge mode"); - PrintAndLogEx(NORMAL, " 23 Read all pages, crypto mode. Key format: ISK high + ISK low. Default: " _YELLOW_("4F4E4D494B52") "(\"ONMIKR\")"); + PrintAndLogEx(NORMAL, " 23 Read all pages, crypto mode. Key format: ISK high + ISK low. Default: " _YELLOW_("4F4E4D494B52") " (\"ONMIKR\")"); PrintAndLogEx(NORMAL, " 25 Test recorded authentications"); PrintAndLogEx(NORMAL, " 26 Just read UID"); return PM3_SUCCESS; @@ -512,7 +512,7 @@ static int CmdLFHitagInfo(const char *Cmd) { return PM3_ESOFT; PrintAndLogEx(NORMAL, ""); - PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------------------------"); + PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") " ---------------------------"); PrintAndLogEx(INFO, "-------------------------------------------------------------"); PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%08X"), uid); PrintAndLogEx(SUCCESS, " TYPE: " _GREEN_("%s"), getHitagTypeStr(uid)); diff --git a/client/src/cmdlfindala.c b/client/src/cmdlfindala.c index 83d952ea6..69c1e5a55 100644 --- a/client/src/cmdlfindala.c +++ b/client/src/cmdlfindala.c @@ -671,7 +671,7 @@ static int CmdIndalaClone(const char *Cmd) { print_blocks(blocks, max); int res = clone_t55xx_tag(blocks, max); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf indala read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf indala read`") " to verify"); return res; } diff --git a/client/src/cmdlfio.c b/client/src/cmdlfio.c index 28c653ab4..e93a7cde3 100644 --- a/client/src/cmdlfio.c +++ b/client/src/cmdlfio.c @@ -277,7 +277,7 @@ static int CmdIOProxClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf io read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf io read`") " to verify"); return res; } diff --git a/client/src/cmdlfjablotron.c b/client/src/cmdlfjablotron.c index f2f93c513..285ddca7d 100644 --- a/client/src/cmdlfjablotron.c +++ b/client/src/cmdlfjablotron.c @@ -122,7 +122,7 @@ static int CmdJablotronDemod(const char *Cmd) { bool isok = (chksum == jablontron_chksum(DemodBuffer)); PrintAndLogEx(isok ? SUCCESS : INFO, - "Checksum: %02X [ %s]", + "Checksum: %02X [%s]", chksum, isok ? _GREEN_("OK") : _RED_("Fail") ); diff --git a/client/src/cmdlfkeri.c b/client/src/cmdlfkeri.c index 020a8331e..5e126955e 100644 --- a/client/src/cmdlfkeri.c +++ b/client/src/cmdlfkeri.c @@ -305,7 +305,7 @@ static int CmdKeriClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf keri read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf keri read`") " to verify"); return res; } diff --git a/client/src/cmdlfmotorola.c b/client/src/cmdlfmotorola.c index b6ba5b8b0..3db82a0be 100644 --- a/client/src/cmdlfmotorola.c +++ b/client/src/cmdlfmotorola.c @@ -179,7 +179,7 @@ static int CmdMotorolaClone(const char *Cmd) { print_blocks(blocks, ARRAYLEN(blocks)); int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf motorola read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf motorola read`") " to verify"); return res; } diff --git a/client/src/cmdlfnedap.c b/client/src/cmdlfnedap.c index 5ac4e07fa..cb0b11629 100644 --- a/client/src/cmdlfnedap.c +++ b/client/src/cmdlfnedap.c @@ -476,7 +476,7 @@ static int CmdLFNedapClone(const char *Cmd) { PrintAndLogEx(NORMAL, ""); } PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf nedap read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf nedap read`") " to verify"); return res; } diff --git a/client/src/cmdlfnexwatch.c b/client/src/cmdlfnexwatch.c index 5e3801118..c5d168a7c 100644 --- a/client/src/cmdlfnexwatch.c +++ b/client/src/cmdlfnexwatch.c @@ -160,7 +160,7 @@ static int CmdNexWatchClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf nexwatch read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf nexwatch read`") " to verify"); return res; } diff --git a/client/src/cmdlfnoralsy.c b/client/src/cmdlfnoralsy.c index dc8fb4df0..a0ab69e3f 100644 --- a/client/src/cmdlfnoralsy.c +++ b/client/src/cmdlfnoralsy.c @@ -171,7 +171,7 @@ static int CmdNoralsyClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf noralsy read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf noralsy read`") " to verify"); return res; } diff --git a/client/src/cmdlfpac.c b/client/src/cmdlfpac.c index c633ccc1a..abfb5483a 100644 --- a/client/src/cmdlfpac.c +++ b/client/src/cmdlfpac.c @@ -241,7 +241,7 @@ static int CmdPacClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pac read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pac read`") " to verify"); return res; } diff --git a/client/src/cmdlfparadox.c b/client/src/cmdlfparadox.c index 8422f0f6f..c94e17cf7 100644 --- a/client/src/cmdlfparadox.c +++ b/client/src/cmdlfparadox.c @@ -171,7 +171,7 @@ static int CmdParadoxClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf paradox read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf paradox read`") " to verify"); return res; } diff --git a/client/src/cmdlfpcf7931.c b/client/src/cmdlfpcf7931.c index c37fc9470..4c2c9848c 100644 --- a/client/src/cmdlfpcf7931.c +++ b/client/src/cmdlfpcf7931.c @@ -151,7 +151,7 @@ static int CmdLFPCF7931Write(const char *Cmd) { SendCommandMIX(CMD_LF_PCF7931_WRITE, block, bytepos, data, buf, sizeof(buf)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pcf7931 read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pcf7931 read`") " to verify"); return PM3_SUCCESS; } diff --git a/client/src/cmdlfpresco.c b/client/src/cmdlfpresco.c index fe4f3dd1c..d7024633d 100644 --- a/client/src/cmdlfpresco.c +++ b/client/src/cmdlfpresco.c @@ -138,7 +138,7 @@ static int CmdPrescoClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf presco read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf presco read`") " to verify"); return res; } diff --git a/client/src/cmdlfpyramid.c b/client/src/cmdlfpyramid.c index 91b2fb25e..ed2895ecb 100644 --- a/client/src/cmdlfpyramid.c +++ b/client/src/cmdlfpyramid.c @@ -252,7 +252,7 @@ static int CmdPyramidClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pyramid read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf pyramid read`") " to verify"); return res; } diff --git a/client/src/cmdlfsecurakey.c b/client/src/cmdlfsecurakey.c index 643ab980d..108e9125c 100644 --- a/client/src/cmdlfsecurakey.c +++ b/client/src/cmdlfsecurakey.c @@ -170,7 +170,7 @@ static int CmdSecurakeyClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf securakey read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf securakey read`") " to verify"); return res; } diff --git a/client/src/cmdlft55xx.c b/client/src/cmdlft55xx.c index 574030f01..6d384c33d 100644 --- a/client/src/cmdlft55xx.c +++ b/client/src/cmdlft55xx.c @@ -482,7 +482,7 @@ static bool t55xxProtect(bool lock, bool usepwd, uint8_t override, uint32_t pass int res = T55xxReadBlockEx(T55x7_CONFIGURATION_BLOCK, T55x7_PAGE0, usepwd, override, password, downlink_mode, false); if (res != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Failed to read block0, use " _YELLOW_("`p`") "password parameter?"); + PrintAndLogEx(WARNING, "Failed to read block0, use " _YELLOW_("`p`") " password parameter?"); return false; } @@ -538,7 +538,7 @@ static bool t55xxProtect(bool lock, bool usepwd, uint8_t override, uint32_t pass PrintAndLogEx(WARNING, "Failed to validate pwd bit set on configuration block. aborting."); return false; } else { - PrintAndLogEx(SUCCESS, "New configuration block " _YELLOW_("%08X")"password " _YELLOW_("%08X"), block0, new_password); + PrintAndLogEx(SUCCESS, "New configuration block " _YELLOW_("%08X")" password " _YELLOW_("%08X"), block0, new_password); PrintAndLogEx(SUCCESS, "Success, tag is locked"); return true; } @@ -2398,7 +2398,7 @@ static int CmdT55xxRestore(const char *Cmd) { success = loadFileEML(preferredName, (uint8_t *)data, &datalen); } else - PrintAndLogEx(WARNING, "\nWarning: invalid dump filename "_YELLOW_("%s")"to restore!\n", preferredName); + PrintAndLogEx(WARNING, "\nWarning: invalid dump filename "_YELLOW_("%s")" to restore!\n", preferredName); } if (success == PM3_SUCCESS) { // Got data, so write to cards @@ -3039,7 +3039,7 @@ static int CmdT55xxChkPwds(const char *Cmd) { if (AcquireData(T55x7_PAGE0, T55x7_CONFIGURATION_BLOCK, true, resp.oldarg[1], downlink_mode)) { found = tryDetectModulation(downlink_mode, T55XX_PrintConfig); if (found) { - PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08"PRIX64) "]", resp.oldarg[1]); + PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08"PRIX64) " ]", resp.oldarg[1]); } else { PrintAndLogEx(WARNING, "Check pwd failed"); @@ -3089,7 +3089,7 @@ static int CmdT55xxChkPwds(const char *Cmd) { found = tryDetectModulation(dl_mode, T55XX_PrintConfig); if (found) { - PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08"PRIX64) "]", curr_password); + PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08"PRIX64) " ]", curr_password); dl_mode = 4; // Exit other downlink mode checks c = keycount; // Exit loop } @@ -3177,10 +3177,10 @@ static int CmdT55xxBruteForce(const char *Cmd) { PrintAndLogEx(NORMAL, ""); if (found) { - PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") "]", curr - 1); + PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") " ]", curr - 1); T55xx_Print_DownlinkMode((found >> 1) & 3); } else - PrintAndLogEx(WARNING, "Bruteforce failed, last tried: [ " _YELLOW_("%08X") "]", curr); + PrintAndLogEx(WARNING, "Bruteforce failed, last tried: [ " _YELLOW_("%08X") " ]", curr); t1 = msclock() - t1; PrintAndLogEx(SUCCESS, "\nTime in bruteforce: %.0f seconds\n", (float)t1 / 1000.0); @@ -3316,7 +3316,7 @@ out: PrintAndLogEx(NORMAL, ""); if (found > 0) { - PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") "]", curr_password); + PrintAndLogEx(SUCCESS, "Found valid password: [ " _GREEN_("%08X") " ]", curr_password); T55xx_Print_DownlinkMode((found >> 1) & 3); } else PrintAndLogEx(WARNING, "Recover pwd failed"); @@ -3683,7 +3683,7 @@ static int CmdT55xxProtect(const char *Cmd) { // lock if (t55xxProtect(true, usepwd, override, password, downlink_mode, new_password) == false) { - PrintAndLogEx(WARNING, "Command failed. Did you run " _YELLOW_("`lf t55xx detect`") "before?"); + PrintAndLogEx(WARNING, "Command failed. Did you run " _YELLOW_("`lf t55xx detect`") " before?"); return PM3_ESOFT; } return PM3_SUCCESS; diff --git a/client/src/cmdlfti.c b/client/src/cmdlfti.c index 7aa04ca28..ed3b6f510 100644 --- a/client/src/cmdlfti.c +++ b/client/src/cmdlfti.c @@ -297,7 +297,7 @@ static int CmdTIWrite(const char *Cmd) { clearCommandBuffer(); SendCommandMIX(CMD_LF_TI_WRITE, arg0, arg1, arg2, NULL, 0); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf ti read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf ti read`") " to verify"); return PM3_SUCCESS; } diff --git a/client/src/cmdlfverichip.c b/client/src/cmdlfverichip.c index a8cd68195..c3201e1f6 100644 --- a/client/src/cmdlfverichip.c +++ b/client/src/cmdlfverichip.c @@ -123,7 +123,7 @@ static int CmdVerichipClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf verichip read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf verichip read`") " to verify"); return res; } diff --git a/client/src/cmdlfviking.c b/client/src/cmdlfviking.c index e30234e5a..153c1d54d 100644 --- a/client/src/cmdlfviking.c +++ b/client/src/cmdlfviking.c @@ -118,7 +118,7 @@ static int CmdVikingClone(const char *Cmd) { return PM3_ETIMEOUT; } PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf viking read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf viking read`") " to verify"); return resp.status; } diff --git a/client/src/cmdlfvisa2000.c b/client/src/cmdlfvisa2000.c index 7293b5efc..a90e5ddce 100644 --- a/client/src/cmdlfvisa2000.c +++ b/client/src/cmdlfvisa2000.c @@ -186,7 +186,7 @@ static int CmdVisa2kClone(const char *Cmd) { int res = clone_t55xx_tag(blocks, ARRAYLEN(blocks)); PrintAndLogEx(SUCCESS, "Done"); - PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf visa2000 read`") "to verify"); + PrintAndLogEx(HINT, "Hint: try " _YELLOW_("`lf visa2000 read`") " to verify"); return res; } diff --git a/client/src/cmdmain.c b/client/src/cmdmain.c index 932b66bd3..f9cfe310a 100644 --- a/client/src/cmdmain.c +++ b/client/src/cmdmain.c @@ -140,7 +140,7 @@ static int lf_search_plus(const char *Cmd) { // Try to change config! uint32_t d; d = config.divisor = default_divisor[i]; - PrintAndLogEx(INFO, "--> trying ( " _GREEN_("%d.%02d kHz")")", 12000 / (d + 1), ((1200000 + (d + 1) / 2) / (d + 1)) - ((12000 / (d + 1)) * 100)); + PrintAndLogEx(INFO, "--> trying (" _GREEN_("%d.%02d kHz")")", 12000 / (d + 1), ((1200000 + (d + 1) / 2) / (d + 1)) - ((12000 / (d + 1)) * 100)); retval = lf_config(&config); if (retval != PM3_SUCCESS) @@ -174,7 +174,7 @@ static int CmdAuto(const char *Cmd) { return ret; PrintAndLogEx(INFO, "Failed both LF / HF SEARCH,"); - PrintAndLogEx(INFO, "Trying " _YELLOW_("`lf read`") "and save a trace for you"); + PrintAndLogEx(INFO, "Trying " _YELLOW_("`lf read`") " and save a trace for you"); CmdPlot(""); lf_read(false, 40000); diff --git a/client/src/cmdparser.c b/client/src/cmdparser.c index ab9fd3732..e57d32090 100644 --- a/client/src/cmdparser.c +++ b/client/src/cmdparser.c @@ -201,7 +201,7 @@ int CmdsParse(const command_t Commands[], const char *Cmd) { if (Commands[i].IsAvailable()) { break; } else { - PrintAndLogEx(WARNING, "This command is " _YELLOW_("not available") "in this mode"); + PrintAndLogEx(WARNING, "This command is " _YELLOW_("not available") " in this mode"); return PM3_ENOTIMPL; } } diff --git a/client/src/cmdtrace.c b/client/src/cmdtrace.c index 305f2839c..41c102aa1 100644 --- a/client/src/cmdtrace.c +++ b/client/src/cmdtrace.c @@ -662,7 +662,7 @@ int CmdTraceList(const char *Cmd) { } } - PrintAndLogEx(SUCCESS, "Recorded activity (trace len = " _YELLOW_("%lu") "bytes)", traceLen); + PrintAndLogEx(SUCCESS, "Recorded activity (trace len = " _YELLOW_("%lu") " bytes)", traceLen); /* if (protocol == FELICA) { @@ -674,7 +674,7 @@ int CmdTraceList(const char *Cmd) { tracepos = printHexLine(tracepos, traceLen, trace, protocol); } } else { - PrintAndLogEx(INFO, _YELLOW_("Start") "= Start of Start Bit, " _YELLOW_("End") "= End of last modulation. " _YELLOW_("Src") "= Source of Transfer"); + PrintAndLogEx(INFO, _YELLOW_("Start") " = Start of Start Bit, " _YELLOW_("End") " = End of last modulation. " _YELLOW_("Src") " = Source of Transfer"); if (protocol == ISO_14443A || protocol == PROTO_MIFARE || protocol == MFDES || protocol == TOPAZ || protocol == LTO) PrintAndLogEx(INFO, "ISO14443A - All times are in carrier periods (1/13.56MHz)"); if (protocol == THINFILM) diff --git a/client/src/cmdusart.c b/client/src/cmdusart.c index 8e095f41e..3168d66b7 100644 --- a/client/src/cmdusart.c +++ b/client/src/cmdusart.c @@ -316,7 +316,7 @@ static int CmdUsartBtFactory(const char *Cmd) { } if (USART_BAUD_RATE != atoi(BTADDON_BAUD_NUM)) { - PrintAndLogEx(WARNING, _RED_("WARNING:") "current Proxmark3 firmware has default USART baudrate = %i", USART_BAUD_RATE); + PrintAndLogEx(WARNING, _RED_("WARNING:") " current Proxmark3 firmware has default USART baudrate = %i", USART_BAUD_RATE); PrintAndLogEx(WARNING, "Current btfactory implementation is hardcoded to " BTADDON_BAUD_NUM " bauds"); return PM3_ENOTIMPL; } diff --git a/client/src/comms.c b/client/src/comms.c index b5055803b..88ffde16c 100644 --- a/client/src/comms.c +++ b/client/src/comms.c @@ -558,11 +558,11 @@ bool OpenProxmark(void *port, bool wait_for_port, int timeout, bool flash_mode, // check result of uart opening if (sp == INVALID_SERIAL_PORT) { - PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") "invalid serial port " _YELLOW_("%s"), portname); + PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") " invalid serial port " _YELLOW_("%s"), portname); sp = NULL; return false; } else if (sp == CLAIMED_SERIAL_PORT) { - PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") "serial port " _YELLOW_("%s") " is claimed by another process", portname); + PrintAndLogEx(WARNING, "\n" _RED_("ERROR:") " serial port " _YELLOW_("%s") " is claimed by another process", portname); sp = NULL; return false; } else { @@ -641,7 +641,7 @@ int TestProxmark(void) { PrintAndLogEx(INFO, "Communicating with PM3 over %s%s", conn.send_via_fpc_usart ? _YELLOW_("FPC UART") : _YELLOW_("USB-CDC"), - memcmp(conn.serial_port_name, "tcp:", 4) == 0 ? "over " _YELLOW_("TCP") : ""); + memcmp(conn.serial_port_name, "tcp:", 4) == 0 ? " over " _YELLOW_("TCP") : ""); if (conn.send_via_fpc_usart) { PrintAndLogEx(INFO, "PM3 UART serial baudrate: " _YELLOW_("%u") "\n", conn.uart_speed); diff --git a/client/src/fileutils.c b/client/src/fileutils.c index 2e9ae43d6..b32d8ec88 100644 --- a/client/src/fileutils.c +++ b/client/src/fileutils.c @@ -181,7 +181,7 @@ int saveFile(const char *preferredName, const char *suffix, const void *data, si fwrite(data, 1, datalen, f); fflush(f); fclose(f); - PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%zu") "bytes to binary file " _YELLOW_("%s"), datalen, fileName); + PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%zu") " bytes to binary file " _YELLOW_("%s"), datalen, fileName); free(fileName); return PM3_SUCCESS; } @@ -224,7 +224,7 @@ int saveFileEML(const char *preferredName, uint8_t *data, size_t datalen, size_t } fflush(f); fclose(f); - PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%" PRId32) "blocks to text file " _YELLOW_("%s"), blocks, fileName); + PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%" PRId32) " blocks to text file " _YELLOW_("%s"), blocks, fileName); out: free(fileName); @@ -522,7 +522,7 @@ int saveFileWAVE(const char *preferredName, int *data, size_t datalen) { } fclose(wave_file); - PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%zu") "bytes to wave file " _YELLOW_("'%s'"), 2 * datalen, fileName); + PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%zu") " bytes to wave file " _YELLOW_("'%s'"), 2 * datalen, fileName); out: free(fileName); @@ -549,7 +549,7 @@ int saveFilePM3(const char *preferredName, int *data, size_t datalen) { fflush(f); fclose(f); - PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%zu") "bytes to PM3 file " _YELLOW_("'%s'"), datalen, fileName); + PrintAndLogEx(SUCCESS, "saved " _YELLOW_("%zu") " bytes to PM3 file " _YELLOW_("'%s'"), datalen, fileName); out: free(fileName); @@ -648,7 +648,7 @@ int loadFile(const char *preferredName, const char *suffix, void *data, size_t m memcpy((data), dump, bytes_read); free(dump); - PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") "bytes from binary file " _YELLOW_("%s"), bytes_read, fileName); + PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from binary file " _YELLOW_("%s"), bytes_read, fileName); *datalen = bytes_read; @@ -704,7 +704,7 @@ int loadFile_safe(const char *preferredName, const char *suffix, void **pdata, s *datalen = bytes_read; - PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") "bytes from binary file " _YELLOW_("%s"), bytes_read, preferredName); + PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from binary file " _YELLOW_("%s"), bytes_read, preferredName); return PM3_SUCCESS; } @@ -755,7 +755,7 @@ int loadFileEML(const char *preferredName, void *data, size_t *datalen) { } } fclose(f); - PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") "bytes from text file " _YELLOW_("%s"), counter, fileName); + PrintAndLogEx(SUCCESS, "loaded " _YELLOW_("%zu") " bytes from text file " _YELLOW_("%s"), counter, fileName); if (datalen) *datalen = counter; @@ -1005,7 +1005,7 @@ int loadFileDICTIONARYEx(const char *preferredName, void *data, size_t maxdatale } fclose(f); if (verbose) - PrintAndLogEx(SUCCESS, "loaded " _GREEN_("%2d") "keys from dictionary file " _YELLOW_("%s"), vkeycnt, path); + PrintAndLogEx(SUCCESS, "loaded " _GREEN_("%2d") " keys from dictionary file " _YELLOW_("%s"), vkeycnt, path); if (datalen) *datalen = counter; @@ -1097,7 +1097,7 @@ int loadFileDICTIONARY_safe(const char *preferredName, void **pdata, uint8_t key memset(line, 0, sizeof(line)); } fclose(f); - PrintAndLogEx(SUCCESS, "loaded " _GREEN_("%2d") "keys from dictionary file " _YELLOW_("%s"), *keycnt, path); + PrintAndLogEx(SUCCESS, "loaded " _GREEN_("%2d") " keys from dictionary file " _YELLOW_("%s"), *keycnt, path); out: free(path); diff --git a/client/src/flash.c b/client/src/flash.c index ad3d8fd93..278aa34d9 100644 --- a/client/src/flash.c +++ b/client/src/flash.c @@ -235,12 +235,12 @@ int flash_load(flash_file_t *ctx, const char *name, int can_write_bl, int flash_ fd = fopen(name, "rb"); if (!fd) { - PrintAndLogEx(ERR, _RED_("Could not open file") "%s >>> ", name); + PrintAndLogEx(ERR, _RED_("Could not open file") " %s >>> ", name); res = PM3_EFILE; goto fail; } - PrintAndLogEx(SUCCESS, _BLUE_("Loading ELF file") _YELLOW_("%s"), name); + PrintAndLogEx(SUCCESS, _BLUE_("Loading ELF file") _YELLOW_(" %s"), name); if (fread(&ehdr, sizeof(ehdr), 1, fd) != 1) { PrintAndLogEx(ERR, "Error while reading ELF file header"); @@ -336,7 +336,7 @@ static int get_proxmark_state(uint32_t *state) { *state = resp.oldarg[0]; break; default: - PrintAndLogEx(ERR, _RED_("Error:") "Couldn't get Proxmark3 state, bad response type: 0x%04x", resp.cmd); + PrintAndLogEx(ERR, _RED_("Error:") " Couldn't get Proxmark3 state, bad response type: 0x%04x", resp.cmd); return PM3_EFATAL; break; } @@ -378,12 +378,12 @@ static int enter_bootloader(char *serial_port_name) { PrintAndLogEx(NORMAL, " " _GREEN_("Found")); return PM3_SUCCESS; } else { - PrintAndLogEx(ERR, _RED_("Error:") "Proxmark3 not found."); + PrintAndLogEx(ERR, _RED_("Error:") " Proxmark3 not found."); return PM3_ETIMEOUT; } } - PrintAndLogEx(ERR, _RED_("Error:") "Unknown Proxmark3 mode"); + PrintAndLogEx(ERR, _RED_("Error:") " Unknown Proxmark3 mode"); return PM3_EFATAL; } @@ -401,7 +401,7 @@ static int wait_for_ack(PacketResponseNG *ack) { } static void flash_suggest_update_bootloader(void) { - PrintAndLogEx(ERR, _RED_("It is recommended that you first " _YELLOW_("update your bootloader") _RED_("alone,"))); + PrintAndLogEx(ERR, _RED_("It is recommended that you first" _YELLOW_(" update your bootloader") _RED_(" alone,"))); PrintAndLogEx(ERR, _RED_("reboot the Proxmark3 then only update the main firmware") "\n"); } @@ -454,7 +454,7 @@ int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t } } else { PrintAndLogEx(ERR, _RED_("====================== OBS ! ===========================================")); - PrintAndLogEx(ERR, _RED_("Note: Your bootloader does not understand the new " _YELLOW_("CMD_BL_VERSION") _RED_("command"))); + PrintAndLogEx(ERR, _RED_("Note: Your bootloader does not understand the new" _YELLOW_(" CMD_BL_VERSION") _RED_(" command"))); flash_suggest_update_bootloader(); } @@ -463,7 +463,7 @@ int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t int mem_avail = chipid_to_mem_avail(chipinfo); if (mem_avail != 0) { - PrintAndLogEx(INFO, "Available memory on this board: "_YELLOW_("%uK") "bytes\n", mem_avail); + PrintAndLogEx(INFO, "Available memory on this board: "_YELLOW_("%uK") " bytes\n", mem_avail); if (mem_avail > 256) { if (BL_VERSION_MAJOR(version) < BL_VERSION_MAJOR(BL_VERSION_1_0_0)) { PrintAndLogEx(ERR, _RED_("====================== OBS ! ======================")); @@ -477,7 +477,7 @@ int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t } else { PrintAndLogEx(INFO, "Available memory on this board: "_RED_("UNKNOWN")"\n"); PrintAndLogEx(ERR, _RED_("====================== OBS ! ======================================")); - PrintAndLogEx(ERR, _RED_("Note: Your bootloader does not understand the new " _YELLOW_("CHIP_INFO") _RED_("command"))); + PrintAndLogEx(ERR, _RED_("Note: Your bootloader does not understand the new" _YELLOW_(" CHIP_INFO") _RED_(" command"))); flash_suggest_update_bootloader(); } @@ -497,7 +497,7 @@ int flash_start_flashing(int enable_bl_writes, char *serial_port_name, uint32_t return wait_for_ack(&resp); } else { PrintAndLogEx(ERR, _RED_("====================== OBS ! ========================================")); - PrintAndLogEx(ERR, _RED_("Note: Your bootloader does not understand the new " _YELLOW_("START_FLASH") _RED_("command"))); + PrintAndLogEx(ERR, _RED_("Note: Your bootloader does not understand the new" _YELLOW_(" START_FLASH") _RED_(" command"))); flash_suggest_update_bootloader(); } return PM3_SUCCESS; diff --git a/client/src/loclass/elite_crack.c b/client/src/loclass/elite_crack.c index fd0c5c8dd..03a9a3080 100644 --- a/client/src/loclass/elite_crack.c +++ b/client/src/loclass/elite_crack.c @@ -475,7 +475,7 @@ int calculateMasterKey(uint8_t first16bytes[], uint64_t master_key[]) { memcpy(master_key, key64, 8); if (memcmp(z_0, result, 4) != 0) { - PrintAndLogEx(WARNING, _RED_("Failed to verify") "calculated master key (k_cus)! Something is wrong."); + PrintAndLogEx(WARNING, _RED_("Failed to verify") " calculated master key (k_cus)! Something is wrong."); return 1; } else { PrintAndLogEx(NORMAL, "\n"); @@ -511,7 +511,7 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[]) { if (errors) { - PrintAndLogEx(ERR, "loclass exiting. Try run " _YELLOW_("`hf iclass sim 2`") "again and collect new data"); + PrintAndLogEx(ERR, "loclass exiting. Try run " _YELLOW_("`hf iclass sim 2`") " again and collect new data"); return 1; } diff --git a/client/src/mifare/mifarehost.c b/client/src/mifare/mifarehost.c index 1d19a7c6d..8b57604f9 100644 --- a/client/src/mifare/mifarehost.c +++ b/client/src/mifare/mifarehost.c @@ -127,7 +127,7 @@ int mfDarkside(uint8_t blockno, uint8_t key_type, uint64_t *key) { } } - PrintAndLogEx(SUCCESS, "found " _YELLOW_("%u") "candidate key%s", keycount, (keycount > 1) ? "s." : "."); + PrintAndLogEx(SUCCESS, "found " _YELLOW_("%u") " candidate key%s", keycount, (keycount > 1) ? "s." : "."); *key = UINT64_C(-1); uint8_t keyBlock[PM3_CMD_DATA_SIZE]; @@ -510,7 +510,7 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, uint32_t keycnt = statelists[0].len; if (keycnt == 0) goto out; - PrintAndLogEx(SUCCESS, "Found " _YELLOW_("%u") "key candidates", keycnt); + PrintAndLogEx(SUCCESS, "Found " _YELLOW_("%u") " key candidates", keycnt); memset(resultKey, 0, 6); uint64_t key64 = -1; @@ -536,7 +536,7 @@ int mfnested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBlockNo, free(statelists[1].head.slhead); num_to_bytes(key64, 6, resultKey); - PrintAndLogEx(SUCCESS, "target block:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "]", + PrintAndLogEx(SUCCESS, "target block:%3u key type: %c -- found valid key [ " _YELLOW_("%s") " ]", package->block, package->keytype ? 'B' : 'A', sprint_hex_inrow(resultKey, 6) @@ -644,7 +644,7 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl uint32_t keycnt = statelists[0].len; if (keycnt == 0) goto out; - PrintAndLogEx(SUCCESS, "Found " _YELLOW_("%u") "key candidates", keycnt); + PrintAndLogEx(SUCCESS, "Found " _YELLOW_("%u") " key candidates", keycnt); memset(resultKey, 0, 6); uint64_t key64 = -1; @@ -711,7 +711,7 @@ int mfStaticNested(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_t trgBl num_to_bytes(key64, 6, resultKey); - PrintAndLogEx(SUCCESS, "target block:%3u key type: %c -- found valid key [ " _YELLOW_("%s") "]", + PrintAndLogEx(SUCCESS, "target block:%3u key type: %c -- found valid key [ " _YELLOW_("%s") " ]", package->block, package->keytype ? 'B' : 'A', sprint_hex_inrow(resultKey, 6) diff --git a/client/src/proxmark3.c b/client/src/proxmark3.c index 492fdd8c5..c3f5de60a 100644 --- a/client/src/proxmark3.c +++ b/client/src/proxmark3.c @@ -66,9 +66,9 @@ static void utf8_showBanner(void) { PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s %s%s%s%s %s%s%s%s %s%s%s%s%s "), sq, sq, sq, sq, sq, sq, tr, sq, sq, sq, tr, sq, sq, sq, tr, sq, sq, sq, sq, tr); PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s %s%s%s%s%s %s%s%s%s"), sq, sq, tl, hl, hl, sq, sq, tr, sq, sq, sq, sq, tr, sq, sq, sq, sq, vl, hl, hl, sq, vl); PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s%s %s%s%s%s%s%s"), sq, sq, sq, sq, sq, sq, tl, br, sq, sq, tl, sq, sq, sq, sq, tl, sq, sq, vl, sq, sq, sq, sq, tl, br); - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s %s%s%s%s%s%s%s%s%s%s%s %s%s%s%s")"%s", sq, sq, tr, hl, hl, hl, br, sq, sq, vl, bl, sq, sq, tl, br, sq, sq, vl, hl, hl, sq, vl, msg1); - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s %s%s%s %s%s%s %s%s%s %s%s%s%s%s%s")"%s", sq, sq, vl, sq, sq, vl, bl, hl, br, sq, sq, vl, sq, sq, sq, sq, tl, br, msg2); - PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s %s%s%s %s%s%s %s%s%s%s%s ")"%s", bl, hl, br, bl, hl, br, bl, hl, br, bl, hl, hl, hl, br, msg3); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s%s%s%s%s %s%s%s%s%s%s%s%s%s%s%s %s%s%s%s")" %s", sq, sq, tr, hl, hl, hl, br, sq, sq, vl, bl, sq, sq, tl, br, sq, sq, vl, hl, hl, sq, vl, msg1); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s %s%s%s %s%s%s %s%s%s %s%s%s%s%s%s")" %s", sq, sq, vl, sq, sq, vl, bl, hl, br, sq, sq, vl, sq, sq, sq, sq, tl, br, msg2); + PrintAndLogEx(NORMAL, " " _BLUE_("%s%s%s %s%s%s %s%s%s %s%s%s%s%s ")" %s", bl, hl, br, bl, hl, br, bl, hl, br, bl, hl, hl, hl, br, msg3); PrintAndLogEx(NORMAL, ""); fflush(stdout); @@ -94,9 +94,9 @@ static void showBanner(void) { PrintAndLogEx(NORMAL, " " _BLUE_("██████╗ ███╗ ███╗ ████╗ ")); PrintAndLogEx(NORMAL, " " _BLUE_("██╔══██╗████╗ ████║ ══█║")); PrintAndLogEx(NORMAL, " " _BLUE_("██████╔╝██╔████╔██║ ████╔╝")); - PrintAndLogEx(NORMAL, " " _BLUE_("██╔═══╝ ██║╚██╔╝██║ ══█║") " :snowflake: iceman@icesql.net :coffee:"); - PrintAndLogEx(NORMAL, " " _BLUE_("██║ ██║ ╚═╝ ██║ ████╔╝") " https://github.com/rfidresearchgroup/proxmark3/"); - PrintAndLogEx(NORMAL, " " _BLUE_("╚═╝ ╚═╝ ╚═╝ ╚═══╝ ") "pre-release v4.0"); + PrintAndLogEx(NORMAL, " " _BLUE_("██╔═══╝ ██║╚██╔╝██║ ══█║") " :snowflake: iceman@icesql.net :coffee:"); + PrintAndLogEx(NORMAL, " " _BLUE_("██║ ██║ ╚═╝ ██║ ████╔╝") " https://github.com/rfidresearchgroup/proxmark3/"); + PrintAndLogEx(NORMAL, " " _BLUE_("╚═╝ ╚═╝ ╚═╝ ╚═══╝ ") " pre-release v4.0"); #else PrintAndLogEx(NORMAL, " ======. ===. ===. ====."); PrintAndLogEx(NORMAL, " ==...==.====. ====. ..=."); @@ -117,14 +117,11 @@ static void showBanner(void) { static int check_comm(void) { // If communications thread goes down. Device disconnected then this should hook up PM3 again. if (IsCommunicationThreadDead() && session.pm3_present) { - if (session.supports_colors) - rl_set_prompt(PROXPROMPT_OFFLINE_COLOR); - else - rl_set_prompt(PROXPROMPT_OFFLINE); + rl_set_prompt(PROXPROMPT_OFFLINE); rl_forced_update_display(); CloseProxmark(); - PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Use "_YELLOW_("\"hw connect\"") "to reconnect\n"); + PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") " mode. Use "_YELLOW_("\"hw connect\"") " to reconnect\n"); } return 0; } @@ -213,7 +210,7 @@ main_loop(char *script_cmds_file, char *script_cmd, bool stayInCommandLoop) { // loops every time enter is pressed... while (1) { bool printprompt = false; - const char *prompt = (session.supports_colors) ? PROXPROMPT_CON_COLOR : PROXPROMPT_CON; + const char *prompt = PROXPROMPT_CON; check_script: // If there is a script file @@ -277,11 +274,11 @@ check_script: rl_event_hook = check_comm; if (session.pm3_present) { if (conn.send_via_fpc_usart == false) - prompt = (session.supports_colors) ? PROXPROMPT_USB_COLOR : PROXPROMPT_USB; + prompt = PROXPROMPT_USB; else - prompt = (session.supports_colors) ? PROXPROMPT_FPC_COLOR : PROXPROMPT_FPC; + prompt = PROXPROMPT_FPC; } else { - prompt = (session.supports_colors) ? PROXPROMPT_OFFLINE_COLOR : PROXPROMPT_OFFLINE; + prompt = PROXPROMPT_OFFLINE; } cmd = readline(prompt); fflush(NULL); @@ -452,7 +449,7 @@ static void show_help(bool showFullHelp, char *exec_name) { PrintAndLogEx(NORMAL, " %s -- runs the pm3 client in OFFLINE mode", exec_name); PrintAndLogEx(NORMAL, "\n to execute different commands from terminal:\n"); PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -c \"hf mf chk 1* ?\" -- execute cmd and quit client", exec_name); - PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -l hf_read -- execute lua script " _YELLOW_("`hf_read`")"and quit client", exec_name); + PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -l hf_read -- execute lua script " _YELLOW_("`hf_read`")" and quit client", exec_name); PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" -s mycmds.txt -- execute each pm3 cmd in file and quit client", exec_name); PrintAndLogEx(NORMAL, "\n to flash fullimage and bootloader:\n"); PrintAndLogEx(NORMAL, " %s "SERIAL_PORT_EXAMPLE_H" --flash --unlock-bootloader --image bootrom.elf --image fullimage.elf", exec_name); @@ -671,7 +668,7 @@ int main(int argc, char *argv[]) { // For backward compatibility we accept direct port if (port != NULL) { // We got already one - PrintAndLogEx(ERR, _RED_("ERROR:") "cannot parse command line. We got " _YELLOW_("%s") " as port and now we got also: " _YELLOW_("%s") "\n", port, argv[i]); + PrintAndLogEx(ERR, _RED_("ERROR:") " cannot parse command line. We got " _YELLOW_("%s") " as port and now we got also: " _YELLOW_("%s") "\n", port, argv[i]); show_help(false, exec_name); return 1; } @@ -682,13 +679,13 @@ int main(int argc, char *argv[]) { // port if (strcmp(argv[i], "-p") == 0 || strcmp(argv[i], "--port") == 0) { if (i + 1 == argc) { - PrintAndLogEx(ERR, _RED_("ERROR:") "missing port specification after -p\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " missing port specification after -p\n"); show_help(false, exec_name); return 1; } if (port != NULL) { // We got already one - PrintAndLogEx(ERR, _RED_("ERROR:") "cannot parse command line. We got " _YELLOW_("%s") " as port and now we got also: " _YELLOW_("%s") "\n", port, argv[i + 1]); + PrintAndLogEx(ERR, _RED_("ERROR:") " cannot parse command line. We got " _YELLOW_("%s") " as port and now we got also: " _YELLOW_("%s") "\n", port, argv[i + 1]); show_help(false, exec_name); return 1; } @@ -726,13 +723,13 @@ int main(int argc, char *argv[]) { // set debugmode if (strcmp(argv[i], "-d") == 0 || strcmp(argv[i], "--debug") == 0) { if (i + 1 == argc) { - PrintAndLogEx(ERR, _RED_("ERROR:") "missing debugmode specification after -d\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " missing debugmode specification after -d\n"); show_help(false, exec_name); return 1; } int demod = atoi(argv[i + 1]); if (demod < 0 || demod > 2) { - PrintAndLogEx(ERR, _RED_("ERROR:") "invalid debugmode: -d " _YELLOW_("%s") "\n", argv[i + 1]); + PrintAndLogEx(ERR, _RED_("ERROR:") " invalid debugmode: -d " _YELLOW_("%s") "\n", argv[i + 1]); return 1; } g_debugMode = demod; @@ -750,13 +747,13 @@ int main(int argc, char *argv[]) { // set baudrate if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--baud") == 0) { if (i + 1 == argc) { - PrintAndLogEx(ERR, _RED_("ERROR:") "missing baud specification after -b\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " missing baud specification after -b\n"); show_help(false, exec_name); return 1; } uint64_t tmpspeed = strtoul(argv[i + 1], NULL, 10); if ((tmpspeed == ULONG_MAX) || (tmpspeed == 0)) { - PrintAndLogEx(ERR, _RED_("ERROR:") "invalid baudrate: -b " _YELLOW_("%s") "\n", argv[i + 1]); + PrintAndLogEx(ERR, _RED_("ERROR:") " invalid baudrate: -b " _YELLOW_("%s") "\n", argv[i + 1]); return 1; } speed = tmpspeed; @@ -773,7 +770,7 @@ int main(int argc, char *argv[]) { // execute pm3 command if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--command") == 0) { if (i + 1 == argc) { - PrintAndLogEx(ERR, _RED_("ERROR:") "missing command specification after -c\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " missing command specification after -c\n"); show_help(false, exec_name); return 1; } @@ -784,7 +781,7 @@ int main(int argc, char *argv[]) { // execute pm3 command file if (strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--script-file") == 0) { if (i + 1 == argc) { - PrintAndLogEx(ERR, _RED_("ERROR:") "missing script file specification after -s\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " missing script file specification after -s\n"); show_help(false, exec_name); return 1; } @@ -796,7 +793,7 @@ int main(int argc, char *argv[]) { if (strcmp(argv[i], "-l") == 0 || strcmp(argv[i], "--lua") == 0) { addLuaExec = true; if (i + 1 == argc) { - PrintAndLogEx(ERR, _RED_("ERROR:") "missing lua script specification after -l\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " missing lua script specification after -l\n"); show_help(false, exec_name); return 1; } @@ -825,11 +822,11 @@ int main(int argc, char *argv[]) { // flash file if (strcmp(argv[i], "--image") == 0) { if (flash_num_files == FLASH_MAX_FILES) { - PrintAndLogEx(ERR, _RED_("ERROR:") "too many --image, please use it max %i times\n", FLASH_MAX_FILES); + PrintAndLogEx(ERR, _RED_("ERROR:") " too many --image, please use it max %i times\n", FLASH_MAX_FILES); return 1; } if (i + 1 == argc) { - PrintAndLogEx(ERR, _RED_("ERROR:") "missing image specification after --image\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " missing image specification after --image\n"); show_help(false, exec_name); return 1; } @@ -838,7 +835,7 @@ int main(int argc, char *argv[]) { } // We got an unknown parameter - PrintAndLogEx(ERR, _RED_("ERROR:") "invalid parameter: " _YELLOW_("%s") "\n", argv[i]); + PrintAndLogEx(ERR, _RED_("ERROR:") " invalid parameter: " _YELLOW_("%s") "\n", argv[i]); show_help(false, exec_name); return 1; } @@ -888,7 +885,7 @@ int main(int argc, char *argv[]) { if (strlen(script_cmd) == 0) { script_cmd = NULL; - PrintAndLogEx(ERR, _RED_("ERROR:") "execute command: " _YELLOW_("command not found") ".\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " execute command: " _YELLOW_("command not found") ".\n"); return 2; } else { if (addLuaExec) { @@ -913,7 +910,7 @@ int main(int argc, char *argv[]) { } if (session.pm3_present && (TestProxmark() != PM3_SUCCESS)) { - PrintAndLogEx(ERR, _RED_("ERROR:") "cannot communicate with the Proxmark\n"); + PrintAndLogEx(ERR, _RED_("ERROR:") " cannot communicate with the Proxmark\n"); CloseProxmark(); } @@ -921,7 +918,7 @@ int main(int argc, char *argv[]) { exit(EXIT_FAILURE); if (!session.pm3_present) - PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") "mode. Check " _YELLOW_("\"%s -h\"") " if it's not what you want.\n", exec_name); + PrintAndLogEx(INFO, "Running in " _YELLOW_("OFFLINE") " mode. Check " _YELLOW_("\"%s -h\"") " if it's not what you want.\n", exec_name); // ascii art only in interactive client if (!script_cmds_file && !script_cmd && session.stdinOnTTY && session.stdoutOnTTY && !flash_mode) diff --git a/client/src/proxmark3.h b/client/src/proxmark3.h index 107e64859..015b34ec3 100644 --- a/client/src/proxmark3.h +++ b/client/src/proxmark3.h @@ -14,17 +14,13 @@ #include "common.h" -#define PROXPROMPT_CON "[con] pm3 --> " -#define PROXPROMPT_CON_COLOR "[\001\033[1;32m\002con\001\033[0m\002] pm3 --> " +#define PROXPROMPT_CON "[" _BOLD_GREEN_("con") "] pm3 --> " -#define PROXPROMPT_USB "[usb] pm3 --> " -#define PROXPROMPT_USB_COLOR "[\001\033[1;32m\002usb\001\033[0m\002] pm3 --> " +#define PROXPROMPT_USB "[" _BOLD_GREEN_("usb") "] pm3 --> " -#define PROXPROMPT_FPC "[fpc] pm3 --> " -#define PROXPROMPT_FPC_COLOR "[\001\033[1;32m\002fpc\001\033[0m\002] pm3 --> " +#define PROXPROMPT_FPC "[" _BOLD_GREEN_("fpc") "] pm3 --> " -#define PROXPROMPT_OFFLINE "[offline] pm3 --> " -#define PROXPROMPT_OFFLINE_COLOR "[\001\033[1;31m\002offline\001\033[0m\002] pm3 --> " +#define PROXPROMPT_OFFLINE "[" _BOLD_RED_("offline") "] pm3 --> " #define PROXHISTORY "history.txt" #define PROXLOG "log_%Y%m%d.txt" diff --git a/client/src/ui.c b/client/src/ui.c index bd8ed0dce..5d0e28aec 100644 --- a/client/src/ui.c +++ b/client/src/ui.c @@ -156,30 +156,30 @@ void PrintAndLogEx(logLevel_t level, const char *fmt, ...) { if (session.emoji_mode == EMOJI) strncpy(prefix, _RED_("[!!]") " :rotating_light: ", sizeof(prefix) - 1); else - strncpy(prefix, _RED_("[!!]"), sizeof(prefix) - 1); + strncpy(prefix, _RED_("[!!] "), sizeof(prefix) - 1); stream = stderr; break; case FAILED: if (session.emoji_mode == EMOJI) strncpy(prefix, _RED_("[-]") " :no_entry: ", sizeof(prefix) - 1); else - strncpy(prefix, _RED_("[-]"), sizeof(prefix) - 1); + strncpy(prefix, _RED_("[-] "), sizeof(prefix) - 1); break; case DEBUG: - strncpy(prefix, _BLUE_("[#]"), sizeof(prefix) - 1); + strncpy(prefix, _BLUE_("[#] "), sizeof(prefix) - 1); break; case HINT: case SUCCESS: - strncpy(prefix, _GREEN_("[+]"), sizeof(prefix) - 1); + strncpy(prefix, _GREEN_("[+] "), sizeof(prefix) - 1); break; case WARNING: if (session.emoji_mode == EMOJI) strncpy(prefix, _CYAN_("[!]") " :warning: ", sizeof(prefix) - 1); else - strncpy(prefix, _CYAN_("[!]"), sizeof(prefix) - 1); + strncpy(prefix, _CYAN_("[!] "), sizeof(prefix) - 1); break; case INFO: - strncpy(prefix, _YELLOW_("[=]"), sizeof(prefix) - 1); + strncpy(prefix, _YELLOW_("[=] "), sizeof(prefix) - 1); break; case INPLACE: if (session.emoji_mode == EMOJI) { @@ -278,7 +278,7 @@ static void fPrintAndLog(FILE *stream, const char *fmt, ...) { } else { if (session.supports_colors) { - printf(_YELLOW_("[=]") "Session log " _YELLOW_("%s") "\n", my_logfile_path); + printf(_YELLOW_("[=] ") "Session log " _YELLOW_("%s") "\n", my_logfile_path); } else { printf("[=] Session log %s\n", my_logfile_path); } diff --git a/include/ansi.h b/include/ansi.h index 49bd46039..e86a36ee4 100644 --- a/include/ansi.h +++ b/include/ansi.h @@ -1,11 +1,13 @@ #ifndef __ANSI_H #define __ANSI_H -#define AEND "\x1b[0m " +#define AEND "\x1b[0m" #define _BLUE_(s) "\x1b[34m" s AEND #define _RED_(s) "\x1b[31m" s AEND +#define _BOLD_RED_(s) "\x1b[1;31m" s AEND #define _GREEN_(s) "\x1b[32m" s AEND +#define _BOLD_GREEN_(s) "\x1b[1;32m" s AEND #define _YELLOW_(s) "\x1b[33m" s AEND #define _MAGENTA_(s) "\x1b[35m" s AEND #define _CYAN_(s) "\x1b[36m" s AEND