HF 14a: Only hint EMV when correct AID is found
This commit is contained in:
1 parent
c10930d6e4
commit
aa55bfca0e
7 files changed
+20
-6
No files matched your search
@@ -17,7 +17,7 @@
|
||||
"Country": "United States",
|
||||
"Name": "EMV Payment System Environment - PSE (1PAY.SYS.DDF01)",
|
||||
"Description": "",
|
||||
"Type": ""
|
||||
"Type": "EMV"
|
||||
},
|
||||
{
|
||||
"AID": "325041592E5359532E4444463031",
|
||||
@@ -25,7 +25,7 @@
|
||||
"Country": "United States",
|
||||
"Name": "EMV Proximity Payment System Environment - PPSE (2PAY.SYS.DDF01)",
|
||||
"Description": "Visa payWave for Mobile",
|
||||
"Type": ""
|
||||
"Type": "EMV"
|
||||
},
|
||||
{
|
||||
"AID": "44464D46412E44466172653234313031",
|
||||
|
||||
@@ -125,6 +125,10 @@ bool AIDGetFromElm(json_t *data, uint8_t *aid, size_t aidmaxlen, int *aidlen) {
|
||||
return true;
|
||||
}
|
||||
|
||||
const char *AIDGetTypeFromElm(json_t *data) {
|
||||
return jsonStrGet(data, "Type");
|
||||
}
|
||||
|
||||
bool AIDSeenBefore(json_t *root, const uint8_t *aid, size_t aidlen, size_t before_index) {
|
||||
if (root == NULL || aid == NULL || aidlen == 0) {
|
||||
return false;
|
||||
|
||||
@@ -31,6 +31,7 @@ int PrintAIDDescriptionBuf(json_t *root, uint8_t *aid, size_t aidlen, bool verbo
|
||||
json_t *AIDSearchInit(bool verbose);
|
||||
json_t *AIDSearchGetElm(json_t *root, size_t elmindx);
|
||||
bool AIDGetFromElm(json_t *data, uint8_t *aid, size_t aidmaxlen, int *aidlen);
|
||||
const char *AIDGetTypeFromElm(json_t *data);
|
||||
bool AIDSeenBefore(json_t *root, const uint8_t *aid, size_t aidlen, size_t before_index);
|
||||
int AIDSearchFree(json_t *root);
|
||||
|
||||
|
||||
+10
-2
@@ -2935,7 +2935,8 @@ static void get_compact_tlv(uint8_t *d, uint8_t n) {
|
||||
}
|
||||
|
||||
// selects every AID in aidlist.json, returns how many were found
|
||||
int hf14a_aid_search(bool verbose) {
|
||||
// emv_found (optional) is set when an EMV application answers
|
||||
int hf14a_aid_search(bool verbose, bool *emv_found) {
|
||||
|
||||
PrintAndLogEx(INFO, "-------------------- " _CYAN_("AID Search") " --------------------");
|
||||
|
||||
@@ -3024,6 +3025,11 @@ int hf14a_aid_search(bool verbose) {
|
||||
|
||||
if (verbose) PrintAndLogEx(SUCCESS, "----------------------------------------------------");
|
||||
found++;
|
||||
|
||||
const char *type = AIDGetTypeFromElm(data);
|
||||
if (emv_found && type && strcmp(type, "EMV") == 0) {
|
||||
*emv_found = true;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -3517,7 +3523,9 @@ int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search) {
|
||||
}
|
||||
|
||||
if (do_aid_search) {
|
||||
if (hf14a_aid_search(verbose) > 0) {
|
||||
bool emv_found = false;
|
||||
hf14a_aid_search(verbose, &emv_found);
|
||||
if (emv_found) {
|
||||
isEMV = true;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ int hf14a_getconfig(hf14a_config_t *config);
|
||||
int hf14a_setconfig(hf14a_config_t *config, bool verbose);
|
||||
int infoHF14A(bool verbose, bool do_nack_test, bool do_aid_search);
|
||||
int infoHF14A4Applications(bool verbose);
|
||||
int hf14a_aid_search(bool verbose);
|
||||
int hf14a_aid_search(bool verbose, bool *emv_found);
|
||||
const char *getTagInfo(uint8_t uid);
|
||||
int Hf14443_4aGetCardData(iso14a_card_select_t *card);
|
||||
int ExchangeAPDU14a(const uint8_t *datain, int datainlen, bool activateField, bool leaveSignalON, uint8_t *dataout, int maxdataoutlen, int *dataoutlen);
|
||||
|
||||
@@ -1738,7 +1738,7 @@ static int seos_print_card(const uint8_t *custom_aid, int custom_aid_len) {
|
||||
}
|
||||
DropField();
|
||||
|
||||
hf14a_aid_search(false);
|
||||
hf14a_aid_search(false, NULL);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user