minor adjustments to texts

This commit is contained in:
iceman1001 2023-10-09 20:09:22 +02:00
commit 7cec258349
6 changed files with 60 additions and 24 deletions

View file

@ -203,8 +203,8 @@ void RunMod(void) {
#define DYNAMIC_RESPONSE_BUFFER_SIZE 64
#define DYNAMIC_MODULATION_BUFFER_SIZE 512
uint8_t *dynamic_response_buffer = BigBuf_calloc(DYNAMIC_RESPONSE_BUFFER_SIZE);
uint8_t *dynamic_modulation_buffer = BigBuf_calloc(DYNAMIC_MODULATION_BUFFER_SIZE);
uint8_t dynamic_response_buffer[DYNAMIC_RESPONSE_BUFFER_SIZE] = {0};
uint8_t dynamic_modulation_buffer[DYNAMIC_MODULATION_BUFFER_SIZE] = {0};
// to know the transaction status
uint8_t prevCmd = 0;
@ -458,12 +458,13 @@ void RunMod(void) {
// SFI
} else if (receivedCmd[1] == 0x00 && receivedCmd[2] == 0xB2 && prevCmd == 3) {
uint8_t last[4] = {0x70, 0x15, 0x57, 0x13};
uint8_t statusapdu[2] = {0x90, 0x00};
uint8_t card[25];
memcpy(&card[0], last, sizeof(last));
uint8_t card[25] = {
0x70, 0x15, 0x57, 0x13, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x90,
0x00
};
memcpy(&card[4], token, sizeof(token));
memcpy(&card[23], statusapdu, sizeof(statusapdu));
memcpy(&dynamic_response_info.response[1], card, sizeof(card));
dynamic_response_info.response_n = sizeof(card) + 1;
prevCmd++;

View file

@ -994,7 +994,7 @@ int SelectCard14443A_4_WithParameters(bool disconnect, bool verbose, iso14a_card
// check result
if (resp.oldarg[0] == 0) {
if (verbose) {
PrintAndLogEx(FAILED, "No card in field");
PrintAndLogEx(WARNING, "No ISO1443-A Card in field");
}
return PM3_ECARDEXCHANGE;
}

View file

@ -1697,7 +1697,7 @@ int select_card_14443b_4(bool disconnect, iso14b_card_select_t *card) {
// check result
int status = resp.oldarg[0];
if (status < 0) {
PrintAndLogEx(ERR, "No card in field.");
PrintAndLogEx(FAILED, "No ISO14443-B Card in field");
switch_off_field_14b();
return PM3_ESOFT;
}

View file

@ -356,7 +356,7 @@ static int VASReader(uint8_t *pidHash, const char *url, size_t urlLen, uint8_t *
};
if (SelectCard14443A_4_WithParameters(false, false, NULL, &polling_parameters) != PM3_SUCCESS) {
PrintAndLogEx(FAILED, "No card in field");
PrintAndLogEx(WARNING, "No ISO14443-A Card in field");
return PM3_ECARDEXCHANGE;
}

View file

@ -44,28 +44,30 @@ static int CmdHelp(const char *Cmd);
#define TLV_ADD(tag, value)( tlvdb_change_or_add_node(tlvRoot, tag, sizeof(value) - 1, (const unsigned char *)value) )
static void ParamLoadDefaults(struct tlvdb *tlvRoot) {
//9F02:(Amount, authorized (Numeric)) len:6
// 9F02:(Amount, authorized (Numeric)) len:6
TLV_ADD(0x9F02, "\x00\x00\x00\x00\x01\x00");
//9F1A:(Terminal Country Code) len:2
// 9F1A:(Terminal Country Code) len:2
TLV_ADD(0x9F1A, "ru");
//5F2A:(Transaction Currency Code) len:2
// 5F2A:(Transaction Currency Code) len:2
// USD 840, EUR 978, RUR 810, RUB 643, RUR 810(old), UAH 980, AZN 031, n/a 999
TLV_ADD(0x5F2A, "\x09\x80");
//9A:(Transaction Date) len:3
TLV_ADD(0x5F2A, "\x090\x78");
// 9A:(Transaction Date) len:3
TLV_ADD(0x9A, "\x00\x00\x00");
//9C:(Transaction Type) len:1 | 00 => Goods and service #01 => Cash
// 9C:(Transaction Type) len:1
// | 00 => Goods and Service
// | 01 => Cash
TLV_ADD(0x9C, "\x00");
// 9F37 Unpredictable Number len:4
// 9F37 Unpredictable Number (UN) len:4
TLV_ADD(0x9F37, "\x01\x02\x03\x04");
// 9F6A Unpredictable Number (MSD for UDOL) len:4
TLV_ADD(0x9F6A, "\x01\x02\x03\x04");
//9F66:(Terminal Transaction Qualifiers (TTQ)) len:4
// 9F66:(Terminal Transaction Qualifiers (TTQ)) len:4
TLV_ADD(0x9F66, "\x26\x00\x00\x00"); // qVSDC
//95:(Terminal Verification Results) len:5
// 95:(Terminal Verification Results) len:5
// all OK TVR
TLV_ADD(0x95, "\x00\x00\x00\x00\x00");
// 9F4E Merchant Name and Location len:x
TLV_ADD(0x9F4E, "proxmrk3rdv\x00");
TLV_ADD(0x9F4E, "proxmark3rdv4\x00");
}
static void PrintChannel(Iso7816CommandChannel channel) {
@ -298,14 +300,14 @@ static int emv_parse_track1(const uint8_t *d, size_t n, bool verbose) {
case 0: {
size_t a = strlen(token);
if (a == 16) {
PrintAndLogEx(INFO, "PAN...................... %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c",
PrintAndLogEx(INFO, "PAN...................... " _GREEN_("%c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c"),
token[1], token[2], token[3], token[4],
token[5], token[6], token[7], token[8],
token[9], token[10], token[11], token[12],
token[13], token[14], token[15], token[16]
);
} else if (a == 19) {
PrintAndLogEx(INFO, "PAN...................... %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c",
PrintAndLogEx(INFO, "PAN...................... " _GREEN_("%c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c"),
token[1], token[2], token[3], token[4],
token[5], token[6], token[7], token[8],
token[9], token[10], token[11], token[12],
@ -362,7 +364,7 @@ static int emv_parse_track2(const uint8_t *d, size_t n, bool verbose) {
if (tmp[0] == ';')
tmp++;
PrintAndLogEx(INFO, "PAN...................... %c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c",
PrintAndLogEx(INFO, "PAN...................... "_GREEN_("%c%c%c%c %c%c%c%c %c%c%c%c %c%c%c%c"),
tmp[0], tmp[1], tmp[2], tmp[3],
tmp[4], tmp[5], tmp[6], tmp[7],
tmp[8], tmp[9], tmp[10], tmp[11],
@ -479,7 +481,7 @@ static int emv_parse_card_details(uint8_t *response, size_t reslen, bool verbose
if (apan_full != NULL) {
const struct tlv *apan_tlv = tlvdb_get_tlv(apan_full);
if (apan_tlv->len == 8) {
PrintAndLogEx(INFO, "PAN.................. " _YELLOW_("%02x%02x %02x%02x %02x%02x %02x%02x"),
PrintAndLogEx(INFO, "PAN.................. " _GREEN_("%02x%02x %02x%02x %02x%02x %02x%02x"),
apan_tlv->value[0],
apan_tlv->value[1],
apan_tlv->value[2],
@ -543,6 +545,34 @@ static int emv_parse_card_details(uint8_t *response, size_t reslen, bool verbose
// Track 3 Data
// to be impl.
// Unpredicable Number (UN)
struct tlvdb *un1_full = tlvdb_find_full(root, 0x9f37);
if (un1_full != NULL) {
const struct tlv *un1_tlv = tlvdb_get_tlv(un1_full);
if (un1_tlv->len) {
PrintAndLogEx(INFO, "9F37 Unpredicable Number... " _YELLOW_("%s"), sprint_hex_inrow(un1_tlv->value, un1_tlv->len));
}
}
// Unpredicable Number (UN)
struct tlvdb *un_full = tlvdb_find_full(root, 0x9f6a);
if (un_full != NULL) {
const struct tlv *un_tlv = tlvdb_get_tlv(un_full);
if (un_tlv->len) {
PrintAndLogEx(INFO, "9F6A Unpredicable Number... " _YELLOW_("%s"), sprint_hex_inrow(un_tlv->value, un_tlv->len));
emv_parse_track2(un_tlv->value, un_tlv->len, verbose);
}
}
struct tlvdb *merch_full = tlvdb_find_full(root, 0x9f4e);
if (merch_full != NULL) {
const struct tlv *merch_tlv = tlvdb_get_tlv(merch_full);
if (merch_tlv->len) {
PrintAndLogEx(INFO, "Merchant Name and Location... " _YELLOW_("%s"), sprint_hex_inrow(merch_tlv->value, merch_tlv->len));
}
}
tlvdb_free(root);
return PM3_SUCCESS;
}

View file

@ -133,6 +133,11 @@ int Iso7816ExchangeEx(Iso7816CommandChannel channel, bool activate_field, bool l
res = ExchangeAPDU14a(data, datalen, activate_field, leave_field_on, result, (int)max_result_len, (int *)result_len);
if (res != PM3_SUCCESS) {
res = exchange_14b_apdu(data, datalen, activate_field, leave_field_on, result, (int)max_result_len, (int *)result_len, 4000);
if (res == PM3_SUCCESS) {
PrintAndLogEx(INFO, "Testing ISO14443-B... ( " _GREEN_("ok") " )");
} else {
PrintAndLogEx(INFO, "Testing ISO14443-B... ( " _RED_("fail") " )");
}
}
break;
}