mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
no printf, sprintf
This commit is contained in:
parent
7336906923
commit
10c64d755d
1 changed files with 12 additions and 11 deletions
|
@ -994,7 +994,7 @@ static int SanityOfflineCheck(bool useGraphBuffer) {
|
||||||
|
|
||||||
static void T55xx_Print_DownlinkMode(uint8_t downlink_mode) {
|
static void T55xx_Print_DownlinkMode(uint8_t downlink_mode) {
|
||||||
char msg[80];
|
char msg[80];
|
||||||
sprintf(msg, "Downlink Mode used : ");
|
snprintf(msg, sizeof(msg) ,"Downlink Mode used : ");
|
||||||
|
|
||||||
switch (downlink_mode) {
|
switch (downlink_mode) {
|
||||||
case 1 :
|
case 1 :
|
||||||
|
@ -2327,7 +2327,7 @@ static int CmdT55xxDump(const char *Cmd) {
|
||||||
strcpy(preferredName, "lf-t55xx");
|
strcpy(preferredName, "lf-t55xx");
|
||||||
for (uint8_t i = 1; i <= 7; i++) {
|
for (uint8_t i = 1; i <= 7; i++) {
|
||||||
if ((cardmem[i].blockdata != 0x00) && (cardmem[i].blockdata != 0xFFFFFFFF))
|
if ((cardmem[i].blockdata != 0x00) && (cardmem[i].blockdata != 0xFFFFFFFF))
|
||||||
sprintf(preferredName + strlen(preferredName), "-%08X", cardmem[i].blockdata);
|
snprintf(preferredName + strlen(preferredName), sizeof(preferredName) - strlen(preferredName) , "-%08X", cardmem[i].blockdata);
|
||||||
else
|
else
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
@ -2416,7 +2416,7 @@ static int CmdT55xxRestore(const char *Cmd) {
|
||||||
if (success == PM3_SUCCESS) { // Got data, so write to cards
|
if (success == PM3_SUCCESS) { // Got data, so write to cards
|
||||||
if (datalen == T55x7_BLOCK_COUNT * 4) { // 12 blocks * 4 bytes per block
|
if (datalen == T55x7_BLOCK_COUNT * 4) { // 12 blocks * 4 bytes per block
|
||||||
if (usepwd)
|
if (usepwd)
|
||||||
sprintf(pwdOpt, "p %08X", password);
|
snprintf(pwdOpt, sizeof(pwdOpt), "p %08X", password);
|
||||||
|
|
||||||
// Restore endien for writing to card
|
// Restore endien for writing to card
|
||||||
for (blockidx = 0; blockidx < 12; blockidx++)
|
for (blockidx = 0; blockidx < 12; blockidx++)
|
||||||
|
@ -2433,18 +2433,20 @@ static int CmdT55xxRestore(const char *Cmd) {
|
||||||
|
|
||||||
// write out blocks 1-7 page 0
|
// write out blocks 1-7 page 0
|
||||||
for (blockidx = 1; blockidx <= 7; blockidx++) {
|
for (blockidx = 1; blockidx <= 7; blockidx++) {
|
||||||
sprintf(writeCmdOpt, "b %d d %08X %s", blockidx, data[blockidx], pwdOpt);
|
snprintf(writeCmdOpt, sizeof(writeCmdOpt), "b %d d %08X %s", blockidx, data[blockidx], pwdOpt);
|
||||||
|
|
||||||
if (CmdT55xxWriteBlock(writeCmdOpt) != PM3_SUCCESS)
|
if (CmdT55xxWriteBlock(writeCmdOpt) != PM3_SUCCESS)
|
||||||
PrintAndLogEx(WARNING, "Warning: error writing blk %d", blockidx);
|
PrintAndLogEx(WARNING, "Warning: error writing blk %d", blockidx);
|
||||||
}
|
}
|
||||||
|
|
||||||
// if password was set on the "blank" update as we may have just changed it
|
// if password was set on the "blank" update as we may have just changed it
|
||||||
if (usepwd)
|
if (usepwd)
|
||||||
sprintf(pwdOpt, "p %08X", data[7]);
|
snprintf(pwdOpt, sizeof(pwdOpt), "p %08X", data[7]);
|
||||||
|
|
||||||
// write out blocks 1-3 page 1
|
// write out blocks 1-3 page 1
|
||||||
for (blockidx = 9; blockidx <= 11; blockidx++) {
|
for (blockidx = 9; blockidx <= 11; blockidx++) {
|
||||||
sprintf(writeCmdOpt, "b %d 1 d %08X %s", blockidx - 8, data[blockidx], pwdOpt);
|
snprintf(writeCmdOpt, sizeof(writeCmdOpt), "b %d 1 d %08X %s", blockidx - 8, data[blockidx], pwdOpt);
|
||||||
|
|
||||||
if (CmdT55xxWriteBlock(writeCmdOpt) != PM3_SUCCESS)
|
if (CmdT55xxWriteBlock(writeCmdOpt) != PM3_SUCCESS)
|
||||||
PrintAndLogEx(WARNING, "Warning: error writing blk %d", blockidx);
|
PrintAndLogEx(WARNING, "Warning: error writing blk %d", blockidx);
|
||||||
}
|
}
|
||||||
|
@ -2453,7 +2455,7 @@ static int CmdT55xxRestore(const char *Cmd) {
|
||||||
config.downlink_mode = downlink_mode;
|
config.downlink_mode = downlink_mode;
|
||||||
|
|
||||||
// Write the page 0 config
|
// Write the page 0 config
|
||||||
sprintf(writeCmdOpt, "b 0 d %08X %s", data[0], pwdOpt);
|
snprintf(writeCmdOpt, sizeof(writeCmdOpt), "b 0 d %08X %s", data[0], pwdOpt);
|
||||||
if (CmdT55xxWriteBlock(writeCmdOpt) != PM3_SUCCESS)
|
if (CmdT55xxWriteBlock(writeCmdOpt) != PM3_SUCCESS)
|
||||||
PrintAndLogEx(WARNING, "Warning: error writing blk 0");
|
PrintAndLogEx(WARNING, "Warning: error writing blk 0");
|
||||||
}
|
}
|
||||||
|
@ -3039,13 +3041,13 @@ static int CmdT55xxChkPwds(const char *Cmd) {
|
||||||
|
|
||||||
while (!WaitForResponseTimeout(CMD_LF_T55XX_CHK_PWDS, &resp, 2000)) {
|
while (!WaitForResponseTimeout(CMD_LF_T55XX_CHK_PWDS, &resp, 2000)) {
|
||||||
timeout++;
|
timeout++;
|
||||||
printf(".");
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
fflush(stdout);
|
|
||||||
if (timeout > 180) {
|
if (timeout > 180) {
|
||||||
PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting...");
|
PrintAndLogEx(WARNING, "\nNo response from Proxmark3. Aborting...");
|
||||||
return PM3_ENODATA;
|
return PM3_ENODATA;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
PrintAndLogEx(NORMAL, "");
|
||||||
struct p {
|
struct p {
|
||||||
bool found;
|
bool found;
|
||||||
uint32_t candidate;
|
uint32_t candidate;
|
||||||
|
@ -3178,8 +3180,7 @@ static int CmdT55xxBruteForce(const char *Cmd) {
|
||||||
|
|
||||||
while (found == 0) {
|
while (found == 0) {
|
||||||
|
|
||||||
printf(".");
|
PrintAndLogEx(NORMAL, "." NOLF);
|
||||||
fflush(stdout);
|
|
||||||
|
|
||||||
if (IsCancelled()) {
|
if (IsCancelled()) {
|
||||||
return PM3_EOPABORTED;
|
return PM3_EOPABORTED;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue