mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-25 07:35:40 -07:00
lsapp base works
This commit is contained in:
parent
b12abd8f73
commit
a36ec29383
2 changed files with 34 additions and 3 deletions
|
@ -6172,6 +6172,14 @@ static int CmdHF14ADesLsFiles(const char *Cmd) {
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int AppListSearchAID(uint32_t appNum, AppListS AppList, size_t appcount) {
|
||||||
|
for (int i = 0; i < appcount; i++)
|
||||||
|
if (AppList[i].appNum == appNum)
|
||||||
|
return i;
|
||||||
|
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
|
||||||
static int CmdHF14ADesLsApp(const char *Cmd) {
|
static int CmdHF14ADesLsApp(const char *Cmd) {
|
||||||
CLIParserContext *ctx;
|
CLIParserContext *ctx;
|
||||||
CLIParserInit(&ctx, "hf mfdes lsapp",
|
CLIParserInit(&ctx, "hf mfdes lsapp",
|
||||||
|
@ -6201,7 +6209,7 @@ static int CmdHF14ADesLsApp(const char *Cmd) {
|
||||||
|
|
||||||
DesfireContext dctx;
|
DesfireContext dctx;
|
||||||
int securechann = defaultSecureChannel;
|
int securechann = defaultSecureChannel;
|
||||||
int res = CmdDesGetSessionParameters(ctx, &dctx, 3, 4, 5, 6, 7, 8, 9, 10, 0, &securechann, DCMPlain, NULL);
|
int res = CmdDesGetSessionParameters(ctx, &dctx, 3, 4, 5, 6, 7, 8, 9, 10, 0, &securechann, DCMMACed, NULL);
|
||||||
if (res) {
|
if (res) {
|
||||||
CLIParserFree(ctx);
|
CLIParserFree(ctx);
|
||||||
return res;
|
return res;
|
||||||
|
@ -6226,17 +6234,33 @@ static int CmdHF14ADesLsApp(const char *Cmd) {
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
AppListS AppList = {0};
|
||||||
|
|
||||||
|
size_t appcount = buflen / 3;
|
||||||
for (int i = 0; i < buflen; i += 3)
|
for (int i = 0; i < buflen; i += 3)
|
||||||
PrintAndLogEx(INFO, "AID: %06x", DesfireAIDByteToUint(&buf[i]));
|
AppList[i / 3].appNum = DesfireAIDByteToUint(&buf[i]);
|
||||||
|
|
||||||
// result bytes: 3, 2, 1-16. total record size = 24
|
// result bytes: 3, 2, 1-16. total record size = 24
|
||||||
res = DesfireGetDFList(&dctx, buf, &buflen);
|
res = DesfireGetDFList(&dctx, buf, &buflen);
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(WARNING, "Desfire GetDFList command " _RED_("error") ". Result: %d", res);
|
PrintAndLogEx(WARNING, "Desfire GetDFList command " _RED_("error") ". Result: %d", res);
|
||||||
} else if (buflen > 1) {
|
} else if (buflen > 1) {
|
||||||
//for
|
for (int i = 0; i < buflen; i++) {
|
||||||
|
int indx = AppListSearchAID(DesfireAIDByteToUint(&buf[i * 24 + 1]), AppList, appcount);
|
||||||
|
if (indx >= 0) {
|
||||||
|
AppList[indx].appISONum = MemBeToUint2byte(&buf[i * 24 + 1 + 3]);
|
||||||
|
memcpy(AppList[indx].appDFName, &buf[i * 24 + 1 + 5], strnlen((char *)&buf[i * 24 + 1 + 5], 16));
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PrintAndLogEx(INFO, "-------------- " _CYAN_("Alications list") " --------------");
|
||||||
|
PrintAndLogEx(INFO, "Applications count: " _GREEN_("%zu"), appcount);
|
||||||
|
if (appcount > 0) {
|
||||||
|
for (int i = 0; i < appcount; i++) {
|
||||||
|
PrintAndLogEx(INFO, "App num: 0x%02x iso id: 0x%04x name: %s", AppList[i].appNum, AppList[i].appISONum, AppList[i].appDFName);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
DropField();
|
DropField();
|
||||||
return PM3_SUCCESS;
|
return PM3_SUCCESS;
|
||||||
|
|
|
@ -85,6 +85,13 @@ typedef struct {
|
||||||
|
|
||||||
typedef FileListElmS FileListS[32];
|
typedef FileListElmS FileListS[32];
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
uint32_t appNum;
|
||||||
|
uint16_t appISONum;
|
||||||
|
char appDFName[16];
|
||||||
|
} AppListElmS;
|
||||||
|
typedef AppListElmS AppListS[64];
|
||||||
|
|
||||||
typedef enum {
|
typedef enum {
|
||||||
RFTAuto,
|
RFTAuto,
|
||||||
RFTData,
|
RFTData,
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue