mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-03-19 11:33:51 +08:00
getfreemem
This commit is contained in:
parent
9c63d09179
commit
6442223937
2 changed files with 15 additions and 0 deletions
|
@ -913,6 +913,20 @@ int DesfireFormatPICC(DesfireContext *dctx) {
|
|||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int DesfireGetFreeMem(DesfireContext *dctx, uint32_t *freemem) {
|
||||
*freemem = 0;
|
||||
uint8_t respcode = 0xff;
|
||||
uint8_t resp[257] = {0};
|
||||
size_t resplen = 0;
|
||||
int res = DesfireExchange(dctx, MFDES_GET_FREE_MEMORY, NULL, 0, &respcode, resp, &resplen);
|
||||
if (res != PM3_SUCCESS)
|
||||
return res;
|
||||
if (respcode != MFDES_S_OPERATION_OK || resplen != 3)
|
||||
return PM3_EAPDU_FAIL;
|
||||
*freemem = DesfireAIDByteToUint(resp);
|
||||
return PM3_SUCCESS;
|
||||
}
|
||||
|
||||
int DesfireGetUID(DesfireContext *dctx, uint8_t *resp, size_t *resplen) {
|
||||
uint8_t respcode = 0xff;
|
||||
int res = DesfireExchange(dctx, MFDES_GET_UID, NULL, 0, &respcode, resp, resplen);
|
||||
|
|
|
@ -41,6 +41,7 @@ int DesfireSelectAndAuthenticate(DesfireContext *dctx, DesfireSecureChannel secu
|
|||
int DesfireAuthenticate(DesfireContext *dctx, DesfireSecureChannel secureChannel);
|
||||
|
||||
int DesfireFormatPICC(DesfireContext *dctx);
|
||||
int DesfireGetFreeMem(DesfireContext *dctx, uint32_t *freemem);
|
||||
int DesfireGetUID(DesfireContext *dctx, uint8_t *resp, size_t *resplen);
|
||||
int DesfireGetAIDList(DesfireContext *dctx, uint8_t *resp, size_t *resplen);
|
||||
int DesfireGetDFList(DesfireContext *dctx, uint8_t *resp, size_t *resplen);
|
||||
|
|
Loading…
Add table
Reference in a new issue