mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-22 22:33:48 -07:00
no printf
This commit is contained in:
parent
7fd4d5f158
commit
d09ed2eec0
1 changed files with 25 additions and 20 deletions
|
@ -347,9 +347,9 @@ static char *getCardSizeStr(uint8_t fsize) {
|
||||||
|
|
||||||
// is LSB set?
|
// is LSB set?
|
||||||
if (fsize & 1)
|
if (fsize & 1)
|
||||||
sprintf(retStr, "0x%02X (" _YELLOW_("%d - %d bytes") ")", fsize, usize, lsize);
|
snprintf(retStr, sizeof(buf), "0x%02X (" _YELLOW_("%d - %d bytes") ")", fsize, usize, lsize);
|
||||||
else
|
else
|
||||||
sprintf(retStr, "0x%02X (" _YELLOW_("%d bytes") ")", fsize, lsize);
|
snprintf(retStr, sizeof(buf), "0x%02X (" _YELLOW_("%d bytes") ")", fsize, lsize);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -359,14 +359,14 @@ static char *getProtocolStr(uint8_t id, bool hw) {
|
||||||
char *retStr = buf;
|
char *retStr = buf;
|
||||||
|
|
||||||
if (id == 0x04) {
|
if (id == 0x04) {
|
||||||
sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-3 MIFARE, 14443-4") ")", id);
|
snprintf(retStr, sizeof(buf), "0x%02X (" _YELLOW_("ISO 14443-3 MIFARE, 14443-4") ")", id);
|
||||||
} else if (id == 0x05) {
|
} else if (id == 0x05) {
|
||||||
if (hw)
|
if (hw)
|
||||||
sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-2, 14443-3") ")", id);
|
snprintf(retStr, sizeof(buf), "0x%02X (" _YELLOW_("ISO 14443-2, 14443-3") ")", id);
|
||||||
else
|
else
|
||||||
sprintf(retStr, "0x%02X (" _YELLOW_("ISO 14443-3, 14443-4") ")", id);
|
snprintf(retStr, sizeof(buf), "0x%02X (" _YELLOW_("ISO 14443-3, 14443-4") ")", id);
|
||||||
} else {
|
} else {
|
||||||
sprintf(retStr, "0x%02X (" _YELLOW_("Unknown") ")", id);
|
snprintf(retStr, sizeof(buf), "0x%02X (" _YELLOW_("Unknown") ")", id);
|
||||||
}
|
}
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
@ -377,17 +377,17 @@ static char *getVersionStr(uint8_t major, uint8_t minor) {
|
||||||
char *retStr = buf;
|
char *retStr = buf;
|
||||||
|
|
||||||
if (major == 0x00)
|
if (major == 0x00)
|
||||||
sprintf(retStr, "%x.%x (" _YELLOW_("DESFire MF3ICD40") ")", major, minor);
|
snprintf(retStr, sizeof(buf), "%x.%x (" _YELLOW_("DESFire MF3ICD40") ")", major, minor);
|
||||||
else if (major == 0x01 && minor == 0x00)
|
else if (major == 0x01 && minor == 0x00)
|
||||||
sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV1") ")", major, minor);
|
snprintf(retStr, sizeof(buf), "%x.%x (" _YELLOW_("DESFire EV1") ")", major, minor);
|
||||||
else if (major == 0x12 && minor == 0x00)
|
else if (major == 0x12 && minor == 0x00)
|
||||||
sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV2") ")", major, minor);
|
snprintf(retStr, sizeof(buf), "%x.%x (" _YELLOW_("DESFire EV2") ")", major, minor);
|
||||||
else if (major == 0x33 && minor == 0x00)
|
else if (major == 0x33 && minor == 0x00)
|
||||||
sprintf(retStr, "%x.%x (" _YELLOW_("DESFire EV3") ")", major, minor);
|
snprintf(retStr, sizeof(buf), "%x.%x (" _YELLOW_("DESFire EV3") ")", major, minor);
|
||||||
else if (major == 0x30 && minor == 0x00)
|
else if (major == 0x30 && minor == 0x00)
|
||||||
sprintf(retStr, "%x.%x (" _YELLOW_("DESFire Light") ")", major, minor);
|
snprintf(retStr, sizeof(buf), "%x.%x (" _YELLOW_("DESFire Light") ")", major, minor);
|
||||||
else
|
else
|
||||||
sprintf(retStr, "%x.%x (" _YELLOW_("Unknown") ")", major, minor);
|
snprintf(retStr, sizeof(buf), "%x.%x (" _YELLOW_("Unknown") ")", major, minor);
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3401,6 +3401,7 @@ static void DecodeComSet(uint8_t comset) {
|
||||||
}
|
}
|
||||||
|
|
||||||
static char *DecodeAccessValue(uint8_t value) {
|
static char *DecodeAccessValue(uint8_t value) {
|
||||||
|
|
||||||
char *car = (char *)calloc(255, sizeof(char));
|
char *car = (char *)calloc(255, sizeof(char));
|
||||||
if (car == NULL)
|
if (car == NULL)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -3413,7 +3414,7 @@ static char *DecodeAccessValue(uint8_t value) {
|
||||||
strcat(car, "(Denied Access)");
|
strcat(car, "(Denied Access)");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
sprintf(car, "(Access Key: %d)", value);
|
snprintf(car, 255, "(Access Key: %d)", value);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return car;
|
return car;
|
||||||
|
@ -4364,7 +4365,7 @@ static int CmdHF14aDesChk(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!verbose)
|
if (!verbose)
|
||||||
printf("Search keys:\n");
|
PrintAndLogEx(INFO, "Search keys:");
|
||||||
|
|
||||||
bool result = false;
|
bool result = false;
|
||||||
uint8_t app_ids[78] = {0};
|
uint8_t app_ids[78] = {0};
|
||||||
|
@ -4382,25 +4383,29 @@ static int CmdHF14aDesChk(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
for (uint32_t x = 0; x < app_ids_len / 3; x++) {
|
for (uint32_t x = 0; x < app_ids_len / 3; x++) {
|
||||||
|
|
||||||
uint32_t curaid = (app_ids[x * 3] & 0xFF) + ((app_ids[(x * 3) + 1] & 0xFF) << 8) + ((app_ids[(x * 3) + 2] & 0xFF) << 16);
|
uint32_t curaid = (app_ids[x * 3] & 0xFF) + ((app_ids[(x * 3) + 1] & 0xFF) << 8) + ((app_ids[(x * 3) + 2] & 0xFF) << 16);
|
||||||
PrintAndLogEx(ERR, "Checking aid 0x%06X...", curaid);
|
PrintAndLogEx(ERR, "Checking aid 0x%06X...", curaid);
|
||||||
|
|
||||||
res = AuthCheckDesfire(&app_ids[x * 3], deskeyList, deskeyListLen, aeskeyList, aeskeyListLen, k3kkeyList, k3kkeyListLen, foundKeys, &result);
|
res = AuthCheckDesfire(&app_ids[x * 3], deskeyList, deskeyListLen, aeskeyList, aeskeyListLen, k3kkeyList, k3kkeyListLen, foundKeys, &result);
|
||||||
if (res == PM3_EOPABORTED) {
|
if (res == PM3_EOPABORTED) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pattern2b && startPattern < 0x10000) {
|
if (pattern2b && startPattern < 0x10000) {
|
||||||
if (!verbose)
|
if (verbose == false)
|
||||||
printf("p");
|
PrintAndLogEx(NORMAL, "p" NOLF);
|
||||||
|
|
||||||
aeskeyListLen = 0;
|
aeskeyListLen = 0;
|
||||||
deskeyListLen = 0;
|
deskeyListLen = 0;
|
||||||
k3kkeyListLen = 0;
|
k3kkeyListLen = 0;
|
||||||
DesFill2bPattern(deskeyList, &deskeyListLen, aeskeyList, &aeskeyListLen, k3kkeyList, &k3kkeyListLen, &startPattern);
|
DesFill2bPattern(deskeyList, &deskeyListLen, aeskeyList, &aeskeyListLen, k3kkeyList, &k3kkeyListLen, &startPattern);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (dict_filenamelen && endFilePosition) {
|
if (dict_filenamelen && endFilePosition) {
|
||||||
if (!verbose)
|
if (verbose == false)
|
||||||
printf("d");
|
PrintAndLogEx(NORMAL, "d" NOLF);
|
||||||
|
|
||||||
uint32_t keycnt = 0;
|
uint32_t keycnt = 0;
|
||||||
res = loadFileDICTIONARYEx((char *)dict_filename, deskeyList, sizeof(deskeyList), NULL, 16, &keycnt, endFilePosition, &endFilePosition, false);
|
res = loadFileDICTIONARYEx((char *)dict_filename, deskeyList, sizeof(deskeyList), NULL, 16, &keycnt, endFilePosition, &endFilePosition, false);
|
||||||
|
@ -4420,8 +4425,8 @@ static int CmdHF14aDesChk(const char *Cmd) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (!verbose)
|
if (verbose == false)
|
||||||
printf("\n");
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
|
||||||
// save keys to json
|
// save keys to json
|
||||||
if ((jsonnamelen > 0) && result) {
|
if ((jsonnamelen > 0) && result) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue