chg: "lf hitag info" - added HITAG type detection (Thanks! @cosmo61)

This commit is contained in:
iceman1001 2020-04-17 10:29:54 +02:00
commit 40c69b3f83

View file

@ -22,6 +22,31 @@
static int CmdHelp(const char *Cmd); static int CmdHelp(const char *Cmd);
static char* getHitagTypeStr(uint32_t uid) {
//uid s/n ********
uint8_t type = (uid >> 4) & 0xF;
switch(type) {
case 1:
return "PCF 7936";
case 2:
return "PCF 7946";
case 3:
return "PCF 7947";
case 4:
return "PCF 7942/44";
case 5:
return "PCF 7943";
case 6:
return "PCF 7941";
case 7:
return "PCF 7952";
case 9:
return "PCF 7945";
default:
return "";
}
}
/* /*
static size_t nbytes(size_t nbits) { static size_t nbytes(size_t nbits) {
return (nbits / 8) + ((nbits % 8) > 0); return (nbits / 8) + ((nbits % 8) > 0);
@ -486,7 +511,11 @@ static int CmdLFHitagInfo(const char *Cmd) {
if (getHitagUid(&uid) == false) if (getHitagUid(&uid) == false)
return PM3_ESOFT; return PM3_ESOFT;
PrintAndLogEx(SUCCESS, "UID: " _YELLOW_("%08X"), uid); PrintAndLogEx(NORMAL, "");
PrintAndLogEx(INFO, "--- " _CYAN_("Tag Information") "---------------------------");
PrintAndLogEx(INFO, "-------------------------------------------------------------");
PrintAndLogEx(SUCCESS, " UID: " _GREEN_("%08X"), uid);
PrintAndLogEx(SUCCESS, " TYPE: " _GREEN_("%s"), getHitagTypeStr(uid));
// how to detemine Hitag types? // how to detemine Hitag types?
// read block3, get configuration byte. // read block3, get configuration byte.
@ -497,6 +526,7 @@ static int CmdLFHitagInfo(const char *Cmd) {
//printHitagConfiguration( 0x02 ); //printHitagConfiguration( 0x02 );
//printHitagConfiguration( 0x00 ); //printHitagConfiguration( 0x00 );
//printHitagConfiguration( 0x04 ); //printHitagConfiguration( 0x04 );
PrintAndLogEx(INFO, "-------------------------------------------------------------");
return PM3_SUCCESS; return PM3_SUCCESS;
} }