move mifare stuff to its folder

This commit is contained in:
merlokk 2019-02-21 19:15:46 +02:00
commit 3b21b17509
19 changed files with 1158 additions and 1147 deletions

View file

@ -108,7 +108,7 @@ CORESRCS = uart_posix.c \
CMDSRCS = crapto1/crapto1.c \
crapto1/crypto1.c \
mfkey.c \
mifare/mfkey.c \
tea.c \
fido/additional_ca.c \
fido/cose.c \
@ -126,7 +126,7 @@ CMDSRCS = crapto1/crapto1.c \
loclass/elite_crack.c \
loclass/fileutils.c \
whereami.c \
mifarehost.c \
mifare/mifarehost.c \
parity.c \
crc.c \
crc16.c \
@ -156,7 +156,7 @@ CMDSRCS = crapto1/crapto1.c \
emv/test/cda_test.c\
emv/cmdemv.c \
emv/emv_roca.c \
mifare4.c \
mifare/mifare4.c \
cmdanalyse.c \
cmdhf.c \
cmdhflist.c \

View file

@ -23,7 +23,7 @@
#include "tea.h"
#include "legic_prng.h"
#include "loclass/elite_crack.h"
#include "mfkey.h" //nonce2key
#include "mifare/mfkey.h" //nonce2key
#include "util_posix.h" // msclock

View file

@ -29,7 +29,7 @@
#include "cmdhfmf.h"
#include "cmdhfmfu.h"
#include "cmdhf.h" // list cmd
#include "mifarehost.h"
#include "mifare/mifarehost.h"
#include "emv/apduinfo.h"
#include "emv/emvcore.h"

View file

@ -31,8 +31,8 @@
#include "emv/cmdemv.h" // EMV
#include "protocols.h"
#include "crapto1/crapto1.h"
#include "mifarehost.h"
#include "mifaredefault.h"
#include "mifare/mifarehost.h"
#include "mifare/mifaredefault.h"
#include "parity.h" // oddparity
#include "iso15693tools.h" // ISO15693 crc

View file

@ -9,7 +9,7 @@
//-----------------------------------------------------------------------------
#include "cmdhfmf.h"
#include "mifare4.h"
#include "mifare/mifare4.h"
#define MIFARE_4K_MAXBLOCK 256
#define MIFARE_2K_MAXBLOCK 128
@ -3216,18 +3216,28 @@ int CmdHF14AMfMAD(const char *cmd) {
CLIParserFree();
uint8_t sector[16 * 4] = {0};
if (mfReadSector(0, 0, (uint8_t *)g_mifare_mad_key, sector)) {
if (mfReadSector(MF_MAD1_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.");
return 2;
}
if (verbose) {
for(int i = 0; i < 3; i ++)
PrintAndLogEx(NORMAL, "[i] %s", sprint_hex(&sector[i * 16], 16));
for(int i = 0; i < 4; i ++)
PrintAndLogEx(NORMAL, "[%d] %s", i, sprint_hex(&sector[i * 16], 16));
}
/*
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.");
return 2;
}
// MADDecodeAndPrint(sector, verbose);
MAD2DecodeAndPrint(sector, verbose);
}
*/
return 0;
}

View file

@ -24,11 +24,11 @@
#include "common.h"
#include "util.h"
#include "mifare.h" // nonces_t struct
#include "mfkey.h" // mfkey32_moebious
#include "mifare/mfkey.h" // mfkey32_moebious
#include "cmdhfmfhard.h"
#include "mifarehost.h" // icesector_t, sector_t
#include "mifare/mifarehost.h" // icesector_t, sector_t
#include "util_posix.h" // msclock
#include "mifaredefault.h" // mifare default key array
#include "mifare/mifaredefault.h" // mifare default key array
#include "cmdhf14a.h" // dropfield
#include "cliparser/cliparser.h" // argtable
#include "hardnested/hardnested_bf_core.h" // SetSIMDInstr

View file

@ -22,7 +22,7 @@
#include "ui.h"
#include "cmdhf14a.h"
#include "mifare.h"
#include "mifare4.h"
#include "mifare/mifare4.h"
#include "cliparser/cliparser.h"
#include "crypto/libpcrypto.h"

View file

@ -10,7 +10,7 @@
#ifndef CMDHFMFP_H__
#define CMDHFMFP_H__
#include "mifaredefault.h"
#include "mifare/mifaredefault.h"
extern int CmdHFMFP(const char *Cmd);

View file

@ -48,7 +48,7 @@
#include <stdarg.h>
#include "../ui.h"
#include "../emv/emvjson.h"
#include "mifare4.h"
#include "mifare/mifare4.h"
#include "cmdhfmfu.h"
typedef enum {

View file

@ -428,14 +428,9 @@ int mfReadSector(uint8_t sectorNo, uint8_t keyType, uint8_t *key, uint8_t *data)
if (isOK) {
memcpy(data, resp.d.asBytes, mfNumBlocksPerSector(sectorNo) * 16);
for (int i = 0; i < (sectorNo<32?3:15); i++) {
PrintAndLogEx(NORMAL, "data : %s", sprint_hex(data + i * 16, 16));
}
PrintAndLogEx(NORMAL, "trailer: %s", sprint_hex(data + (sectorNo<32?3:15) * 16, 16));
return 0;
} else {
return isOK;
return 1;
}
} else {
PrintAndLogEx(ERR, "Command execute timeout");

0
client/obj/mifare/.dummy Normal file
View file

View file

@ -19,7 +19,7 @@
#include "cmdmain.h"
#include "comms.h"
#include "util.h"
#include "mifarehost.h"
#include "mifare/mifarehost.h"
#include "crc.h"
#include "crc16.h"
#include "crc64.h"

View file

@ -13,6 +13,12 @@
#include "common.h"
#define MF_KEY_A 0
#define MF_KEY_B 1
#define MF_MAD1_SECTOR 0x00
#define MF_MAD2_SECTOR 0x10
//-----------------------------------------------------------------------------
// ISO 14443A
//-----------------------------------------------------------------------------