From d73b71803a4a4332acd0f91013871524aa4f7d2f Mon Sep 17 00:00:00 2001 From: wiire-a Date: Thu, 30 Nov 2017 11:19:58 +0100 Subject: [PATCH] Added more useful debugging prints --- src/pixiewps.c | 38 +++++++++++++++++++++++++------------- 1 file changed, 25 insertions(+), 13 deletions(-) diff --git a/src/pixiewps.c b/src/pixiewps.c index 9696333..1d89eef 100644 --- a/src/pixiewps.c +++ b/src/pixiewps.c @@ -110,7 +110,7 @@ static void crack_thread_rtl(struct crack_job *j) if (glibc_rand1(&glibc_lazyprng) == job_control.randr_enonce[0]) { if (!memcmp(glibc_randfill(&glibc_lazyprng, tmp), job_control.randr_enonce, WPS_NONCE_LEN)) { job_control.nonce_seed = seed; - DEBUG_PRINT("Seed found %u", seed); + DEBUG_PRINT("Seed found (%10u)", seed); } } @@ -188,7 +188,7 @@ static void crack_thread_rt(struct crack_job *j) if (crack_rt(start, end, &res)) { job_control.nonce_seed = res; - DEBUG_PRINT("Seed found %u", (unsigned) res); + DEBUG_PRINT("Seed found (%10u)", (unsigned)res); } tmp = (uint64_t)start + (uint64_t)(SEEDS_PER_JOB_BLOCK * job_control.jobs); if (tmp > (uint64_t)job_control.end) break; @@ -368,7 +368,7 @@ static int find_rtl_es(struct global *wps) collect_crack_jobs(); if (job_control.nonce_seed) { - DEBUG_PRINT("First pin half found"); + DEBUG_PRINT("First pin half found (%4s)", wps->pin); wps->s1_seed = job_control.nonce_seed; char pin_copy[WPS_PIN_LEN + 1]; strcpy(pin_copy, wps->pin); @@ -382,7 +382,7 @@ static int find_rtl_es(struct global *wps) DEBUG_PRINT_ARRAY(wps->e_s2, WPS_SECRET_NONCE_LEN); if (crack_second_half(wps, wps->pin)) { wps->s2_seed = wps->s1_seed + j; - DEBUG_PRINT("Pin found"); + DEBUG_PRINT("Pin found (%8s)", wps->pin); return RTL819x; } } @@ -1051,7 +1051,7 @@ usage_err: uint_fast8_t r = crack(wps, wps->pin); if (r == PIN_FOUND) { found_p_mode = RT; - DEBUG_PRINT("Pin found"); + DEBUG_PRINT("Pin found (%8s)", wps->pin); } if (!found_p_mode) { @@ -1083,7 +1083,7 @@ usage_err: r = crack(wps, wps->pin); if (r == PIN_FOUND) { found_p_mode = RT; - DEBUG_PRINT("Pin found"); + DEBUG_PRINT("Pin found (%8s)", wps->pin); } } } @@ -1112,7 +1112,7 @@ usage_err: for (i = 0; i < WPS_SECRET_NONCE_LEN; i++) /* Advance to get E-S2 */ wps->e_s2[i] = (uint8_t) (ecos_rand_simple(&seed) & 0xff); - DEBUG_PRINT("Seed found %u", wps->nonce_seed); + DEBUG_PRINT("Seed found (%10u)", wps->nonce_seed); break; } index++; @@ -1128,9 +1128,12 @@ usage_err: uint_fast8_t r = crack(wps, wps->pin); if (r == PIN_FOUND) { found_p_mode = ECOS_SIMPLE; - DEBUG_PRINT("Pin found"); + DEBUG_PRINT("Pin found (%8s)", wps->pin); } } + else { + DEBUG_PRINT("Nonce doesn't appear to be generated by this mode, skipping..."); + } /* 3 */ } @@ -1150,7 +1153,7 @@ usage_err: uint_fast8_t r = crack(wps, wps->pin); if (r == PIN_FOUND) { found_p_mode = RTL819x; - DEBUG_PRINT("Pin found"); + DEBUG_PRINT("Pin found (%8s)", wps->pin); } if (found_p_mode == NONE) { @@ -1201,6 +1204,9 @@ usage_err: } } } + else { + DEBUG_PRINT("Nonce doesn't appear to be generated by this mode, skipping..."); + } } } @@ -1229,7 +1235,7 @@ usage_err: for (i = 0; i < WPS_SECRET_NONCE_LEN; i++) /* Advance to get E-S2 */ wps->e_s2[i] = (uint8_t) ecos_rand_simplest(&seed); - DEBUG_PRINT("Seed found %u", wps->nonce_seed); + DEBUG_PRINT("Seed found (%10u)", wps->nonce_seed); break; } index++; @@ -1245,9 +1251,12 @@ usage_err: uint_fast8_t r = crack(wps, wps->pin); if (r == PIN_FOUND) { found_p_mode = ECOS_SIMPLEST; - DEBUG_PRINT("Pin found"); + DEBUG_PRINT("Pin found (%8s)", wps->pin); } } + else { + DEBUG_PRINT("Nonce doesn't appear to be generated by this mode, skipping..."); + } /* 5 */ } @@ -1274,7 +1283,7 @@ usage_err: for (i = 0; i < WPS_SECRET_NONCE_LEN; i++) /* Advance to get E-S2 */ wps->e_s2[i] = (uint8_t) ecos_rand_knuth(&seed); - DEBUG_PRINT("Seed found %u", wps->nonce_seed); + DEBUG_PRINT("Seed found (%10u)", wps->nonce_seed); break; } index++; @@ -1290,9 +1299,12 @@ usage_err: uint_fast8_t r = crack(wps, wps->pin); if (r == PIN_FOUND) { found_p_mode = ECOS_KNUTH; - DEBUG_PRINT("Pin found"); + DEBUG_PRINT("Pin found (%8s)", wps->pin); } } + else { + DEBUG_PRINT("Nonce doesn't appear to be generated by this mode, skipping..."); + } }