mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-23 14:45:37 -07:00
print file settings for create
This commit is contained in:
parent
68ebc84641
commit
195b66bdbf
2 changed files with 60 additions and 0 deletions
|
@ -1364,6 +1364,65 @@ void DesfirePrintSetFileSettings(uint8_t *data, size_t len) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void DesfirePrintCreateFileSettings(uint8_t filetype, uint8_t *data, size_t len) {
|
||||||
|
const DesfireCreateFileCommandsS *ftyperec = GetDesfireFileCmdRec(filetype);
|
||||||
|
if (ftyperec == NULL) {
|
||||||
|
PrintAndLogEx(WARNING, "Unknown file type 0x%02x", filetype);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool isoidpresent = ftyperec->mayHaveISOfid; // TODO!!!
|
||||||
|
|
||||||
|
PrintAndLogEx(INFO, "---- " _CYAN_("Create file settings") " ----");
|
||||||
|
PrintAndLogEx(SUCCESS, "File type : %s", ftyperec->text);
|
||||||
|
PrintAndLogEx(SUCCESS, "File number : 0x%02x (%d)", data[0], data[0]);
|
||||||
|
size_t xlen = 1;
|
||||||
|
if (isoidpresent) {
|
||||||
|
PrintAndLogEx(SUCCESS, "File ISO number : 0x%02x%02x", data[xlen], data[xlen + 1]);
|
||||||
|
xlen += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, "File comm mode : %s", GetDesfireCommunicationMode(data[xlen] & 0x03));
|
||||||
|
bool addaccess = ((data[xlen] & 0x80) != 0);
|
||||||
|
PrintAndLogEx(SUCCESS, "Additional access: %s", (addaccess) ? "Yes" : "No");
|
||||||
|
xlen++;
|
||||||
|
|
||||||
|
PrintAndLogEx(SUCCESS, "Access rights : %02x%02x", data[xlen + 1], data[xlen]);
|
||||||
|
DesfirePrintAccessRight(&data[xlen]);
|
||||||
|
xlen += 2;
|
||||||
|
|
||||||
|
switch (filetype) {
|
||||||
|
case 0x00:
|
||||||
|
case 0x01: {
|
||||||
|
int filesize = (data[xlen + 2] << 16) + (data[xlen + 1] << 8) + data[xlen];
|
||||||
|
xlen += 3;
|
||||||
|
|
||||||
|
PrintAndLogEx(INFO, "File size : %d (0x%X) bytes", filesize, filesize);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case 0x02: {
|
||||||
|
int lowerlimit = (data[xlen + 3] << 24) + (data[xlen + 2] << 16) + (data[xlen + 1] << 8) + data[xlen];
|
||||||
|
xlen += 4;
|
||||||
|
int upperlimit = (data[xlen + 3] << 24) + (data[xlen + 2] << 16) + (data[xlen + 1] << 8) + data[xlen];
|
||||||
|
xlen += 4;
|
||||||
|
int limitcredvalue = (data[xlen + 3] << 24) + (data[xlen + 2] << 16) + (data[xlen + 1] << 8) + data[xlen];
|
||||||
|
xlen += 4;
|
||||||
|
uint8_t limited_credit_enabled = data[xlen];
|
||||||
|
xlen++;
|
||||||
|
|
||||||
|
PrintAndLogEx(INFO, "Lower limit : %d (0x%X)", lowerlimit, lowerlimit);
|
||||||
|
PrintAndLogEx(INFO, "Upper limit : %d (0x%X)", upperlimit, upperlimit);
|
||||||
|
PrintAndLogEx(INFO, "Limited credit : [%d - %s] %d (0x%X)", limited_credit_enabled, (limited_credit_enabled == 1) ? "enabled" : "disabled", limitcredvalue, limitcredvalue);
|
||||||
|
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default: {
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
int DesfireChangeKey(DesfireContext *dctx, bool change_master_key, uint8_t newkeynum, DesfireCryptoAlgorythm newkeytype, uint32_t newkeyver, uint8_t *newkey, DesfireCryptoAlgorythm oldkeytype, uint8_t *oldkey, bool verbose) {
|
int DesfireChangeKey(DesfireContext *dctx, bool change_master_key, uint8_t newkeynum, DesfireCryptoAlgorythm newkeytype, uint32_t newkeyver, uint8_t *newkey, DesfireCryptoAlgorythm oldkeytype, uint8_t *oldkey, bool verbose) {
|
||||||
|
|
||||||
uint8_t okeybuf[DESFIRE_MAX_KEY_SIZE] = {0};
|
uint8_t okeybuf[DESFIRE_MAX_KEY_SIZE] = {0};
|
||||||
|
|
|
@ -83,6 +83,7 @@ void DesfireDecodeFileAcessMode(uint8_t *mode, uint8_t *r, uint8_t *w, uint8_t *
|
||||||
void DesfirePrintAccessRight(uint8_t *data);
|
void DesfirePrintAccessRight(uint8_t *data);
|
||||||
void DesfirePrintFileSettings(uint8_t *data, size_t len);
|
void DesfirePrintFileSettings(uint8_t *data, size_t len);
|
||||||
void DesfirePrintSetFileSettings(uint8_t *data, size_t len);
|
void DesfirePrintSetFileSettings(uint8_t *data, size_t len);
|
||||||
|
void DesfirePrintCreateFileSettings(uint8_t filetype, uint8_t *data, size_t len);
|
||||||
|
|
||||||
int DesfireCreateFile(DesfireContext *dctx, uint8_t ftype, uint8_t *fdata, size_t fdatalen, bool checklen);
|
int DesfireCreateFile(DesfireContext *dctx, uint8_t ftype, uint8_t *fdata, size_t fdatalen, bool checklen);
|
||||||
int DesfireDeleteFile(DesfireContext *dctx, uint8_t fid);
|
int DesfireDeleteFile(DesfireContext *dctx, uint8_t fid);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue