mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-08-23 14:35:28 -07:00
CHG: the work in progress of making "HF MFU INFO" / "HF MFU DUMP" goes on.
ook @marshmellows changes and remade them a bit. TagTypeUL_t behaves like a flag-enum. "HF MFU DUMP" now autodetects tagtype, and the deviceside should report back proper length.
This commit is contained in:
parent
a8be77afd1
commit
1ec21089b2
3 changed files with 171 additions and 147 deletions
|
@ -163,9 +163,6 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
|
||||||
|
|
||||||
memcpy(key, datain, 16);
|
memcpy(key, datain, 16);
|
||||||
|
|
||||||
// Dbprintf("KEY: %02x %02x %02x %02x %02x %02x %02x %02x", key[0],key[1],key[2],key[3],key[4],key[5],key[6],key[7] );
|
|
||||||
// Dbprintf("KEY: %02x %02x %02x %02x %02x %02x %02x %02x", key[8],key[9],key[10],key[11],key[12],key[13],key[14],key[15] );
|
|
||||||
|
|
||||||
uint8_t a[8] = {1,1,1,1,1,1,1,1 };
|
uint8_t a[8] = {1,1,1,1,1,1,1,1 };
|
||||||
uint8_t b[8] = {0x00};
|
uint8_t b[8] = {0x00};
|
||||||
uint8_t enc_b[8] = {0x00};
|
uint8_t enc_b[8] = {0x00};
|
||||||
|
@ -320,14 +317,14 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
|
||||||
uint8_t sectorNo = arg0;
|
uint8_t sectorNo = arg0;
|
||||||
int Pages = arg1;
|
int Pages = arg1;
|
||||||
int countpages = 0;
|
int countpages = 0;
|
||||||
byte_t dataout[176] = {0x00};;
|
uint8_t dataout[176] = {0x00};;
|
||||||
uint32_t cuid = 0x00;
|
|
||||||
|
|
||||||
LED_A_ON(); LED_B_OFF(); LED_C_OFF();
|
LEDsoff();
|
||||||
|
LED_A_ON();
|
||||||
clear_trace();
|
clear_trace();
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
|
|
||||||
int len = iso14443a_select_card(NULL, NULL, &cuid);
|
int len = iso14443a_select_card(NULL, NULL, NULL);
|
||||||
if (!len) {
|
if (!len) {
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%d)",len);
|
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Can't select card (RC:%d)",len);
|
||||||
OnError(1);
|
OnError(1);
|
||||||
|
@ -347,20 +344,21 @@ void MifareUReadCard(uint8_t arg0, int arg1, uint8_t *datain)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
len = mifare_ultra_halt();
|
if (mifare_ultra_halt()) {
|
||||||
if (len) {
|
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Halt error");
|
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Halt error");
|
||||||
OnError(3);
|
OnError(3);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ALL) Dbprintf("Pages read %d", countpages);
|
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) Dbprintf("Pages read %d", countpages);
|
||||||
|
|
||||||
len = 16*4; //64 bytes
|
// Read a UL-C, EV1,
|
||||||
|
// if lockbits,
|
||||||
|
if (countpages > 16)
|
||||||
|
len = Pages*4;
|
||||||
|
else
|
||||||
|
len = Pages*4;
|
||||||
|
|
||||||
// Read a UL-C
|
|
||||||
if (Pages == 44 && countpages > 16)
|
|
||||||
len = 176;
|
|
||||||
|
|
||||||
cmd_send(CMD_ACK, 1, 0, 0, dataout, len);
|
cmd_send(CMD_ACK, 1, 0, 0, dataout, len);
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
|
|
|
@ -59,18 +59,88 @@ typedef enum TAGTYPE_UL {
|
||||||
UL_C = 0x02,
|
UL_C = 0x02,
|
||||||
UL_EV1_48 = 0x04,
|
UL_EV1_48 = 0x04,
|
||||||
UL_EV1_128 = 0x08,
|
UL_EV1_128 = 0x08,
|
||||||
UL_MAGIC = 0x10,
|
MAGIC = 0x10,
|
||||||
UL_C_MAGIC = 0x14,
|
UL_MAGIC = UL | MAGIC,
|
||||||
|
UL_C_MAGIC = UL_C | MAGIC,
|
||||||
|
UL_ERROR = 0xFF,
|
||||||
} TagTypeUL_t;
|
} TagTypeUL_t;
|
||||||
|
|
||||||
|
uint8_t GetHF14AMfU_Type(){
|
||||||
|
|
||||||
|
TagTypeUL_t tagtype = UNKNOWN;
|
||||||
|
iso14a_card_select_t card;
|
||||||
|
|
||||||
|
// select and run 0x60 (GET_VERSION - EV1 command)
|
||||||
|
UsbCommand c = {CMD_READER_ISO_14443a, {ISO14A_CONNECT | ISO14A_RAW | ISO14A_APPEND_CRC, 1, 0}};
|
||||||
|
c.d.asBytes[0] = 0x60;
|
||||||
|
SendCommand(&c);
|
||||||
|
UsbCommand resp;
|
||||||
|
WaitForResponse(CMD_ACK, &resp);
|
||||||
|
|
||||||
|
if ( resp.arg[0] == 0 ) return UL_ERROR;
|
||||||
|
|
||||||
|
memcpy(&card, (iso14a_card_select_t *)resp.d.asBytes, sizeof(iso14a_card_select_t));
|
||||||
|
|
||||||
|
// Ultralight - ATQA / SAK
|
||||||
|
if ( card.atqa[1] != 0x00 && card.atqa[0] != 0x44 && card.sak != 0x00 ) return UL_ERROR;
|
||||||
|
|
||||||
|
// EV1 GetVersion
|
||||||
|
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
||||||
|
|
||||||
|
uint8_t version[8] = {0,0,0,0,0,0,0,0};
|
||||||
|
memcpy(&version, resp.d.asBytes, sizeof(version));
|
||||||
|
uint8_t len = resp.arg[0] & 0xff;
|
||||||
|
|
||||||
|
if ( len == 0x0A && version[6] == 0x0B )
|
||||||
|
tagtype = UL_EV1_48;
|
||||||
|
else if ( len == 0x0A && version[6] != 0x0B )
|
||||||
|
tagtype = UL_EV1_128;
|
||||||
|
else if ( len == 0x01 )
|
||||||
|
tagtype = UL_C;
|
||||||
|
else if ( len == 0x00 )
|
||||||
|
tagtype = UL;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Magic UL-C, mine have a static nonce response to 0x1A command.
|
||||||
|
uint8_t nonce1[8] = {0,0,0,0,0,0,0,0};
|
||||||
|
uint8_t nonce2[8] = {0,0,0,0,0,0,0,0};
|
||||||
|
uint8_t status = requestAuthentication(nonce1);
|
||||||
|
if ( status ) {
|
||||||
|
requestAuthentication(nonce2);
|
||||||
|
if ( !memcmp(nonce1, nonce2, 8) ){
|
||||||
|
tagtype = UL_C_MAGIC;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
//TODO: Magic Ultralight test here
|
||||||
|
}
|
||||||
|
return tagtype;
|
||||||
|
}
|
||||||
|
|
||||||
int CmdHF14AMfUInfo(const char *Cmd){
|
int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
|
|
||||||
TagTypeUL_t tagtype = UNKNOWN;
|
|
||||||
|
|
||||||
uint8_t datatemp[7] = {0x00};
|
uint8_t datatemp[7] = {0x00};
|
||||||
uint8_t isOK = 0;
|
uint8_t isOK = 0;
|
||||||
uint8_t data[16] = {0x00};
|
uint8_t data[16] = {0x00};
|
||||||
|
uint8_t *key;
|
||||||
|
|
||||||
|
TagTypeUL_t tagtype = GetHF14AMfU_Type();
|
||||||
|
if (tagtype == UL_ERROR) return -1;
|
||||||
|
|
||||||
|
PrintAndLog("\n-- Tag Information ---------");
|
||||||
|
PrintAndLog("-------------------------------------------------------------");
|
||||||
|
|
||||||
|
if ( tagtype & UL )
|
||||||
|
PrintAndLog(" TYPE : MIFARE Ultralight %s", (tagtype & MAGIC)?"(magic)":"");
|
||||||
|
else if ( tagtype & UL_C)
|
||||||
|
PrintAndLog(" TYPE : MIFARE Ultralight C %s", (tagtype & MAGIC)?"(magic)":"" );
|
||||||
|
else if ( tagtype & UL_EV1_48)
|
||||||
|
PrintAndLog(" TYPE : MIFARE Ultralight EV1 48 bytes");
|
||||||
|
else if ( tagtype & UL_EV1_128)
|
||||||
|
PrintAndLog(" TYPE : MIFARE Ultralight EV1 128 bytes");
|
||||||
|
else
|
||||||
|
PrintAndLog(" TYPE : Unknown %x",tagtype);
|
||||||
|
|
||||||
|
// read pages 0,1,2,4
|
||||||
UsbCommand c = {CMD_MIFAREU_READCARD, {0, 4}};
|
UsbCommand c = {CMD_MIFAREU_READCARD, {0, 4}};
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
|
@ -87,61 +157,6 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
PrintAndLog("Command execute timed out");
|
PrintAndLog("Command execute timed out");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
PrintAndLog("\n-- Tag Information ---------");
|
|
||||||
PrintAndLog("-------------------------------------------------------------");
|
|
||||||
|
|
||||||
c.cmd = CMD_READER_ISO_14443a;
|
|
||||||
c.arg[0] = ISO14A_CONNECT | ISO14A_RAW | ISO14A_APPEND_CRC;
|
|
||||||
c.arg[1] = 1;
|
|
||||||
c.arg[2] = 0;
|
|
||||||
c.d.asBytes[0] = 0x60;
|
|
||||||
SendCommand(&c);
|
|
||||||
WaitForResponse(CMD_ACK, &resp);
|
|
||||||
|
|
||||||
if ( resp.arg[0] ) {
|
|
||||||
if (WaitForResponseTimeout(CMD_ACK, &resp, 1500)) {
|
|
||||||
|
|
||||||
uint8_t version[8] = {0,0,0,0,0,0,0,0};
|
|
||||||
memcpy(&version, resp.d.asBytes, sizeof(version));
|
|
||||||
uint8_t len = resp.arg[0] & 0xff;
|
|
||||||
|
|
||||||
if ( len == 0x0A && version[6] == 0x0B )
|
|
||||||
tagtype = UL_EV1_48;
|
|
||||||
else if ( len == 0x0A && version[6] != 0x0B )
|
|
||||||
tagtype = UL_EV1_128;
|
|
||||||
else if ( len == 0x01 )
|
|
||||||
tagtype = UL_C | UL_C_MAGIC;
|
|
||||||
else if ( len == 0x00 )
|
|
||||||
tagtype = UL | UL_MAGIC | UL_C_MAGIC;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Magic UL-C, mine have a static nonce response to 0x1A command.
|
|
||||||
uint8_t nonce1[8] = {0,0,0,0,0,0,0,0};
|
|
||||||
uint8_t nonce2[8] = {0,0,0,0,0,0,0,0};
|
|
||||||
uint8_t status = requestAuthentication(nonce1);
|
|
||||||
if ( status ) {
|
|
||||||
requestAuthentication(nonce2);
|
|
||||||
if ( !memcmp(nonce1, nonce2, 8) )
|
|
||||||
tagtype = UL_C_MAGIC;
|
|
||||||
} else {
|
|
||||||
|
|
||||||
//remove UL_C_MAGIC
|
|
||||||
tagtype = tagtype & UL_C_MAGIC;
|
|
||||||
|
|
||||||
// Magic Ultralight test here
|
|
||||||
}
|
|
||||||
|
|
||||||
switch(tagtype){
|
|
||||||
case UNKNOWN : PrintAndLog(" TYPE : Unknown"); return 0;
|
|
||||||
case UL : PrintAndLog(" TYPE : MIFARE Ultralight");break;
|
|
||||||
case UL_C : PrintAndLog(" TYPE : MIFARE Ultralight C");break;
|
|
||||||
case UL_EV1_48 : PrintAndLog(" TYPE : MIFARE Ultralight EV1 48 bytes"); break;
|
|
||||||
case UL_EV1_128 : PrintAndLog(" TYPE : MIFARE Ultralight EV1 128 bytes"); break;
|
|
||||||
case UL_MAGIC : PrintAndLog(" TYPE : MIFARE Ultralight (MAGIC)");break;
|
|
||||||
case UL_C_MAGIC : PrintAndLog(" TYPE : MIFARE Ultralight-C (MAGIC)");break;
|
|
||||||
}
|
|
||||||
|
|
||||||
// UID
|
// UID
|
||||||
memcpy( datatemp, data, 3);
|
memcpy( datatemp, data, 3);
|
||||||
|
@ -173,11 +188,10 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
|
|
||||||
|
|
||||||
PrintAndLog("--- ");
|
PrintAndLog("--- ");
|
||||||
if ( (tagtype & UL_C) == UL_C || (tagtype & UL_C_MAGIC) == UL_C_MAGIC ){
|
if ( tagtype & UL_C ) {
|
||||||
|
|
||||||
PrintAndLog("Trying some default 3des keys");
|
PrintAndLog("Trying some default 3des keys");
|
||||||
uint8_t *key;
|
|
||||||
|
|
||||||
for (uint8_t i = 0; i < 5; ++i ){
|
for (uint8_t i = 0; i < 5; ++i ){
|
||||||
key = default_3des_keys[i];
|
key = default_3des_keys[i];
|
||||||
if (try3DesAuthentication(key)){
|
if (try3DesAuthentication(key)){
|
||||||
|
@ -186,12 +200,17 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (
|
else if ((tagtype & (UL_EV1_48 || UL_EV1_128))) {
|
||||||
(tagtype & UL_EV1_48) == UL_EV1_48 ||
|
//TODO
|
||||||
(tagtype & UL_EV1_128) == UL_EV1_128
|
// --problem, there is a failed pwd tries counter in UL-EV1
|
||||||
) {
|
//PrintAndLog("Trying some known EV1 passwords.");
|
||||||
PrintAndLog("Trying some known EV1 passwords.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// disconnect
|
||||||
|
// c.arg[0] = 0;
|
||||||
|
// c.arg[1] = 0;
|
||||||
|
// c.arg[2] = 0;
|
||||||
|
// SendCommand(&c);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -306,66 +325,84 @@ int CmdHF14AMfURdBl(const char *Cmd){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int usage_hf_mfu_dump()
|
||||||
|
{
|
||||||
|
PrintAndLog("Reads all pages from Ultralight, Ultralight-C, Ultralight EV1");
|
||||||
|
PrintAndLog("and saves binary dump into the file `filename.bin` or `cardUID.bin`");
|
||||||
|
PrintAndLog("It autodetects card type.\n");
|
||||||
|
PrintAndLog("Usage: hf mfu dump <filename w/o .bin>");
|
||||||
|
PrintAndLog(" sample : hf mfu dump");
|
||||||
|
PrintAndLog(" : hf mfu dump myfile");
|
||||||
|
PrintAndLog(" : hf mfu dump 1 myfile");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
//
|
//
|
||||||
// Mifare Ultralight / Ultralight-C; Read and Dump Card Contents
|
// Mifare Ultralight / Ultralight-C / Ultralight-EV1
|
||||||
|
// Read and Dump Card Contents, using auto detection of tag size.
|
||||||
//
|
//
|
||||||
|
// TODO: take a password to read UL-C / UL-EV1 tags.
|
||||||
int CmdHF14AMfUDump(const char *Cmd){
|
int CmdHF14AMfUDump(const char *Cmd){
|
||||||
|
|
||||||
|
char cmdp = param_getchar(Cmd, 0);
|
||||||
|
if (cmdp == 'h' || cmdp == 'H')
|
||||||
|
return usage_hf_mfu_dump();
|
||||||
|
|
||||||
FILE *fout;
|
FILE *fout;
|
||||||
char filename[FILE_PATH_SIZE] = {0x00};
|
char filename[FILE_PATH_SIZE] = {0x00};
|
||||||
char * fnameptr = filename;
|
char * fnameptr = filename;
|
||||||
|
char* str = "Dumping Ultralight%s%s Card Data...";
|
||||||
|
|
||||||
uint8_t *lockbytes_t = NULL;
|
uint8_t *lockbytes_t = NULL;
|
||||||
uint8_t lockbytes[2] = {0x00};
|
uint8_t lockbytes[2] = {0x00};
|
||||||
|
|
||||||
uint8_t *lockbytes_t2 = NULL;
|
uint8_t *lockbytes_t2 = NULL;
|
||||||
uint8_t lockbytes2[2] = {0x00};
|
uint8_t lockbytes2[2] = {0x00};
|
||||||
|
|
||||||
bool bit[16] = {0x00};
|
bool bit[16] = {0x00};
|
||||||
bool bit2[16] = {0x00};
|
bool bit2[16] = {0x00};
|
||||||
|
uint8_t data[176] = {0x00};
|
||||||
|
|
||||||
int i;
|
int i = 0;
|
||||||
uint8_t BlockNo = 0;
|
int Pages = 16;
|
||||||
int Pages = 16;
|
bool tmplockbit = false;
|
||||||
|
|
||||||
bool tmplockbit = false;
|
|
||||||
uint8_t isOK = 0;
|
|
||||||
uint8_t *data = NULL;
|
|
||||||
|
|
||||||
char cmdp = param_getchar(Cmd, 0);
|
|
||||||
|
|
||||||
if (cmdp == 'h' || cmdp == 'H') {
|
TagTypeUL_t tagtype = GetHF14AMfU_Type();
|
||||||
PrintAndLog("Reads all pages from Mifare Ultralight or Ultralight-C tag.");
|
if (tagtype == UL_ERROR) return -1;
|
||||||
PrintAndLog("It saves binary dump into the file `filename.bin` or `cardUID.bin`");
|
|
||||||
PrintAndLog("Usage: hf mfu dump <c> <filename w/o .bin>");
|
if ( tagtype & UL ) {
|
||||||
PrintAndLog(" <c> optional cardtype c == Ultralight-C, Defaults to Ultralight");
|
Pages = 16;
|
||||||
PrintAndLog(" sample: hf mfu dump");
|
PrintAndLog(str,"", (tagtype & MAGIC)?" (magic)":"" );
|
||||||
PrintAndLog(" : hf mfu dump myfile");
|
}
|
||||||
PrintAndLog(" : hf mfu dump c myfile");
|
else if ( tagtype & UL_C ) {
|
||||||
return 0;
|
Pages = 44;
|
||||||
|
PrintAndLog(str,"-C", (tagtype & MAGIC)?" (magic)":"" );
|
||||||
|
}
|
||||||
|
else if ( tagtype & UL_EV1_48 ) {
|
||||||
|
Pages = 18;
|
||||||
|
PrintAndLog(str," EV1_48","");
|
||||||
|
}
|
||||||
|
else if ( tagtype & UL_EV1_128 ) {
|
||||||
|
Pages = 32;
|
||||||
|
PrintAndLog(str," EV1_128","");
|
||||||
|
} else {
|
||||||
|
Pages = 16;
|
||||||
|
PrintAndLog("Dumping unknown Ultralight, using default values.");
|
||||||
}
|
}
|
||||||
|
|
||||||
// UL or UL-C?
|
|
||||||
Pages = (cmdp == 'c' || cmdp == 'C') ? 44 : 16;
|
|
||||||
|
|
||||||
PrintAndLog("Dumping Ultralight%s Card Data...", (Pages ==16)?"":"-C");
|
UsbCommand c = {CMD_MIFAREU_READCARD, {0,Pages}};
|
||||||
|
|
||||||
UsbCommand c = {CMD_MIFAREU_READCARD, {BlockNo,Pages}};
|
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
|
|
||||||
if (WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
|
if (!WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
|
||||||
isOK = resp.arg[0] & 0xff;
|
|
||||||
if (!isOK) {
|
|
||||||
PrintAndLog("Command error");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
data = resp.d.asBytes;
|
|
||||||
} else {
|
|
||||||
PrintAndLog("Command execute time-out");
|
PrintAndLog("Command execute time-out");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!resp.arg[0] ) {
|
||||||
|
PrintAndLog("Read command failed");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
memcpy(data, resp.d.asBytes, sizeof(data));
|
||||||
|
|
||||||
// Load lock bytes.
|
// Load lock bytes.
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
|
@ -441,26 +478,17 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),tmplockbit);
|
PrintAndLog("Block %02x:%s [%d]", i,sprint_hex(data + i * 4, 4),tmplockbit);
|
||||||
}
|
}
|
||||||
|
|
||||||
int len = 0;
|
int len = param_getstr(Cmd,0,filename);
|
||||||
if ( Pages == 16 )
|
if (len > FILE_PATH_SIZE-5)
|
||||||
len = param_getstr(Cmd,0,filename);
|
len = FILE_PATH_SIZE-5;
|
||||||
else
|
|
||||||
len = param_getstr(Cmd,1,filename);
|
|
||||||
|
|
||||||
if (len > FILE_PATH_SIZE-5) len = FILE_PATH_SIZE-5;
|
|
||||||
|
|
||||||
// user supplied filename?
|
|
||||||
if (len < 1) {
|
if (len < 1) {
|
||||||
|
|
||||||
// UID = data 0-1-2 4-5-6-7 (skips a beat)
|
|
||||||
sprintf(fnameptr,"%02X%02X%02X%02X%02X%02X%02X.bin",
|
sprintf(fnameptr,"%02X%02X%02X%02X%02X%02X%02X.bin",
|
||||||
data[0],data[1], data[2], data[4],data[5],data[6], data[7]);
|
data[0], data[1], data[2], data[4], data[5], data[6], data[7]);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
sprintf(fnameptr + len," .bin");
|
sprintf(fnameptr + len," .bin");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if ((fout = fopen(filename,"wb")) == NULL) {
|
if ((fout = fopen(filename,"wb")) == NULL) {
|
||||||
PrintAndLog("Could not create file name %s", filename);
|
PrintAndLog("Could not create file name %s", filename);
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -825,8 +853,7 @@ int CmdHF14AMfUCWrBl(const char *Cmd){
|
||||||
//
|
//
|
||||||
int CmdHF14AMfucSetPwd(const char *Cmd){
|
int CmdHF14AMfucSetPwd(const char *Cmd){
|
||||||
|
|
||||||
uint8_t pwd[16] = {0x00};
|
uint8_t pwd[16] = {0x00};
|
||||||
|
|
||||||
char cmdp = param_getchar(Cmd, 0);
|
char cmdp = param_getchar(Cmd, 0);
|
||||||
|
|
||||||
if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') {
|
if (strlen(Cmd) == 0 || cmdp == 'h' || cmdp == 'H') {
|
||||||
|
@ -859,14 +886,13 @@ int CmdHF14AMfucSetPwd(const char *Cmd){
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
PrintAndLog("command execution time out");
|
PrintAndLog("command execution time out");
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
// Mifare Ultraligh - Set UID
|
// Magic UL / UL-C tags - Set UID
|
||||||
//
|
//
|
||||||
int CmdHF14AMfucSetUid(const char *Cmd){
|
int CmdHF14AMfucSetUid(const char *Cmd){
|
||||||
|
|
||||||
|
@ -1042,22 +1068,19 @@ int CmdHF14AMfuGenDiverseKeys(const char *Cmd){
|
||||||
// return;
|
// return;
|
||||||
// }
|
// }
|
||||||
|
|
||||||
//------------------------------------
|
|
||||||
// Menu Stuff
|
|
||||||
//------------------------------------
|
|
||||||
static command_t CommandTable[] =
|
static command_t CommandTable[] =
|
||||||
{
|
{
|
||||||
{"help", CmdHelp, 1,"This help"},
|
{"help", CmdHelp, 1, "This help"},
|
||||||
{"dbg", CmdHF14AMfDbg, 0,"Set default debug mode"},
|
{"dbg", CmdHF14AMfDbg, 0, "Set default debug mode"},
|
||||||
{"info", CmdHF14AMfUInfo, 0,"Taginfo"},
|
{"info", CmdHF14AMfUInfo, 0, "Tag information"},
|
||||||
{"dump", CmdHF14AMfUDump, 0,"Dump MIFARE Ultralight / Ultralight-C tag to binary file"},
|
{"dump", CmdHF14AMfUDump, 0, "Dump Ultralight / Ultralight-C tag to binary file"},
|
||||||
{"rdbl", CmdHF14AMfURdBl, 0,"Read block - MIFARE Ultralight"},
|
{"rdbl", CmdHF14AMfURdBl, 0, "Read block - Ultralight"},
|
||||||
{"wrbl", CmdHF14AMfUWrBl, 0,"Write block - MIFARE Ultralight"},
|
{"wrbl", CmdHF14AMfUWrBl, 0, "Write block - Ultralight"},
|
||||||
{"crdbl", CmdHF14AMfUCRdBl, 0,"Read block - MIFARE Ultralight C"},
|
{"crdbl", CmdHF14AMfUCRdBl, 0, "Read block - Ultralight C"},
|
||||||
{"cwrbl", CmdHF14AMfUCWrBl, 0,"Write block - MIFARE Ultralight C"},
|
{"cwrbl", CmdHF14AMfUCWrBl, 0, "Write block - Ultralight C"},
|
||||||
{"cauth", CmdHF14AMfucAuth, 0,"Ultralight C Authentication"},
|
{"cauth", CmdHF14AMfucAuth, 0, "Authentication - Ultralight C"},
|
||||||
{"setpwd", CmdHF14AMfucSetPwd , 1, "Set 3des password [Ultralight-C only]"},
|
{"setpwd", CmdHF14AMfucSetPwd, 1, "Set 3des password - Ultralight-C"},
|
||||||
{"setuid", CmdHF14AMfucSetUid , 1, "Set UID"},
|
{"setuid", CmdHF14AMfucSetUid, 1, "Set UID - MAGIC tags only"},
|
||||||
{"gen", CmdHF14AMfuGenDiverseKeys , 1, "Generate 3des mifare diversified keys"},
|
{"gen", CmdHF14AMfuGenDiverseKeys , 1, "Generate 3des mifare diversified keys"},
|
||||||
{NULL, NULL, 0, NULL}
|
{NULL, NULL, 0, NULL}
|
||||||
};
|
};
|
||||||
|
|
|
@ -19,6 +19,9 @@ 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);
|
||||||
|
uint8_t GetHF14AMfU_Type();
|
||||||
|
|
||||||
|
int usage_hf_mfu_dump();
|
||||||
|
|
||||||
int CmdHFMFUltra(const char *Cmd);
|
int CmdHFMFUltra(const char *Cmd);
|
||||||
int CmdHF14AMfUInfo(const char *Cmd);
|
int CmdHF14AMfUInfo(const char *Cmd);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue