From e444640068cd389ed03def9270d95d5a5ac9079d Mon Sep 17 00:00:00 2001 From: iceman1001 Date: Thu, 14 May 2020 16:59:02 +0200 Subject: [PATCH] printandlogex --- client/src/cmdhf14a.c | 2 +- client/src/cmdhffelica.c | 2 +- client/src/cmdhficlass.c | 18 ++++++++++-------- client/src/mifare/mifarehost.c | 2 +- client/src/uart/uart_win32.c | 9 +++++---- 5 files changed, 18 insertions(+), 15 deletions(-) diff --git a/client/src/cmdhf14a.c b/client/src/cmdhf14a.c index 4e4e411e8..d65869144 100644 --- a/client/src/cmdhf14a.c +++ b/client/src/cmdhf14a.c @@ -401,7 +401,7 @@ static int CmdHF14ACUIDs(const char *Cmd) { for (int i = 0; i < n; i++) { if (kbd_enter_pressed()) { - PrintAndLogEx(WARNING, "\n[!] aborted via keyboard!\n"); + PrintAndLogEx(WARNING, "aborted via keyboard!\n"); break; } diff --git a/client/src/cmdhffelica.c b/client/src/cmdhffelica.c index 9757e54a3..377b4a0a9 100644 --- a/client/src/cmdhffelica.c +++ b/client/src/cmdhffelica.c @@ -1632,7 +1632,7 @@ static int CmdHFFelicaDumpLite(const char *Cmd) { printf("."); fflush(stdout); if (kbd_enter_pressed()) { - PrintAndLogEx(WARNING, "\n[!] aborted via keyboard!\n"); + PrintAndLogEx(WARNING, "aborted via keyboard!\n"); DropField(); return PM3_EOPABORTED; } diff --git a/client/src/cmdhficlass.c b/client/src/cmdhficlass.c index ba1aa2157..0d063aaab 100644 --- a/client/src/cmdhficlass.c +++ b/client/src/cmdhficlass.c @@ -1324,7 +1324,8 @@ static int CmdHFiClassReader_Dump(const char *Cmd) { printf("."); fflush(stdout); if (kbd_enter_pressed()) { - PrintAndLogEx(WARNING, "\n[!] aborted via keyboard!\n"); + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(WARNING, "aborted via keyboard!\n"); DropField(); return PM3_EOPABORTED; } @@ -2470,7 +2471,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) { uint8_t timeout = 0; if (kbd_enter_pressed()) { - PrintAndLogEx(WARNING, "\n[!] Aborted via keyboard!\n"); + PrintAndLogEx(WARNING, "Aborted via keyboard!\n"); goto out; } @@ -2497,10 +2498,12 @@ static int CmdHFiClassCheckKeys(const char *Cmd) { printf("."); fflush(stdout); if (timeout > 120) { - PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting..."); + PrintAndLogEx(NORMAL, ""); + PrintAndLogEx(WARNING, "No response from Proxmark3. Aborting..."); goto out; } } + PrintAndLogEx(NORMAL, ""); found_offset = resp.oldarg[1] & 0xFF; uint8_t isOK = resp.oldarg[0] & 0xFF; @@ -2509,8 +2512,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) { switch (isOK) { case 1: { found_debit = true; - - PrintAndLogEx(NORMAL, "\n[-] Chunk [%d/%d]: %.1fs [%s] idx [%u] - found key "_YELLOW_("%s") + PrintAndLogEx(INFO, "Chunk [%d/%d]: %.1fs [%s] idx [%u] - found key "_YELLOW_("%s") , key_offset , keycount , (float)(t2 / 1000.0) @@ -2521,7 +2523,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) { break; } case 0: { - PrintAndLogEx(NORMAL, "\n[-] Chunk [%d/%d] : %.1fs [%s]" + PrintAndLogEx(INFO, "Chunk [%d/%d] : %.1fs [%s]" , key_offset , keycount , (float)(t2 / 1000.0) @@ -2546,7 +2548,7 @@ static int CmdHFiClassCheckKeys(const char *Cmd) { out: t1 = msclock() - t1; - PrintAndLogEx(SUCCESS, "\nTime in iclass checkkeys: %.0f seconds\n", (float)t1 / 1000.0); + PrintAndLogEx(SUCCESS, "Time in iclass checkkeys: %.0f seconds\n", (float)t1 / 1000.0); DropField(); // add to managekeys @@ -2806,7 +2808,7 @@ static void permute(uint8_t *data, uint8_t len, uint8_t *output) { return; } if (len != KEY_SIZE) { - PrintAndLogEx(NORMAL, "[!] wrong key size\n"); + PrintAndLogEx(WARNING, "wrong key size\n"); return; } for (uint8_t i = 0; i < KEY_SIZE; ++i) { diff --git a/client/src/mifare/mifarehost.c b/client/src/mifare/mifarehost.c index c1982b088..00e26a89e 100644 --- a/client/src/mifare/mifarehost.c +++ b/client/src/mifare/mifarehost.c @@ -1240,7 +1240,7 @@ int mfTraceDecode(uint8_t *data_src, int len, bool wantSaveToEmlFile) { traceCrypto1 = lfsr_recovery64(ks2, ks3); } else { - PrintAndLogEx(NORMAL, "[!] nested key recovery not implemented!\n"); + PrintAndLogEx(WARNING, "nested key recovery not implemented!\n"); //at_enc = bytes_to_num(data, 4); crypto1_destroy(traceCrypto1); traceState = TRACE_ERROR; diff --git a/client/src/uart/uart_win32.c b/client/src/uart/uart_win32.c index bbb5bfcfa..93ee2f126 100644 --- a/client/src/uart/uart_win32.c +++ b/client/src/uart/uart_win32.c @@ -43,6 +43,7 @@ #include #include "comms.h" +#include "ui.h" // The windows serial port implementation #ifdef _WIN32 @@ -90,7 +91,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) { serial_port_windows *sp = calloc(sizeof(serial_port_windows), sizeof(uint8_t)); if (sp == 0) { - printf("[!] UART failed to allocate memory\n"); + PrintAndLogEx(WARNING, "UART failed to allocate memory\n"); return INVALID_SERIAL_PORT; } // Copy the input "com?" to "\\.\COM?" format @@ -111,14 +112,14 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) { sp->dcb.DCBlength = sizeof(DCB); if (!BuildCommDCBA("baud=115200 parity=N data=8 stop=1", &sp->dcb)) { uart_close(sp); - printf("[!] UART error cdc setup\n"); + PrintAndLogEx(WARNING, "UART error cdc setup\n"); return INVALID_SERIAL_PORT; } // Update the active serial port if (!SetCommState(sp->hPort, &sp->dcb)) { uart_close(sp); - printf("[!] UART error while setting com state\n"); + PrintAndLogEx(WARNING, "UART error while setting com state\n"); return INVALID_SERIAL_PORT; } @@ -130,7 +131,7 @@ serial_port uart_open(const char *pcPortName, uint32_t speed) { speed = 115200; if (!uart_set_speed(sp, speed)) { uart_close(sp); - printf("[!] UART error while setting baudrate\n"); + PrintAndLogEx(WARNING, "UART error while setting baudrate\n"); return INVALID_SERIAL_PORT; } }