Chg 'hf 14a info' - static/fixed nonce detection

This commit is contained in:
iceman1001
2019-12-23 15:23:04 +01:00
parent 07b3b6ed4e
commit a6a48f0e6d
6 changed files with 86 additions and 0 deletions

View File

@@ -1132,6 +1132,34 @@ int detect_classic_nackbug(bool verbose) {
}
return PM3_SUCCESS;
}
/* Detect Mifare Classic Static / Fixed nonce
detects special magic cards that has a static / fixed nonce
returns:
0 = has normal nonce
1 = has static/fixed nonce
2 = cmd failed
*/
int detect_classic_static_nonce(void) {
clearCommandBuffer();
SendCommandNG(CMD_HF_MIFARE_STATIC_NONCE, NULL, 0);
PacketResponseNG resp;
if (WaitForResponseTimeout(CMD_HF_MIFARE_STATIC_NONCE, &resp, 500)) {
if (resp.status == PM3_ESOFT)
return 2;
if (resp.data.asBytes[0] == 0)
return 0;
if (resp.data.asBytes[0] != 0)
return 1;
}
return 2;
}
/* try to see if card responses to "chinese magic backdoor" commands. */
void detect_classic_magic(void) {

View File

@@ -90,5 +90,6 @@ 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);
void detect_classic_magic(void);
int detect_classic_static_nonce(void);
void mf_crypto1_decrypt(struct Crypto1State *pcs, uint8_t *data, int len, bool isEncrypted);
#endif