mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-08-21 13:53:55 -07:00
denote MAD sectors as decimal since public documentation
This commit is contained in:
parent
1cf98096e6
commit
717ceecf1f
3 changed files with 19 additions and 15 deletions
|
@ -121,13 +121,6 @@ static char *GenerateFilename(const char *prefix, const char *suffix) {
|
||||||
// Each entry also stores whether the key was "found", defaults to false (0)
|
// Each entry also stores whether the key was "found", defaults to false (0)
|
||||||
static int initSectorTable(sector_t **src, size_t items) {
|
static int initSectorTable(sector_t **src, size_t items) {
|
||||||
|
|
||||||
|
|
||||||
// typedef struct {
|
|
||||||
// uint64_t Key[2];
|
|
||||||
// uint8_t foundKey[2];
|
|
||||||
// } sector_t;
|
|
||||||
|
|
||||||
// This allocates based on the size of a single item
|
|
||||||
(*src) = calloc(items, sizeof(sector_t));
|
(*src) = calloc(items, sizeof(sector_t));
|
||||||
if (*src == NULL) {
|
if (*src == NULL) {
|
||||||
return PM3_EMALLOC;
|
return PM3_EMALLOC;
|
||||||
|
|
|
@ -180,10 +180,21 @@ typedef struct {
|
||||||
const char *comment;
|
const char *comment;
|
||||||
} mfdesCommonAID_t;
|
} mfdesCommonAID_t;
|
||||||
|
|
||||||
|
/*
|
||||||
|
PACS application id(s) - HID Factory, CP1000 Standard, Mobile, Custom and Elite
|
||||||
|
We have HID Factory, Field Encoder == CP1000 (?)
|
||||||
|
No mobile, Custom or Elite
|
||||||
|
*/
|
||||||
|
|
||||||
static const mfdesCommonAID_t commonAids[] = {
|
static const mfdesCommonAID_t commonAids[] = {
|
||||||
// AID, name/comment
|
{ 0x53494F, "\x53\x49\x4F", "SIO DESFire EV1 - HID Factory" },
|
||||||
|
{ 0xD3494F, "\xD3\x49\x4F", "SIO DESFire EV1 - Field Encoder" },
|
||||||
|
{ 0xD9494F, "\xD9\x49\x4F", "SIO DESFire EV1 - Field Encoder" },
|
||||||
|
{ 0xF484E3, "\xF4\x84\xE3", "SE Enhanced" },
|
||||||
|
{ 0xF484E4, "\xF4\x84\xE4", "SE Enhanced" },
|
||||||
{ 0xF4812F, "\xf4\x81\x2f", "Gallagher card data application" },
|
{ 0xF4812F, "\xf4\x81\x2f", "Gallagher card data application" },
|
||||||
{ 0xF48120, "\xf4\x81\x20", "Gallagher card application directory" }, // Can be 0xF48120 - 0xF4812B, but I've only ever seen 0xF48120
|
{ 0xF48120, "\xf4\x81\x20", "Gallagher card application directory" }, // Can be 0xF48120 - 0xF4812B, but I've only ever seen 0xF48120
|
||||||
|
{ 0xF47300, "\xf4\x73\x00", "Inner Range card application" },
|
||||||
};
|
};
|
||||||
|
|
||||||
static int CmdHelp(const char *Cmd);
|
static int CmdHelp(const char *Cmd);
|
||||||
|
|
|
@ -1812,7 +1812,7 @@ static int CmdHFMFPMAD(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t sector0[16 * 4] = {0};
|
uint8_t sector0[16 * 4] = {0};
|
||||||
uint8_t sector10[16 * 4] = {0};
|
uint8_t sector16[16 * 4] = {0};
|
||||||
|
|
||||||
if (mfpReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifarep_mad_key, sector0, verbose)) {
|
if (mfpReadSector(MF_MAD1_SECTOR, MF_KEY_A, (uint8_t *)g_mifarep_mad_key, sector0, verbose)) {
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
|
@ -1832,19 +1832,19 @@ static int CmdHFMFPMAD(const char *Cmd) {
|
||||||
MAD1DecodeAndPrint(sector0, swapmad, verbose, &haveMAD2);
|
MAD1DecodeAndPrint(sector0, swapmad, verbose, &haveMAD2);
|
||||||
|
|
||||||
if (haveMAD2) {
|
if (haveMAD2) {
|
||||||
if (mfpReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifarep_mad_key, sector10, verbose)) {
|
if (mfpReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifarep_mad_key, sector16, verbose)) {
|
||||||
PrintAndLogEx(NORMAL, "");
|
PrintAndLogEx(NORMAL, "");
|
||||||
PrintAndLogEx(ERR, "error, read sector " _YELLOW_("0x10") ". Card doesn't have MAD or doesn't have MAD on default keys");
|
PrintAndLogEx(ERR, "error, read sector " _YELLOW_("0x10") ". Card doesn't have MAD or doesn't have MAD on default keys");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
}
|
}
|
||||||
|
|
||||||
MAD2DecodeAndPrint(sector10, swapmad, verbose);
|
MAD2DecodeAndPrint(sector16, swapmad, verbose);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (aidlen == 2 || decodeholder) {
|
if (aidlen == 2 || decodeholder) {
|
||||||
uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};
|
uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};
|
||||||
size_t madlen = 0;
|
size_t madlen = 0;
|
||||||
if (MADDecode(sector0, sector10, mad, &madlen, swapmad)) {
|
if (MADDecode(sector0, sector16, mad, &madlen, swapmad)) {
|
||||||
PrintAndLogEx(ERR, "can't decode MAD");
|
PrintAndLogEx(ERR, "can't decode MAD");
|
||||||
return PM3_EWRONGANSWER;
|
return PM3_EWRONGANSWER;
|
||||||
}
|
}
|
||||||
|
@ -1990,7 +1990,7 @@ int CmdHFMFPNDEFRead(const char *Cmd) {
|
||||||
}
|
}
|
||||||
|
|
||||||
uint8_t sector0[MIFARE_1K_MAXBLOCK] = {0};
|
uint8_t sector0[MIFARE_1K_MAXBLOCK] = {0};
|
||||||
uint8_t sector10[MIFARE_1K_MAXBLOCK] = {0};
|
uint8_t sector16[MIFARE_1K_MAXBLOCK] = {0};
|
||||||
uint8_t data[MIFARE_4K_MAX_BYTES] = {0};
|
uint8_t data[MIFARE_4K_MAX_BYTES] = {0};
|
||||||
int datalen = 0;
|
int datalen = 0;
|
||||||
|
|
||||||
|
@ -2015,7 +2015,7 @@ int CmdHFMFPNDEFRead(const char *Cmd) {
|
||||||
if (verbose)
|
if (verbose)
|
||||||
PrintAndLogEx(INFO, "reading MAD v2 sector");
|
PrintAndLogEx(INFO, "reading MAD v2 sector");
|
||||||
|
|
||||||
if (mfpReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifarep_mad_key, sector10, verbose)) {
|
if (mfpReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifarep_mad_key, sector16, verbose)) {
|
||||||
PrintAndLogEx(ERR, "error, read sector 0x10. card doesn't have MAD or doesn't have MAD on default keys");
|
PrintAndLogEx(ERR, "error, read sector 0x10. card doesn't have MAD or doesn't have MAD on default keys");
|
||||||
PrintAndLogEx(HINT, "Try " _YELLOW_("`hf mfp ndefread -k `") " with your custom key");
|
PrintAndLogEx(HINT, "Try " _YELLOW_("`hf mfp ndefread -k `") " with your custom key");
|
||||||
return PM3_ESOFT;
|
return PM3_ESOFT;
|
||||||
|
@ -2024,7 +2024,7 @@ int CmdHFMFPNDEFRead(const char *Cmd) {
|
||||||
|
|
||||||
uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};
|
uint16_t mad[7 + 8 + 8 + 8 + 8] = {0};
|
||||||
size_t madlen = 0;
|
size_t madlen = 0;
|
||||||
res = MADDecode(sector0, (haveMAD2 ? sector10 : NULL), mad, &madlen, false);
|
res = MADDecode(sector0, (haveMAD2 ? sector16 : NULL), mad, &madlen, false);
|
||||||
if (res != PM3_SUCCESS) {
|
if (res != PM3_SUCCESS) {
|
||||||
PrintAndLogEx(ERR, "can't decode MAD");
|
PrintAndLogEx(ERR, "can't decode MAD");
|
||||||
return res;
|
return res;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue