From 8bf4b4ad97b213da18481bc18ea6942a2a79b873 Mon Sep 17 00:00:00 2001 From: Philippe Teuwen Date: Sun, 14 Jul 2019 00:35:18 +0200 Subject: [PATCH] Promote WARNING to ERR on some error msgs --- client/cmdcrc.c | 2 +- client/cmddata.c | 14 ++++++------ client/cmdflashmem.c | 6 ++--- client/cmdhf14a.c | 2 +- client/cmdhf15.c | 8 +++---- client/cmdhffido.c | 4 ++-- client/cmdhficlass.c | 18 +++++++-------- client/cmdhflegic.c | 4 ++-- client/cmdhfmf.c | 34 ++++++++++++++-------------- client/cmdhfmfhard.c | 24 ++++++++++---------- client/cmdhfmfu.c | 18 +++++++-------- client/cmdhftopaz.c | 10 ++++---- client/cmdlf.c | 6 ++--- client/cmdlfawid.c | 8 +++---- client/cmdlfem4x.c | 18 +++++++-------- client/cmdlffdx.c | 4 ++-- client/cmdlfguard.c | 6 ++--- client/cmdlfhitag.c | 2 +- client/cmdlfio.c | 4 ++-- client/cmdlfjablotron.c | 4 ++-- client/cmdlfkeri.c | 2 +- client/cmdlfnedap.c | 6 ++--- client/cmdlfnoralsy.c | 6 ++--- client/cmdlfparadox.c | 2 +- client/cmdlfpresco.c | 2 +- client/cmdlfpyramid.c | 6 ++--- client/cmdlft55xx.c | 8 +++---- client/cmdlfti.c | 4 ++-- client/cmdlfviking.c | 2 +- client/cmdlfvisa2000.c | 2 +- client/cmdsmartcard.c | 6 ++--- client/comms.c | 8 +++---- client/emv/cmdemv.c | 14 ++++++------ client/emv/emvcore.c | 44 ++++++++++++++++++------------------ client/fido/fidocore.c | 2 +- client/loclass/elite_crack.c | 14 ++++++------ client/mifare/mad.c | 2 +- client/mifare/mifarehost.c | 6 ++--- 38 files changed, 166 insertions(+), 166 deletions(-) diff --git a/client/cmdcrc.c b/client/cmdcrc.c index 58cab45e5..af4baae45 100644 --- a/client/cmdcrc.c +++ b/client/cmdcrc.c @@ -248,7 +248,7 @@ int RunModel(char *inModel, char *inHexStr, bool reverse, char endian, char *res //set model c = mbynam(&model, inModel); if (!c) { - PrintAndLogEx(WARNING, "error: preset model '%s' not found. Use reveng -D to list presets. [%d]", inModel, c); + PrintAndLogEx(ERR, "error: preset model '%s' not found. Use reveng -D to list presets. [%d]", inModel, c); return 0; } if (c < 0) { diff --git a/client/cmddata.c b/client/cmddata.c index d6a4e8e73..e0e0f73c1 100644 --- a/client/cmddata.c +++ b/client/cmddata.c @@ -602,7 +602,7 @@ static int Cmdmandecoderaw(const char *Cmd) { } if (high > 7 || low < 0) { - PrintAndLogEx(WARNING, "Error: please raw demod the wave first then manchester raw decode"); + PrintAndLogEx(ERR, "Error: please raw demod the wave first then manchester raw decode"); return PM3_ESOFT; } @@ -611,7 +611,7 @@ static int Cmdmandecoderaw(const char *Cmd) { uint8_t alignPos = 0; errCnt = manrawdecode(bits, &size, invert, &alignPos); if (errCnt >= maxErr) { - PrintAndLogEx(WARNING, "Too many errors: %u", errCnt); + PrintAndLogEx(ERR, "Too many errors: %u", errCnt); return PM3_ESOFT; } @@ -658,16 +658,16 @@ static int CmdBiphaseDecodeRaw(const char *Cmd) { errCnt = BiphaseRawDecode(bits, &size, &offset, invert); if (errCnt < 0) { - PrintAndLogEx(WARNING, "Error during decode:%d", errCnt); + PrintAndLogEx(ERR, "Error during decode:%d", errCnt); return PM3_ESOFT; } if (errCnt > maxErr) { - PrintAndLogEx(WARNING, "Too many errors attempting to decode: %d", errCnt); + PrintAndLogEx(ERR, "Too many errors attempting to decode: %d", errCnt); return PM3_ESOFT; } if (errCnt > 0) - PrintAndLogEx(WARNING, "# Errors found during Demod (shown as " _YELLOW_("7")" in bit stream): %d", errCnt); + PrintAndLogEx(ERR, "# Errors found during Demod (shown as " _YELLOW_("7")" in bit stream): %d", errCnt); PrintAndLogEx(NORMAL, "Biphase Decoded using offset: %d - # invert:%d - data:", offset, invert); PrintAndLogEx(NORMAL, "%s", sprint_bin_break(bits, size, 32)); @@ -1290,7 +1290,7 @@ int CmdPSK1rawDemod(const char *Cmd) { int ans = PSKDemod(Cmd, true); //output if (ans != PM3_SUCCESS) { - if (g_debugMode) PrintAndLogEx(WARNING, "Error demoding: %d", ans); + if (g_debugMode) PrintAndLogEx(ERR, "Error demoding: %d", ans); return PM3_ESOFT; } PrintAndLogEx(NORMAL, "PSK1 demoded bitstream:"); @@ -1307,7 +1307,7 @@ static int CmdPSK2rawDemod(const char *Cmd) { int ans = PSKDemod(Cmd, true); if (ans != PM3_SUCCESS) { - if (g_debugMode) PrintAndLogEx(WARNING, "Error demoding: %d", ans); + if (g_debugMode) PrintAndLogEx(ERR, "Error demoding: %d", ans); return PM3_ESOFT; } psk1TOpsk2(DemodBuffer, DemodBufferLen); diff --git a/client/cmdflashmem.c b/client/cmdflashmem.c index dafda3ae6..6bab15cd9 100644 --- a/client/cmdflashmem.c +++ b/client/cmdflashmem.c @@ -136,7 +136,7 @@ static int CmdFlashMemRead(const char *Cmd) { return PM3_EINVARG; } if (start_index + len > FLASH_MEM_MAX_SIZE) { - PrintAndLogDevice(WARNING, "error, start_index + length is larger than available memory"); + PrintAndLogDevice(ERR, "error, start_index + length is larger than available memory"); return PM3_EOVFLOW; } @@ -258,7 +258,7 @@ static int CmdFlashMemLoad(const char *Cmd) { } if (datalen > FLASH_MEM_MAX_SIZE) { - PrintAndLogDevice(WARNING, "error, filesize is larger than available memory"); + PrintAndLogDevice(ERR, "error, filesize is larger than available memory"); free(data); return PM3_EOVFLOW; } @@ -354,7 +354,7 @@ static int CmdFlashMemSave(const char *Cmd) { uint8_t *dump = calloc(len, sizeof(uint8_t)); if (!dump) { - PrintAndLogDevice(WARNING, "error, cannot allocate memory "); + PrintAndLogDevice(ERR, "error, cannot allocate memory "); return PM3_EMALLOC; } diff --git a/client/cmdhf14a.c b/client/cmdhf14a.c index bb5144f0b..c138aefa1 100644 --- a/client/cmdhf14a.c +++ b/client/cmdhf14a.c @@ -798,7 +798,7 @@ int ExchangeAPDU14a(uint8_t *datain, int datainlen, bool activateField, bool lea vActivateField = false; if (*dataoutlen) { if (clen != datainlen) - PrintAndLogEx(WARNING, "APDU: I-block/R-block sequence error. Data len=%d, Sent=%d, Last packet len=%d", datainlen, clen, *dataoutlen); + PrintAndLogEx(ERR, "APDU: I-block/R-block sequence error. Data len=%d, Sent=%d, Last packet len=%d", datainlen, clen, *dataoutlen); break; } } while (clen < datainlen); diff --git a/client/cmdhf15.c b/client/cmdhf15.c index 9d5f3802d..65bc26010 100644 --- a/client/cmdhf15.c +++ b/client/cmdhf15.c @@ -564,7 +564,7 @@ static int CmdHF15Demod(const char *Cmd) { } if (mask != 0x01) { - PrintAndLogEx(WARNING, "Error, uneven octet! (discard extra bits!)"); + PrintAndLogEx(ERR, "Error, uneven octet! (discard extra bits!)"); PrintAndLogEx(NORMAL, " mask = %02x", mask); } PrintAndLogEx(NORMAL, "%d octets", k); @@ -634,7 +634,7 @@ static int CmdHF15Info(const char *Cmd) { recv = resp.data.asBytes; if (recv[0] & ISO15_RES_ERROR) { - PrintAndLogEx(WARNING, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); + PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); return 3; } @@ -1069,7 +1069,7 @@ static int CmdHF15Read(const char *Cmd) { } if (recv[0] & ISO15_RES_ERROR) { - PrintAndLogEx(WARNING, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); + PrintAndLogEx(ERR, "iso15693 card returned error %i: %s", recv[0], TagErrorStr(recv[0])); return 3; } @@ -1246,7 +1246,7 @@ static int CmdHF15Restore(const char *Cmd) { fclose(f); return 0; } else if (bytes_read != blocksize) { - PrintAndLogEx(WARNING, "File reading error (%s), %u bytes read instead of %u bytes.", filename, bytes_read, blocksize); + PrintAndLogEx(ERR, "File reading error (%s), %u bytes read instead of %u bytes.", filename, bytes_read, blocksize); fclose(f); return 2; } diff --git a/client/cmdhffido.c b/client/cmdhffido.c index 39b080dca..9db6583f6 100644 --- a/client/cmdhffido.c +++ b/client/cmdhffido.c @@ -351,7 +351,7 @@ static int CmdHFFidoRegister(const char *cmd) { if (res == -0x4e00) { PrintAndLogEx(WARNING, "Signature is NOT VALID."); } else { - PrintAndLogEx(WARNING, "Other signature check error: %x %s", (res < 0) ? -res : res, ecdsa_get_error(res)); + PrintAndLogEx(ERR, "Other signature check error: %x %s", (res < 0) ? -res : res, ecdsa_get_error(res)); } } else { PrintAndLogEx(SUCCESS, "Signature is OK."); @@ -577,7 +577,7 @@ static int CmdHFFidoAuthenticate(const char *cmd) { if (res == -0x4e00) { PrintAndLogEx(WARNING, "Signature is NOT VALID."); } else { - PrintAndLogEx(WARNING, "Other signature check error: %x %s", (res < 0) ? -res : res, ecdsa_get_error(res)); + PrintAndLogEx(ERR, "Other signature check error: %x %s", (res < 0) ? -res : res, ecdsa_get_error(res)); } } else { PrintAndLogEx(SUCCESS, "Signature is OK."); diff --git a/client/cmdhficlass.c b/client/cmdhficlass.c index ec2179ab3..f8d57556f 100644 --- a/client/cmdhficlass.c +++ b/client/cmdhficlass.c @@ -550,14 +550,14 @@ static int CmdHFiClassELoad(const char *Cmd) { fseek(f, 0, SEEK_SET); if (fsize <= 0) { - PrintAndLogDevice(WARNING, "error, when getting filesize"); + PrintAndLogDevice(ERR, "error, when getting filesize"); fclose(f); return 1; } uint8_t *dump = calloc(fsize, sizeof(uint8_t)); if (!dump) { - PrintAndLogDevice(WARNING, "error, cannot allocate memory "); + PrintAndLogDevice(ERR, "error, cannot allocate memory "); fclose(f); return 1; } @@ -569,7 +569,7 @@ static int CmdHFiClassELoad(const char *Cmd) { //Validate if (bytes_read < fsize) { - PrintAndLogDevice(WARNING, "error, could only read %d bytes (should be %d)", bytes_read, fsize); + PrintAndLogDevice(ERR, "error, could only read %d bytes (should be %d)", bytes_read, fsize); free(dump); return 1; } @@ -650,7 +650,7 @@ static int CmdHFiClassDecrypt(const char *Cmd) { fseek(f, 0, SEEK_SET); if (fsize <= 0) { - PrintAndLogEx(WARNING, "error, when getting filesize"); + PrintAndLogEx(ERR, "error, when getting filesize"); fclose(f); return 2; } @@ -665,7 +665,7 @@ static int CmdHFiClassDecrypt(const char *Cmd) { size_t bytes_read = fread(decrypted, 1, fsize, f); fclose(f); if (bytes_read == 0) { - PrintAndLogEx(WARNING, "file reading error"); + PrintAndLogEx(ERR, "file reading error"); free(decrypted); return 3; } @@ -1281,7 +1281,7 @@ static int CmdHFiClassCloneTag(const char *Cmd) { fseek(f, startblock * 8, SEEK_SET); size_t bytes_read = fread(tag_data, sizeof(iclass_block_t), endblock - startblock + 1, f); if (bytes_read == 0) { - PrintAndLogEx(WARNING, "file reading error."); + PrintAndLogEx(ERR, "file reading error."); fclose(f); return 2; } @@ -1448,7 +1448,7 @@ static int CmdHFiClass_loclass(const char *Cmd) { errors += testMAC(); errors += doKeyTests(0); errors += testElite(); - if (errors) PrintAndLogDevice(WARNING, "There were errors!!!"); + if (errors) PrintAndLogDevice(ERR, "There were errors!!!"); return errors; } return PM3_SUCCESS; @@ -1518,7 +1518,7 @@ static int CmdHFiClassReadTagFile(const char *Cmd) { fseek(f, 0, SEEK_SET); if (fsize <= 0) { - PrintAndLogEx(WARNING, "Error, when getting filesize"); + PrintAndLogEx(ERR, "Error, when getting filesize"); fclose(f); return 1; } @@ -1676,7 +1676,7 @@ static int loadKeys(char *filename) { fseek(f, 0, SEEK_SET); if (fsize <= 0) { - PrintAndLogEx(WARNING, "Error, when getting filesize"); + PrintAndLogEx(ERR, "Error, when getting filesize"); fclose(f); return 1; } diff --git a/client/cmdhflegic.c b/client/cmdhflegic.c index 8bd976030..03c5ecfcd 100644 --- a/client/cmdhflegic.c +++ b/client/cmdhflegic.c @@ -1037,7 +1037,7 @@ static int CmdLegicRestore(const char *Cmd) { fclose(f); if (bytes_read == 0) { - PrintAndLogEx(WARNING, "File reading error"); + PrintAndLogEx(ERR, "File reading error"); free(data); return 2; } @@ -1139,7 +1139,7 @@ static int CmdLegicELoad(const char *Cmd) { // load file size_t bytes_read = fread(data, 1, numofbytes, f); if (bytes_read == 0) { - PrintAndLogEx(WARNING, "File reading error"); + PrintAndLogEx(ERR, "File reading error"); free(data); fclose(f); f = NULL; diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index 0bed91dfd..3ca958f80 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -765,7 +765,7 @@ static int CmdHF14AMfDump(const char *Cmd) { for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { bytes_read = fread(keyA[sectorNo], 1, 6, f); if (bytes_read != 6) { - PrintAndLogEx(WARNING, "File reading error."); + PrintAndLogEx(ERR, "File reading error."); fclose(f); return PM3_EFILE; } @@ -775,7 +775,7 @@ static int CmdHF14AMfDump(const char *Cmd) { for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { bytes_read = fread(keyB[sectorNo], 1, 6, f); if (bytes_read != 6) { - PrintAndLogEx(WARNING, "File reading error."); + PrintAndLogEx(ERR, "File reading error."); fclose(f); return PM3_EFILE; } @@ -984,7 +984,7 @@ static int CmdHF14AMfRestore(const char *Cmd) { for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { bytes_read = fread(keyA[sectorNo], 1, 6, fkeys); if (bytes_read != 6) { - PrintAndLogEx(WARNING, "File reading error " _YELLOW_("%s"), keyFilename); + PrintAndLogEx(ERR, "File reading error " _YELLOW_("%s"), keyFilename); fclose(fkeys); return 2; } @@ -993,7 +993,7 @@ static int CmdHF14AMfRestore(const char *Cmd) { for (sectorNo = 0; sectorNo < numSectors; sectorNo++) { bytes_read = fread(keyB[sectorNo], 1, 6, fkeys); if (bytes_read != 6) { - PrintAndLogEx(WARNING, "File reading error " _YELLOW_("%s"), keyFilename); + PrintAndLogEx(ERR, "File reading error " _YELLOW_("%s"), keyFilename); fclose(fkeys); return 2; } @@ -1021,7 +1021,7 @@ static int CmdHF14AMfRestore(const char *Cmd) { memcpy(data, key, 6); bytes_read = fread(bldata, 1, 16, fdump); if (bytes_read != 16) { - PrintAndLogEx(WARNING, "File reading error " _YELLOW_("%s"), dataFilename); + PrintAndLogEx(ERR, "File reading error " _YELLOW_("%s"), dataFilename); fclose(fdump); fdump = NULL; return 2; @@ -1129,7 +1129,7 @@ static int CmdHF14AMfNested(const char *Cmd) { int16_t isOK = mfnested(blockNo, keyType, key, trgBlockNo, trgKeyType, keyBlock, true); switch (isOK) { case -1 : - PrintAndLogEx(WARNING, "Error: No response from Proxmark3.\n"); + PrintAndLogEx(ERR, "Error: No response from Proxmark3.\n"); break; case -2 : PrintAndLogEx(WARNING, "Button pressed. Aborted.\n"); @@ -1162,7 +1162,7 @@ static int CmdHF14AMfNested(const char *Cmd) { } return PM3_SUCCESS; default : - PrintAndLogEx(WARNING, "Unknown Error.\n"); + PrintAndLogEx(ERR, "Unknown Error.\n"); } return PM3_SUCCESS; } else { // ------------------------------------ multiple sectors working @@ -1199,7 +1199,7 @@ static int CmdHF14AMfNested(const char *Cmd) { int16_t isOK = mfnested(blockNo, keyType, key, FirstBlockOfSector(sectorNo), trgKeyType, keyBlock, calibrate); switch (isOK) { case -1 : - PrintAndLogEx(WARNING, "error: No response from Proxmark3.\n"); + PrintAndLogEx(ERR, "error: No response from Proxmark3.\n"); break; case -2 : PrintAndLogEx(WARNING, "button pressed. Aborted.\n"); @@ -1221,7 +1221,7 @@ static int CmdHF14AMfNested(const char *Cmd) { continue; default : - PrintAndLogEx(WARNING, "unknown Error.\n"); + PrintAndLogEx(ERR, "unknown Error.\n"); } free(e_sector); return PM3_ESOFT; @@ -1502,7 +1502,7 @@ static int CmdHF14AMfNestedHard(const char *Cmd) { if (isOK) { switch (isOK) { case 1 : - PrintAndLogEx(WARNING, "Error: No response from Proxmark3.\n"); + PrintAndLogEx(ERR, "Error: No response from Proxmark3.\n"); break; case 2 : PrintAndLogEx(NORMAL, "Button pressed. Aborted.\n"); @@ -2765,7 +2765,7 @@ static int CmdHF14AMfEKeyPrn(const char *Cmd) { PrintAndLogEx(NORMAL, "|---|----------------|----------------|"); for (i = 0; i < numSectors; i++) { if (mfEmlGetMem(data, FirstBlockOfSector(i) + NumBlocksPerSector(i) - 1, 1) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "error get block %d", FirstBlockOfSector(i) + NumBlocksPerSector(i) - 1); + PrintAndLogEx(ERR, "error get block %d", FirstBlockOfSector(i) + NumBlocksPerSector(i) - 1); break; } uint64_t keyA = bytes_to_num(data, 6); @@ -2828,7 +2828,7 @@ static int CmdHF14AMfCSetUID(const char *Cmd) { res = mfCSetUID(uid, (atqaPresent) ? atqa : NULL, (atqaPresent) ? sak : NULL, oldUid, wipeCard); if (res) { - PrintAndLogEx(WARNING, "Can't set UID. error=%d", res); + PrintAndLogEx(ERR, "Can't set UID. error=%d", res); return PM3_ESOFT; } @@ -2858,7 +2858,7 @@ static int CmdHF14AMfCSetBlk(const char *Cmd) { res = mfCSetBlock(blockNo, block, NULL, params); if (res) { - PrintAndLogEx(WARNING, "Can't write block. error=%d", res); + PrintAndLogEx(ERR, "Can't write block. error=%d", res); return PM3_ESOFT; } return PM3_SUCCESS; @@ -2933,7 +2933,7 @@ static int CmdHF14AMfCLoad(const char *Cmd) { // 64 or 256blocks. if (datalen != 1024 && datalen != 4096) { - PrintAndLogEx(WARNING, "File content error. "); + PrintAndLogEx(ERR, "File content error. "); free(data); return PM3_EFILE; } @@ -2972,7 +2972,7 @@ static int CmdHF14AMfCLoad(const char *Cmd) { // 64 or 256blocks. if (blockNum != 16 * 4 && blockNum != 32 * 4 + 8 * 16) { - PrintAndLogEx(WARNING, "File content error. There must be 64 blocks"); + PrintAndLogEx(ERR, "File content error. There must be 64 blocks"); free(data); return PM3_EFILE; } @@ -2994,7 +2994,7 @@ static int CmdHF14AMfCGetBlk(const char *Cmd) { int res = mfCGetBlock(blockNo, data, MAGIC_SINGLE); if (res) { - PrintAndLogEx(WARNING, "Can't read block. error=%d", res); + PrintAndLogEx(ERR, "Can't read block. error=%d", res); return PM3_ESOFT; } @@ -3045,7 +3045,7 @@ static int CmdHF14AMfCGetSc(const char *Cmd) { int res = mfCGetBlock(start + i, data, flags); if (res) { - PrintAndLogEx(WARNING, "Can't read block. %d error=%d", start + i, res); + PrintAndLogEx(ERR, "Can't read block. %d error=%d", start + i, res); return PM3_ESOFT; } PrintAndLogEx(NORMAL, "%3d | %s", start + i, sprint_hex(data, 16)); diff --git a/client/cmdhfmfhard.c b/client/cmdhfmfhard.c index 2b96d8d77..4de46d36a 100644 --- a/client/cmdhfmfhard.c +++ b/client/cmdhfmfhard.c @@ -258,7 +258,7 @@ static void init_bitflip_bitarrays(void) { fseek(statesfile, 0, SEEK_END); int fsize = ftell(statesfile); if (fsize == -1) { - PrintAndLogEx(WARNING, "File read error with %s. Aborting...\n", state_file_name); + PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); fclose(statesfile); exit(5); } @@ -267,7 +267,7 @@ static void init_bitflip_bitarrays(void) { uint8_t input_buffer[filesize]; size_t bytesread = fread(input_buffer, 1, filesize, statesfile); if (bytesread != filesize) { - PrintAndLogEx(WARNING, "File read error with %s. Aborting...\n", state_file_name); + PrintAndLogEx(ERR, "File read error with %s. Aborting...\n", state_file_name); fclose(statesfile); //inflateEnd(&compressed_stream); exit(5); @@ -279,7 +279,7 @@ static void init_bitflip_bitarrays(void) { if ((float)count / (1 << 24) < IGNORE_BITFLIP_THRESHOLD) { uint32_t *bitset = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); if (bitset == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in init_bitflip_statelists(). Aborting...\n"); + PrintAndLogEx(ERR, "Out of memory error in init_bitflip_statelists(). Aborting...\n"); inflateEnd(&compressed_stream); exit(4); } @@ -390,7 +390,7 @@ static void init_part_sum_bitarrays(void) { for (uint16_t part_sum_a0 = 0; part_sum_a0 < NUM_PART_SUMS; part_sum_a0++) { part_sum_a0_bitarrays[odd_even][part_sum_a0] = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); if (part_sum_a0_bitarrays[odd_even][part_sum_a0] == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in init_part_suma0_statelists(). Aborting...\n"); + PrintAndLogEx(ERR, "Out of memory error in init_part_suma0_statelists(). Aborting...\n"); exit(4); } clear_bitarray24(part_sum_a0_bitarrays[odd_even][part_sum_a0]); @@ -410,7 +410,7 @@ static void init_part_sum_bitarrays(void) { for (uint16_t part_sum_a8 = 0; part_sum_a8 < NUM_PART_SUMS; part_sum_a8++) { part_sum_a8_bitarrays[odd_even][part_sum_a8] = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); if (part_sum_a8_bitarrays[odd_even][part_sum_a8] == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in init_part_suma8_statelists(). Aborting...\n"); + PrintAndLogEx(ERR, "Out of memory error in init_part_suma8_statelists(). Aborting...\n"); exit(4); } clear_bitarray24(part_sum_a8_bitarrays[odd_even][part_sum_a8]); @@ -449,7 +449,7 @@ static void init_sum_bitarrays(void) { for (odd_even_t odd_even = EVEN_STATE; odd_even <= ODD_STATE; odd_even++) { sum_a0_bitarrays[odd_even][sum_a0] = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); if (sum_a0_bitarrays[odd_even][sum_a0] == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in init_sum_bitarrays(). Aborting...\n"); + PrintAndLogEx(ERR, "Out of memory error in init_sum_bitarrays(). Aborting...\n"); exit(4); } clear_bitarray24(sum_a0_bitarrays[odd_even][sum_a0]); @@ -564,14 +564,14 @@ static void init_nonce_memory(void) { } nonces[i].states_bitarray[EVEN_STATE] = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); if (nonces[i].states_bitarray[EVEN_STATE] == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in init_nonce_memory(). Aborting...\n"); + PrintAndLogEx(ERR, "Out of memory error in init_nonce_memory(). Aborting...\n"); exit(4); } set_bitarray24(nonces[i].states_bitarray[EVEN_STATE]); nonces[i].num_states_bitarray[EVEN_STATE] = 1 << 24; nonces[i].states_bitarray[ODD_STATE] = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * (1 << 19)); if (nonces[i].states_bitarray[ODD_STATE] == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in init_nonce_memory(). Aborting...\n"); + PrintAndLogEx(ERR, "Out of memory error in init_nonce_memory(). Aborting...\n"); exit(4); } set_bitarray24(nonces[i].states_bitarray[ODD_STATE]); @@ -1048,7 +1048,7 @@ static int read_nonce_file(char *filename) { hardnested_print_progress(0, progress_text, (float)(1LL << 47), 0); size_t bytes_read = fread(read_buf, 1, 6, fnonces); if (bytes_read != 6) { - PrintAndLogEx(WARNING, "File reading error."); + PrintAndLogEx(ERR, "File reading error."); fclose(fnonces); return 1; } @@ -1711,12 +1711,12 @@ static void add_matching_states(statelist_t *candidates, uint8_t part_sum_a0, ui const uint32_t worstcase_size = 1 << 20; candidates->states[odd_even] = (uint32_t *)malloc(sizeof(uint32_t) * worstcase_size); if (candidates->states[odd_even] == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in add_matching_states() - statelist.\n"); + PrintAndLogEx(ERR, "Out of memory error in add_matching_states() - statelist.\n"); exit(4); } uint32_t *candidates_bitarray = (uint32_t *)malloc_bitarray(sizeof(uint32_t) * worstcase_size); if (candidates_bitarray == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in add_matching_states() - bitarray.\n"); + PrintAndLogEx(ERR, "Out of memory error in add_matching_states() - bitarray.\n"); free(candidates->states[odd_even]); exit(4); } @@ -1772,7 +1772,7 @@ static void add_bitflip_candidates(uint8_t byte) { uint32_t worstcase_size = nonces[byte].num_states_bitarray[odd_even] + 1; candidates1->states[odd_even] = (uint32_t *)malloc(sizeof(uint32_t) * worstcase_size); if (candidates1->states[odd_even] == NULL) { - PrintAndLogEx(WARNING, "Out of memory error in add_bitflip_candidates().\n"); + PrintAndLogEx(ERR, "Out of memory error in add_bitflip_candidates().\n"); exit(4); } diff --git a/client/cmdhfmfu.c b/client/cmdhfmfu.c index eb7d26c4f..91e223427 100644 --- a/client/cmdhfmfu.c +++ b/client/cmdhfmfu.c @@ -1232,7 +1232,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { status = ul_read(0, data, sizeof(data)); if (status == -1) { DropField(); - PrintAndLogEx(WARNING, "Error: tag didn't answer to READ"); + PrintAndLogEx(ERR, "Error: tag didn't answer to READ"); return status; } else if (status == 16) { ul_print_default(data); @@ -1248,7 +1248,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { uint8_t ulc_conf[16] = {0x00}; status = ul_read(0x28, ulc_conf, sizeof(ulc_conf)); if (status == -1) { - PrintAndLogEx(WARNING, "Error: tag didn't answer to READ UL-C"); + PrintAndLogEx(ERR, "Error: tag didn't answer to READ UL-C"); DropField(); return status; } @@ -1263,7 +1263,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { status = ul_read(0x2C, ulc_deskey, sizeof(ulc_deskey)); if (status == -1) { DropField(); - PrintAndLogEx(WARNING, "Error: tag didn't answer to READ magic"); + PrintAndLogEx(ERR, "Error: tag didn't answer to READ magic"); return status; } if (status == 16) ulc_print_3deskey(ulc_deskey); @@ -1306,7 +1306,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { uint8_t ulev1_signature[32] = {0x00}; status = ulev1_readSignature(ulev1_signature, sizeof(ulev1_signature)); if (status == -1) { - PrintAndLogEx(WARNING, "Error: tag didn't answer to READ SIGNATURE"); + PrintAndLogEx(ERR, "Error: tag didn't answer to READ SIGNATURE"); DropField(); return status; } @@ -1322,7 +1322,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { uint8_t version[10] = {0x00}; status = ulev1_getVersion(version, sizeof(version)); if (status == -1) { - PrintAndLogEx(WARNING, "Error: tag didn't answer to GETVERSION"); + PrintAndLogEx(ERR, "Error: tag didn't answer to GETVERSION"); DropField(); return status; } else if (status == 10) { @@ -1346,7 +1346,7 @@ static int CmdHF14AMfUInfo(const char *Cmd) { if (startconfigblock) { // if we know where the config block is... status = ul_read(startconfigblock, ulev1_conf, sizeof(ulev1_conf)); if (status == -1) { - PrintAndLogEx(WARNING, "Error: tag didn't answer to READ EV1"); + PrintAndLogEx(ERR, "Error: tag didn't answer to READ EV1"); DropField(); return status; } else if (status == 16) { @@ -2134,7 +2134,7 @@ static int CmdHF14AMfURestore(const char *Cmd) { long fsize = ftell(f); fseek(f, 0, SEEK_SET); if (fsize <= 0) { - PrintAndLogEx(WARNING, "Error, when getting filesize"); + PrintAndLogEx(ERR, "Error, when getting filesize"); fclose(f); return 1; } @@ -2150,7 +2150,7 @@ static int CmdHF14AMfURestore(const char *Cmd) { size_t bytes_read = fread(dump, 1, fsize, f); fclose(f); if (bytes_read < MFU_DUMP_PREFIX_LENGTH) { - PrintAndLogEx(WARNING, "Error, dump file is too small"); + PrintAndLogEx(ERR, "Error, dump file is too small"); free(dump); return 1; } @@ -2167,7 +2167,7 @@ static int CmdHF14AMfURestore(const char *Cmd) { uint8_t pages = (bytes_read - MFU_DUMP_PREFIX_LENGTH) / 4; if (pages - 1 != mem->pages) { - PrintAndLogEx(WARNING, "Error, invalid dump, wrong page count"); + PrintAndLogEx(ERR, "Error, invalid dump, wrong page count"); free(dump); return 1; } diff --git a/client/cmdhftopaz.c b/client/cmdhftopaz.c index 2b743a574..d604d4baf 100644 --- a/client/cmdhftopaz.c +++ b/client/cmdhftopaz.c @@ -321,7 +321,7 @@ static void topaz_print_control_TLVs(uint8_t *memory) { static int topaz_read_dynamic_data(void) { // first read the remaining block of segment 0 if (topaz_read_block(topaz_tag.uid, 0x0f, &topaz_tag.dynamic_memory[0]) == -1) { - PrintAndLogEx(WARNING, "Error while reading dynamic memory block %02x. Aborting...", 0x0f); + PrintAndLogEx(ERR, "Error while reading dynamic memory block %02x. Aborting...", 0x0f); return -1; } @@ -329,7 +329,7 @@ static int topaz_read_dynamic_data(void) { uint8_t max_segment = topaz_tag.size / 128 - 1; for (uint8_t segment = 1; segment <= max_segment; segment++) { if (topaz_read_segment(topaz_tag.uid, segment, &topaz_tag.dynamic_memory[(segment - 1) * 128 + 8]) == -1) { - PrintAndLogEx(WARNING, "Error while reading dynamic memory block %02x. Aborting...", 0x0f); + PrintAndLogEx(ERR, "Error while reading dynamic memory block %02x. Aborting...", 0x0f); return -1; } } @@ -381,7 +381,7 @@ static int CmdHFTopazReader(const char *Cmd) { status = topaz_select(atqa, rid_response); if (status == -1) { - if (verbose) PrintAndLogEx(WARNING, "Error: couldn't receive ATQA"); + if (verbose) PrintAndLogEx(ERR, "Error: couldn't receive ATQA"); return -1; } @@ -393,7 +393,7 @@ static int CmdHFTopazReader(const char *Cmd) { } if (status == -2) { - PrintAndLogEx(WARNING, "Error: tag didn't answer to RID"); + PrintAndLogEx(ERR, "Error: tag didn't answer to RID"); topaz_switch_off_field(); return -1; } @@ -411,7 +411,7 @@ static int CmdHFTopazReader(const char *Cmd) { status = topaz_rall(uid_echo, rall_response); if (status == -1) { - PrintAndLogEx(WARNING, "Error: tag didn't answer to RALL"); + PrintAndLogEx(ERR, "Error: tag didn't answer to RALL"); topaz_switch_off_field(); return -1; } diff --git a/client/cmdlf.c b/client/cmdlf.c index 389e76ca9..42b26be0d 100644 --- a/client/cmdlf.c +++ b/client/cmdlf.c @@ -573,7 +573,7 @@ int CmdLFfskSim(const char *Cmd) { dataLen = hextobinarray((char *)data, hexData); if (dataLen == 0) errors = true; - if (errors) PrintAndLogEx(WARNING, "Error getting hex data"); + if (errors) PrintAndLogEx(ERR, "Error getting hex data"); cmdp += 2; break; default: @@ -685,7 +685,7 @@ int CmdLFaskSim(const char *Cmd) { dataLen = hextobinarray((char *)data, hexData); if (dataLen == 0) errors = true; - if (errors) PrintAndLogEx(WARNING, "Error getting hex data, datalen: %d", dataLen); + if (errors) PrintAndLogEx(ERR, "Error getting hex data, datalen: %d", dataLen); cmdp += 2; break; default: @@ -788,7 +788,7 @@ int CmdLFpskSim(const char *Cmd) { dataLen = hextobinarray((char *)data, hexData); if (dataLen == 0) errors = true; - if (errors) PrintAndLogEx(WARNING, "Error getting hex data"); + if (errors) PrintAndLogEx(ERR, "Error getting hex data"); cmdp += 2; break; default: diff --git a/client/cmdlfawid.c b/client/cmdlfawid.c index 1c2d96004..386d14e5e 100644 --- a/client/cmdlfawid.c +++ b/client/cmdlfawid.c @@ -103,7 +103,7 @@ static int sendTry(uint8_t fmtlen, uint32_t fc, uint32_t cn, uint32_t delay, uin PrintAndLogEx(INFO, "Trying FC: %u; CN: %u", fc, cn); if (getAWIDBits(fmtlen, fc, cn, bits) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -333,7 +333,7 @@ static int CmdAWIDSim(const char *Cmd) { verify_values(&fmtlen, &fc, &cn); if (getAWIDBits(fmtlen, fc, cn, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -388,7 +388,7 @@ static int CmdAWIDClone(const char *Cmd) { verify_values(&fmtlen, &fc, &cn); if (getAWIDBits(fmtlen, fc, cn, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -419,7 +419,7 @@ static int CmdAWIDClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } diff --git a/client/cmdlfem4x.c b/client/cmdlfem4x.c index ce9a9ea0a..aaf8c0db4 100644 --- a/client/cmdlfem4x.c +++ b/client/cmdlfem4x.c @@ -482,12 +482,12 @@ static int CmdEM410xBrute(const char *Cmd) { int filelen = param_getstr(Cmd, 0, filename, FILE_PATH_SIZE); if (filelen == 0) { - PrintAndLogEx(WARNING, "Error: Please specify a filename"); + PrintAndLogEx(ERR, "Error: Please specify a filename"); return PM3_EINVARG; } if ((f = fopen(filename, "r")) == NULL) { - PrintAndLogEx(WARNING, "Error: Could not open UIDs file ["_YELLOW_("%s")"]", filename); + PrintAndLogEx(ERR, "Error: Could not open UIDs file ["_YELLOW_("%s")"]", filename); return PM3_EFILE; } @@ -613,21 +613,21 @@ static int CmdEM410xWrite(const char *Cmd) { // Check ID if (id == 0xFFFFFFFFFFFFFFFF) { - PrintAndLogEx(WARNING, "Error! ID is required.\n"); + PrintAndLogEx(ERR, "Error! ID is required.\n"); return PM3_EINVARG; } if (id >= 0x10000000000) { - PrintAndLogEx(WARNING, "Error! Given EM410x ID is longer than 40 bits.\n"); + PrintAndLogEx(ERR, "Error! Given EM410x ID is longer than 40 bits.\n"); return PM3_EINVARG; } // Check Card if (card == 0xFF) { - PrintAndLogEx(WARNING, "Error! Card type required.\n"); + PrintAndLogEx(ERR, "Error! Card type required.\n"); return PM3_EINVARG; } if (card < 0) { - PrintAndLogEx(WARNING, "Error! Bad card type selected.\n"); + PrintAndLogEx(ERR, "Error! Bad card type selected.\n"); return PM3_EINVARG; } @@ -637,7 +637,7 @@ static int CmdEM410xWrite(const char *Cmd) { // Allowed clock rates: 16, 32, 40 and 64 if ((clock1 != 16) && (clock1 != 32) && (clock1 != 64) && (clock1 != 40)) { - PrintAndLogEx(WARNING, "Error! Clock rate" _YELLOW_("%d")" not valid. Supported clock rates are 16, 32, 40 and 64.\n", clock1); + PrintAndLogEx(ERR, "Error! Clock rate" _YELLOW_("%d")" not valid. Supported clock rates are 16, 32, 40 and 64.\n", clock1); return PM3_EINVARG; } @@ -837,7 +837,7 @@ int EM4x50Read(const char *Cmd, bool verbose) { } } if (!clk) { - if (verbose || g_debugMode) PrintAndLogEx(WARNING, "Error: EM4x50 - didn't find a clock"); + if (verbose || g_debugMode) PrintAndLogEx(ERR, "Error: EM4x50 - didn't find a clock"); return PM3_ESOFT; } } else tol = clk / 8; @@ -1262,7 +1262,7 @@ static int CmdEM4x05Write(const char *Cmd) { SendCommandNG(CMD_EM4X_WRITE_WORD, (uint8_t *)&payload, sizeof(payload)); PacketResponseNG resp; if (!WaitForResponseTimeout(CMD_EM4X_WRITE_WORD, &resp, 2000)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } diff --git a/client/cmdlffdx.c b/client/cmdlffdx.c index 8cf93b12f..35f3216ad 100644 --- a/client/cmdlffdx.c +++ b/client/cmdlffdx.c @@ -264,7 +264,7 @@ static int CmdFdxClone(const char *Cmd) { // getFDXBits(uint64_t national_id, uint16_t country, uint8_t isanimal, uint8_t isextended, uint32_t extended, uint8_t *bits) if (getFDXBits(animalid, countryid, 1, 0, 0, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -300,7 +300,7 @@ static int CmdFdxClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } diff --git a/client/cmdlfguard.c b/client/cmdlfguard.c index 54073fc02..1b09eb18d 100644 --- a/client/cmdlfguard.c +++ b/client/cmdlfguard.c @@ -155,7 +155,7 @@ static int CmdGuardClone(const char *Cmd) { cardnumber = (cn & 0x0000FFFF); if (getGuardBits(fmtlen, facilitycode, cardnumber, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -189,7 +189,7 @@ static int CmdGuardClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } @@ -213,7 +213,7 @@ static int CmdGuardSim(const char *Cmd) { cardnumber = (cn & 0x0000FFFF); if (getGuardBits(fmtlen, facilitycode, cardnumber, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } diff --git a/client/cmdlfhitag.c b/client/cmdlfhitag.c index 47e08eb2e..69ba874c1 100644 --- a/client/cmdlfhitag.c +++ b/client/cmdlfhitag.c @@ -177,7 +177,7 @@ static int CmdLFHitagList(const char *Cmd) { if (strlen(filename) > 0) { f = fopen(filename, "wb"); if (!f) { - PrintAndLogEx(WARNING, "Error: Could not open file [%s]", filename); + PrintAndLogEx(ERR, "Error: Could not open file [%s]", filename); return PM3_EFILE; } } diff --git a/client/cmdlfio.c b/client/cmdlfio.c index ad37b9fd7..d187daaab 100644 --- a/client/cmdlfio.c +++ b/client/cmdlfio.c @@ -199,7 +199,7 @@ static int CmdIOProxSim(const char *Cmd) { PrintAndLogEx(SUCCESS, "Press pm3-button to abort simulation or run another command"); if (getIOProxBits(version, fc, cn, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } // IOProx uses: fcHigh: 10, fcLow: 8, clk: 64, invert: 1 @@ -249,7 +249,7 @@ static int CmdIOProxClone(const char *Cmd) { } if (getIOProxBits(version, fc, cn, bits) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } diff --git a/client/cmdlfjablotron.c b/client/cmdlfjablotron.c index a5b9166ac..c2478705c 100644 --- a/client/cmdlfjablotron.c +++ b/client/cmdlfjablotron.c @@ -145,7 +145,7 @@ static int CmdJablotronClone(const char *Cmd) { } if (getJablotronBits(fullcode, bits) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -174,7 +174,7 @@ static int CmdJablotronClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } diff --git a/client/cmdlfkeri.c b/client/cmdlfkeri.c index 82d1b9f84..b3761055f 100644 --- a/client/cmdlfkeri.c +++ b/client/cmdlfkeri.c @@ -164,7 +164,7 @@ static int CmdKeriClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } diff --git a/client/cmdlfnedap.c b/client/cmdlfnedap.c index d081ff56c..0b998d716 100644 --- a/client/cmdlfnedap.c +++ b/client/cmdlfnedap.c @@ -182,7 +182,7 @@ static int CmdLFNedapClone(const char *Cmd) { cardnumber = (cn & 0x00FFFFFF); if ( getNedapBits(cardnumber, bits) == PM3_SUCCESS ) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -220,7 +220,7 @@ static int CmdLFNedapClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } @@ -243,7 +243,7 @@ static int CmdLFNedapSim(const char *Cmd) { memset(bs, 0x00, sizeof(bs)); if (getNedapBits(cardnumber, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } diff --git a/client/cmdlfnoralsy.c b/client/cmdlfnoralsy.c index 9e3413405..34ad1023f 100644 --- a/client/cmdlfnoralsy.c +++ b/client/cmdlfnoralsy.c @@ -142,7 +142,7 @@ static int CmdNoralsyClone(const char *Cmd) { blocks[0] = T5555_MODULATION_MANCHESTER | T5555_SET_BITRATE(32) | T5555_ST_TERMINATOR | 3 << T5555_MAXBLOCK_SHIFT; if (getnoralsyBits(id, year, bits) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -172,7 +172,7 @@ static int CmdNoralsyClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } @@ -195,7 +195,7 @@ static int CmdNoralsySim(const char *Cmd) { year = param_get32ex(Cmd, 1, 2000, 10); if (getnoralsyBits(id, year, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } diff --git a/client/cmdlfparadox.c b/client/cmdlfparadox.c index 684730ef3..c5c022d9b 100644 --- a/client/cmdlfparadox.c +++ b/client/cmdlfparadox.c @@ -128,7 +128,7 @@ static int CmdParadoxSim(const char *Cmd) { cardnumber = (cn & 0x0000FFFF); // if ( GetParadoxBits(facilitycode, cardnumber, bs) != PM3_SUCCESS) { - // PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + // PrintAndLogEx(ERR, "Error with tag bitstream generation."); // return 1; // } diff --git a/client/cmdlfpresco.c b/client/cmdlfpresco.c index a51155e78..3f1ce71f3 100644 --- a/client/cmdlfpresco.c +++ b/client/cmdlfpresco.c @@ -138,7 +138,7 @@ static int CmdPrescoClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } diff --git a/client/cmdlfpyramid.c b/client/cmdlfpyramid.c index 91b895bcb..4e5588ec6 100644 --- a/client/cmdlfpyramid.c +++ b/client/cmdlfpyramid.c @@ -212,7 +212,7 @@ static int CmdPyramidClone(const char *Cmd) { cardnumber = (cn & 0x0000FFFF); if (getPyramidBits(facilitycode, cardnumber, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } @@ -249,7 +249,7 @@ static int CmdPyramidClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } @@ -272,7 +272,7 @@ static int CmdPyramidSim(const char *Cmd) { cardnumber = (cn & 0x0000FFFF); if (getPyramidBits(facilitycode, cardnumber, bs) != PM3_SUCCESS) { - PrintAndLogEx(WARNING, "Error with tag bitstream generation."); + PrintAndLogEx(ERR, "Error with tag bitstream generation."); return PM3_ESOFT; } diff --git a/client/cmdlft55xx.c b/client/cmdlft55xx.c index b1c03b514..07285053b 100644 --- a/client/cmdlft55xx.c +++ b/client/cmdlft55xx.c @@ -1103,7 +1103,7 @@ static int CmdT55xxWriteBlock(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, 2000)) { - PrintAndLogEx(WARNING, "Error occurred, device did not ACK write operation. (May be due to old firmware)"); + PrintAndLogEx(ERR, "Error occurred, device did not ACK write operation. (May be due to old firmware)"); return PM3_ETIMEOUT; } return PM3_SUCCESS; @@ -1829,13 +1829,13 @@ static int CmdT55xxWipe(const char *Cmd) { else snprintf(ptrData, sizeof(writeData), "b 0 d 000880E0 p 0"); - if (CmdT55xxWriteBlock(ptrData) != PM3_SUCCESS) PrintAndLogEx(WARNING, "Error writing blk 0"); + if (CmdT55xxWriteBlock(ptrData) != PM3_SUCCESS) PrintAndLogEx(ERR, "Error writing blk 0"); for (uint8_t blk = 1; blk < 8; blk++) { snprintf(ptrData, sizeof(writeData), "b %d d 0", blk); - if (CmdT55xxWriteBlock(ptrData) != PM3_SUCCESS) PrintAndLogEx(WARNING, "Error writing blk %d", blk); + if (CmdT55xxWriteBlock(ptrData) != PM3_SUCCESS) PrintAndLogEx(ERR, "Error writing blk %d", blk); memset(writeData, 0x00, sizeof(writeData)); } @@ -1919,7 +1919,7 @@ static int CmdT55xxChkPwds(const char *Cmd) { // TODO, a way of reallocating memory if file was larger keyBlock = calloc(4 * 200, sizeof(uint8_t)); if (keyBlock == NULL) { - PrintAndLogDevice(WARNING, "error, cannot allocate memory "); + PrintAndLogDevice(ERR, "error, cannot allocate memory "); return PM3_ESOFT; } diff --git a/client/cmdlfti.c b/client/cmdlfti.c index 3baa8c2e6..b37a6fdc1 100644 --- a/client/cmdlfti.c +++ b/client/cmdlfti.c @@ -233,7 +233,7 @@ static int CmdTIDemod(const char *Cmd) { // only 15 bits compare, last bit of ident is not valid if ((shift3 ^ shift0) & 0x7FFF) { - PrintAndLogEx(WARNING, "Error: Ident mismatch!"); + PrintAndLogEx(ERR, "Error: Ident mismatch!"); } // WARNING the order of the bytes in which we calc crc below needs checking // i'm 99% sure the crc algorithm is correct, but it may need to eat the @@ -257,7 +257,7 @@ static int CmdTIDemod(const char *Cmd) { PrintAndLogEx(INFO, "Tag data = %08X%08X [Crc %04X %s]", shift1, shift0, crc, crcStr); if (crc != (shift2 & 0xFFFF)) - PrintAndLogEx(WARNING, "Error: CRC mismatch, calculated %04X, got %04X", crc, shift2 & 0xFFFF); + PrintAndLogEx(ERR, "Error: CRC mismatch, calculated %04X, got %04X", crc, shift2 & 0xFFFF); retval = PM3_SUCCESS; goto out; diff --git a/client/cmdlfviking.c b/client/cmdlfviking.c index 750070a34..41193ea12 100644 --- a/client/cmdlfviking.c +++ b/client/cmdlfviking.c @@ -91,7 +91,7 @@ static int CmdVikingClone(const char *Cmd) { SendCommandMIX(CMD_VIKING_CLONE_TAG, rawID >> 32, rawID & 0xFFFFFFFF, Q5, NULL, 0); PacketResponseNG resp; if (!WaitForResponseTimeout(CMD_ACK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } return PM3_SUCCESS; diff --git a/client/cmdlfvisa2000.c b/client/cmdlfvisa2000.c index b717f65dd..12d4ba1c6 100644 --- a/client/cmdlfvisa2000.c +++ b/client/cmdlfvisa2000.c @@ -186,7 +186,7 @@ static int CmdVisa2kClone(const char *Cmd) { SendCommandNG(CMD_T55XX_WRITE_BLOCK, (uint8_t *)&ng, sizeof(ng)); if (!WaitForResponseTimeout(CMD_T55XX_WRITE_BLOCK, &resp, T55XX_WRITE_TIMEOUT)) { - PrintAndLogEx(WARNING, "Error occurred, device did not respond during write operation."); + PrintAndLogEx(ERR, "Error occurred, device did not respond during write operation."); return PM3_ETIMEOUT; } } diff --git a/client/cmdsmartcard.c b/client/cmdsmartcard.c index f936f10a9..f7a0b4ca4 100644 --- a/client/cmdsmartcard.c +++ b/client/cmdsmartcard.c @@ -284,7 +284,7 @@ static int PrintATR(uint8_t *atr, size_t atrlen) { vxor ^= atr[i]; if (vxor) - PrintAndLogEx(WARNING, "Check sum error. Must be 0 got 0x%02X", vxor); + PrintAndLogEx(ERR, "Check sum error. Must be 0 got 0x%02X", vxor); else PrintAndLogEx(INFO, "Check sum OK."); } @@ -568,14 +568,14 @@ static int CmdSmartUpgrade(const char *Cmd) { fseek(f, 0, SEEK_SET); if (fsize <= 0) { - PrintAndLogEx(WARNING, "error, when getting filesize"); + PrintAndLogEx(ERR, "error, when getting filesize"); fclose(f); return 1; } uint8_t *dump = calloc(fsize, sizeof(uint8_t)); if (!dump) { - PrintAndLogEx(WARNING, "error, cannot allocate memory "); + PrintAndLogEx(ERR, "error, cannot allocate memory "); fclose(f); return 1; } diff --git a/client/comms.c b/client/comms.c index 6fd41ecad..dad7c1640 100644 --- a/client/comms.c +++ b/client/comms.c @@ -359,7 +359,7 @@ __attribute__((force_align_arg_pointer)) res = uart_receive(sp, (uint8_t *)&rx_raw.data, length, &rxlen); if ((res != PM3_SUCCESS) || (rxlen != length)) { - PrintAndLogEx(WARNING, "Received packet frame error variable part too short? %d/%d", rxlen, length); + PrintAndLogEx(ERR, "Received packet frame error variable part too short? %d/%d", rxlen, length); error = true; } else { @@ -392,7 +392,7 @@ __attribute__((force_align_arg_pointer)) if (!error) { // Get the postamble res = uart_receive(sp, (uint8_t *)&rx_raw.foopost, sizeof(PacketResponseNGPostamble), &rxlen); if ((res != PM3_SUCCESS) || (rxlen != sizeof(PacketResponseNGPostamble))) { - PrintAndLogEx(WARNING, "Received packet frame error fetching postamble"); + PrintAndLogEx(ERR, "Received packet frame error fetching postamble"); error = true; } } @@ -402,7 +402,7 @@ __attribute__((force_align_arg_pointer)) uint8_t first, second; compute_crc(CRC_14443_A, (uint8_t *)&rx_raw, sizeof(PacketResponseNGPreamble) + length, &first, &second); if ((first << 8) + second != rx.crc) { - PrintAndLogEx(WARNING, "Received packet frame CRC error %02X%02X <> %04X", first, second, rx.crc); + PrintAndLogEx(ERR, "Received packet frame CRC error %02X%02X <> %04X", first, second, rx.crc); error = true; } } @@ -424,7 +424,7 @@ __attribute__((force_align_arg_pointer)) res = uart_receive(sp, ((uint8_t *)&rx_old) + sizeof(PacketResponseNGPreamble), sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble), &rxlen); if ((res != PM3_SUCCESS) || (rxlen != sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble))) { - PrintAndLogEx(WARNING, "Received packet OLD frame payload error too short? %d/%d", rxlen, sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble)); + PrintAndLogEx(ERR, "Received packet OLD frame payload error too short? %d/%d", rxlen, sizeof(PacketResponseOLD) - sizeof(PacketResponseNGPreamble)); error = true; } if (!error) { diff --git a/client/emv/cmdemv.c b/client/emv/cmdemv.c index 22fdea153..0585c1661 100644 --- a/client/emv/cmdemv.c +++ b/client/emv/cmdemv.c @@ -931,7 +931,7 @@ static int CmdEMVExec(const char *Cmd) { while (AFL && AFL->len) { if (AFL->len % 4) { - PrintAndLogEx(WARNING, "Error: Wrong AFL length: %d", AFL->len); + PrintAndLogEx(ERR, "Error: Wrong AFL length: %d", AFL->len); break; } @@ -952,7 +952,7 @@ static int CmdEMVExec(const char *Cmd) { res = EMVReadRecord(channel, true, SFI, n, buf, sizeof(buf), &len, &sw, tlvRoot); if (res) { - PrintAndLogEx(WARNING, "Error SFI[%02x]. APDU error %4x", SFI, sw); + PrintAndLogEx(ERR, "Error SFI[%02x]. APDU error %4x", SFI, sw); continue; } @@ -972,7 +972,7 @@ static int CmdEMVExec(const char *Cmd) { memcpy(&ODAiList[ODAiListLen], &buf[len - elmlen], elmlen); ODAiListLen += elmlen; } else { - PrintAndLogEx(WARNING, "Error SFI[%02x]. Creating input list for Offline Data Authentication error.", SFI); + PrintAndLogEx(ERR, "Error SFI[%02x]. Creating input list for Offline Data Authentication error.", SFI); } } else { memcpy(&ODAiList[ODAiListLen], buf, len); @@ -1051,7 +1051,7 @@ static int CmdEMVExec(const char *Cmd) { } } else { - PrintAndLogEx(WARNING, "Error AC: Application Transaction Counter (ATC) not found."); + PrintAndLogEx(ERR, "Error AC: Application Transaction Counter (ATC) not found."); } } } @@ -1131,14 +1131,14 @@ static int CmdEMVExec(const char *Cmd) { PrintAndLogEx(NORMAL, "Transaction approved ONLINE."); break; default: - PrintAndLogEx(WARNING, "Error: CID transaction code error %2x", CID->value[0] & EMVAC_AC_MASK); + PrintAndLogEx(ERR, "Error: CID transaction code error %2x", CID->value[0] & EMVAC_AC_MASK); break; } } else { - PrintAndLogEx(WARNING, "Error: Wrong CID length %d", CID->len); + PrintAndLogEx(ERR, "Error: Wrong CID length %d", CID->len); } } else { - PrintAndLogEx(WARNING, "Error: CID(9F27) not found."); + PrintAndLogEx(ERR, "Error: CID(9F27) not found."); } } diff --git a/client/emv/emvcore.c b/client/emv/emvcore.c index e9e725448..e7bda4be5 100644 --- a/client/emv/emvcore.c +++ b/client/emv/emvcore.c @@ -511,7 +511,7 @@ int EMVSearchPSE(EMVCommandChannel channel, bool ActivateField, bool LeaveFieldO PrintAndLogEx(WARNING, "%s ERROR: Can't get TLV from response.", PSE_or_PPSE); } } else { - PrintAndLogEx(WARNING, "%s ERROR: Can't select PPSE AID. Error: %d", PSE_or_PPSE, res); + PrintAndLogEx(ERR, "%s ERROR: Can't select PPSE AID. Error: %d", PSE_or_PPSE, res); } if (!LeaveFieldON) @@ -654,14 +654,14 @@ int trSDA(struct tlvdb *tlv) { struct emv_pk *pk = get_ca_pk(tlv); if (!pk) { - PrintAndLogEx(WARNING, "Error: Key not found. Exit."); + PrintAndLogEx(ERR, "Error: Key not found. Exit."); return 2; } struct emv_pk *issuer_pk = emv_pki_recover_issuer_cert(pk, tlv); if (!issuer_pk) { emv_pk_free(pk); - PrintAndLogEx(WARNING, "Error: Issuer certificate not found. Exit."); + PrintAndLogEx(ERR, "Error: Issuer certificate not found. Exit."); return 2; } @@ -693,7 +693,7 @@ int trSDA(struct tlvdb *tlv) { } else { emv_pk_free(issuer_pk); emv_pk_free(pk); - PrintAndLogEx(WARNING, "SSAD verify error"); + PrintAndLogEx(ERR, "SSAD verify error"); return 4; } @@ -712,21 +712,21 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { struct emv_pk *pk = get_ca_pk(tlv); if (!pk) { - PrintAndLogEx(WARNING, "Error: Key not found. Exit."); + PrintAndLogEx(ERR, "Error: Key not found. Exit."); return 2; } const struct tlv *sda_tlv = tlvdb_get(tlv, 0x21, NULL); /* if (!sda_tlv || sda_tlv->len < 1) { it may be 0!!!! emv_pk_free(pk); - PrintAndLogEx(WARNING, "Error: Can't find input list for Offline Data Authentication. Exit."); + PrintAndLogEx(ERR, "Error: Can't find input list for Offline Data Authentication. Exit."); return 3; } */ struct emv_pk *issuer_pk = emv_pki_recover_issuer_cert(pk, tlv); if (!issuer_pk) { emv_pk_free(pk); - PrintAndLogEx(WARNING, "Error: Issuer certificate not found. Exit."); + PrintAndLogEx(ERR, "Error: Issuer certificate not found. Exit."); return 2; } PrintAndLogEx(SUCCESS, "Issuer PK recovered. RID %02hhx:%02hhx:%02hhx:%02hhx:%02hhx IDX %02hhx CSN %02hhx:%02hhx:%02hhx\n", @@ -745,7 +745,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { if (!icc_pk) { emv_pk_free(pk); emv_pk_free(issuer_pk); - PrintAndLogEx(WARNING, "Error: ICC certificate not found. Exit."); + PrintAndLogEx(ERR, "Error: ICC certificate not found. Exit."); return 2; } PrintAndLogEx(SUCCESS, "ICC PK recovered. RID %02hhx:%02hhx:%02hhx:%02hhx:%02hhx IDX %02hhx CSN %02hhx:%02hhx:%02hhx\n", @@ -763,7 +763,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { if (tlvdb_get(tlv, 0x9f2d, NULL)) { struct emv_pk *icc_pe_pk = emv_pki_recover_icc_pe_cert(issuer_pk, tlv); if (!icc_pe_pk) { - PrintAndLogEx(WARNING, "WARNING: ICC PE PK recover error. "); + PrintAndLogEx(ERR, "WARNING: ICC PE PK recover error. "); } else { PrintAndLogEx(SUCCESS, "ICC PE PK recovered. RID %02hhx:%02hhx:%02hhx:%02hhx:%02hhx IDX %02hhx CSN %02hhx:%02hhx:%02hhx\n", icc_pe_pk->rid[0], @@ -790,7 +790,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { const struct tlvdb *atc_db = emv_pki_recover_atc_ex(icc_pk, tlv, true); if (!atc_db) { - PrintAndLogEx(WARNING, "Error: Can't recover IDN (ICC Dynamic Number)"); + PrintAndLogEx(ERR, "Error: Can't recover IDN (ICC Dynamic Number)"); emv_pk_free(pk); emv_pk_free(issuer_pk); emv_pk_free(icc_pk); @@ -807,7 +807,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { PrintAndLogEx(SUCCESS, "ATC check OK."); PrintAndLogEx(SUCCESS, "fDDA (fast DDA) verified OK."); } else { - PrintAndLogEx(WARNING, "Error: fDDA verified, but ATC in the certificate and ATC in the record not the same."); + PrintAndLogEx(ERR, "Error: fDDA verified, but ATC in the certificate and ATC in the record not the same."); } } else { PrintAndLogEx(NORMAL, "\nERROR: fDDA (fast DDA) verify error"); @@ -823,7 +823,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { PrintAndLogEx(NORMAL, "SDAD verified OK. (Data Authentication Code: %02hhx:%02hhx)\n", dac_tlv->value[0], dac_tlv->value[1]); tlvdb_add(tlv, dac_db); } else { - PrintAndLogEx(WARNING, "Error: SSAD verify error"); + PrintAndLogEx(ERR, "Error: SSAD verify error"); emv_pk_free(pk); emv_pk_free(issuer_pk); emv_pk_free(icc_pk); @@ -839,7 +839,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { struct tlv *ddol_data_tlv = dol_process(ddol_tlv, tlv, 0); if (!ddol_data_tlv) { - PrintAndLogEx(WARNING, "Error: Can't create DDOL TLV"); + PrintAndLogEx(ERR, "Error: Can't create DDOL TLV"); emv_pk_free(pk); emv_pk_free(issuer_pk); emv_pk_free(icc_pk); @@ -851,7 +851,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { PrintAndLogEx(NORMAL, "\n* Internal Authenticate"); int res = EMVInternalAuthenticate(channel, true, (uint8_t *)ddol_data_tlv->value, ddol_data_tlv->len, buf, sizeof(buf), &len, &sw, NULL); if (res) { - PrintAndLogEx(WARNING, "Internal Authenticate error(%d): %4x. Exit...", res, sw); + PrintAndLogEx(ERR, "Internal Authenticate error(%d): %4x. Exit...", res, sw); free(ddol_data_tlv); emv_pk_free(pk); emv_pk_free(issuer_pk); @@ -862,7 +862,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { struct tlvdb *dda_db = NULL; if (buf[0] == 0x80) { if (len < 3) { - PrintAndLogEx(WARNING, "Error: Internal Authenticate format1 parsing error. length=%d", len); + PrintAndLogEx(ERR, "Error: Internal Authenticate format1 parsing error. length=%d", len); } else { // parse response 0x80 struct tlvdb *t80 = tlvdb_parse_multi(buf, len); @@ -882,7 +882,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { } else { dda_db = tlvdb_parse_multi(buf, len); if (!dda_db) { - PrintAndLogEx(WARNING, "Error: Can't parse Internal Authenticate result as TLV"); + PrintAndLogEx(ERR, "Error: Can't parse Internal Authenticate result as TLV"); free(ddol_data_tlv); emv_pk_free(pk); emv_pk_free(issuer_pk); @@ -898,7 +898,7 @@ int trDDA(EMVCommandChannel channel, bool decodeTLV, struct tlvdb *tlv) { struct tlvdb *idn_db = emv_pki_recover_idn_ex(icc_pk, dda_db, ddol_data_tlv, true); free(ddol_data_tlv); if (!idn_db) { - PrintAndLogEx(WARNING, "Error: Can't recover IDN (ICC Dynamic Number)"); + PrintAndLogEx(ERR, "Error: Can't recover IDN (ICC Dynamic Number)"); tlvdb_free(dda_db); emv_pk_free(pk); emv_pk_free(issuer_pk); @@ -935,20 +935,20 @@ int trCDA(struct tlvdb *tlv, struct tlvdb *ac_tlv, struct tlv *pdol_data_tlv, st struct emv_pk *pk = get_ca_pk(tlv); if (!pk) { - PrintAndLogEx(WARNING, "Error: Key not found. Exit."); + PrintAndLogEx(ERR, "Error: Key not found. Exit."); return 2; } const struct tlv *sda_tlv = tlvdb_get(tlv, 0x21, NULL); if (!sda_tlv || sda_tlv->len < 1) { - PrintAndLogEx(WARNING, "Error: Can't find input list for Offline Data Authentication. Exit."); + PrintAndLogEx(ERR, "Error: Can't find input list for Offline Data Authentication. Exit."); emv_pk_free(pk); return 3; } struct emv_pk *issuer_pk = emv_pki_recover_issuer_cert(pk, tlv); if (!issuer_pk) { - PrintAndLogEx(WARNING, "Error: Issuer certificate not found. Exit."); + PrintAndLogEx(ERR, "Error: Issuer certificate not found. Exit."); emv_pk_free(pk); return 2; } @@ -966,7 +966,7 @@ int trCDA(struct tlvdb *tlv, struct tlvdb *ac_tlv, struct tlv *pdol_data_tlv, st struct emv_pk *icc_pk = emv_pki_recover_icc_cert(issuer_pk, tlv, sda_tlv); if (!icc_pk) { - PrintAndLogEx(WARNING, "Error: ICC certificate not found. Exit."); + PrintAndLogEx(ERR, "Error: ICC certificate not found. Exit."); emv_pk_free(pk); emv_pk_free(issuer_pk); return 2; @@ -989,7 +989,7 @@ int trCDA(struct tlvdb *tlv, struct tlvdb *ac_tlv, struct tlv *pdol_data_tlv, st PrintAndLogEx(NORMAL, "SSAD verified OK. (%02hhx:%02hhx)", dac_tlv->value[0], dac_tlv->value[1]); tlvdb_add(tlv, dac_db); } else { - PrintAndLogEx(WARNING, "Error: SSAD verify error"); + PrintAndLogEx(ERR, "Error: SSAD verify error"); emv_pk_free(pk); emv_pk_free(issuer_pk); emv_pk_free(icc_pk); diff --git a/client/fido/fidocore.c b/client/fido/fidocore.c index c356c3456..21079eb34 100644 --- a/client/fido/fidocore.c +++ b/client/fido/fidocore.c @@ -386,7 +386,7 @@ static int FIDO2CheckSignature(json_t *root, uint8_t *publickey, uint8_t *sign, if (res == -0x4e00) { PrintAndLogEx(WARNING, "Signature is NOT VALID."); } else { - PrintAndLogEx(WARNING, "Other signature check error: %x %s", (res < 0) ? -res : res, ecdsa_get_error(res)); + PrintAndLogEx(ERR, "Other signature check error: %x %s", (res < 0) ? -res : res, ecdsa_get_error(res)); } return res; } else { diff --git a/client/loclass/elite_crack.c b/client/loclass/elite_crack.c index a461557b1..3e0aa1dc5 100644 --- a/client/loclass/elite_crack.c +++ b/client/loclass/elite_crack.c @@ -517,7 +517,7 @@ int bruteforceDump(uint8_t dump[], size_t dumpsize, uint16_t keytable[]) { first16bytes[i] = keytable[i] & 0xFF; if (!(keytable[i] & CRACKED)) - PrintAndLogDevice(WARNING, "error, we are missing byte %d, custom key calculation will fail...", i); + PrintAndLogDevice(ERR, "error, we are missing byte %d, custom key calculation will fail...", i); } errors += calculateMasterKey(first16bytes, NULL); return errors; @@ -541,7 +541,7 @@ int bruteforceFile(const char *filename, uint16_t keytable[]) { fseek(f, 0, SEEK_SET); if (fsize <= 0) { - PrintAndLogDevice(WARNING, "Error, when getting filesize"); + PrintAndLogDevice(ERR, "Error, when getting filesize"); fclose(f); return 1; } @@ -557,7 +557,7 @@ int bruteforceFile(const char *filename, uint16_t keytable[]) { fclose(f); if (bytes_read < fsize) { - PrintAndLogDevice(WARNING, "Error, could only read %d bytes (should be %d)", bytes_read, fsize); + PrintAndLogDevice(ERR, "Error, could only read %d bytes (should be %d)", bytes_read, fsize); } uint8_t res = bruteforceDump(dump, fsize, keytable); @@ -612,7 +612,7 @@ static int _testBruteforce() { } else if (fileExists("client/loclass/iclass_dump.bin")) { errors |= bruteforceFile("client/loclass/iclass_dump.bin", keytable); } else { - PrintAndLogDevice(WARNING, "Error: The file iclass_dump.bin was not found!"); + PrintAndLogDevice(ERR, "Error: The file iclass_dump.bin was not found!"); } } return errors; @@ -627,14 +627,14 @@ static int _test_iclass_key_permutation() { permutekey_rev(testcase_output, testcase_output_rev); if (memcmp(testcase_output, testcase_output_correct, 8) != 0) { - PrintAndLogDevice(WARNING, "Error with iclass key permute!"); + PrintAndLogDevice(ERR, "Error with iclass key permute!"); printarr("testcase_output", testcase_output, 8); printarr("testcase_output_correct", testcase_output_correct, 8); return 1; } if (memcmp(testcase, testcase_output_rev, 8) != 0) { - PrintAndLogDevice(WARNING, "Error with reverse iclass key permute"); + PrintAndLogDevice(ERR, "Error with reverse iclass key permute"); printarr("testcase", testcase, 8); printarr("testcase_output_rev", testcase_output_rev, 8); return 1; @@ -651,7 +651,7 @@ static int _testHash1() { hash1(csn, k); if (memcmp(k, expected, 8) != 0) { - PrintAndLogDevice(WARNING, "Error with hash1!"); + PrintAndLogDevice(ERR, "Error with hash1!"); printarr("calculated", k, 8); printarr("expected", expected, 8); return 1; diff --git a/client/mifare/mad.c b/client/mifare/mad.c index 47b7cb70a..fa5b7d259 100644 --- a/client/mifare/mad.c +++ b/client/mifare/mad.c @@ -225,7 +225,7 @@ int MAD1DecodeAndPrint(uint8_t *sector, bool verbose, bool *haveMAD2) { PrintAndLogEx(NORMAL, "Card publisher sector not present."); } if (InfoByte == 0x10 || InfoByte >= 0x28) - PrintAndLogEx(WARNING, "Info byte error"); + PrintAndLogEx(ERR, "Info byte error"); PrintAndLogEx(NORMAL, "00 MAD1"); for (int i = 1; i < 16; i++) { diff --git a/client/mifare/mifarehost.c b/client/mifare/mifarehost.c index e9810e71a..100b595ce 100644 --- a/client/mifare/mifarehost.c +++ b/client/mifare/mifarehost.c @@ -914,7 +914,7 @@ int detect_classic_prng(void) { // if select tag failed. if (resp.oldarg[0] == 0) { - PrintAndLogEx(WARNING, "error: selecting tag failed, can't detect prng\n"); + PrintAndLogEx(ERR, "error: selecting tag failed, can't detect prng\n"); return PM3_ERFTRANS; } if (!WaitForResponseTimeout(CMD_ACK, &respA, 2500)) { @@ -924,7 +924,7 @@ int detect_classic_prng(void) { // check respA if (respA.oldarg[0] != 4) { - PrintAndLogEx(WARNING, "PRNG data error: Wrong length: %d", respA.oldarg[0]); + PrintAndLogEx(ERR, "PRNG data error: Wrong length: %d", respA.oldarg[0]); return PM3_ESOFT; } @@ -996,7 +996,7 @@ int detect_classic_nackbug(bool verbose) { PrintAndLogEx(SUCCESS, "No NACK bug detected"); return PM3_SUCCESS; default : - PrintAndLogEx(WARNING, "errorcode from device [%i]", ok); + PrintAndLogEx(ERR, "errorcode from device [%i]", ok); return PM3_EUNDEF; } break;