changed "hf mfdes lsapp" to print dfname regardless if it is not a genuine strign

This commit is contained in:
iceman1001 2022-10-23 18:45:20 +02:00
commit 8940982c85
3 changed files with 17 additions and 12 deletions

View file

@ -18,10 +18,8 @@
// Code heavily modified by B.Kerler :) // Code heavily modified by B.Kerler :)
#include "cmdhfmfdes.h" #include "cmdhfmfdes.h"
#include <stdio.h> #include <stdio.h>
#include <string.h> #include <string.h>
#include "commonutil.h" // ARRAYLEN #include "commonutil.h" // ARRAYLEN
#include "cmdparser.h" // command_t #include "cmdparser.h" // command_t
#include "comms.h" #include "comms.h"
@ -41,7 +39,7 @@
#include "mifare/mifaredefault.h" // default keys #include "mifare/mifaredefault.h" // default keys
#include "crapto1/crapto1.h" #include "crapto1/crapto1.h"
#include "fileutils.h" #include "fileutils.h"
#include "nfc/ndef.h" // NDEF //#include "nfc/ndef.h" // NDEF
#include "mifare/mad.h" #include "mifare/mad.h"
#include "mifare/mifaredefault.h" #include "mifare/mifaredefault.h"
#include "generator.h" #include "generator.h"

View file

@ -333,7 +333,7 @@ int AIDDFDecodeAndPrint(uint8_t aid[3]) {
open_aiddf_file(&df_known_aids, false); open_aiddf_file(&df_known_aids, false);
char fmt[80]; char fmt[80];
snprintf(fmt, sizeof(fmt), " DF AID Function %02X%02X%02X :" _YELLOW_("%s"), aid[2], aid[1], aid[0], "%s"); snprintf(fmt, sizeof(fmt), " DF AID Function... %02X%02X%02X :" _YELLOW_("%s"), aid[2], aid[1], aid[0], "%s");
print_aiddf_description(df_known_aids, aid, fmt, false); print_aiddf_description(df_known_aids, aid, fmt, false);
close_aiddf_file(df_known_aids); close_aiddf_file(df_known_aids);
return PM3_SUCCESS; return PM3_SUCCESS;

View file

@ -997,7 +997,7 @@ int DesfireSelectAndAuthenticateEx(DesfireContext_t *dctx, DesfireSecureChannel
if (isosw) if (isosw)
dctx->cmdSet = DCCISO; dctx->cmdSet = DCCISO;
if (!noauth) { if (noauth == false) {
res = DesfireAuthenticate(dctx, secureChannel, verbose); res = DesfireAuthenticate(dctx, secureChannel, verbose);
if (res != PM3_SUCCESS) { if (res != PM3_SUCCESS) {
PrintAndLogEx(ERR, "Desfire authenticate " _RED_("error") ". Result: [%d] %s", res, DesfireAuthErrorToStr(res)); PrintAndLogEx(ERR, "Desfire authenticate " _RED_("error") ". Result: [%d] %s", res, DesfireAuthErrorToStr(res));
@ -1746,7 +1746,12 @@ int DesfireFillAppList(DesfireContext_t *dctx, PICCInfo_t *PICCInfo, AppListS ap
int indx = AppListSearchAID(DesfireAIDByteToUint(&buf[i * 24 + 1]), appList, PICCInfo->appCount); int indx = AppListSearchAID(DesfireAIDByteToUint(&buf[i * 24 + 1]), appList, PICCInfo->appCount);
if (indx >= 0) { if (indx >= 0) {
appList[indx].appISONum = MemLeToUint2byte(&buf[i * 24 + 1 + 3]); appList[indx].appISONum = MemLeToUint2byte(&buf[i * 24 + 1 + 3]);
memcpy(appList[indx].appDFName, &buf[i * 24 + 1 + 5], strnlen((char *)&buf[i * 24 + 1 + 5], 16)); memcpy(
appList[indx].appDFName,
&buf[i * 24 + 1 + 5],
// strnlen((char *)&buf[i * 24 + 1 + 5], 16)
16
);
} }
} }
} }
@ -1822,7 +1827,9 @@ void DesfirePrintAppList(DesfireContext_t *dctx, PICCInfo_t *PICCInfo, AppListS
PrintAndLogEx(SUCCESS, "--------------------------------- " _CYAN_("Applications list") " ---------------------------------"); PrintAndLogEx(SUCCESS, "--------------------------------- " _CYAN_("Applications list") " ---------------------------------");
for (int i = 0; i < PICCInfo->appCount; i++) { for (int i = 0; i < PICCInfo->appCount; i++) {
PrintAndLogEx(SUCCESS, _CYAN_("Application number: 0x%02x") " iso id: " _GREEN_("0x%04x") " name: " _GREEN_("%s"), appList[i].appNum, appList[i].appISONum, appList[i].appDFName); PrintAndLogEx(SUCCESS, _CYAN_("Application number: 0x%02X"), appList[i].appNum);
PrintAndLogEx(SUCCESS," ISO id.... " _GREEN_("0x%04X"), appList[i].appISONum);
PrintAndLogEx(SUCCESS," DF name... " _GREEN_("%s") " ( %s)", appList[i].appDFName, sprint_hex((uint8_t*)appList[i].appDFName, sizeof(appList[i].appDFName)));
DesfirePrintAIDFunctions(appList[i].appNum); DesfirePrintAIDFunctions(appList[i].appNum);