mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2024-09-20 23:36:31 +08:00
ADD: added some identification on between old Desfire, Desfire EV1 and Desfire EV2
DEL: removed two old des-commands files which wasn't used.
This commit is contained in:
parent
ddaecc0826
commit
288c6845a7
|
@ -92,6 +92,7 @@ CMDSRCS = nonce2key/crapto1.c \
|
|||
ui.c \
|
||||
cmddata.c \
|
||||
lfdemod.c \
|
||||
cmdanalyse.c \
|
||||
cmdhf.c \
|
||||
cmdhf14a.c \
|
||||
cmdhf14b.c \
|
||||
|
@ -140,8 +141,7 @@ CMDSRCS = nonce2key/crapto1.c \
|
|||
tea.c \
|
||||
prng.c \
|
||||
radixsort.c \
|
||||
bucketsort.c \
|
||||
cmdanalyse.c
|
||||
bucketsort.c
|
||||
|
||||
ZLIBSRCS = deflate.c adler32.c trees.c zutil.c inflate.c inffast.c inftrees.c
|
||||
ZLIB_FLAGS = -DZ_SOLO -DZ_PREFIX -DNO_GZIP -DZLIB_PM3_TUNED
|
||||
|
|
|
@ -1,72 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2012 nuit
|
||||
//
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// High frequency MIFARE DESfire commands
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#include "cmdhfdes.h"
|
||||
#include "proxmark3.h"
|
||||
#include "cmdmain.h"
|
||||
|
||||
static int CmdHelp(const char *Cmd);
|
||||
|
||||
int CmdHFDESReader(const char *Cmd)
|
||||
{
|
||||
UsbCommand c = { CMD_MIFARE_DES_READER, {3, 0x60, 0} };
|
||||
SendCommand(&c);
|
||||
UsbCommand resp;
|
||||
if (!WaitForResponseTimeout(CMD_ACK,&resp,2000) ){
|
||||
PrintAndLog("Command time-out");
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHFDESDbg(const char *Cmd)
|
||||
{
|
||||
int dbgMode = param_get32ex(Cmd, 0, 0, 10);
|
||||
if (dbgMode > 4) {
|
||||
PrintAndLog("Max debud mode parameter is 4 \n");
|
||||
}
|
||||
|
||||
if (strlen(Cmd) < 1 || !param_getchar(Cmd, 0) || dbgMode > 4) {
|
||||
PrintAndLog("Usage: hf des dbg <debug level>");
|
||||
PrintAndLog(" 0 - no debug messages");
|
||||
PrintAndLog(" 1 - error messages");
|
||||
PrintAndLog(" 2 - all messages");
|
||||
PrintAndLog(" 4 - extended debug mode");
|
||||
return 0;
|
||||
}
|
||||
|
||||
UsbCommand c = {CMD_MIFARE_SET_DBGMODE, {dbgMode, 0, 0}};
|
||||
SendCommand(&c);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static command_t CommandTable[] =
|
||||
{
|
||||
{"help", CmdHelp, 1, "This help"},
|
||||
{"dbg", CmdHFDESDbg, 0, "Set default debug mode"},
|
||||
{"reader", CmdHFDESReader, 0, "Reader"},
|
||||
{NULL, NULL, 0, NULL}
|
||||
};
|
||||
|
||||
int CmdHFDES(const char *Cmd)
|
||||
{
|
||||
//flush
|
||||
clearCommandBuffer();
|
||||
//WaitForResponseTimeout(CMD_ACK,NULL,100);
|
||||
CmdsParse(CommandTable, Cmd);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int CmdHelp(const char *Cmd)
|
||||
{
|
||||
CmdsHelp(CommandTable);
|
||||
return 0;
|
||||
}
|
|
@ -1,27 +0,0 @@
|
|||
//-----------------------------------------------------------------------------
|
||||
// Copyright (C) 2012 nuit
|
||||
//
|
||||
// This code is licensed to you under the terms of the GNU GPL, version 2 or,
|
||||
// at your option, any later version. See the LICENSE.txt file for the text of
|
||||
// the license.
|
||||
//-----------------------------------------------------------------------------
|
||||
// High frequency MIFARE DESfire commands
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
#ifndef CMDHFDES_H__
|
||||
#define CMDHFDES_H__
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <ctype.h>
|
||||
#include "proxmark3.h"
|
||||
#include "data.h"
|
||||
#include "ui.h"
|
||||
#include "cmdparser.h"
|
||||
#include "common.h"
|
||||
#include "util.h"
|
||||
int CmdHFDES(const char *Cmd);
|
||||
int CmdHFDESReader(const char *Cmd);
|
||||
int CmdHFDESDbg(const char *Cmd);
|
||||
#endif
|
|
@ -159,7 +159,7 @@ int CmdHF14ADesInfo(const char *Cmd){
|
|||
PrintAndLog(" Vendor Id : %s", getTagInfo(resp.d.asBytes[7]));
|
||||
PrintAndLog(" Type : 0x%02X",resp.d.asBytes[8]);
|
||||
PrintAndLog(" Subtype : 0x%02X",resp.d.asBytes[9]);
|
||||
PrintAndLog(" Version : %d.%d",resp.d.asBytes[10], resp.d.asBytes[11]);
|
||||
PrintAndLog(" Version : %s",GetVersionStr(resp.d.asBytes[10], resp.d.asBytes[11]) );
|
||||
PrintAndLog(" Storage size : %s",GetCardSizeStr(resp.d.asBytes[12]));
|
||||
PrintAndLog(" Protocol : %s",GetProtocolStr(resp.d.asBytes[13]));
|
||||
PrintAndLog(" -----------------------------------------------------------");
|
||||
|
@ -217,7 +217,7 @@ int CmdHF14ADesInfo(const char *Cmd){
|
|||
*/
|
||||
char * GetCardSizeStr( uint8_t fsize ){
|
||||
|
||||
static char buf[30];
|
||||
static char buf[30] = {0x00};
|
||||
char *retStr = buf;
|
||||
|
||||
uint16_t usize = 1 << ((fsize >>1) + 1);
|
||||
|
@ -233,7 +233,7 @@ char * GetCardSizeStr( uint8_t fsize ){
|
|||
|
||||
char * GetProtocolStr(uint8_t id){
|
||||
|
||||
static char buf[30];
|
||||
static char buf[30] = {0x00};
|
||||
char *retStr = buf;
|
||||
|
||||
if ( id == 0x05)
|
||||
|
@ -243,6 +243,22 @@ char * GetProtocolStr(uint8_t id){
|
|||
return buf;
|
||||
}
|
||||
|
||||
char * GetVersionStr(uint8_t major, uint8_t minor){
|
||||
|
||||
static char buf[30] = {0x00};
|
||||
char *retStr = buf;
|
||||
|
||||
if ( major == 0)
|
||||
sprintf(retStr,"%d.%d (Desfire MF3ICD40)", major, minor);
|
||||
else if ( major == 1 && minor == 1)
|
||||
sprintf(retStr,"%d.%d (Desfire EV1)", major, minor);
|
||||
else if ( major == 1 && minor == 2)
|
||||
sprintf(retStr,"%d.%d (Desfire EV2)", major, minor);
|
||||
else
|
||||
sprintf(retStr,"%d.%d (Unknown)", major, minor);
|
||||
return buf;
|
||||
}
|
||||
|
||||
void GetKeySettings( uint8_t *aid){
|
||||
|
||||
char messStr[512] = {0x00};
|
||||
|
@ -649,7 +665,6 @@ static command_t CommandTable[] = {
|
|||
int CmdHFMFDes(const char *Cmd) {
|
||||
// flush
|
||||
clearCommandBuffer();
|
||||
//WaitForResponseTimeout(CMD_ACK,NULL,100);
|
||||
CmdsParse(CommandTable, Cmd);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -16,8 +16,9 @@ int CmdHF14ADesInfo(const char *Cmd);
|
|||
int CmdHF14ADesEnumApplications(const char *Cmd);
|
||||
|
||||
char * GetCardSizeStr( uint8_t fsize );
|
||||
char * GetProtocolStr(uint8_t id);
|
||||
void GetKeySettings( uint8_t * aid);
|
||||
char * GetProtocolStr( uint8_t id );
|
||||
char * GetVersionStr( uint8_t major, uint8_t minor );
|
||||
void GetKeySettings( uint8_t * aid );
|
||||
|
||||
// Command options for Desfire behavior.
|
||||
enum {
|
||||
|
|
|
@ -240,7 +240,6 @@ static command_t CommandTable[] =
|
|||
int CmdHFMFDesfire(const char *Cmd){
|
||||
// flush
|
||||
clearCommandBuffer();
|
||||
//WaitForResponseTimeout(CMD_ACK,NULL,100);
|
||||
CmdsParse(CommandTable, Cmd);
|
||||
return 0;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue