diff --git a/client/Makefile b/client/Makefile index 9f8055f8e..ebbce92dd 100644 --- a/client/Makefile +++ b/client/Makefile @@ -157,6 +157,7 @@ CMDSRCS = crapto1/crapto1.c \ emv/cmdemv.c \ emv/emv_roca.c \ mifare/mifare4.c \ + mifare/mad.c \ cmdanalyse.c \ cmdhf.c \ cmdhflist.c \ diff --git a/client/cmdhfmf.c b/client/cmdhfmf.c index a12bc34c2..edc3a662f 100644 --- a/client/cmdhfmf.c +++ b/client/cmdhfmf.c @@ -10,6 +10,7 @@ #include "cmdhfmf.h" #include "mifare/mifare4.h" +#include "mifare/mad.h" #define MIFARE_4K_MAXBLOCK 256 #define MIFARE_2K_MAXBLOCK 128 @@ -3225,7 +3226,7 @@ int CmdHF14AMfMAD(const char *cmd) { for(int i = 0; i < 4; i ++) PrintAndLogEx(NORMAL, "[%d] %s", i, sprint_hex(§or[i * 16], 16)); } - /* + bool haveMAD2 = false; MAD1DecodeAndPrint(sector, verbose, &haveMAD2); @@ -3237,7 +3238,7 @@ int CmdHF14AMfMAD(const char *cmd) { MAD2DecodeAndPrint(sector, verbose); } - */ + return 0; } diff --git a/client/mifare/mad.c b/client/mifare/mad.c new file mode 100644 index 000000000..88fc2c31b --- /dev/null +++ b/client/mifare/mad.c @@ -0,0 +1,31 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2019 Merlok +// +// This code is licensed to you under the terms of the GNU GPL, version 2 or, +// at your option, any later version. See the LICENSE.txt file for the text of +// the license. +//----------------------------------------------------------------------------- +// MIFARE Application Directory (MAD) functions +//----------------------------------------------------------------------------- + +#include "mad.h" +#include "ui.h" + +madAIDDescr madKnownAIDs[] = { + {0x0000, "free"}, + {0x0001, "defect, e.g. access keys are destroyed or unknown"}, + {0x0002, "reserved"}, + {0x0003, "contains additional directory info"}, + {0x0004, "contains card holder information in ASCII format."}, + {0x0005, "not applicable (above memory size)}"} +}; + +int MAD1DecodeAndPrint(uint8_t *sector, bool verbose, bool *haveMAD2) { + + return 0; +}; + +int MAD2DecodeAndPrint(uint8_t *sector, bool verbose) { + + return 0; +}; diff --git a/client/mifare/mad.h b/client/mifare/mad.h new file mode 100644 index 000000000..dc2b2e3c0 --- /dev/null +++ b/client/mifare/mad.h @@ -0,0 +1,26 @@ +//----------------------------------------------------------------------------- +// Copyright (C) 2019 Merlok +// +// This code is licensed to you under the terms of the GNU GPL, version 2 or, +// at your option, any later version. See the LICENSE.txt file for the text of +// the license. +//----------------------------------------------------------------------------- +// MIFARE Application Directory (MAD) functions +//----------------------------------------------------------------------------- + +#ifndef _MAD_H_ +#define _MAD_H_ + +#include <stdint.h> +#include <stdbool.h> + +typedef struct { + uint16_t AID; + const char *Description; +} madAIDDescr; + +int MAD1DecodeAndPrint(uint8_t *sector, bool verbose, bool *haveMAD2); +int MAD2DecodeAndPrint(uint8_t *sector, bool verbose); + + +#endif // _MAD_H_