made keytype instead of fixed keyB. would help in situations keyB is readable...

This commit is contained in:
iceman1001 committed 2023-12-31 09:35:42 +01:00
1 parent ade6770ecb
commit f840dc810b
6 files changed
+13 -12

No files matched your search

+3 -3
View File
@@ -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>");
}
}
+4 -4
View File
@@ -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)) {
+1 -1
View File
@@ -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);