mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2025-02-13 10:43:01 +08:00
some of MAD2 code
This commit is contained in:
parent
5122e1289d
commit
20be5c5d9f
2 changed files with 12 additions and 4 deletions
|
@ -3230,9 +3230,9 @@ int CmdHF14AMfMAD(const char *cmd) {
|
|||
bool haveMAD2 = false;
|
||||
MAD1DecodeAndPrint(sector, verbose, &haveMAD2);
|
||||
|
||||
if (haveMAD2) {
|
||||
if (mfReadSector(MF_MAD2_SECTOR, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector)) {
|
||||
PrintAndLogEx(ERR, "read sector 0 error. card don't have MAD or don't have MAD on default keys.");
|
||||
if (haveMAD2) { // MF_MAD2_SECTOR
|
||||
if (mfReadSector(1, MF_KEY_A, (uint8_t *)g_mifare_mad_key, sector)) {
|
||||
PrintAndLogEx(ERR, "read sector 0x10 error. card don't have MAD or don't have MAD on default keys.");
|
||||
return 2;
|
||||
}
|
||||
|
||||
|
|
|
@ -122,7 +122,10 @@ int madCRCCheck(uint8_t *sector, bool verbose, int MADver) {
|
|||
}
|
||||
|
||||
uint16_t madGetAID(uint8_t *sector, int MADver, int sectorNo) {
|
||||
return (sector[16 + 2 + (sectorNo - 1) * 2] << 8) + (sector[16 + 2 + (sectorNo - 1) * 2 + 1]);
|
||||
if (MADver == 1)
|
||||
return (sector[16 + 2 + (sectorNo - 1) * 2] << 8) + (sector[16 + 2 + (sectorNo - 1) * 2 + 1]);
|
||||
else
|
||||
return (sector[2 + (sectorNo - 1) * 2] << 8) + (sector[2 + (sectorNo - 1) * 2 + 1]);
|
||||
}
|
||||
|
||||
int MAD1DecodeAndPrint(uint8_t *sector, bool verbose, bool *haveMAD2) {
|
||||
|
@ -185,6 +188,11 @@ int MAD2DecodeAndPrint(uint8_t *sector, bool verbose) {
|
|||
if (res)
|
||||
return res;
|
||||
|
||||
for(int i = 1; i < 8 + 8 + 7; i++) {
|
||||
uint16_t AID = madGetAID(sector, 2, i);
|
||||
PrintAndLogEx(NORMAL, "%02d [%04X] %s", i + 15, AID, GetAIDDescription(AID));
|
||||
};
|
||||
|
||||
|
||||
return 0;
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue