mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-12-27 02:24:47 +08:00
hf 14a config: force RATS
This commit is contained in:
parent
5d6f8053c6
commit
e3b8e868ea
3 changed files with 33 additions and 4 deletions
|
@ -128,8 +128,9 @@ Default HF 14a config is set to:
|
|||
forcebcc = 0 (expect valid BCC)
|
||||
forcecl2 = 0 (auto)
|
||||
forcecl3 = 0 (auto)
|
||||
forcerats = 0 (auto)
|
||||
*/
|
||||
static hf14a_config hf14aconfig = { 0, 0, 0, 0 } ;
|
||||
static hf14a_config hf14aconfig = { 0, 0, 0, 0, 0 } ;
|
||||
|
||||
void printHf14aConfig(void) {
|
||||
DbpString(_CYAN_("HF 14a config"));
|
||||
|
@ -137,6 +138,7 @@ void printHf14aConfig(void) {
|
|||
Dbprintf("[b] BCC override..........%s%s%s", (hf14aconfig.forcebcc == 0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcebcc == 1) ? _RED_("Yes: Always do CL2") : "", (hf14aconfig.forcebcc == 2) ? _RED_("Yes: Always use card BCC") : "");
|
||||
Dbprintf("[2] CL2 override..........%s%s%s", (hf14aconfig.forcecl2 == 0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcecl2 == 1) ? _RED_("Yes: Always do CL2") : "", (hf14aconfig.forcecl2 == 2) ? _RED_("Yes: Always skip CL2") : "");
|
||||
Dbprintf("[3] CL3 override..........%s%s%s", (hf14aconfig.forcecl3 == 0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcecl3 == 1) ? _RED_("Yes: Always do CL3") : "", (hf14aconfig.forcecl3 == 2) ? _RED_("Yes: Always skip CL3") : "");
|
||||
Dbprintf("[r] RATS override.........%s%s%s", (hf14aconfig.forcerats == 0) ? _GREEN_("No") " (follow standard)" : "", (hf14aconfig.forcerats == 1) ? _RED_("Yes: Always do RATS") : "", (hf14aconfig.forcerats == 2) ? _RED_("Yes: Always skip RATS") : "");
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -157,6 +159,8 @@ void setHf14aConfig(hf14a_config *hc) {
|
|||
hf14aconfig.forcecl2 = hc->forcecl2;
|
||||
if ((hc->forcecl3 >= 0) && (hc->forcecl3 <= 2))
|
||||
hf14aconfig.forcecl3 = hc->forcecl3;
|
||||
if ((hc->forcerats >= 0) && (hc->forcerats <= 2))
|
||||
hf14aconfig.forcerats = hc->forcerats;
|
||||
}
|
||||
|
||||
hf14a_config *getHf14aConfig(void) {
|
||||
|
@ -2539,8 +2543,12 @@ int iso14443a_select_card(uint8_t *uid_ptr, iso14a_card_select_t *p_card, uint32
|
|||
p_card->sak = sak;
|
||||
}
|
||||
|
||||
// PICC compliant with iso14443a-4 ---> (SAK & 0x20 != 0)
|
||||
if ((sak & 0x20) == 0) return 2;
|
||||
if (hf14aconfig.forcerats == 0) {
|
||||
// PICC compliant with iso14443a-4 ---> (SAK & 0x20 != 0)
|
||||
if ((sak & 0x20) == 0) return 2;
|
||||
} else if (hf14aconfig.forcerats == 2) {
|
||||
return 2;
|
||||
} // else force RATS
|
||||
|
||||
// RATS, Request for answer to select
|
||||
if (!no_rats) {
|
||||
|
|
|
@ -176,6 +176,7 @@ static int usage_hf_14a_config(void) {
|
|||
PrintAndLogEx(NORMAL, " b 0|1|2 BCC: 0=follow standard 1=use fixed BCC 2=use card BCC");
|
||||
PrintAndLogEx(NORMAL, " 2 0|1|2 SAK<>CL2: 0=follow standard 1=execute CL2 2=skip CL2");
|
||||
PrintAndLogEx(NORMAL, " 3 0|1|2 SAK<>CL3: 0=follow standard 1=execute CL3 2=skip CL3");
|
||||
PrintAndLogEx(NORMAL, " r 0|1|2 SAK<>ATS: 0=follow standard 1=execute RATS 2=skip RATS");
|
||||
PrintAndLogEx(NORMAL, "Examples:");
|
||||
PrintAndLogEx(NORMAL, _YELLOW_(" hf 14a config ")" Print current configuration");
|
||||
PrintAndLogEx(NORMAL, _YELLOW_(" hf 14a config a 1 ")" Force execution of anticollision");
|
||||
|
@ -294,7 +295,8 @@ static int CmdHf14AConfig(const char *Cmd) {
|
|||
.forceanticol = -1,
|
||||
.forcebcc = -1,
|
||||
.forcecl2 = -1,
|
||||
.forcecl3 = -1
|
||||
.forcecl3 = -1,
|
||||
.forcerats = -1
|
||||
};
|
||||
|
||||
bool errors = false;
|
||||
|
@ -375,6 +377,24 @@ static int CmdHf14AConfig(const char *Cmd) {
|
|||
}
|
||||
cmdp += 2;
|
||||
break;
|
||||
case 'r':
|
||||
switch (param_getchar(Cmd, cmdp + 1)) {
|
||||
case '0':
|
||||
config.forcerats = 0;
|
||||
break;
|
||||
case '1':
|
||||
config.forcerats = 1;
|
||||
break;
|
||||
case '2':
|
||||
config.forcerats = 2;
|
||||
break;
|
||||
default:
|
||||
PrintAndLogEx(WARNING, "Unknown value '%c'", param_getchar(Cmd, cmdp + 1));
|
||||
errors = 1;
|
||||
break;
|
||||
}
|
||||
cmdp += 2;
|
||||
break;
|
||||
default:
|
||||
PrintAndLogEx(WARNING, "Unknown parameter '%c'", param_getchar(Cmd, cmdp));
|
||||
errors = 1;
|
||||
|
|
|
@ -128,6 +128,7 @@ typedef struct {
|
|||
int8_t forcebcc; // 0:expect valid BCC 1:force using computed BCC 2:force using card BCC
|
||||
int8_t forcecl2; // 0:auto 1:force executing CL2 2:force skipping CL2
|
||||
int8_t forcecl3; // 0:auto 1:force executing CL3 2:force skipping CL3
|
||||
int8_t forcerats; // 0:auto 1:force executing RATS 2:force skipping RATS
|
||||
} PACKED hf14a_config;
|
||||
|
||||
// Tracelog Header struct
|
||||
|
|
Loading…
Reference in a new issue