mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 22:03:42 -07:00
formatting
This commit is contained in:
parent
907c4a4b39
commit
a5f7e4172b
2 changed files with 48 additions and 17 deletions
|
@ -6781,9 +6781,6 @@ static int CmdHF14ADesLsFiles(const char *Cmd) {
|
|||
}
|
||||
}
|
||||
|
||||
//int DesfireGetFileIDList(DesfireContext *dctx, uint8_t *resp, size_t *resplen);
|
||||
//int DesfireGetFileISOIDList(DesfireContext *dctx, uint8_t *resp, size_t *resplen);
|
||||
|
||||
FileListS FileList;
|
||||
memset(FileList, 0, sizeof(FileList));
|
||||
|
||||
|
@ -6815,33 +6812,35 @@ static int CmdHF14ADesLsFiles(const char *Cmd) {
|
|||
PrintAndLogEx(ERR, "Desfire GetFileISOIDList command " _RED_("error") ". Result: %d", res);
|
||||
}
|
||||
|
||||
size_t isoindx = 0;
|
||||
if (buflen > 0) {
|
||||
size_t isoindx = 0;
|
||||
for (int i = 0; i < filescount; i++) {
|
||||
if (FileList[i].fileSettings.fileType != 0x03 && FileList[i].fileSettings.fileType != 0x05) {
|
||||
if (FileList[i].fileSettings.fileType != 0x02 && FileList[i].fileSettings.fileType != 0x05) {
|
||||
FileList[i].fileISONum = MemBeToUint2byte(&buf[isoindx * 2]);
|
||||
isoindx++;
|
||||
}
|
||||
}
|
||||
if (isoindx > 0)
|
||||
isoindx--;
|
||||
if (isoindx * 2 != buflen)
|
||||
PrintAndLogEx(WARNING, "Wrong ISO ID list length. must be %d but %d", buflen, isoindx * 2);
|
||||
} else {
|
||||
PrintAndLogEx(WARNING, "ISO ID list returned no data");
|
||||
}
|
||||
|
||||
PrintAndLogEx(INFO, "---- " _CYAN_("File list") " ----");
|
||||
PrintAndLogEx(INFO, "---------------------------- " _CYAN_("File list") " ----------(r w rw ch)------------------");
|
||||
for (int i = 0; i < filescount; i++) {
|
||||
PrintAndLogEx(SUCCESS, "ID: " _GREEN_("%02x ") NOLF, FileList[i].fileNum);
|
||||
if (FileList[i].fileISONum != 0)
|
||||
PrintAndLogEx(NORMAL, "ISO ID: %04x " NOLF, FileList[i].fileISONum);
|
||||
else
|
||||
PrintAndLogEx(NORMAL, "ISO ID: n/a " NOLF);
|
||||
if (isoindx > 0) {
|
||||
if (FileList[i].fileISONum != 0)
|
||||
PrintAndLogEx(NORMAL, "ISO ID: " _CYAN_("%04x ") NOLF, FileList[i].fileISONum);
|
||||
else
|
||||
PrintAndLogEx(NORMAL, "ISO ID: " _YELLOW_("n/a ") NOLF);
|
||||
}
|
||||
|
||||
DesfirePrintFileSettingsOneLine(&FileList[i].fileSettings);
|
||||
}
|
||||
|
||||
|
||||
|
||||
DropField();
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
|
|
@ -1475,13 +1475,45 @@ void DesfireFillFileSettings(uint8_t *data, size_t datalen, FileSettingsS *fsett
|
|||
|
||||
void DesfirePrintFileSettingsOneLine(FileSettingsS *fsettings) {
|
||||
PrintAndLogEx(NORMAL, "(%-5s) " NOLF, GetDesfireCommunicationMode(fsettings->fileCommMode));
|
||||
PrintAndLogEx(NORMAL, "[0x%02x] %-13s ", fsettings->fileType, GetDesfireFileType(fsettings->fileType));
|
||||
PrintAndLogEx(NORMAL, "[0x%02x] %-13s " NOLF, fsettings->fileType, GetDesfireFileType(fsettings->fileType));
|
||||
|
||||
switch (fsettings->fileType) {
|
||||
case 0x00:
|
||||
case 0x01: {
|
||||
PrintAndLogEx(NORMAL, "size: %d [0x%x] " NOLF, fsettings->fileSize, fsettings->fileSize);
|
||||
break;
|
||||
}
|
||||
/* case 0x02: {
|
||||
fsettings->lowerLimit = MemLeToUint4byte(&data[4]);
|
||||
fsettings->upperLimit = MemLeToUint4byte(&data[8]);
|
||||
fsettings->value = MemLeToUint4byte(&data[12]);
|
||||
fsettings->limitedCredit = data[16];
|
||||
reclen = 4 + 13;
|
||||
break;
|
||||
}
|
||||
case 0x03:
|
||||
case 0x04: {
|
||||
fsettings->recordSize = MemLeToUint3byte(&data[4]);
|
||||
fsettings->maxRecordCount = MemLeToUint3byte(&data[7]);
|
||||
fsettings->curRecordCount = MemLeToUint3byte(&data[10]);
|
||||
reclen = 4 + 9;
|
||||
break;
|
||||
}
|
||||
case 0x05: {
|
||||
fsettings->keyType = data[4];
|
||||
fsettings->keyVersion = data[5];
|
||||
break;
|
||||
}*/
|
||||
default: {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/* PrintAndLogEx(SUCCESS, "read : %s", GetDesfireAccessRightStr(r));
|
||||
PrintAndLogEx(SUCCESS, "write : %s", GetDesfireAccessRightStr(w));
|
||||
PrintAndLogEx(SUCCESS, "readwrite: %s", GetDesfireAccessRightStr(rw));
|
||||
PrintAndLogEx(SUCCESS, "change : %s", GetDesfireAccessRightStr(ch));*/
|
||||
PrintAndLogEx(NORMAL, "(%s %s %s %s)",
|
||||
GetDesfireAccessRightStr(fsettings->rAccess),
|
||||
GetDesfireAccessRightStr(fsettings->wAccess),
|
||||
GetDesfireAccessRightStr(fsettings->rwAccess),
|
||||
GetDesfireAccessRightStr(fsettings->chAccess));
|
||||
}
|
||||
|
||||
static void DesfirePrintFileSettDynPart(uint8_t filetype, uint8_t *data, size_t datalen, uint8_t *dynlen, bool create) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue