This commit is contained in:
iceman1001 2024-09-06 22:59:23 +02:00
commit e50459b2c5
6 changed files with 45 additions and 42 deletions

View file

@ -2,12 +2,12 @@
* ht2crack2search.c
* this searches the sorted tables for the given RNG data, retrieves the matching
* PRNG state, checks it is correct, and then rolls back the PRNG to recover the key
*
*
* Iceman 2024,
* This is a multi threaded version. After discussions with mwalker33 about how to make this multi threaded
* version he concluded that the file lookups would be ideal. So we don't do it inside the individual file searches but
* version he concluded that the file lookups would be ideal. So we don't do it inside the individual file searches but
* rather we can put each file to search in each thread instead. Come up with ways to make it faster!
*
*
* When testing remember OS cache fiddles with your mind and results. Running same test values will be much faster second run
*/
@ -23,7 +23,7 @@ static int global_found = 0;
static int thread_count = 2;
static int g_bitoffset = 0;
static uint8_t g_rngmatch[6];
static uint8_t g_rngstate[6];
static uint8_t g_rngstate[6];
typedef struct {
int len;
@ -454,7 +454,7 @@ int main(int argc, char *argv[]) {
pthread_mutex_init(&print_lock, NULL);
// findmatch(&rng, rngmatch, rngstate, &bitoffset)
// threads
for (int i = 0; i < thread_count; ++i) {
targs *a = calloc(1, rng.len + sizeof(targs));
@ -480,8 +480,10 @@ int main(int argc, char *argv[]) {
printf("\n" _RED_("!!!") " failed to find a key\n\n");
} else {
printf("Found match:\n");
printf("rngmatch.... "); print_hex(g_rngmatch, sizeof(g_rngmatch));
printf("rngstate.... "); print_hex(g_rngstate, sizeof(g_rngstate));
printf("rngmatch.... ");
print_hex(g_rngmatch, sizeof(g_rngmatch));
printf("rngstate.... ");
print_hex(g_rngstate, sizeof(g_rngstate));
printf("bitoffset... %d\n", g_bitoffset);
Hitag_State hstate;

View file

@ -439,17 +439,17 @@ int main(int argc, char *const argv[]) {
}
printf("uid=%08x nt_enc=%08x nt_par_err=%i%i%i%i nt_par_enc=%i%i%i%i %u/%i: %u\n"
, authuid
, nt_enc
, nt_par_err_arr[0], nt_par_err_arr[1], nt_par_err_arr[2], nt_par_err_arr[3]
, (nt_par_enc >> 3) & 1
, (nt_par_enc >> 2) & 1
, (nt_par_enc >> 1) & 1
, nt_par_enc & 1
, NKL.nr_nonces + 1
, (argc - 1) / 3
, j
);
, authuid
, nt_enc
, nt_par_err_arr[0], nt_par_err_arr[1], nt_par_err_arr[2], nt_par_err_arr[3]
, (nt_par_enc >> 3) & 1
, (nt_par_enc >> 2) & 1
, (nt_par_enc >> 1) & 1
, nt_par_enc & 1
, NKL.nr_nonces + 1
, (argc - 1) / 3
, j
);
pNtData->authuid = authuid;
pNtData->sizeNK = j;

View file

@ -141,19 +141,19 @@ int main(int argc, char *const argv[]) {
((nt_par_err_arr[3] ^ oddparity8((nt_enc >> 0) & 0xFF)) << 0);
printf("uid=%08x nt=%08x nt_enc=%08x nt_par_err=%u%u%u%u nt_par_enc=%u%u%u%u ks1=%08x\n"
, authuid
, nt
, nt_enc
, nt_par_err_arr[0]
, nt_par_err_arr[1]
, nt_par_err_arr[2]
, nt_par_err_arr[3]
, (nt_par_enc >> 3) & 1
, (nt_par_enc >> 2) & 1
, (nt_par_enc >> 1) & 1
, nt_par_enc & 1
, nt ^ nt_enc
);
, authuid
, nt
, nt_enc
, nt_par_err_arr[0]
, nt_par_err_arr[1]
, nt_par_err_arr[2]
, nt_par_err_arr[3]
, (nt_par_enc >> 3) & 1
, (nt_par_enc >> 2) & 1
, (nt_par_enc >> 1) & 1
, nt_par_enc & 1
, nt ^ nt_enc
);
printf("Finding key candidates...\n");