mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 05:13:46 -07:00
minor corrections..
This commit is contained in:
parent
9f54a5e4b9
commit
c5616dfe76
9 changed files with 124 additions and 119 deletions
|
@ -167,13 +167,14 @@ int CmdHF14AList(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int CmdHF14AReader(const char *Cmd) {
|
int CmdHF14AReader(const char *Cmd) {
|
||||||
|
bool silent = (Cmd[0] == 's' || Cmd[0] == 'S');
|
||||||
UsbCommand cDisconnect = {CMD_READER_ISO_14443a, {0,0,0}};
|
UsbCommand cDisconnect = {CMD_READER_ISO_14443a, {0,0,0}};
|
||||||
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_NO_DISCONNECT, 0, 0}};
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2500)) {
|
||||||
if (Cmd[0] != 's') PrintAndLog("iso14443a card select failed");
|
if (!silent) PrintAndLog("iso14443a card select failed");
|
||||||
SendCommand(&cDisconnect);
|
SendCommand(&cDisconnect);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -181,10 +182,16 @@ int CmdHF14AReader(const char *Cmd) {
|
||||||
iso14a_card_select_t card;
|
iso14a_card_select_t card;
|
||||||
memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t));
|
memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t));
|
||||||
|
|
||||||
uint64_t select_status = resp.arg[0]; // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS, 3: proprietary Anticollision
|
/*
|
||||||
|
0: couldn't read
|
||||||
|
1: OK, with ATS
|
||||||
|
2: OK, no ATS
|
||||||
|
3: proprietary Anticollision
|
||||||
|
*/
|
||||||
|
uint64_t select_status = resp.arg[0];
|
||||||
|
|
||||||
if (select_status == 0) {
|
if (select_status == 0) {
|
||||||
if (Cmd[0] != 's') PrintAndLog("iso14443a card select failed");
|
if (!silent) PrintAndLog("iso14443a card select failed");
|
||||||
SendCommand(&cDisconnect);
|
SendCommand(&cDisconnect);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
@ -484,7 +484,8 @@ int CmdHF15DumpMem(const char*Cmd) {
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
} // else PrintAndLog("crc");
|
} // else PrintAndLog("crc");
|
||||||
} // else PrintAndLog("r null");
|
}
|
||||||
|
// else PrintAndLog("r null");
|
||||||
} // retry
|
} // retry
|
||||||
// TODO: need fix
|
// TODO: need fix
|
||||||
// if (resp.arg[0]<3)
|
// if (resp.arg[0]<3)
|
||||||
|
@ -555,7 +556,7 @@ int CmdHF15CmdInquiry(const char *Cmd)
|
||||||
PrintAndLog("Response to short, just %i bytes. No tag?\n", resp.arg[0]);
|
PrintAndLog("Response to short, just %i bytes. No tag?\n", resp.arg[0]);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("timeout.");
|
PrintAndLog("timeout while waiting for reply.");
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -849,7 +850,7 @@ int CmdHF15CmdSysinfo(const char *Cmd) {
|
||||||
PrintAndLog("CRC failed");
|
PrintAndLog("CRC failed");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("timeout: no answer");
|
PrintAndLog("timeout while waiting for reply.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -928,7 +929,7 @@ int CmdHF15CmdReadmulti(const char *Cmd) {
|
||||||
PrintAndLog("CRC failed");
|
PrintAndLog("CRC failed");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("no answer");
|
PrintAndLog("timeout while waiting for reply.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -1002,7 +1003,7 @@ int CmdHF15CmdRead(const char *Cmd) {
|
||||||
PrintAndLog("CRC failed");
|
PrintAndLog("CRC failed");
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("no answer");
|
PrintAndLog("timeout while waiting for reply.");
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -173,7 +173,7 @@ int CmdHfEmvTrans(const char *Cmd) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 5000)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 5000)) {
|
||||||
PrintAndLog("Command execute time-out");
|
PrintAndLog("Command execute time-out");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
@ -312,7 +312,7 @@ int CmdHfEmvSim(const char *Cmd) {
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
||||||
PrintAndLog("Command execute time-out");
|
PrintAndLog("Command execute time-out");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
|
@ -318,6 +318,7 @@ int CmdHFiClassSim(const char *Cmd) {
|
||||||
memcpy(c.d.asBytes, csns, 8*NUM_CSNS);
|
memcpy(c.d.asBytes, csns, 8*NUM_CSNS);
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
|
// -1 make it wait all the time (iceman)
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, -1)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, -1)) {
|
||||||
PrintAndLog("Command timed out");
|
PrintAndLog("Command timed out");
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -1619,7 +1619,8 @@ int CmdHF14AMfSniff(const char *Cmd){
|
||||||
}
|
}
|
||||||
|
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 2000)) {
|
if ( !WaitForResponseTimeout(CMD_ACK, &resp, 2000) ) continue;
|
||||||
|
|
||||||
res = resp.arg[0] & 0xff;
|
res = resp.arg[0] & 0xff;
|
||||||
traceLen = resp.arg[1];
|
traceLen = resp.arg[1];
|
||||||
len = resp.arg[2];
|
len = resp.arg[2];
|
||||||
|
@ -1709,7 +1710,6 @@ int CmdHF14AMfSniff(const char *Cmd){
|
||||||
}
|
}
|
||||||
pckNum = 0;
|
pckNum = 0;
|
||||||
}
|
}
|
||||||
} // resp not NULL
|
|
||||||
} // while (true)
|
} // while (true)
|
||||||
|
|
||||||
free(buf);
|
free(buf);
|
||||||
|
|
|
@ -181,9 +181,8 @@ int CmdHF14ADesInfo(const char *Cmd){
|
||||||
c.arg[1] = 0x01;
|
c.arg[1] = 0x01;
|
||||||
c.d.asBytes[0] = GET_FREE_MEMORY;
|
c.d.asBytes[0] = GET_FREE_MEMORY;
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
if ( !WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
|
if ( !WaitForResponseTimeout(CMD_ACK,&resp,1500))
|
||||||
return 0;
|
return 0;
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t tmp[3];
|
uint8_t tmp[3];
|
||||||
memcpy(tmp, resp.d.asBytes+3,3);
|
memcpy(tmp, resp.d.asBytes+3,3);
|
||||||
|
@ -299,9 +298,7 @@ void GetKeySettings( uint8_t *aid){
|
||||||
c.d.asBytes[0] = GET_KEY_VERSION; //0x64
|
c.d.asBytes[0] = GET_KEY_VERSION; //0x64
|
||||||
c.d.asBytes[1] = 0x00;
|
c.d.asBytes[1] = 0x00;
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
if ( !WaitForResponseTimeout(CMD_ACK,&resp,1000) ) {
|
if ( !WaitForResponseTimeout(CMD_ACK,&resp,1000) ) { return; }
|
||||||
return;
|
|
||||||
}
|
|
||||||
isOK = resp.arg[0] & 0xff;
|
isOK = resp.arg[0] & 0xff;
|
||||||
if ( !isOK ){
|
if ( !isOK ){
|
||||||
PrintAndLog(" Can't read key-version");
|
PrintAndLog(" Can't read key-version");
|
||||||
|
|
|
@ -107,9 +107,8 @@ int CmdHF14AMfDESAuth(const char *Cmd){
|
||||||
uint8_t isOK = respb.arg[0] & 0xff;
|
uint8_t isOK = respb.arg[0] & 0xff;
|
||||||
uint8_t * data2= respb.d.asBytes;
|
uint8_t * data2= respb.d.asBytes;
|
||||||
|
|
||||||
if (isOK){
|
if (isOK)
|
||||||
PrintAndLog("b3:%s", sprint_hex(data2+2, 8));
|
PrintAndLog("b3:%s", sprint_hex(data2+2, 8));
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("Command execute timeout");
|
PrintAndLog("Command execute timeout");
|
||||||
|
@ -214,9 +213,8 @@ int CmdHF14AMfAESAuth(const char *Cmd){
|
||||||
uint8_t isOK = respb.arg[0] & 0xff;
|
uint8_t isOK = respb.arg[0] & 0xff;
|
||||||
uint8_t * data2= respb.d.asBytes;
|
uint8_t * data2= respb.d.asBytes;
|
||||||
|
|
||||||
if (isOK){
|
if (isOK)
|
||||||
PrintAndLog("b3:%s", sprint_hex(data2+2, 16));
|
PrintAndLog("b3:%s", sprint_hex(data2+2, 16));
|
||||||
}
|
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
PrintAndLog("Command execute timeout");
|
PrintAndLog("Command execute timeout");
|
||||||
|
|
|
@ -1459,6 +1459,7 @@ static int acquire_nonces(uint8_t blockNo, uint8_t keyType, uint8_t *key, uint8_
|
||||||
|
|
||||||
if (initialize) {
|
if (initialize) {
|
||||||
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
if (!WaitForResponseTimeout(CMD_ACK, &resp, 3000)) {
|
||||||
|
//strange second call (iceman)
|
||||||
UsbCommand c = {CMD_MIFARE_ACQUIRE_ENCRYPTED_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, 4}};
|
UsbCommand c = {CMD_MIFARE_ACQUIRE_ENCRYPTED_NONCES, {blockNo + keyType * 0x100, trgBlockNo + trgKeyType * 0x100, 4}};
|
||||||
clearCommandBuffer();
|
clearCommandBuffer();
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue