Promote WARNING to ERR on some error msgs

This commit is contained in:
Philippe Teuwen
2019-07-14 00:35:18 +02:00
parent bb3c5e364e
commit 8bf4b4ad97
38 changed files with 166 additions and 166 deletions
+1 -1
View File
@@ -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) {
+7 -7
View File
@@ -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);
+3 -3
View File
@@ -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;
}
+1 -1
View File
@@ -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);
+4 -4
View File
@@ -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;
}
+2 -2
View File
@@ -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.");
+9 -9
View File
@@ -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;
}
+2 -2
View File
@@ -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;
+17 -17
View File
@@ -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));
+12 -12
View File
@@ -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);
}
+9 -9
View File
@@ -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;
}
+5 -5
View File
@@ -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;
}
+3 -3
View File
@@ -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:
+4 -4
View File
@@ -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;
}
}
+9 -9
View File
@@ -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;
}
+2 -2
View File
@@ -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;
}
}
+3 -3
View File
@@ -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;
}
+1 -1
View File
@@ -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;
}
}
+2 -2
View File
@@ -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;
}
+2 -2
View File
@@ -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;
}
}

Some files were not shown because too many files have changed in this diff Show More