mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 05:43:48 -07:00
CHG: rename a local scope variable "data"->"cmd"
CHG: call params to selectcard too few CHG: 'standalone HF mode' - when copying second UID onto data array, it should append after first one, not over the first one. ref: https://github.com/iceman1001/proxmark3/issues/77 Lets see if this fixes the HF part of this issue
This commit is contained in:
parent
bdf387c7ef
commit
16cfceb689
3 changed files with 16 additions and 15 deletions
|
@ -446,8 +446,9 @@ void StandAloneMode14a()
|
||||||
continue;
|
continue;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Dbprintf("Read UID:"); Dbhexdump(10,uid,0);
|
Dbprintf("Read UID:");
|
||||||
memcpy(readUID,uid,10*sizeof(uint8_t));
|
Dbhexdump(10, uid, 0);
|
||||||
|
memcpy(readUID, uid, 10 * sizeof(uint8_t));
|
||||||
uint8_t *dst = (uint8_t *)&uid_tmp1;
|
uint8_t *dst = (uint8_t *)&uid_tmp1;
|
||||||
// Set UID byte order
|
// Set UID byte order
|
||||||
for (int i=0; i<4; i++)
|
for (int i=0; i<4; i++)
|
||||||
|
@ -473,8 +474,8 @@ void StandAloneMode14a()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Dbprintf("ATQA = %02X%02X",hi14a_card[selected].atqa[0],hi14a_card[selected].atqa[1]);
|
Dbprintf("ATQA = %02X%02X", hi14a_card[selected].atqa[0], hi14a_card[selected].atqa[1]);
|
||||||
Dbprintf("SAK = %02X",hi14a_card[selected].sak);
|
Dbprintf("SAK = %02X", hi14a_card[selected].sak);
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
LED(LED_GREEN, 200);
|
LED(LED_GREEN, 200);
|
||||||
LED(LED_ORANGE, 200);
|
LED(LED_ORANGE, 200);
|
||||||
|
@ -544,15 +545,15 @@ void StandAloneMode14a()
|
||||||
playing = 1;
|
playing = 1;
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Dbprintf("UID from target tag: %02X%02X%02X%02X", oldBlock0[0],oldBlock0[1],oldBlock0[2],oldBlock0[3]);
|
Dbprintf("UID from target tag: %02X%02X%02X%02X", oldBlock0[0], oldBlock0[1], oldBlock0[2], oldBlock0[3]);
|
||||||
memcpy(newBlock0,oldBlock0,16);
|
memcpy(newBlock0, oldBlock0, 16);
|
||||||
// Copy uid_1st for bank (2nd is for longer UIDs not supported if classic)
|
// Copy uid_1st for bank (2nd is for longer UIDs not supported if classic)
|
||||||
|
|
||||||
newBlock0[0] = uid_1st[selected]>>24;
|
newBlock0[0] = uid_1st[selected]>>24;
|
||||||
newBlock0[1] = 0xFF & (uid_1st[selected]>>16);
|
newBlock0[1] = 0xFF & (uid_1st[selected]>>16);
|
||||||
newBlock0[2] = 0xFF & (uid_1st[selected]>>8);
|
newBlock0[2] = 0xFF & (uid_1st[selected]>>8);
|
||||||
newBlock0[3] = 0xFF & (uid_1st[selected]);
|
newBlock0[3] = 0xFF & (uid_1st[selected]);
|
||||||
newBlock0[4] = newBlock0[0]^newBlock0[1]^newBlock0[2]^newBlock0[3];
|
newBlock0[4] = newBlock0[0] ^ newBlock0[1] ^ newBlock0[2] ^ newBlock0[3];
|
||||||
|
|
||||||
// arg0 = workFlags, arg1 = blockNo, datain
|
// arg0 = workFlags, arg1 = blockNo, datain
|
||||||
MifareCSetBlock(params, 0, newBlock0);
|
MifareCSetBlock(params, 0, newBlock0);
|
||||||
|
@ -590,9 +591,9 @@ void StandAloneMode14a()
|
||||||
uint8_t data[512] = {0}; // in case there is a read command received we shouldn't break
|
uint8_t data[512] = {0}; // in case there is a read command received we shouldn't break
|
||||||
uint8_t flags = ( uid_2nd[selected] > 0x00 ) ? FLAG_7B_UID_IN_DATA : FLAG_4B_UID_IN_DATA;
|
uint8_t flags = ( uid_2nd[selected] > 0x00 ) ? FLAG_7B_UID_IN_DATA : FLAG_4B_UID_IN_DATA;
|
||||||
num_to_bytes(uid_1st[selected], 3, data);
|
num_to_bytes(uid_1st[selected], 3, data);
|
||||||
num_to_bytes(uid_2nd[selected], 4, data);
|
num_to_bytes(uid_2nd[selected], 4, data+3);
|
||||||
|
|
||||||
Dbprintf("Simulating ISO14443a tag with uid[0]: %08x, uid[1]: %08x [Bank: %u]", uid_1st[selected],uid_2nd[selected],selected);
|
Dbprintf("Simulating ISO14443a tag with uid[0]: %08x, uid[1]: %08x [Bank: %u]", uid_1st[selected], uid_2nd[selected], selected);
|
||||||
if (hi14a_card[selected].sak == 8 && hi14a_card[selected].atqa[0] == 4 && hi14a_card[selected].atqa[1] == 0) {
|
if (hi14a_card[selected].sak == 8 && hi14a_card[selected].atqa[0] == 4 && hi14a_card[selected].atqa[1] == 0) {
|
||||||
DbpString("Mifare Classic");
|
DbpString("Mifare Classic");
|
||||||
SimulateIso14443aTag(1, flags, data); // Mifare Classic
|
SimulateIso14443aTag(1, flags, data); // Mifare Classic
|
||||||
|
@ -607,7 +608,7 @@ void StandAloneMode14a()
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
Dbprintf("Unrecognized tag type -- defaulting to Mifare Classic emulation");
|
Dbprintf("Unrecognized tag type -- defaulting to Mifare Classic emulation");
|
||||||
SimulateIso14443aTag(1, flags, data);
|
SimulateIso14443aTag(1, flags, data); // Mifare Classic
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (button_action == BUTTON_SINGLE_CLICK) {
|
else if (button_action == BUTTON_SINGLE_CLICK) {
|
||||||
|
|
|
@ -348,7 +348,7 @@ void EMVTransaction()
|
||||||
|
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
while(true) {
|
while(true) {
|
||||||
if(!iso14443a_select_card(uid,NULL,&cuid)) {
|
if(!iso14443a_select_card(uid, NULL, &cuid, true, 0)) {
|
||||||
if(EMV_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
if(EMV_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1108,12 +1108,12 @@ void SimulateIso14443aTag(int tagType, int flags, byte_t* data) {
|
||||||
p_response = NULL;
|
p_response = NULL;
|
||||||
} else if (receivedCmd[0] == MIFARE_ULEV1_READ_CNT && tagType == 7) { // Received a READ COUNTER --
|
} else if (receivedCmd[0] == MIFARE_ULEV1_READ_CNT && tagType == 7) { // Received a READ COUNTER --
|
||||||
uint8_t index = receivedCmd[1];
|
uint8_t index = receivedCmd[1];
|
||||||
uint8_t data[] = {0x00,0x00,0x00,0x14,0xa5};
|
uint8_t cmd[] = {0x00,0x00,0x00,0x14,0xa5};
|
||||||
if ( counters[index] > 0) {
|
if ( counters[index] > 0) {
|
||||||
num_to_bytes(counters[index], 3, data);
|
num_to_bytes(counters[index], 3, cmd);
|
||||||
AppendCrc14443a(data, sizeof(data)-2);
|
AppendCrc14443a(cmd, sizeof(cmd)-2);
|
||||||
}
|
}
|
||||||
EmSendCmdEx(data,sizeof(data),false);
|
EmSendCmdEx(cmd,sizeof(cmd),false);
|
||||||
p_response = NULL;
|
p_response = NULL;
|
||||||
} else if (receivedCmd[0] == MIFARE_ULEV1_INCR_CNT && tagType == 7) { // Received a INC COUNTER --
|
} else if (receivedCmd[0] == MIFARE_ULEV1_INCR_CNT && tagType == 7) { // Received a INC COUNTER --
|
||||||
// number of counter
|
// number of counter
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue