mirror of
https://github.com/RfidResearchGroup/proxmark3.git
synced 2026-10-23 13:03:13 +00:00
made keytype instead of fixed keyB. would help in situations keyB is readable...
This commit is contained in:
1 parent
ade6770ecb
commit
f840dc810b
6 files changed
+13
-12
No files matched your search
+2
-1
@@ -1736,10 +1736,11 @@ static void PacketReceived(PacketCommandNG *packet) {
|
||||
|
||||
struct p {
|
||||
uint8_t is_mfc;
|
||||
uint8_t keytype;
|
||||
uint8_t key[6];
|
||||
} PACKED;
|
||||
struct p *payload = (struct p *) packet->data.asBytes;
|
||||
MifareCIdent(payload->is_mfc, payload->key);
|
||||
MifareCIdent(payload->is_mfc, payload->keytype, payload->key);
|
||||
break;
|
||||
}
|
||||
// Gen 3 magic cards
|
||||
|
||||
+2
-2
@@ -2420,7 +2420,7 @@ static void mf_reset_card(void) {
|
||||
iso14443a_setup(FPGA_HF_ISO14443A_READER_LISTEN);
|
||||
}
|
||||
|
||||
void MifareCIdent(bool is_mfc, uint8_t *key) {
|
||||
void MifareCIdent(bool is_mfc, uint8_t keytype, uint8_t *key) {
|
||||
// variables
|
||||
uint8_t rec[1] = {0x00};
|
||||
uint8_t recpar[1] = {0x00};
|
||||
@@ -2570,7 +2570,7 @@ void MifareCIdent(bool is_mfc, uint8_t *key) {
|
||||
pcs = &mpcs;
|
||||
|
||||
uint64_t tmpkey = bytes_to_num(key, 6);
|
||||
if (mifare_classic_authex(pcs, cuid, 0, MF_KEY_B, tmpkey, AUTH_FIRST, NULL, NULL) == 0) {
|
||||
if (mifare_classic_authex(pcs, cuid, 0, keytype, tmpkey, AUTH_FIRST, NULL, NULL) == 0) {
|
||||
uint8_t receivedAnswer[MAX_MIFARE_FRAME_SIZE] = {0x00};
|
||||
uint8_t receivedAnswerPar[MAX_MIFARE_PARITY_SIZE] = {0x00};
|
||||
if ((mifare_sendcmd_short(pcs, 1, ISO14443A_CMD_WRITEBLOCK, 0, receivedAnswer, receivedAnswerPar, NULL) == 1) && (receivedAnswer[0] == 0x0A)) {
|
||||
|
||||
+1
-1
@@ -47,7 +47,7 @@ int MifareECardLoadExt(uint8_t sectorcnt, uint8_t keytype);
|
||||
// MFC GEN1a /1b
|
||||
void MifareCSetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain); // Work with "magic Chinese" card
|
||||
void MifareCGetBlock(uint32_t arg0, uint32_t arg1, uint8_t *datain);
|
||||
void MifareCIdent(bool is_mfc, uint8_t *key); // is "magic chinese" card?
|
||||
void MifareCIdent(bool is_mfc, uint8_t keytype, uint8_t *key); // is "magic chinese" card?
|
||||
void MifareHasStaticNonce(void); // Has the tag a static nonce?
|
||||
void MifareHasStaticEncryptedNonce(uint8_t block_no, uint8_t key_type, uint8_t *key); // Has the tag a static encrypted nonce?
|
||||
|
||||
|
||||
@@ -8923,7 +8923,7 @@ static int CmdHF14AMfInfo(const char *Cmd) {
|
||||
int sectorsCnt = 1;
|
||||
uint8_t *keyBlock = NULL;
|
||||
uint32_t keycnt = 0;
|
||||
res = mfLoadKeys(&keyBlock, &keycnt, NULL, 0, NULL, 0);
|
||||
res = mfLoadKeys(&keyBlock, &keycnt, key, MIFARE_KEY_SIZE, NULL, 0);
|
||||
if (res != PM3_SUCCESS) {
|
||||
return res;
|
||||
}
|
||||
@@ -8973,8 +8973,8 @@ static int CmdHF14AMfInfo(const char *Cmd) {
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
PrintAndLogEx(INFO, "--- " _CYAN_("Magic Tag Information"));
|
||||
if (detect_mf_magic(true, e_sector[0].Key[MF_KEY_B]) == 0) {
|
||||
if (detect_mf_magic(true, e_sector[0].Key[MF_KEY_A]) == 0) {
|
||||
if (detect_mf_magic(true, MF_KEY_B, e_sector[0].Key[MF_KEY_B]) == 0) {
|
||||
if (detect_mf_magic(true, MF_KEY_A, e_sector[0].Key[MF_KEY_A]) == 0) {
|
||||
PrintAndLogEx(INFO, "<N/A>");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1373,7 +1373,7 @@ returns:
|
||||
*/
|
||||
int detect_classic_static_encrypted_nonce(uint8_t block_no, uint8_t key_type, uint8_t *key) {
|
||||
clearCommandBuffer();
|
||||
uint8_t cdata[1 + 1 + MIFARE_KEY_SIZE] = {0};
|
||||
uint8_t cdata[1 + 1 + MIFARE_KEY_SIZE] = { 0 };
|
||||
cdata[0] = block_no;
|
||||
cdata[1] = key_type;
|
||||
memcpy(&cdata[2], key, MIFARE_KEY_SIZE);
|
||||
@@ -1390,13 +1390,13 @@ int detect_classic_static_encrypted_nonce(uint8_t block_no, uint8_t key_type, ui
|
||||
}
|
||||
|
||||
/* try to see if card responses to "Chinese magic backdoor" commands. */
|
||||
int detect_mf_magic(bool is_mfc, uint64_t key) {
|
||||
int detect_mf_magic(bool is_mfc, uint8_t key_type, uint64_t key) {
|
||||
|
||||
uint8_t isMagic = 0;
|
||||
PacketResponseNG resp;
|
||||
clearCommandBuffer();
|
||||
uint8_t payload[1 + MIFARE_KEY_SIZE] = { is_mfc };
|
||||
num_to_bytes(key, MIFARE_KEY_SIZE, payload + 1);
|
||||
uint8_t payload[1 + 1 + MIFARE_KEY_SIZE] = { is_mfc, key_type };
|
||||
num_to_bytes(key, MIFARE_KEY_SIZE, payload + 2);
|
||||
|
||||
SendCommandNG(CMD_HF_MIFARE_CIDENT, payload, sizeof(payload));
|
||||
if (WaitForResponseTimeout(CMD_HF_MIFARE_CIDENT, &resp, 1500)) {
|
||||
|
||||
@@ -101,7 +101,7 @@ int tryDecryptWord(uint32_t nt, uint32_t ar_enc, uint32_t at_enc, uint8_t *data,
|
||||
|
||||
int detect_classic_prng(void);
|
||||
int detect_classic_nackbug(bool verbose);
|
||||
int detect_mf_magic(bool is_mfc, uint64_t key);
|
||||
int detect_mf_magic(bool is_mfc, uint8_t key_type, uint64_t key);
|
||||
int detect_classic_static_nonce(void);
|
||||
int detect_classic_static_encrypted_nonce(uint8_t block_no, uint8_t key_type, uint8_t *key);
|
||||
bool detect_mfc_ev1_signature(void);
|
||||
|
||||
Reference in new issue
Block a user