mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-01-10 18:24:27 +08:00
Merge branch 'master' of github.com:RfidResearchGroup/proxmark3
This commit is contained in:
commit
42b48fec85
3 changed files with 19 additions and 19 deletions
|
@ -115,14 +115,14 @@ static int GetHFMF14AUID(uint8_t *uid, int *uidlen) {
|
|||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) {
|
||||
PrintAndLogEx(WARNING, "iso14443a card select failed");
|
||||
DropField();
|
||||
return 0;
|
||||
return PM3_ERFTRANS;
|
||||
}
|
||||
|
||||
iso14a_card_select_t card;
|
||||
memcpy(&card, (iso14a_card_select_t *)resp.data.asBytes, sizeof(iso14a_card_select_t));
|
||||
memcpy(uid, card.uid, card.uidlen * sizeof(uint8_t));
|
||||
*uidlen = card.uidlen;
|
||||
return 1;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static char *GenerateFilename(const char *prefix, const char *suffix) {
|
||||
|
@ -133,8 +133,8 @@ static char *GenerateFilename(const char *prefix, const char *suffix) {
|
|||
int uidlen = 0;
|
||||
char *fptr = calloc(sizeof(char) * (strlen(prefix) + strlen(suffix)) + sizeof(uid) * 2 + 1, sizeof(uint8_t));
|
||||
|
||||
GetHFMF14AUID(uid, &uidlen);
|
||||
if (!uidlen) {
|
||||
int res = GetHFMF14AUID(uid, &uidlen);
|
||||
if (res != PM3_SUCCESS || !uidlen) {
|
||||
PrintAndLogEx(WARNING, "No tag found.");
|
||||
free(fptr);
|
||||
return NULL;
|
||||
|
@ -234,7 +234,7 @@ static bool mfc_value(const uint8_t *d, int32_t *val) {
|
|||
if (val) {
|
||||
*val = a;
|
||||
}
|
||||
return (val_checks);
|
||||
return val_checks;
|
||||
}
|
||||
static void mf_print_block(uint8_t blockno, uint8_t *d, bool verbose) {
|
||||
if (blockno == 0) {
|
||||
|
@ -788,7 +788,7 @@ static int CmdHF14AMfDump(const char *Cmd) {
|
|||
uint64_t select_status = resp.oldarg[0];
|
||||
if (select_status == 0) {
|
||||
PrintAndLogEx(WARNING, "iso14443a card select failed");
|
||||
return select_status;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// store card info
|
||||
|
@ -4907,7 +4907,7 @@ static int CmdHF14AMfCSave(const char *Cmd) {
|
|||
uint64_t select_status = resp.oldarg[0];
|
||||
if (select_status == 0) {
|
||||
PrintAndLogEx(WARNING, "iso14443a card select failed");
|
||||
return select_status;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
// store card info
|
||||
|
@ -5058,7 +5058,7 @@ static int CmdHF14AMfCView(const char *Cmd) {
|
|||
|
||||
if (select_status == 0) {
|
||||
PrintAndLogEx(WARNING, "iso14443a card select failed");
|
||||
return select_status;
|
||||
return PM3_ERFTRANS;
|
||||
}
|
||||
|
||||
iso14a_card_select_t card;
|
||||
|
@ -5826,7 +5826,7 @@ int CmdHFMFNDEFFormat(const char *Cmd) {
|
|||
uint64_t select_status = resp.oldarg[0];
|
||||
if (select_status == 0) {
|
||||
PrintAndLogEx(WARNING, "iso14443a card select failed");
|
||||
return select_status;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
DropField();
|
||||
|
@ -6834,7 +6834,7 @@ static int CmdHF14AGen4View(const char *Cmd) {
|
|||
|
||||
if (select_status == 0) {
|
||||
PrintAndLogEx(WARNING, "iso14443a card select failed");
|
||||
return select_status;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
iso14a_card_select_t card;
|
||||
|
|
|
@ -317,7 +317,7 @@ int MAD1DecodeAndPrint(uint8_t *sector, bool swapmad, bool verbose, bool *haveMA
|
|||
|
||||
int ibs = MADInfoByteDecode(sector, swapmad, 1, verbose);
|
||||
|
||||
if (ibs) {
|
||||
if (ibs > 0) {
|
||||
PrintAndLogEx(SUCCESS, "Card publisher sector " _MAGENTA_("0x%02x"), ibs);
|
||||
} else {
|
||||
PrintAndLogEx(WARNING, "Card publisher " _RED_("not") " present " _YELLOW_("0x%02x"), ibs);
|
||||
|
@ -360,7 +360,7 @@ int MAD2DecodeAndPrint(uint8_t *sector, bool swapmad, bool verbose) {
|
|||
}
|
||||
|
||||
int ibs = MADInfoByteDecode(sector, swapmad, 2, verbose);
|
||||
if (ibs) {
|
||||
if (ibs > 0) {
|
||||
PrintAndLogEx(SUCCESS, "Card publisher sector " _MAGENTA_("0x%02x"), ibs);
|
||||
} else {
|
||||
PrintAndLogEx(WARNING, "Card publisher " _RED_("not") " present " _YELLOW_("0x%02x"), ibs);
|
||||
|
|
|
@ -198,7 +198,7 @@ int MifareAuth4(mf4Session_t *mf4session, uint8_t *keyn, uint8_t *key, bool acti
|
|||
if (res) {
|
||||
if (!silentMode) PrintAndLogEx(ERR, "Exchange raw error: %d", res);
|
||||
if (dropFieldIfError) DropField();
|
||||
return 2;
|
||||
return PM3_ERFTRANS;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
|
@ -207,19 +207,19 @@ int MifareAuth4(mf4Session_t *mf4session, uint8_t *keyn, uint8_t *key, bool acti
|
|||
if (datalen < 1) {
|
||||
if (!silentMode) PrintAndLogEx(ERR, "Card response wrong length: %d", datalen);
|
||||
if (dropFieldIfError) DropField();
|
||||
return 3;
|
||||
return PM3_EWRONGANSWER;
|
||||
}
|
||||
|
||||
if (data[0] != 0x90) {
|
||||
if (!silentMode) PrintAndLogEx(ERR, "Card response error: %02x %s", data[0], mfpGetErrorDescription(data[0]));
|
||||
if (dropFieldIfError) DropField();
|
||||
return 3;
|
||||
return PM3_EWRONGANSWER;
|
||||
}
|
||||
|
||||
if (datalen != 19) { // code 1b + 16b + crc 2b
|
||||
if (!silentMode) PrintAndLogEx(ERR, "Card response must be 19 bytes long instead of: %d", datalen);
|
||||
if (dropFieldIfError) DropField();
|
||||
return 3;
|
||||
return PM3_EWRONGANSWER;
|
||||
}
|
||||
|
||||
aes_decode(NULL, key, &data[1], RndB, 16);
|
||||
|
@ -242,7 +242,7 @@ int MifareAuth4(mf4Session_t *mf4session, uint8_t *keyn, uint8_t *key, bool acti
|
|||
if (res) {
|
||||
if (!silentMode) PrintAndLogEx(ERR, "Exchange raw error: %d", res);
|
||||
if (dropFieldIfError) DropField();
|
||||
return 4;
|
||||
return PM3_ERFTRANS;
|
||||
}
|
||||
|
||||
if (verbose)
|
||||
|
@ -262,7 +262,7 @@ int MifareAuth4(mf4Session_t *mf4session, uint8_t *keyn, uint8_t *key, bool acti
|
|||
PrintAndLogEx(ERR, "RndA card: %s", sprint_hex(&raw[4], 16));
|
||||
}
|
||||
if (dropFieldIfError) DropField();
|
||||
return 5;
|
||||
return PM3_EWRONGANSWER;
|
||||
}
|
||||
|
||||
if (verbose) {
|
||||
|
@ -319,7 +319,7 @@ int MifareAuth4(mf4Session_t *mf4session, uint8_t *keyn, uint8_t *key, bool acti
|
|||
if (verbose)
|
||||
PrintAndLogEx(INFO, "Authentication OK");
|
||||
|
||||
return 0;
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
static int intExchangeRAW14aPlus(uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen) {
|
||||
|
|
Loading…
Reference in a new issue