From: iceman1001 Date: Mon, 13 Jun 2016 17:05:50 +0000 (+0200) Subject: ADD: added some identification on between old Desfire, Desfire EV1 and Desfire EV2 X-Git-Url: https://git.zerfleddert.de/cgi-bin/gitweb.cgi/proxmark3-svn/commitdiff_plain/288c6845a7acf5afd2daa7f158fedc4e8e0e0ff8 ADD: added some identification on between old Desfire, Desfire EV1 and Desfire EV2 DEL: removed two old des-commands files which wasn't used. --- diff --git a/client/Makefile b/client/Makefile index f76c9556..8ccd1cea 100644 --- a/client/Makefile +++ b/client/Makefile @@ -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 diff --git a/client/cmdhfdes.c b/client/cmdhfdes.c deleted file mode 100644 index 200270f0..00000000 --- a/client/cmdhfdes.c +++ /dev/null @@ -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 "); - 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; -} diff --git a/client/cmdhfdes.h b/client/cmdhfdes.h deleted file mode 100644 index e51797cb..00000000 --- a/client/cmdhfdes.h +++ /dev/null @@ -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 -#include -#include -#include -#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 diff --git a/client/cmdhfmfdes.c b/client/cmdhfmfdes.c index 9ab5a4af..e30407af 100644 --- a/client/cmdhfmfdes.c +++ b/client/cmdhfmfdes.c @@ -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; } diff --git a/client/cmdhfmfdes.h b/client/cmdhfmfdes.h index c05f15d6..46e401d4 100644 --- a/client/cmdhfmfdes.h +++ b/client/cmdhfmfdes.h @@ -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 { diff --git a/client/cmdhfmfdesfire.c b/client/cmdhfmfdesfire.c index 5eada6e9..89784da2 100644 --- a/client/cmdhfmfdesfire.c +++ b/client/cmdhfmfdesfire.c @@ -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; }