mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-20 21:33:19 -07:00
fix my understanding of REQB vs WUPB
This commit is contained in:
parent
f3b83bee83
commit
146600578c
2 changed files with 11 additions and 13 deletions
|
@ -321,16 +321,14 @@ static int GetIso14443bCommandFromReader(uint8_t *received, uint16_t *len)
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
void SimulateIso14443bTag(void)
|
void SimulateIso14443bTag(void)
|
||||||
{
|
{
|
||||||
// the only commands we understand is REQB, AFI=0, Select All, N=8:
|
// the only commands we understand is WUPB, AFI=0, Select All, N=1:
|
||||||
static const uint8_t cmd1[] = { 0x05, 0x00, 0x08, 0x39, 0x73 }; // REQB
|
static const uint8_t cmd1[] = { 0x05, 0x00, 0x08, 0x39, 0x73 }; // WUPB
|
||||||
// ... and REQB, AFI=0, Normal Request, N=0:
|
// ... and REQB, AFI=0, Normal Request, N=1:
|
||||||
static const uint8_t cmd2[] = { 0x05, 0x00, 0x00, 0x71, 0xFF }; // REQB
|
static const uint8_t cmd2[] = { 0x05, 0x00, 0x00, 0x71, 0xFF }; // REQB
|
||||||
// ... and WUPB, AFI=0, N=8:
|
|
||||||
static const uint8_t cmd3[] = { 0x05, 0x08, 0x08, 0xF9, 0xBD }; // WUPB
|
|
||||||
// ... and HLTB
|
// ... and HLTB
|
||||||
static const uint8_t cmd4[] = { 0x50, 0xff, 0xff, 0xff, 0xff }; // HLTB
|
static const uint8_t cmd3[] = { 0x50, 0xff, 0xff, 0xff, 0xff }; // HLTB
|
||||||
// ... and ATTRIB
|
// ... and ATTRIB
|
||||||
static const uint8_t cmd5[] = { 0x1D, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; // ATTRIB
|
static const uint8_t cmd4[] = { 0x1D, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff}; // ATTRIB
|
||||||
|
|
||||||
// ... and we always respond with ATQB, PUPI = 820de174, Application Data = 0x20381922,
|
// ... and we always respond with ATQB, PUPI = 820de174, Application Data = 0x20381922,
|
||||||
// supports only 106kBit/s in both directions, max frame size = 32Bytes,
|
// supports only 106kBit/s in both directions, max frame size = 32Bytes,
|
||||||
|
@ -391,14 +389,13 @@ void SimulateIso14443bTag(void)
|
||||||
|
|
||||||
// Good, look at the command now.
|
// Good, look at the command now.
|
||||||
if ( (len == sizeof(cmd1) && memcmp(receivedCmd, cmd1, len) == 0)
|
if ( (len == sizeof(cmd1) && memcmp(receivedCmd, cmd1, len) == 0)
|
||||||
|| (len == sizeof(cmd2) && memcmp(receivedCmd, cmd2, len) == 0)
|
|| (len == sizeof(cmd2) && memcmp(receivedCmd, cmd2, len) == 0) ) {
|
||||||
|| (len == sizeof(cmd3) && memcmp(receivedCmd, cmd3, len) == 0) ) {
|
|
||||||
resp = response1;
|
resp = response1;
|
||||||
respLen = sizeof(response1);
|
respLen = sizeof(response1);
|
||||||
respCode = resp1Code;
|
respCode = resp1Code;
|
||||||
respCodeLen = resp1CodeLen;
|
respCodeLen = resp1CodeLen;
|
||||||
} else if ( (len == sizeof(cmd4) && receivedCmd[0] == cmd4[0])
|
} else if ( (len == sizeof(cmd3) && receivedCmd[0] == cmd3[0])
|
||||||
|| (len == sizeof(cmd5) && receivedCmd[0] == cmd5[0]) ) {
|
|| (len == sizeof(cmd4) && receivedCmd[0] == cmd4[0]) ) {
|
||||||
resp = response2;
|
resp = response2;
|
||||||
respLen = sizeof(response2);
|
respLen = sizeof(response2);
|
||||||
respCode = resp2Code;
|
respCode = resp2Code;
|
||||||
|
@ -412,6 +409,7 @@ void SimulateIso14443bTag(void)
|
||||||
if(b1 != receivedCmd[len-2] || b2 != receivedCmd[len-1]) {
|
if(b1 != receivedCmd[len-2] || b2 != receivedCmd[len-1]) {
|
||||||
// Not so good, try again.
|
// Not so good, try again.
|
||||||
DbpString("+++CRC fail");
|
DbpString("+++CRC fail");
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
DbpString("CRC passes");
|
DbpString("CRC passes");
|
||||||
}
|
}
|
||||||
|
|
|
@ -206,7 +206,7 @@ int CmdHF14BCmdRaw (const char *Cmd) {
|
||||||
bool crc2 = true;
|
bool crc2 = true;
|
||||||
cmd2[0] = 0x05;
|
cmd2[0] = 0x05;
|
||||||
cmd2[1] = 0x00;
|
cmd2[1] = 0x00;
|
||||||
cmd2[2] = 0x00;
|
cmd2[2] = 0x08;
|
||||||
|
|
||||||
// REQB
|
// REQB
|
||||||
if (HF14BCmdRaw(true, &crc2, true, cmd2, &cmdLen, false)==0) return rawClose();
|
if (HF14BCmdRaw(true, &crc2, true, cmd2, &cmdLen, false)==0) return rawClose();
|
||||||
|
@ -397,7 +397,7 @@ int HF14BStdReader(uint8_t *data, uint8_t *datalen){
|
||||||
//std read cmd
|
//std read cmd
|
||||||
data[0] = 0x05;
|
data[0] = 0x05;
|
||||||
data[1] = 0x00;
|
data[1] = 0x00;
|
||||||
data[2] = 0x00;
|
data[2] = 0x08;
|
||||||
|
|
||||||
if (HF14BCmdRaw(true, &crc, true, data, datalen, false)==0) return rawClose();
|
if (HF14BCmdRaw(true, &crc, true, data, datalen, false)==0) return rawClose();
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue