From d4562fe424e60ee21f117fcff2b94deca35dca8d Mon Sep 17 00:00:00 2001 From: wiire-a Date: Thu, 7 Dec 2017 14:01:07 +0100 Subject: [PATCH] Fixed display of seeds for mode 3 The seeds were always printed even if there wasn't need to bruteforce the state of the PRNG: [*] Seed N1: 0 (01/01/70 00:00:00 UTC) [*] Seed ES1: 0 (01/01/70 00:00:00 UTC) [*] Seed ES2: 0 (01/01/70 00:00:00 UTC) Correct: [*] Seed N1: - [*] Seed ES1: - [*] Seed ES2: - Introduced in (6082da8). --- src/pixiewps.c | 43 +++++++++++++++++++++++++------------------ 1 file changed, 25 insertions(+), 18 deletions(-) diff --git a/src/pixiewps.c b/src/pixiewps.c index 1e8540b..05b0c83 100644 --- a/src/pixiewps.c +++ b/src/pixiewps.c @@ -1344,25 +1344,32 @@ usage_err: if (wps->verbosity > 2) { if (found_p_mode != NONE) { if (found_p_mode == RTL819x) { - time_t seed_time; - struct tm ts; - char buffer[30]; + if (wps->nonce_seed) { + time_t seed_time; + struct tm ts; + char buffer[30]; - printf("\n [*] Seed N1: %u", wps->nonce_seed); - seed_time = wps->nonce_seed; - ts = *gmtime(&seed_time); - strftime(buffer, 30, "%c", &ts); - printf(" (%s UTC)", buffer); - printf("\n [*] Seed ES1: %u", wps->s1_seed); - seed_time = wps->s1_seed; - ts = *gmtime(&seed_time); - strftime(buffer, 30, "%c", &ts); - printf(" (%s UTC)", buffer); - printf("\n [*] Seed ES2: %u", wps->s2_seed); - seed_time = wps->s2_seed; - ts = *gmtime(&seed_time); - strftime(buffer, 30, "%c", &ts); - printf(" (%s UTC)", buffer); + printf("\n [*] Seed N1: %u", wps->nonce_seed); + seed_time = wps->nonce_seed; + ts = *gmtime(&seed_time); + strftime(buffer, 30, "%c", &ts); + printf(" (%s UTC)", buffer); + printf("\n [*] Seed ES1: %u", wps->s1_seed); + seed_time = wps->s1_seed; + ts = *gmtime(&seed_time); + strftime(buffer, 30, "%c", &ts); + printf(" (%s UTC)", buffer); + printf("\n [*] Seed ES2: %u", wps->s2_seed); + seed_time = wps->s2_seed; + ts = *gmtime(&seed_time); + strftime(buffer, 30, "%c", &ts); + printf(" (%s UTC)", buffer); + } + else { + printf("\n [*] Seed N1: -"); + printf("\n [*] Seed ES1: -"); + printf("\n [*] Seed ES2: -"); + } } else { if (found_p_mode == RT && wps->nonce_seed == 0)