mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-20 21:33:47 -07:00
FIX: made the authentication part a bit clearer. It now uses two booleans to seperate which type of authentication was requested from user.
This commit is contained in:
parent
1fa96198bb
commit
c81a80dc96
1 changed files with 18 additions and 16 deletions
|
@ -620,6 +620,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
int status;
|
int status;
|
||||||
bool errors = false;
|
bool errors = false;
|
||||||
bool hasAuthKey = false;
|
bool hasAuthKey = false;
|
||||||
|
bool hasPwdKey = false;
|
||||||
bool locked = false;
|
bool locked = false;
|
||||||
uint8_t cmdp = 0;
|
uint8_t cmdp = 0;
|
||||||
uint8_t datalen = 0;
|
uint8_t datalen = 0;
|
||||||
|
@ -641,7 +642,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
if ( !datalen ) {
|
if ( !datalen ) {
|
||||||
memcpy(authenticationkey, data, 4);
|
memcpy(authenticationkey, data, 4);
|
||||||
cmdp += 2;
|
cmdp += 2;
|
||||||
hasAuthKey = true;
|
hasPwdKey = true;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
// UL-C size key
|
// UL-C size key
|
||||||
|
@ -672,16 +673,17 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
PrintAndLog("-------------------------------------------------------------");
|
PrintAndLog("-------------------------------------------------------------");
|
||||||
ul_print_type(tagtype, 6);
|
ul_print_type(tagtype, 6);
|
||||||
|
|
||||||
|
if (!ul_select(&card)) return 0;
|
||||||
|
|
||||||
if ( hasAuthKey && (tagtype & UL_C)) {
|
if ( hasAuthKey && (tagtype & UL_C)) {
|
||||||
//will select card automatically and close connection on error
|
//will select card automatically and close connection on error
|
||||||
if (!ulc_authentication(authenticationkey, false)) {
|
if (!ulc_authentication(authenticationkey, false)) {
|
||||||
PrintAndLog("Error: Authentication Failed UL-C");
|
PrintAndLog("Error: Authentication Failed UL-C");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
} else {
|
}
|
||||||
if ( !ul_select(&card) ) return 0;
|
|
||||||
|
|
||||||
if (hasAuthKey) {
|
if ( hasPwdKey ) {
|
||||||
len = ulev1_requestAuthentication(authenticationkey, pack, sizeof(pack));
|
len = ulev1_requestAuthentication(authenticationkey, pack, sizeof(pack));
|
||||||
if (len < 1) {
|
if (len < 1) {
|
||||||
ul_switch_off_field();
|
ul_switch_off_field();
|
||||||
|
@ -689,7 +691,6 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
// read pages 0,1,2,3 (should read 4pages)
|
// read pages 0,1,2,3 (should read 4pages)
|
||||||
status = ul_read(0, data, sizeof(data));
|
status = ul_read(0, data, sizeof(data));
|
||||||
|
@ -698,6 +699,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
PrintAndLog("Error: tag didn't answer to READ");
|
PrintAndLog("Error: tag didn't answer to READ");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (status == 16) {
|
if (status == 16) {
|
||||||
ul_print_default(data);
|
ul_print_default(data);
|
||||||
ndef_print_CC(data+12);
|
ndef_print_CC(data+12);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue