Changed hf iclass list to display matched keys on the CHECK command rather than the card response, and made it check for elite keys too
This commit is contained in:
1 parent
6cba844738
commit
eb6b170e51
3 files changed
+16
-11
No files matched your search
@@ -87,7 +87,7 @@ static int cmp_uint32(const void *a, const void *b) {
|
||||
|
||||
bool check_known_default(uint8_t *csn, uint8_t *epurse, uint8_t *rmac, uint8_t *tmac, uint8_t *key) {
|
||||
|
||||
iclass_prekey_t *prekey = calloc(ICLASS_KEYS_MAX, sizeof(iclass_prekey_t));
|
||||
iclass_prekey_t *prekey = calloc(ICLASS_KEYS_MAX * 2, sizeof(iclass_prekey_t));
|
||||
if (prekey == NULL) {
|
||||
return false;
|
||||
}
|
||||
@@ -97,17 +97,20 @@ bool check_known_default(uint8_t *csn, uint8_t *epurse, uint8_t *rmac, uint8_t *
|
||||
memcpy(ccnr + 8, rmac, 4);
|
||||
|
||||
GenerateMacKeyFrom(csn, ccnr, false, false, (uint8_t *)iClass_Key_Table, ICLASS_KEYS_MAX, prekey);
|
||||
qsort(prekey, ICLASS_KEYS_MAX, sizeof(iclass_prekey_t), cmp_uint32);
|
||||
GenerateMacKeyFrom(csn, ccnr, false, true, (uint8_t *)iClass_Key_Table, ICLASS_KEYS_MAX, prekey + ICLASS_KEYS_MAX);
|
||||
qsort(prekey, ICLASS_KEYS_MAX * 2, sizeof(iclass_prekey_t), cmp_uint32);
|
||||
|
||||
iclass_prekey_t lookup;
|
||||
memcpy(lookup.mac, tmac, 4);
|
||||
|
||||
// binsearch
|
||||
iclass_prekey_t *item = (iclass_prekey_t *) bsearch(&lookup, prekey, ICLASS_KEYS_MAX, sizeof(iclass_prekey_t), cmp_uint32);
|
||||
iclass_prekey_t *item = (iclass_prekey_t *) bsearch(&lookup, prekey, ICLASS_KEYS_MAX * 2, sizeof(iclass_prekey_t), cmp_uint32);
|
||||
if (item != NULL) {
|
||||
memcpy(key, item->key, 8);
|
||||
free(prekey);
|
||||
return true;
|
||||
}
|
||||
free(prekey);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3534,8 +3537,6 @@ void GenerateMacKeyFrom(uint8_t *CSN, uint8_t *CCNR, bool use_raw, bool use_elit
|
||||
|
||||
for (int i = 0; i < iclass_tc; i++)
|
||||
pthread_join(threads[i], NULL);
|
||||
|
||||
PrintAndLogEx(NORMAL, "");
|
||||
}
|
||||
|
||||
// print diversified keys
|
||||
|
||||
Reference in new issue
Block a user