mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-12 18:25:07 +08:00
chg: return codes etc
This commit is contained in:
parent
e812726c70
commit
85ff07caa6
1 changed files with 26 additions and 26 deletions
|
@ -16,7 +16,7 @@
|
|||
#include <stdlib.h>
|
||||
|
||||
#include "cmdparser.h" // command_t
|
||||
#include "commonutil.h" // ARRAYLEN
|
||||
#include "commonutil.h" // ARRAYLEN
|
||||
#include "comms.h" // clearCommandBuffer
|
||||
#include "ui.h"
|
||||
#include "util_posix.h"
|
||||
|
@ -38,8 +38,8 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
|
|||
m = m > 0 ? m : 1;
|
||||
n = n > 0 ? n : 1;
|
||||
|
||||
PrintAndLogEx(NORMAL, "Collecting %u %u byte nonces", n, m);
|
||||
PrintAndLogEx(NORMAL, "Start: %" PRIu64, msclock() / 1000);
|
||||
PrintAndLogEx(SUCCESS, "Collecting %u %u byte nonces", n, m);
|
||||
PrintAndLogEx(SUCCESS, "Start: %" PRIu64, msclock() / 1000);
|
||||
// repeat n times
|
||||
for (uint32_t i = 0; i < n; i++) {
|
||||
// execute PACE
|
||||
|
@ -58,15 +58,15 @@ static int CmdHFEPACollectPACENonces(const char *Cmd) {
|
|||
sprintf(nonce + (2 * j), "%02X", resp.data.asBytes[j]);
|
||||
}
|
||||
// print nonce
|
||||
PrintAndLogEx(NORMAL, "Length: %zu, Nonce: %s", nonce_length, nonce);
|
||||
PrintAndLogEx(SUCCESS, "Length: %zu, Nonce: %s", nonce_length, nonce);
|
||||
free(nonce);
|
||||
}
|
||||
if (i < n - 1) {
|
||||
sleep(d);
|
||||
}
|
||||
}
|
||||
PrintAndLogEx(NORMAL, "End: %" PRIu64, msclock() / 1000);
|
||||
return 1;
|
||||
PrintAndLogEx(SUCCESS, "End: %" PRIu64, msclock() / 1000);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// perform the PACE protocol by replaying APDUs
|
||||
|
@ -98,9 +98,9 @@ static int CmdHFEPAPACEReplay(const char *Cmd) {
|
|||
);
|
||||
|
||||
if (scan_return < 1) {
|
||||
PrintAndLogEx(NORMAL, (char *)usage_msg);
|
||||
PrintAndLogEx(INFO, (char *)usage_msg);
|
||||
PrintAndLogEx(WARNING, "Not enough APDUs! Try again!");
|
||||
return 0;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
skip += skip_add;
|
||||
apdu_lengths[i]++;
|
||||
|
@ -110,8 +110,8 @@ static int CmdHFEPAPACEReplay(const char *Cmd) {
|
|||
if (Cmd[skip] == '\0') {
|
||||
if (i < ARRAYLEN(apdu_lengths) - 1) {
|
||||
|
||||
PrintAndLogEx(NORMAL, (char *)usage_msg);
|
||||
return 0;
|
||||
PrintAndLogEx(INFO, (char *)usage_msg);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -146,7 +146,7 @@ static int CmdHFEPAPACEReplay(const char *Cmd) {
|
|||
WaitForResponse(CMD_ACK, &resp);
|
||||
if (resp.oldarg[0] != 0) {
|
||||
PrintAndLogEx(WARNING, "Transfer of APDU #%d Part %d failed!", i, j);
|
||||
return 0;
|
||||
return PM3_ESOFT;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -156,22 +156,22 @@ static int CmdHFEPAPACEReplay(const char *Cmd) {
|
|||
SendCommandMIX(CMD_HF_EPA_REPLAY, 0, 0, 0, NULL, 0);
|
||||
WaitForResponse(CMD_ACK, &resp);
|
||||
if (resp.oldarg[0] != 0) {
|
||||
PrintAndLogEx(NORMAL, "\nPACE replay failed in step %u!", (uint32_t)resp.oldarg[0]);
|
||||
PrintAndLogEx(NORMAL, "Measured times:");
|
||||
PrintAndLogEx(NORMAL, "MSE Set AT: %u us", resp.data.asDwords[0]);
|
||||
PrintAndLogEx(NORMAL, "GA Get Nonce: %u us", resp.data.asDwords[1]);
|
||||
PrintAndLogEx(NORMAL, "GA Map Nonce: %u us", resp.data.asDwords[2]);
|
||||
PrintAndLogEx(NORMAL, "GA Perform Key Agreement: %u us", resp.data.asDwords[3]);
|
||||
PrintAndLogEx(NORMAL, "GA Mutual Authenticate: %u us", resp.data.asDwords[4]);
|
||||
PrintAndLogEx(SUCCESS, "\nPACE replay failed in step %u!", (uint32_t)resp.oldarg[0]);
|
||||
PrintAndLogEx(SUCCESS, "Measured times:");
|
||||
PrintAndLogEx(SUCCESS, "MSE Set AT: %u us", resp.data.asDwords[0]);
|
||||
PrintAndLogEx(SUCCESS, "GA Get Nonce: %u us", resp.data.asDwords[1]);
|
||||
PrintAndLogEx(SUCCESS, "GA Map Nonce: %u us", resp.data.asDwords[2]);
|
||||
PrintAndLogEx(SUCCESS, "GA Perform Key Agreement: %u us", resp.data.asDwords[3]);
|
||||
PrintAndLogEx(SUCCESS, "GA Mutual Authenticate: %u us", resp.data.asDwords[4]);
|
||||
} else {
|
||||
PrintAndLogEx(NORMAL, "PACE replay successful!");
|
||||
PrintAndLogEx(NORMAL, "MSE Set AT: %u us", resp.data.asDwords[0]);
|
||||
PrintAndLogEx(NORMAL, "GA Get Nonce: %u us", resp.data.asDwords[1]);
|
||||
PrintAndLogEx(NORMAL, "GA Map Nonce: %u us", resp.data.asDwords[2]);
|
||||
PrintAndLogEx(NORMAL, "GA Perform Key Agreement: %u us", resp.data.asDwords[3]);
|
||||
PrintAndLogEx(NORMAL, "GA Mutual Authenticate: %u us", resp.data.asDwords[4]);
|
||||
PrintAndLogEx(SUCCESS, "PACE replay successful!");
|
||||
PrintAndLogEx(SUCCESS, "MSE Set AT: %u us", resp.data.asDwords[0]);
|
||||
PrintAndLogEx(SUCCESS, "GA Get Nonce: %u us", resp.data.asDwords[1]);
|
||||
PrintAndLogEx(SUCCESS, "GA Map Nonce: %u us", resp.data.asDwords[2]);
|
||||
PrintAndLogEx(SUCCESS, "GA Perform Key Agreement: %u us", resp.data.asDwords[3]);
|
||||
PrintAndLogEx(SUCCESS, "GA Mutual Authenticate: %u us", resp.data.asDwords[4]);
|
||||
}
|
||||
return 1;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static command_t CommandTable[] = {
|
||||
|
@ -184,7 +184,7 @@ static command_t CommandTable[] = {
|
|||
static int CmdHelp(const char *Cmd) {
|
||||
(void)Cmd; // Cmd is not used so far
|
||||
CmdsHelp(CommandTable);
|
||||
return 0;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int CmdHFEPA(const char *Cmd) {
|
||||
|
|
Loading…
Reference in a new issue