mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-19 21:03:48 -07:00
@Marshmellow42 's cleanup isn device-side "hf mfu" code. Looks nice. Dump uses bigbuffer now, and can dump NTAG216 :)
Consistency on the client-side code "hf mfu". looks nice.
This commit is contained in:
parent
4f5cb23aa1
commit
e7e9508883
7 changed files with 114 additions and 131 deletions
|
@ -832,7 +832,6 @@ void UsbPacketReceived(uint8_t *packet, int len)
|
||||||
MifareUC_Auth(c->arg[0],c->d.asBytes);
|
MifareUC_Auth(c->arg[0],c->d.asBytes);
|
||||||
break;
|
break;
|
||||||
case CMD_MIFAREU_READCARD:
|
case CMD_MIFAREU_READCARD:
|
||||||
case CMD_MIFAREUC_READCARD:
|
|
||||||
MifareUReadCard(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
|
MifareUReadCard(c->arg[0], c->arg[1], c->arg[2], c->d.asBytes);
|
||||||
break;
|
break;
|
||||||
case CMD_MIFAREUC_SETPWD:
|
case CMD_MIFAREUC_SETPWD:
|
||||||
|
|
|
@ -101,18 +101,17 @@ void MifareUC_Auth(uint8_t arg0, uint8_t *keybytes){
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
if(mifare_ultra_auth(keybytes) == 1){
|
if(!mifare_ultra_auth(keybytes)){
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Authentication failed");
|
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Authentication failed");
|
||||||
OnError(1);
|
OnError(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
cmd_send(CMD_ACK,1,0,0,0,0);
|
|
||||||
|
|
||||||
if (turnOffField) {
|
if (turnOffField) {
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
}
|
}
|
||||||
|
cmd_send(CMD_ACK,1,0,0,0,0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Arg0 = BlockNo,
|
// Arg0 = BlockNo,
|
||||||
|
@ -142,7 +141,7 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
|
||||||
uint8_t key[16] = {0x00};
|
uint8_t key[16] = {0x00};
|
||||||
memcpy(key, datain, sizeof(key) );
|
memcpy(key, datain, sizeof(key) );
|
||||||
|
|
||||||
if ( mifare_ultra_auth(key) == 1 ) {
|
if ( !mifare_ultra_auth(key) ) {
|
||||||
OnError(1);
|
OnError(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -153,8 +152,7 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
|
||||||
uint8_t pwd[4] = {0x00};
|
uint8_t pwd[4] = {0x00};
|
||||||
memcpy(pwd, datain, 4);
|
memcpy(pwd, datain, 4);
|
||||||
uint8_t pack[4] = {0,0,0,0};
|
uint8_t pack[4] = {0,0,0,0};
|
||||||
|
if (!mifare_ul_ev1_auth(pwd, pack)) {
|
||||||
if (mifare_ul_ev1_auth(pwd, pack) == 1){
|
|
||||||
OnError(1);
|
OnError(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -176,6 +174,7 @@ void MifareUReadBlock(uint8_t arg0, uint8_t arg1, uint8_t *datain)
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// Select, Authenticate, Read a MIFARE tag.
|
// Select, Authenticate, Read a MIFARE tag.
|
||||||
// read sector (data = 4 x 16 bytes = 64 bytes, or 16 x 16 bytes = 256 bytes)
|
// read sector (data = 4 x 16 bytes = 64 bytes, or 16 x 16 bytes = 256 bytes)
|
||||||
|
@ -212,6 +211,7 @@ void MifareReadSector(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
||||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if(isOK && mifare_classic_auth(pcs, cuid, FirstBlockOfSector(sectorNo), keyType, ui64Key, AUTH_FIRST)) {
|
if(isOK && mifare_classic_auth(pcs, cuid, FirstBlockOfSector(sectorNo), keyType, ui64Key, AUTH_FIRST)) {
|
||||||
isOK = 0;
|
isOK = 0;
|
||||||
if (MF_DBGLEVEL >= 1) Dbprintf("Auth error");
|
if (MF_DBGLEVEL >= 1) Dbprintf("Auth error");
|
||||||
|
@ -254,8 +254,8 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
|
||||||
uint16_t blocks = arg1;
|
uint16_t blocks = arg1;
|
||||||
bool useKey = (arg2 == 1); //UL_C
|
bool useKey = (arg2 == 1); //UL_C
|
||||||
bool usePwd = (arg2 == 2); //UL_EV1/NTAG
|
bool usePwd = (arg2 == 2); //UL_EV1/NTAG
|
||||||
int countblocks = 0;
|
uint32_t countblocks = 0;
|
||||||
uint8_t dataout[176] = {0x00};
|
uint8_t *dataout = BigBuf_get_addr();
|
||||||
|
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
LED_A_ON();
|
LED_A_ON();
|
||||||
|
@ -274,7 +274,7 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
|
||||||
uint8_t key[16] = {0x00};
|
uint8_t key[16] = {0x00};
|
||||||
memcpy(key, datain, sizeof(key) );
|
memcpy(key, datain, sizeof(key) );
|
||||||
|
|
||||||
if ( mifare_ultra_auth(key) == 1 ) {
|
if ( !mifare_ultra_auth(key) ) {
|
||||||
OnError(1);
|
OnError(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -286,19 +286,30 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
|
||||||
memcpy(pwd, datain, sizeof(pwd));
|
memcpy(pwd, datain, sizeof(pwd));
|
||||||
uint8_t pack[4] = {0,0,0,0};
|
uint8_t pack[4] = {0,0,0,0};
|
||||||
|
|
||||||
if (mifare_ul_ev1_auth(pwd, pack) == 1){
|
if (!mifare_ul_ev1_auth(pwd, pack)){
|
||||||
OnError(1);
|
OnError(1);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 0; i < blocks; i++){
|
for (int i = 0; i < blocks; i++){
|
||||||
len = mifare_ultra_readblock(blockNo * 4 + i, dataout + 4 * i);
|
if ((i*4) + 4 > BigBuf_get_traceLen()) {
|
||||||
|
Dbprintf("Data exceeds buffer!!");
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
len = mifare_ultra_readblock(blockNo + i, dataout + 4 * i);
|
||||||
|
|
||||||
if (len) {
|
if (len) {
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Read block %d error",i);
|
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Read block %d error",i);
|
||||||
|
// if no blocks read - error out
|
||||||
|
if (i==0){
|
||||||
OnError(2);
|
OnError(2);
|
||||||
return;
|
return;
|
||||||
|
} else {
|
||||||
|
//stop at last successful read block and return what we got
|
||||||
|
break;
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
countblocks++;
|
countblocks++;
|
||||||
}
|
}
|
||||||
|
@ -313,9 +324,8 @@ void MifareUReadCard(uint8_t arg0, uint16_t arg1, uint8_t arg2, uint8_t *datain)
|
||||||
|
|
||||||
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) Dbprintf("Blocks read %d", countblocks);
|
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) Dbprintf("Blocks read %d", countblocks);
|
||||||
|
|
||||||
len = blocks*4;
|
countblocks *= 4;
|
||||||
|
cmd_send(CMD_ACK, 1, countblocks, countblocks, 0, 0);
|
||||||
cmd_send(CMD_ACK, 1, len, 0, dataout, len);
|
|
||||||
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
FpgaWriteConfWord(FPGA_MAJOR_MODE_OFF);
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
}
|
}
|
||||||
|
@ -392,7 +402,6 @@ void MifareWriteBlock(uint8_t arg0, uint8_t arg1, uint8_t arg2, uint8_t *datain)
|
||||||
LEDsoff();
|
LEDsoff();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MifareUWriteBlock(uint8_t arg0, uint8_t *datain)
|
void MifareUWriteBlock(uint8_t arg0, uint8_t *datain)
|
||||||
{
|
{
|
||||||
uint8_t blockNo = arg0;
|
uint8_t blockNo = arg0;
|
||||||
|
@ -435,7 +444,6 @@ void MifareUWriteBlock_Special(uint8_t arg0, uint8_t *datain)
|
||||||
{
|
{
|
||||||
uint8_t blockNo = arg0;
|
uint8_t blockNo = arg0;
|
||||||
byte_t blockdata[4] = {0x00};
|
byte_t blockdata[4] = {0x00};
|
||||||
uint8_t uid[10] = {0x00};
|
|
||||||
|
|
||||||
memcpy(blockdata, datain,4);
|
memcpy(blockdata, datain,4);
|
||||||
|
|
||||||
|
@ -444,7 +452,7 @@ void MifareUWriteBlock_Special(uint8_t arg0, uint8_t *datain)
|
||||||
clear_trace();
|
clear_trace();
|
||||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||||
|
|
||||||
if(!iso14443a_select_card(uid, NULL, NULL)) {
|
if(!iso14443a_select_card(NULL, NULL, NULL)) {
|
||||||
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
if (MF_DBGLEVEL >= 1) Dbprintf("Can't select card");
|
||||||
OnError(0);
|
OnError(0);
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -322,15 +322,14 @@ int mifare_ul_ev1_auth(uint8_t *keybytes, uint8_t *pack){
|
||||||
len = mifare_sendcmd_short_mfuev1auth(NULL, 0, 0x1B, key, resp, respPar, NULL);
|
len = mifare_sendcmd_short_mfuev1auth(NULL, 0, 0x1B, key, resp, respPar, NULL);
|
||||||
if (len != 4) {
|
if (len != 4) {
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x %u", resp[0], len);
|
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x %u", resp[0], len);
|
||||||
OnError(1);
|
return 0;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MF_DBGLEVEL >= MF_DBG_EXTENDED)
|
if (MF_DBGLEVEL >= MF_DBG_EXTENDED)
|
||||||
Dbprintf("Auth Resp: %02x%02x%02x%02x", resp[0],resp[1],resp[2],resp[3]);
|
Dbprintf("Auth Resp: %02x%02x%02x%02x", resp[0],resp[1],resp[2],resp[3]);
|
||||||
|
|
||||||
memcpy(pack, resp, 4);
|
memcpy(pack, resp, 4);
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mifare_ultra_auth(uint8_t *keybytes){
|
int mifare_ultra_auth(uint8_t *keybytes){
|
||||||
|
@ -352,8 +351,7 @@ int mifare_ultra_auth(uint8_t *keybytes){
|
||||||
len = mifare_sendcmd_short(NULL, 1, 0x1A, 0x00, resp, respPar ,NULL);
|
len = mifare_sendcmd_short(NULL, 1, 0x1A, 0x00, resp, respPar ,NULL);
|
||||||
if (len != 11) {
|
if (len != 11) {
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x", resp[0]);
|
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x", resp[0]);
|
||||||
OnError(1);
|
return 0;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// tag nonce.
|
// tag nonce.
|
||||||
|
@ -385,8 +383,7 @@ int mifare_ultra_auth(uint8_t *keybytes){
|
||||||
len = mifare_sendcmd_short_mfucauth(NULL, 1, 0xAF, rnd_ab, resp, respPar, NULL);
|
len = mifare_sendcmd_short_mfucauth(NULL, 1, 0xAF, rnd_ab, resp, respPar, NULL);
|
||||||
if (len != 11) {
|
if (len != 11) {
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x", resp[0]);
|
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("Cmd Error: %02x", resp[0]);
|
||||||
OnError(1);
|
return 0;
|
||||||
return 1;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t enc_resp[8] = { 0,0,0,0,0,0,0,0 };
|
uint8_t enc_resp[8] = { 0,0,0,0,0,0,0,0 };
|
||||||
|
@ -397,7 +394,7 @@ int mifare_ultra_auth(uint8_t *keybytes){
|
||||||
tdes_2key_dec(resp_random_a, enc_resp, 8, key, enc_random_b);
|
tdes_2key_dec(resp_random_a, enc_resp, 8, key, enc_random_b);
|
||||||
if ( memcmp(resp_random_a, random_a, 8) != 0 ) {
|
if ( memcmp(resp_random_a, random_a, 8) != 0 ) {
|
||||||
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("failed authentication");
|
if (MF_DBGLEVEL >= MF_DBG_ERROR) Dbprintf("failed authentication");
|
||||||
return 1;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) {
|
if (MF_DBGLEVEL >= MF_DBG_EXTENDED) {
|
||||||
|
@ -417,7 +414,7 @@ int mifare_ultra_auth(uint8_t *keybytes){
|
||||||
resp_random_a[0],resp_random_a[1],resp_random_a[2],resp_random_a[3],
|
resp_random_a[0],resp_random_a[1],resp_random_a[2],resp_random_a[3],
|
||||||
resp_random_a[4],resp_random_a[5],resp_random_a[6],resp_random_a[7]);
|
resp_random_a[4],resp_random_a[5],resp_random_a[6],resp_random_a[7]);
|
||||||
}
|
}
|
||||||
return 0;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int mifare_ultra_readblock(uint8_t blockNo, uint8_t *blockData)
|
int mifare_ultra_readblock(uint8_t blockNo, uint8_t *blockData)
|
||||||
|
|
|
@ -14,9 +14,10 @@
|
||||||
#include "mifare.h"
|
#include "mifare.h"
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "../common/protocols.h"
|
#include "../common/protocols.h"
|
||||||
|
#include "data.h"
|
||||||
|
|
||||||
#define MAX_UL_BLOCKS 0x0f
|
#define MAX_UL_BLOCKS 0x0f
|
||||||
#define MAX_ULC_BLOCKS 0x2f
|
#define MAX_ULC_BLOCKS 0x2b
|
||||||
#define MAX_ULEV1a_BLOCKS 0x12
|
#define MAX_ULEV1a_BLOCKS 0x12
|
||||||
#define MAX_ULEV1b_BLOCKS 0x20
|
#define MAX_ULEV1b_BLOCKS 0x20
|
||||||
#define MAX_NTAG_213 0x2c
|
#define MAX_NTAG_213 0x2c
|
||||||
|
@ -157,8 +158,6 @@ static int ul_read( uint8_t page, uint8_t *response, uint16_t responseLength ){
|
||||||
|
|
||||||
uint8_t cmd[] = {ISO14443A_CMD_READBLOCK, page};
|
uint8_t cmd[] = {ISO14443A_CMD_READBLOCK, page};
|
||||||
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
||||||
if ( len == -1 )
|
|
||||||
ul_switch_off_field();
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -173,9 +172,7 @@ static int ul_comp_write( uint8_t page, uint8_t *data, uint8_t datalen ){
|
||||||
memcpy(cmd+2, data, datalen);
|
memcpy(cmd+2, data, datalen);
|
||||||
|
|
||||||
uint8_t response[1] = {0xff};
|
uint8_t response[1] = {0xff};
|
||||||
int len = ul_send_cmd_raw(cmd, 2+datalen, response, sizeof(response));
|
ul_send_cmd_raw(cmd, 2+datalen, response, sizeof(response));
|
||||||
if ( len == -1 )
|
|
||||||
ul_switch_off_field();
|
|
||||||
// ACK
|
// ACK
|
||||||
if ( response[0] == 0x0a ) return 0;
|
if ( response[0] == 0x0a ) return 0;
|
||||||
// NACK
|
// NACK
|
||||||
|
@ -186,8 +183,6 @@ static int ulc_requestAuthentication( uint8_t *nonce, uint16_t nonceLength ){
|
||||||
|
|
||||||
uint8_t cmd[] = {MIFARE_ULC_AUTH_1, 0x00};
|
uint8_t cmd[] = {MIFARE_ULC_AUTH_1, 0x00};
|
||||||
int len = ul_send_cmd_raw(cmd, sizeof(cmd), nonce, nonceLength);
|
int len = ul_send_cmd_raw(cmd, sizeof(cmd), nonce, nonceLength);
|
||||||
if ( len == -1 )
|
|
||||||
ul_switch_off_field();
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -197,18 +192,16 @@ static int ulc_authentication( uint8_t *key, bool switch_off_field ){
|
||||||
memcpy(c.d.asBytes, key, 16);
|
memcpy(c.d.asBytes, key, 16);
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
if ( !WaitForResponseTimeout(CMD_ACK, &resp, 1500) ) return -1;
|
if ( !WaitForResponseTimeout(CMD_ACK, &resp, 1500) ) return 0;
|
||||||
if ( resp.arg[0] == 1 ) return 0;
|
if ( resp.arg[0] == 1 ) return 1;
|
||||||
|
|
||||||
return -2;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int ulev1_requestAuthentication( uint8_t *pwd, uint8_t *pack, uint16_t packLength ){
|
static int ulev1_requestAuthentication( uint8_t *pwd, uint8_t *pack, uint16_t packLength ){
|
||||||
|
|
||||||
uint8_t cmd[] = {MIFARE_ULEV1_AUTH, pwd[0], pwd[1], pwd[2], pwd[3]};
|
uint8_t cmd[] = {MIFARE_ULEV1_AUTH, pwd[0], pwd[1], pwd[2], pwd[3]};
|
||||||
int len = ul_send_cmd_raw(cmd, sizeof(cmd), pack, packLength);
|
int len = ul_send_cmd_raw(cmd, sizeof(cmd), pack, packLength);
|
||||||
if ( len == -1)
|
|
||||||
ul_switch_off_field();
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -216,8 +209,6 @@ static int ulev1_getVersion( uint8_t *response, uint16_t responseLength ){
|
||||||
|
|
||||||
uint8_t cmd[] = {MIFARE_ULEV1_VERSION};
|
uint8_t cmd[] = {MIFARE_ULEV1_VERSION};
|
||||||
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
||||||
if ( len == -1 )
|
|
||||||
ul_switch_off_field();
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -226,7 +217,6 @@ static int ulev1_getVersion( uint8_t *response, uint16_t responseLength ){
|
||||||
// uint8_t cmd[] = {MIFARE_ULEV1_FASTREAD, startblock, endblock};
|
// uint8_t cmd[] = {MIFARE_ULEV1_FASTREAD, startblock, endblock};
|
||||||
|
|
||||||
// if ( !ul_send_cmd_raw(cmd, sizeof(cmd), response)){
|
// if ( !ul_send_cmd_raw(cmd, sizeof(cmd), response)){
|
||||||
// ul_switch_off_field();
|
|
||||||
// return -1;
|
// return -1;
|
||||||
// }
|
// }
|
||||||
// return 0;
|
// return 0;
|
||||||
|
@ -236,8 +226,6 @@ static int ulev1_readCounter( uint8_t counter, uint8_t *response, uint16_t respo
|
||||||
|
|
||||||
uint8_t cmd[] = {MIFARE_ULEV1_READ_CNT, counter};
|
uint8_t cmd[] = {MIFARE_ULEV1_READ_CNT, counter};
|
||||||
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
||||||
if (len == -1)
|
|
||||||
ul_switch_off_field();
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -245,8 +233,6 @@ static int ulev1_readTearing( uint8_t counter, uint8_t *response, uint16_t respo
|
||||||
|
|
||||||
uint8_t cmd[] = {MIFARE_ULEV1_CHECKTEAR, counter};
|
uint8_t cmd[] = {MIFARE_ULEV1_CHECKTEAR, counter};
|
||||||
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
||||||
if (len == -1)
|
|
||||||
ul_switch_off_field();
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,8 +240,6 @@ static int ulev1_readSignature( uint8_t *response, uint16_t responseLength ){
|
||||||
|
|
||||||
uint8_t cmd[] = {MIFARE_ULEV1_READSIG, 0x00};
|
uint8_t cmd[] = {MIFARE_ULEV1_READSIG, 0x00};
|
||||||
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
int len = ul_send_cmd_raw(cmd, sizeof(cmd), response, responseLength);
|
||||||
if (len == -1)
|
|
||||||
ul_switch_off_field();
|
|
||||||
return len;
|
return len;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -536,7 +520,7 @@ uint16_t GetHF14AMfU_Type(void){
|
||||||
if ( card.uid[0] != 0x05) {
|
if ( card.uid[0] != 0x05) {
|
||||||
|
|
||||||
len = ulev1_getVersion(version, sizeof(version));
|
len = ulev1_getVersion(version, sizeof(version));
|
||||||
if (len > -1) ul_switch_off_field(); //if -1 it is already off
|
ul_switch_off_field();
|
||||||
|
|
||||||
switch (len) {
|
switch (len) {
|
||||||
case 0x0A: {
|
case 0x0A: {
|
||||||
|
@ -558,7 +542,7 @@ uint16_t GetHF14AMfU_Type(void){
|
||||||
}
|
}
|
||||||
case 0x01: tagtype = UL_C; break;
|
case 0x01: tagtype = UL_C; break;
|
||||||
case 0x00: tagtype = UL; break;
|
case 0x00: tagtype = UL; break;
|
||||||
case -1 : tagtype = (UL | UL_C); break; //when does this happen? -- if getversion fails, it assumes it is either UL/ULC
|
case -1 : tagtype = (UL | UL_C); break; //when does this happen?
|
||||||
default : tagtype = UNKNOWN; break;
|
default : tagtype = UNKNOWN; break;
|
||||||
}
|
}
|
||||||
// UL-C test
|
// UL-C test
|
||||||
|
@ -573,7 +557,7 @@ uint16_t GetHF14AMfU_Type(void){
|
||||||
status = ulc_requestAuthentication(nonce, sizeof(nonce));
|
status = ulc_requestAuthentication(nonce, sizeof(nonce));
|
||||||
tagtype = ( status > 0 ) ? UL_C : UL;
|
tagtype = ( status > 0 ) ? UL_C : UL;
|
||||||
|
|
||||||
if (status != -1) ul_switch_off_field();
|
ul_switch_off_field();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// Infinition MY-D tests Exam high nibble
|
// Infinition MY-D tests Exam high nibble
|
||||||
|
@ -651,26 +635,23 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
PrintAndLog("-------------------------------------------------------------");
|
PrintAndLog("-------------------------------------------------------------");
|
||||||
ul_print_type(tagtype, 6);
|
ul_print_type(tagtype, 6);
|
||||||
|
|
||||||
|
if ( hasAuthKey && (tagtype & UL_C)) {
|
||||||
|
//will select card automatically and close connection on error
|
||||||
|
if (!ulc_authentication(authenticationkey, false)) {
|
||||||
|
PrintAndLog("Error: Authentication Failed UL-C");
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
} else {
|
||||||
status = ul_select(&card);
|
status = ul_select(&card);
|
||||||
if ( status < 1 ){
|
if ( status < 1 ){
|
||||||
PrintAndLog("iso14443a card select failed");
|
PrintAndLog("iso14443a card select failed");
|
||||||
ul_switch_off_field();
|
ul_switch_off_field();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
if (hasAuthKey) {
|
||||||
if ( hasAuthKey ) {
|
|
||||||
if ((tagtype & UL_C)) {
|
|
||||||
ul_switch_off_field();
|
|
||||||
//will select card automatically
|
|
||||||
if (ulc_authentication(authenticationkey, false) != 1) {
|
|
||||||
ul_switch_off_field();
|
|
||||||
PrintAndLog("Error: Authentication Failed UL-C");
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
len = ulev1_requestAuthentication(authenticationkey, pack, sizeof(pack));
|
len = ulev1_requestAuthentication(authenticationkey, pack, sizeof(pack));
|
||||||
if (len < 1) {
|
if (len < 1) {
|
||||||
if (!len) ul_switch_off_field();
|
ul_switch_off_field();
|
||||||
PrintAndLog("Error: Authentication Failed UL-EV1/NTAG");
|
PrintAndLog("Error: Authentication Failed UL-EV1/NTAG");
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -681,7 +662,8 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
// read pages 0,1,2,4 (should read 4pages)
|
// read pages 0,1,2,4 (should read 4pages)
|
||||||
status = ul_read(0, data, sizeof(data));
|
status = ul_read(0, data, sizeof(data));
|
||||||
if ( status == -1 ){
|
if ( status == -1 ){
|
||||||
PrintAndLog("Error: tag didn't answer to READ A");
|
ul_switch_off_field();
|
||||||
|
PrintAndLog("Error: tag didn't answer to READ");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -694,6 +676,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
status = ul_read(0x28, ulc_conf, sizeof(ulc_conf));
|
status = ul_read(0x28, ulc_conf, sizeof(ulc_conf));
|
||||||
if ( status == -1 ){
|
if ( status == -1 ){
|
||||||
PrintAndLog("Error: tag didn't answer to READ UL-C");
|
PrintAndLog("Error: tag didn't answer to READ UL-C");
|
||||||
|
ul_switch_off_field();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
ulc_print_configuration(ulc_conf);
|
ulc_print_configuration(ulc_conf);
|
||||||
|
@ -703,21 +686,22 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
uint8_t ulc_deskey[16] = {0x00};
|
uint8_t ulc_deskey[16] = {0x00};
|
||||||
status = ul_read(0x2C, ulc_deskey, sizeof(ulc_deskey));
|
status = ul_read(0x2C, ulc_deskey, sizeof(ulc_deskey));
|
||||||
if ( status == -1 ){
|
if ( status == -1 ){
|
||||||
|
ul_switch_off_field();
|
||||||
PrintAndLog("Error: tag didn't answer to READ magic");
|
PrintAndLog("Error: tag didn't answer to READ magic");
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
ulc_print_3deskey(ulc_deskey);
|
ulc_print_3deskey(ulc_deskey);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
|
ul_switch_off_field();
|
||||||
// if we called info with key, just return
|
// if we called info with key, just return
|
||||||
if ( hasAuthKey ) return 1;
|
if ( hasAuthKey ) return 1;
|
||||||
|
|
||||||
// also try to diversify default keys.. look into CmdHF14AMfuGenDiverseKeys
|
// also try to diversify default keys.. look into CmdHF14AMfuGenDiverseKeys
|
||||||
PrintAndLog("Trying some default 3des keys");
|
PrintAndLog("Trying some default 3des keys");
|
||||||
ul_switch_off_field(); //will select again in try3DesAuth...
|
|
||||||
for (uint8_t i = 0; i < KEYS_3DES_COUNT; ++i ){
|
for (uint8_t i = 0; i < KEYS_3DES_COUNT; ++i ){
|
||||||
key = default_3des_keys[i];
|
key = default_3des_keys[i];
|
||||||
if (ulc_authentication(key, true) == 0){
|
if (ulc_authentication(key, true)){
|
||||||
PrintAndLog("Found default 3des key: "); //%s", sprint_hex(key,16));
|
PrintAndLog("Found default 3des key: "); //%s", sprint_hex(key,16));
|
||||||
uint8_t keySwap[16];
|
uint8_t keySwap[16];
|
||||||
memcpy(keySwap, SwapEndian64(key,16,8), 16);
|
memcpy(keySwap, SwapEndian64(key,16,8), 16);
|
||||||
|
@ -737,6 +721,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
status = ulev1_readSignature( ulev1_signature, sizeof(ulev1_signature));
|
status = ulev1_readSignature( ulev1_signature, sizeof(ulev1_signature));
|
||||||
if ( status == -1 ){
|
if ( status == -1 ){
|
||||||
PrintAndLog("Error: tag didn't answer to READ SIGNATURE");
|
PrintAndLog("Error: tag didn't answer to READ SIGNATURE");
|
||||||
|
ul_switch_off_field();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
ulev1_print_signature( ulev1_signature, sizeof(ulev1_signature));
|
ulev1_print_signature( ulev1_signature, sizeof(ulev1_signature));
|
||||||
|
@ -746,6 +731,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
status = ul_read(startconfigblock, ulev1_conf, sizeof(ulev1_conf));
|
status = ul_read(startconfigblock, ulev1_conf, sizeof(ulev1_conf));
|
||||||
if ( status == -1 ){
|
if ( status == -1 ){
|
||||||
PrintAndLog("Error: tag didn't answer to READ EV1");
|
PrintAndLog("Error: tag didn't answer to READ EV1");
|
||||||
|
ul_switch_off_field();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
// save AUTHENTICATION LIMITS for later:
|
// save AUTHENTICATION LIMITS for later:
|
||||||
|
@ -763,31 +749,39 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
uint8_t version[10] = {0x00};
|
uint8_t version[10] = {0x00};
|
||||||
status = ulev1_getVersion(version, sizeof(version));
|
status = ulev1_getVersion(version, sizeof(version));
|
||||||
if ( status == -1 ){
|
if ( status == -1 ){
|
||||||
PrintAndLog("Error: tag didn't answer to GET_VERSION");
|
PrintAndLog("Error: tag didn't answer to GETVERSION");
|
||||||
|
ul_switch_off_field();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
ulev1_print_version(version);
|
ulev1_print_version(version);
|
||||||
|
|
||||||
// if we called info with key, just return
|
// if we called info with key, just return
|
||||||
if ( hasAuthKey ) return 1;
|
if ( hasAuthKey ) {
|
||||||
|
ul_switch_off_field();
|
||||||
|
return 1;
|
||||||
|
}
|
||||||
|
|
||||||
// AUTHLIMIT, (number of failed authentications)
|
// AUTHLIMIT, (number of failed authentications)
|
||||||
// 0 = limitless.
|
// 0 = limitless.
|
||||||
// 1-7 = ... should we even try then?
|
// 1-7 = ... should we even try then?
|
||||||
if ( authlim == 0 ){
|
if ( authlim == 0 ){
|
||||||
PrintAndLog("\n--- Known EV1/NTAG passwords.");
|
PrintAndLog("\n--- Known EV1/NTAG passwords.");
|
||||||
|
len = 0;
|
||||||
|
|
||||||
int len=0; //if len goes to -1 the connection will be turned off.
|
|
||||||
for (uint8_t i = 0; i < KEYS_PWD_COUNT; ++i ){
|
for (uint8_t i = 0; i < KEYS_PWD_COUNT; ++i ){
|
||||||
key = default_pwd_pack[i];
|
key = default_pwd_pack[i];
|
||||||
if ( len > -1 ){
|
|
||||||
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
len = ulev1_requestAuthentication(key, pack, sizeof(pack));
|
||||||
|
if (len >= 1) {
|
||||||
PrintAndLog("Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
PrintAndLog("Found a default password: %s || Pack: %02X %02X",sprint_hex(key, 4), pack[0], pack[1]);
|
||||||
break;
|
break;
|
||||||
|
} else {
|
||||||
|
status = ul_select(&card);
|
||||||
|
if ( status < 1 ){
|
||||||
|
PrintAndLog("iso14443a card select failed - ev1 auth");
|
||||||
|
ul_switch_off_field();
|
||||||
|
return status;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (len > -1) ul_switch_off_field();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -797,6 +791,7 @@ int CmdHF14AMfUInfo(const char *Cmd){
|
||||||
status = ul_read(3, cc, sizeof(cc));
|
status = ul_read(3, cc, sizeof(cc));
|
||||||
if ( status == -1 ){
|
if ( status == -1 ){
|
||||||
PrintAndLog("Error: tag didn't answer to READ ntag");
|
PrintAndLog("Error: tag didn't answer to READ ntag");
|
||||||
|
ul_switch_off_field();
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
ntag_print_CC(cc);
|
ntag_print_CC(cc);
|
||||||
|
@ -973,7 +968,6 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
bool bit2[16] = {0x00};
|
bool bit2[16] = {0x00};
|
||||||
uint8_t data[1024] = {0x00};
|
uint8_t data[1024] = {0x00};
|
||||||
bool hasPwd = false;
|
bool hasPwd = false;
|
||||||
bool hasKey = false;
|
|
||||||
int i = 0;
|
int i = 0;
|
||||||
int Pages = 16;
|
int Pages = 16;
|
||||||
bool tmplockbit = false;
|
bool tmplockbit = false;
|
||||||
|
@ -998,18 +992,17 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
case 'k':
|
case 'k':
|
||||||
case 'K':
|
case 'K':
|
||||||
dataLen = param_getstr(Cmd, cmdp+1, tempStr);
|
dataLen = param_getstr(Cmd, cmdp+1, tempStr);
|
||||||
if (dataLen == 32) {
|
if (dataLen == 32) //ul-c
|
||||||
errors = param_gethex(tempStr, 0, key, dataLen);
|
errors = param_gethex(tempStr, 0, key, dataLen);
|
||||||
hasKey = true;
|
else if (dataLen == 8) //ev1/ntag
|
||||||
}
|
|
||||||
else if (dataLen == 8) {
|
|
||||||
errors = param_gethex(tempStr, 0, key, dataLen);
|
errors = param_gethex(tempStr, 0, key, dataLen);
|
||||||
hasPwd = true;
|
else{
|
||||||
}
|
PrintAndLog("\nERROR: Key is incorrect length\n");
|
||||||
else
|
|
||||||
errors = true;
|
errors = true;
|
||||||
|
}
|
||||||
|
|
||||||
cmdp += 2;
|
cmdp += 2;
|
||||||
|
hasPwd = true;
|
||||||
break;
|
break;
|
||||||
case 'l':
|
case 'l':
|
||||||
case 'L':
|
case 'L':
|
||||||
|
@ -1046,8 +1039,8 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
//Validations
|
//Validations
|
||||||
if(errors) return usage_hf_mfu_dump();
|
if(errors) return usage_hf_mfu_dump();
|
||||||
|
|
||||||
//if (swapEndian && hasKey )
|
if (swapEndian && dataLen == 32)
|
||||||
// keyPtr = SwapEndian64(data, 16, 8);
|
keyPtr = SwapEndian64(data, 16, 8);
|
||||||
|
|
||||||
TagTypeUL_t tagtype = GetHF14AMfU_Type();
|
TagTypeUL_t tagtype = GetHF14AMfU_Type();
|
||||||
if (tagtype == UL_ERROR) return -1;
|
if (tagtype == UL_ERROR) return -1;
|
||||||
|
@ -1059,33 +1052,35 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
|
|
||||||
ul_print_type(tagtype, 0);
|
ul_print_type(tagtype, 0);
|
||||||
PrintAndLog("Reading tag memory...");
|
PrintAndLog("Reading tag memory...");
|
||||||
|
UsbCommand c = {CMD_MIFAREU_READCARD, {startPage,Pages}};
|
||||||
UsbCommand c = {CMD_MIFAREUC_READCARD, {startPage, Pages}};
|
|
||||||
|
|
||||||
if ( hasKey ) {
|
|
||||||
c.arg[2] = 1;
|
|
||||||
memcpy(c.d.asBytes, key, 16);
|
|
||||||
}
|
|
||||||
if ( hasPwd ) {
|
if ( hasPwd ) {
|
||||||
c.arg[2] = 2;
|
if (tagtype & UL_C)
|
||||||
memcpy(c.d.asBytes, key, 4);
|
c.arg[2] = 1; //UL_C auth
|
||||||
}
|
else
|
||||||
|
c.arg[2] = 2; //UL_EV1/NTAG auth
|
||||||
|
|
||||||
|
memcpy(c.d.asBytes, key, dataLen/2);
|
||||||
|
}
|
||||||
SendCommand(&c);
|
SendCommand(&c);
|
||||||
UsbCommand resp;
|
UsbCommand resp;
|
||||||
if (!WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
|
if (!WaitForResponseTimeout(CMD_ACK,&resp,1500)) {
|
||||||
PrintAndLog("Command execute time-out");
|
PrintAndLog("Command execute time-out");
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
PrintAndLog ("%u,%u",resp.arg[0],resp.arg[1]);
|
if (resp.arg[0] != 1) {
|
||||||
uint8_t isOK = resp.arg[0] & 0xff;
|
|
||||||
if (isOK) {
|
|
||||||
memcpy(data, resp.d.asBytes, resp.arg[1]);
|
|
||||||
} else {
|
|
||||||
PrintAndLog("Failed reading block: (%02x)", i);
|
PrintAndLog("Failed reading block: (%02x)", i);
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
uint32_t bufferSize = resp.arg[1];
|
||||||
|
if (bufferSize > sizeof(data)) {
|
||||||
|
PrintAndLog("Data exceeded Buffer size!");
|
||||||
|
bufferSize = sizeof(data);
|
||||||
|
}
|
||||||
|
GetFromBigBuf(data, bufferSize, 0);
|
||||||
|
WaitForResponse(CMD_ACK,NULL);
|
||||||
|
|
||||||
|
Pages = bufferSize/4;
|
||||||
// Load lock bytes.
|
// Load lock bytes.
|
||||||
int j = 0;
|
int j = 0;
|
||||||
|
|
||||||
|
@ -1107,19 +1102,15 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// add keys UL_C
|
// add keys to block dump
|
||||||
if (hasKey ){
|
if (hasPwd && (tagtype & UL_C)){ //UL_C
|
||||||
memcpy(data + Pages*4, key, 16);
|
memcpy(data + Pages*4, key, dataLen/2);
|
||||||
Pages += 4;
|
Pages += 4;
|
||||||
}
|
} else if (hasPwd) { //not sure output is in correct location.
|
||||||
// add keys ULEV1 / NTAG
|
memcpy(data + Pages*4, key, dataLen/2);
|
||||||
if (hasPwd ){
|
|
||||||
memcpy(data + Pages*4, key, 4);
|
|
||||||
Pages += 1;
|
Pages += 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
//TODO add key MEM location for other tags
|
|
||||||
|
|
||||||
for (i = 0; i < Pages; ++i) {
|
for (i = 0; i < Pages; ++i) {
|
||||||
if ( i < 3 ) {
|
if ( i < 3 ) {
|
||||||
PrintAndLog("Block %02x:%s ", i,sprint_hex(data + i * 4, 4));
|
PrintAndLog("Block %02x:%s ", i,sprint_hex(data + i * 4, 4));
|
||||||
|
@ -1192,15 +1183,6 @@ int CmdHF14AMfUDump(const char *Cmd){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// // Needed to Authenticate to Ultralight C tags
|
|
||||||
// void rol (uint8_t *data, const size_t len){
|
|
||||||
// uint8_t first = data[0];
|
|
||||||
// for (size_t i = 0; i < len-1; i++) {
|
|
||||||
// data[i] = data[i+1];
|
|
||||||
// }
|
|
||||||
// data[len-1] = first;
|
|
||||||
// }
|
|
||||||
|
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
// Ultralight C Methods
|
// Ultralight C Methods
|
||||||
//-------------------------------------------------------------------------------
|
//-------------------------------------------------------------------------------
|
||||||
|
@ -1240,7 +1222,7 @@ int CmdHF14AMfucAuth(const char *Cmd){
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t *key = default_3des_keys[keyNo];
|
uint8_t *key = default_3des_keys[keyNo];
|
||||||
if (ulc_authentication(key, true) == 0)
|
if (ulc_authentication(key, true))
|
||||||
PrintAndLog("Authentication successful. 3des key: %s",sprint_hex(key, 16));
|
PrintAndLog("Authentication successful. 3des key: %s",sprint_hex(key, 16));
|
||||||
else
|
else
|
||||||
PrintAndLog("Authentication failed");
|
PrintAndLog("Authentication failed");
|
||||||
|
@ -1248,7 +1230,6 @@ int CmdHF14AMfucAuth(const char *Cmd){
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
A test function to validate that the polarssl-function works the same
|
A test function to validate that the polarssl-function works the same
|
||||||
was as the openssl-implementation.
|
was as the openssl-implementation.
|
||||||
|
@ -1704,6 +1685,9 @@ 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"},
|
||||||
|
|
|
@ -14,16 +14,16 @@ int CmdHF14AMfUCRdCard(const char *Cmd);
|
||||||
int CmdHF14AMfucAuth(const char *Cmd);
|
int CmdHF14AMfucAuth(const char *Cmd);
|
||||||
|
|
||||||
//general stuff
|
//general stuff
|
||||||
int CmdHF14AMfUInfo(const char *Cmd);
|
|
||||||
int CmdHF14AMfUDump(const char *Cmd);
|
int CmdHF14AMfUDump(const char *Cmd);
|
||||||
|
int CmdHF14AMfUInfo(const char *Cmd);
|
||||||
uint16_t GetHF14AMfU_Type(void);
|
uint16_t GetHF14AMfU_Type(void);
|
||||||
|
|
||||||
//void rol (uint8_t *data, const size_t len);
|
//void rol (uint8_t *data, const size_t len);
|
||||||
int ul_print_type(uint16_t tagtype, uint8_t spacer);
|
int ul_print_type(uint16_t tagtype, uint8_t spacer);
|
||||||
void ul_switch_off_field(void);
|
void ul_switch_off_field(void);
|
||||||
|
|
||||||
int usage_hf_mfu_info(void);
|
|
||||||
int usage_hf_mfu_dump(void);
|
int usage_hf_mfu_dump(void);
|
||||||
|
int usage_hf_mfu_info(void);
|
||||||
|
|
||||||
int CmdHFMFUltra(const char *Cmd);
|
int CmdHFMFUltra(const char *Cmd);
|
||||||
|
|
||||||
|
|
|
@ -135,9 +135,7 @@ local _commands = {
|
||||||
CMD_MIFARE_SNIFFER = 0x0630,
|
CMD_MIFARE_SNIFFER = 0x0630,
|
||||||
|
|
||||||
--//ultralightC
|
--//ultralightC
|
||||||
CMD_MIFAREUC_AUTH1 = 0x0724,
|
CMD_MIFAREUC_AUTH = 0x0724,
|
||||||
CMD_MIFAREUC_AUTH2 = 0x0725,
|
|
||||||
CMD_MIFAREUC_READCARD = 0x0726,
|
|
||||||
CMD_MIFAREUC_SETPWD = 0x0727,
|
CMD_MIFAREUC_SETPWD = 0x0727,
|
||||||
CMD_MIFAREU_SETUID = 0x0728,
|
CMD_MIFAREU_SETUID = 0x0728,
|
||||||
|
|
||||||
|
|
|
@ -165,10 +165,8 @@ typedef struct{
|
||||||
|
|
||||||
#define CMD_MIFARE_READBL 0x0620
|
#define CMD_MIFARE_READBL 0x0620
|
||||||
#define CMD_MIFAREU_READBL 0x0720
|
#define CMD_MIFAREU_READBL 0x0720
|
||||||
|
|
||||||
#define CMD_MIFARE_READSC 0x0621
|
#define CMD_MIFARE_READSC 0x0621
|
||||||
#define CMD_MIFAREU_READCARD 0x0721
|
#define CMD_MIFAREU_READCARD 0x0721
|
||||||
|
|
||||||
#define CMD_MIFARE_WRITEBL 0x0622
|
#define CMD_MIFARE_WRITEBL 0x0622
|
||||||
#define CMD_MIFAREU_WRITEBL 0x0722
|
#define CMD_MIFAREU_WRITEBL 0x0722
|
||||||
#define CMD_MIFAREU_WRITEBL_COMPAT 0x0723
|
#define CMD_MIFAREU_WRITEBL_COMPAT 0x0723
|
||||||
|
@ -176,12 +174,11 @@ typedef struct{
|
||||||
#define CMD_MIFARE_CHKKEYS 0x0623
|
#define CMD_MIFARE_CHKKEYS 0x0623
|
||||||
|
|
||||||
#define CMD_MIFARE_SNIFFER 0x0630
|
#define CMD_MIFARE_SNIFFER 0x0630
|
||||||
|
|
||||||
//ultralightC
|
//ultralightC
|
||||||
#define CMD_MIFAREUC_AUTH 0x0724
|
#define CMD_MIFAREUC_AUTH 0x0724
|
||||||
#define CMD_MIFAREUC_READCARD 0x0726
|
//0x0725 and 0x0726 no longer used
|
||||||
#define CMD_MIFAREUC_SETPWD 0x0727
|
#define CMD_MIFAREUC_SETPWD 0x0727
|
||||||
#define CMD_MIFAREU_SETUID 0x0728
|
|
||||||
|
|
||||||
// mifare desfire
|
// mifare desfire
|
||||||
#define CMD_MIFARE_DESFIRE_READBL 0x0728
|
#define CMD_MIFARE_DESFIRE_READBL 0x0728
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue