mirror of
https://github.com/Proxmark/proxmark3.git
synced 2025-07-29 19:18:35 -07:00
added some cone in nested. not tested.
This commit is contained in:
parent
e0158d3373
commit
7bea15816e
2 changed files with 33 additions and 6 deletions
|
@ -297,18 +297,44 @@ bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, bool isResponse, uint8_t *m
|
||||||
}
|
}
|
||||||
|
|
||||||
// check default keys
|
// check default keys
|
||||||
for (int defaultKeyCounter = 0; defaultKeyCounter < MifareDefaultKeysSize; defaultKeyCounter++){
|
if (!traceCrypto1) {
|
||||||
if (NestedCheckKey(MifareDefaultKeys[defaultKeyCounter], &AuthData, cmd, cmdsize)) {
|
for (int defaultKeyCounter = 0; defaultKeyCounter < MifareDefaultKeysSize; defaultKeyCounter++){
|
||||||
|
if (NestedCheckKey(MifareDefaultKeys[defaultKeyCounter], &AuthData, cmd, cmdsize)) {
|
||||||
break;
|
|
||||||
};
|
break;
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// nested
|
// nested
|
||||||
if (validate_prng_nonce(AuthData.nt)) {
|
if (!traceCrypto1 && validate_prng_nonce(AuthData.nt)) {
|
||||||
|
uint32_t ntx = prng_successor(AuthData.nt, 90);
|
||||||
|
for (int i = 0; i < 16383; i++) {
|
||||||
|
ntx = prng_successor(ntx, 1);
|
||||||
|
if (NTParityChk(&AuthData, ntx)){
|
||||||
|
|
||||||
|
uint32_t ks2 = AuthData.ar_enc ^ prng_successor(ntx, 64);
|
||||||
|
uint32_t ks3 = AuthData.at_enc ^ prng_successor(ntx, 96);
|
||||||
|
struct Crypto1State *pcs = lfsr_recovery64(ks2, ks3);
|
||||||
|
memcpy(mfData, cmd, cmdsize);
|
||||||
|
mf_crypto1_decrypt(pcs, mfData, cmdsize, 0);
|
||||||
|
|
||||||
|
crypto1_destroy(pcs);
|
||||||
|
if (CheckCrc14443(CRC_14443_A, mfData, cmdsize)) {
|
||||||
|
traceCrypto1 = lfsr_recovery64(ks2, ks3);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (traceCrypto1)
|
||||||
|
printf("key> nt=%08x nonce distance=%d \n", ntx, nonce_distance(AuthData.nt, ntx));
|
||||||
|
else
|
||||||
|
printf("key> don't have any valid nt( \n");
|
||||||
}
|
}
|
||||||
|
|
||||||
//hardnested
|
//hardnested
|
||||||
|
if (!traceCrypto1) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -33,6 +33,7 @@ extern uint8_t mifare_CRC_check(bool isResponse, uint8_t* data, uint8_t len);
|
||||||
extern void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize);
|
extern void annotateIso14443a(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize);
|
||||||
extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse);
|
extern void annotateMifare(char *exp, size_t size, uint8_t* cmd, uint8_t cmdsize, uint8_t* parity, uint8_t paritysize, bool isResponse);
|
||||||
extern bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, bool isResponse, uint8_t *mfData, size_t *mfDataLen);
|
extern bool DecodeMifareData(uint8_t *cmd, uint8_t cmdsize, bool isResponse, uint8_t *mfData, size_t *mfDataLen);
|
||||||
|
extern bool NTParityChk(TAuthData *ad, uint32_t ntx);
|
||||||
extern bool NestedCheckKey(uint64_t key, TAuthData *ad, uint8_t *cmd, uint8_t cmdsize);
|
extern bool NestedCheckKey(uint64_t key, TAuthData *ad, uint8_t *cmd, uint8_t cmdsize);
|
||||||
|
|
||||||
#endif // CMDHFLIST
|
#endif // CMDHFLIST
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue