mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
Promote WARNING to ERR on some error msgs
This commit is contained in:
parent
bb3c5e364e
commit
8bf4b4ad97
38 changed files with 166 additions and 166 deletions
|
@ -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) {
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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.");
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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));
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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:
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
// }
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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) {
|
||||
|
|
|
@ -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.");
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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 {
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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++) {
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue