mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-02-25 08:05:04 +08:00
hf search - prelim - re-use hf mfu GetTagType...
in hf 14a reader to identify UL(+) still a work in progress.
This commit is contained in:
parent
2be768af57
commit
8ceb6b03e5
4 changed files with 97 additions and 38 deletions
|
@ -544,6 +544,21 @@ int CmdHFList(const char *Cmd)
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int CmdHFSearch(const char *Cmd){
|
||||||
|
int ans = 0;
|
||||||
|
ans = CmdHF14AReader(Cmd);
|
||||||
|
if (ans > 0) return ans;
|
||||||
|
|
||||||
|
ans = CmdHF15Reader(Cmd);
|
||||||
|
//if (ans > 0) return ans;
|
||||||
|
|
||||||
|
ans = CmdHF14BRead(Cmd);
|
||||||
|
//if (ans > 0) return ans;
|
||||||
|
|
||||||
|
ans = CmdHFiClassReader(Cmd);
|
||||||
|
//if (ans > 0) return ans;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
static command_t CommandTable[] =
|
static command_t CommandTable[] =
|
||||||
{
|
{
|
||||||
|
@ -554,10 +569,11 @@ static command_t CommandTable[] =
|
||||||
{"epa", CmdHFEPA, 1, "{ German Identification Card... }"},
|
{"epa", CmdHFEPA, 1, "{ German Identification Card... }"},
|
||||||
{"legic", CmdHFLegic, 0, "{ LEGIC RFIDs... }"},
|
{"legic", CmdHFLegic, 0, "{ LEGIC RFIDs... }"},
|
||||||
{"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},
|
{"iclass", CmdHFiClass, 1, "{ ICLASS RFIDs... }"},
|
||||||
{"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"},
|
{"mf", CmdHFMF, 1, "{ MIFARE RFIDs... }"},
|
||||||
{"mfu", CmdHFMFUltra, 1, "{ MIFARE Ultralight RFIDs... }"},
|
{"mfu", CmdHFMFUltra, 1, "{ MIFARE Ultralight RFIDs... }"},
|
||||||
{"tune", CmdHFTune, 0, "Continuously measure HF antenna tuning"},
|
{"tune", CmdHFTune, 0, "Continuously measure HF antenna tuning"},
|
||||||
{"list", CmdHFList, 1, "List protocol data in trace buffer"},
|
{"list", CmdHFList, 1, "List protocol data in trace buffer"},
|
||||||
|
{"search", CmdHFSearch, 1, "Search for known HF tags"},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -23,6 +23,7 @@
|
||||||
#include "common.h"
|
#include "common.h"
|
||||||
#include "cmdmain.h"
|
#include "cmdmain.h"
|
||||||
#include "mifare.h"
|
#include "mifare.h"
|
||||||
|
#include "cmdhfmfu.h"
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
static void waitCmd(uint8_t iLen);
|
static void waitCmd(uint8_t iLen);
|
||||||
|
@ -169,6 +170,42 @@ int CmdHF14AReader(const char *Cmd)
|
||||||
|
|
||||||
switch (card.sak) {
|
switch (card.sak) {
|
||||||
case 0x00:
|
case 0x00:
|
||||||
|
|
||||||
|
//***************************************test****************
|
||||||
|
// disconnect
|
||||||
|
c.arg[0] = 0;
|
||||||
|
c.arg[1] = 0;
|
||||||
|
c.arg[2] = 0;
|
||||||
|
SendCommand(&c);
|
||||||
|
|
||||||
|
uint16_t tagT = GetHF14AMfU_Type();
|
||||||
|
ul_print_type(tagT, 0);
|
||||||
|
|
||||||
|
//reconnect for further tests
|
||||||
|
c.arg[0] = ISO14A_CONNECT | ISO14A_NO_DISCONNECT;
|
||||||
|
c.arg[1] = 0;
|
||||||
|
c.arg[2] = 0;
|
||||||
|
|
||||||
|
SendCommand(&c);
|
||||||
|
|
||||||
|
UsbCommand resp;
|
||||||
|
WaitForResponse(CMD_ACK,&resp);
|
||||||
|
|
||||||
|
memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t));
|
||||||
|
|
||||||
|
select_status = resp.arg[0]; // 0: couldn't read, 1: OK, with ATS, 2: OK, no ATS
|
||||||
|
|
||||||
|
if(select_status == 0) {
|
||||||
|
//PrintAndLog("iso14443a card select failed");
|
||||||
|
// disconnect
|
||||||
|
c.arg[0] = 0;
|
||||||
|
c.arg[1] = 0;
|
||||||
|
c.arg[2] = 0;
|
||||||
|
SendCommand(&c);
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* orig
|
||||||
// check if the tag answers to GETVERSION (0x60)
|
// check if the tag answers to GETVERSION (0x60)
|
||||||
c.arg[0] = ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT;
|
c.arg[0] = ISO14A_RAW | ISO14A_APPEND_CRC | ISO14A_NO_DISCONNECT;
|
||||||
c.arg[1] = 1;
|
c.arg[1] = 1;
|
||||||
|
@ -187,7 +224,7 @@ int CmdHF14AReader(const char *Cmd)
|
||||||
case 0x01:PrintAndLog("TYPE : NXP MIFARE Ultralight C");break;
|
case 0x01:PrintAndLog("TYPE : NXP MIFARE Ultralight C");break;
|
||||||
case 0x00:PrintAndLog("TYPE : NXP MIFARE Ultralight");break;
|
case 0x00:PrintAndLog("TYPE : NXP MIFARE Ultralight");break;
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
break;
|
break;
|
||||||
case 0x01: PrintAndLog("TYPE : NXP TNP3xxx Activision Game Appliance"); break;
|
case 0x01: PrintAndLog("TYPE : NXP TNP3xxx Activision Game Appliance"); break;
|
||||||
case 0x04: PrintAndLog("TYPE : NXP MIFARE (various !DESFire !DESFire EV1)"); break;
|
case 0x04: PrintAndLog("TYPE : NXP MIFARE (various !DESFire !DESFire EV1)"); break;
|
||||||
|
|
|
@ -23,26 +23,6 @@
|
||||||
#define MAX_NTAG_215 0x86
|
#define MAX_NTAG_215 0x86
|
||||||
#define MAX_NTAG_216 0xe6
|
#define MAX_NTAG_216 0xe6
|
||||||
|
|
||||||
typedef enum TAGTYPE_UL {
|
|
||||||
UNKNOWN = 0x0000,
|
|
||||||
UL = 0x0001,
|
|
||||||
UL_C = 0x0002,
|
|
||||||
UL_EV1_48 = 0x0004,
|
|
||||||
UL_EV1_128 = 0x0008,
|
|
||||||
NTAG = 0x0010,
|
|
||||||
NTAG_213 = 0x0020,
|
|
||||||
NTAG_215 = 0x0040,
|
|
||||||
NTAG_216 = 0x0080,
|
|
||||||
MY_D = 0x0100,
|
|
||||||
MY_D_NFC = 0x0200,
|
|
||||||
MY_D_MOVE = 0x0400,
|
|
||||||
MY_D_MOVE_NFC = 0x0800,
|
|
||||||
MAGIC = 0x1000,
|
|
||||||
UL_MAGIC = UL | MAGIC,
|
|
||||||
UL_C_MAGIC = UL_C | MAGIC,
|
|
||||||
UL_ERROR = 0xFFFF,
|
|
||||||
} TagTypeUL_t;
|
|
||||||
|
|
||||||
#define KEYS_3DES_COUNT 7
|
#define KEYS_3DES_COUNT 7
|
||||||
uint8_t default_3des_keys[KEYS_3DES_COUNT][16] = {
|
uint8_t default_3des_keys[KEYS_3DES_COUNT][16] = {
|
||||||
{ 0x42,0x52,0x45,0x41,0x4b,0x4d,0x45,0x49,0x46,0x59,0x4f,0x55,0x43,0x41,0x4e,0x21 },// 3des std key
|
{ 0x42,0x52,0x45,0x41,0x4b,0x4d,0x45,0x49,0x46,0x59,0x4f,0x55,0x43,0x41,0x4e,0x21 },// 3des std key
|
||||||
|
@ -314,31 +294,35 @@ static int ntag_print_CC(uint8_t *data) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ul_print_type(uint16_t tagtype){
|
int ul_print_type(uint16_t tagtype, uint8_t spaces){
|
||||||
|
char spc[11] = " ";
|
||||||
|
spc[10]=0x00;
|
||||||
|
char *spacer = spc + (10-spaces);
|
||||||
|
|
||||||
if ( tagtype & UL )
|
if ( tagtype & UL )
|
||||||
PrintAndLog(" TYPE : MIFARE Ultralight (MF0ICU1) %s [%x]", (tagtype & MAGIC)?"<magic>":"", tagtype);
|
PrintAndLog("%sTYPE : MIFARE Ultralight (MF0ICU1) %s [%x]", spacer, (tagtype & MAGIC)?"<magic>":"", tagtype);
|
||||||
else if ( tagtype & UL_C)
|
else if ( tagtype & UL_C)
|
||||||
PrintAndLog(" TYPE : MIFARE Ultralight C (MF0ULC) %s [%x]", (tagtype & MAGIC)?"<magic>":"", tagtype );
|
PrintAndLog("%sTYPE : MIFARE Ultralight C (MF0ULC) %s [%x]", spacer, (tagtype & MAGIC)?"<magic>":"", tagtype );
|
||||||
else if ( tagtype & UL_EV1_48)
|
else if ( tagtype & UL_EV1_48)
|
||||||
PrintAndLog(" TYPE : MIFARE Ultralight EV1 48bytes (MF0UL1101)");
|
PrintAndLog("%sTYPE : MIFARE Ultralight EV1 48bytes (MF0UL1101)", spacer);
|
||||||
else if ( tagtype & UL_EV1_128)
|
else if ( tagtype & UL_EV1_128)
|
||||||
PrintAndLog(" TYPE : MIFARE Ultralight EV1 128bytes (MF0UL2101)");
|
PrintAndLog("%sTYPE : MIFARE Ultralight EV1 128bytes (MF0UL2101)", spacer);
|
||||||
else if ( tagtype & NTAG_213 )
|
else if ( tagtype & NTAG_213 )
|
||||||
PrintAndLog(" TYPE : MIFARE NTAG 213 144bytes (NT2H1311G0DU)");
|
PrintAndLog("%sTYPE : MIFARE NTAG 213 144bytes (NT2H1311G0DU)", spacer);
|
||||||
else if ( tagtype & NTAG_215 )
|
else if ( tagtype & NTAG_215 )
|
||||||
PrintAndLog(" TYPE : MIFARE NTAG 215 504bytes (NT2H1511G0DU)");
|
PrintAndLog("%sTYPE : MIFARE NTAG 215 504bytes (NT2H1511G0DU)", spacer);
|
||||||
else if ( tagtype & NTAG_216 )
|
else if ( tagtype & NTAG_216 )
|
||||||
PrintAndLog(" TYPE : MIFARE NTAG 216 888bytes (NT2H1611G0DU)");
|
PrintAndLog("%sTYPE : MIFARE NTAG 216 888bytes (NT2H1611G0DU)", spacer);
|
||||||
else if ( tagtype & MY_D )
|
else if ( tagtype & MY_D )
|
||||||
PrintAndLog(" TYPE : INFINEON my-d\x99");
|
PrintAndLog("%sTYPE : INFINEON my-d\x99", spacer);
|
||||||
else if ( tagtype & MY_D_NFC )
|
else if ( tagtype & MY_D_NFC )
|
||||||
PrintAndLog(" TYPE : INFINEON my-d\x99 NFC");
|
PrintAndLog("%sTYPE : INFINEON my-d\x99 NFC", spacer);
|
||||||
else if ( tagtype & MY_D_MOVE )
|
else if ( tagtype & MY_D_MOVE )
|
||||||
PrintAndLog(" TYPE : INFINEON my-d\x99 move");
|
PrintAndLog("%sTYPE : INFINEON my-d\x99 move", spacer);
|
||||||
else if ( tagtype & MY_D_MOVE_NFC )
|
else if ( tagtype & MY_D_MOVE_NFC )
|
||||||
PrintAndLog(" TYPE : INFINEON my-d\x99 move NFC");
|
PrintAndLog("%sTYPE : INFINEON my-d\x99 move NFC", spacer);
|
||||||
else
|
else
|
||||||
PrintAndLog(" TYPE : Unknown %04x",tagtype);
|
PrintAndLog("%sTYPE : Unknown %04x", spacer, tagtype);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -579,7 +563,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
|
|
||||||
PrintAndLog("\n--- Tag Information ---------");
|
PrintAndLog("\n--- Tag Information ---------");
|
||||||
PrintAndLog("-------------------------------------------------------------");
|
PrintAndLog("-------------------------------------------------------------");
|
||||||
ul_print_type(tagtype);
|
ul_print_type(tagtype, 6);
|
||||||
|
|
||||||
status = ul_select(&card);
|
status = ul_select(&card);
|
||||||
if ( status < 1 ){
|
if ( status < 1 ){
|
||||||
|
|
|
@ -20,9 +20,31 @@ void rol (uint8_t *data, const size_t len);
|
||||||
uint8_t requestAuthentication( uint8_t *nonce);
|
uint8_t requestAuthentication( uint8_t *nonce);
|
||||||
int try3DesAuthentication( uint8_t *key);
|
int try3DesAuthentication( uint8_t *key);
|
||||||
uint16_t GetHF14AMfU_Type(void);
|
uint16_t GetHF14AMfU_Type(void);
|
||||||
|
int ul_print_type(uint16_t tagtype, uint8_t spacer);
|
||||||
|
|
||||||
int usage_hf_mfu_dump(void);
|
int usage_hf_mfu_dump(void);
|
||||||
|
|
||||||
int CmdHFMFUltra(const char *Cmd);
|
int CmdHFMFUltra(const char *Cmd);
|
||||||
int CmdHF14AMfUInfo(const char *Cmd);
|
int CmdHF14AMfUInfo(const char *Cmd);
|
||||||
|
|
||||||
|
typedef enum TAGTYPE_UL {
|
||||||
|
UNKNOWN = 0x0000,
|
||||||
|
UL = 0x0001,
|
||||||
|
UL_C = 0x0002,
|
||||||
|
UL_EV1_48 = 0x0004,
|
||||||
|
UL_EV1_128 = 0x0008,
|
||||||
|
NTAG = 0x0010,
|
||||||
|
NTAG_213 = 0x0020,
|
||||||
|
NTAG_215 = 0x0040,
|
||||||
|
NTAG_216 = 0x0080,
|
||||||
|
MY_D = 0x0100,
|
||||||
|
MY_D_NFC = 0x0200,
|
||||||
|
MY_D_MOVE = 0x0400,
|
||||||
|
MY_D_MOVE_NFC = 0x0800,
|
||||||
|
MAGIC = 0x1000,
|
||||||
|
UL_MAGIC = UL | MAGIC,
|
||||||
|
UL_C_MAGIC = UL_C | MAGIC,
|
||||||
|
UL_ERROR = 0xFFFF,
|
||||||
|
} TagTypeUL_t;
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
Loading…
Reference in a new issue