From ff5419c00b6570d3ec34d14e5663a65987bcf7e3 Mon Sep 17 00:00:00 2001 From: magnum Date: Wed, 6 May 2015 00:33:19 +0200 Subject: [PATCH] Improve StatusShowCandidates so it logs the exact candidate number for a crack. Screen output will still be rounded up to batch size. Closes #1269. --- run/john.conf | 6 +++--- src/cracker.c | 2 +- src/logger.c | 5 +++-- src/logger.h | 3 ++- 4 files changed, 9 insertions(+), 7 deletions(-) diff --git a/run/john.conf b/run/john.conf index 6b7e3ff57b..8da5418f04 100644 --- a/run/john.conf +++ b/run/john.conf @@ -89,9 +89,9 @@ SingleWordsPairMax = 6 # to true here, --crack-status will toggle it back to false. CrackStatus = N -# When printing status, show number of candidates tried (eg. 123456p). Note -# that the number *is* now equal to "words tried" and nothing else. -# This is added to the "+ Cracked" line in the log as well. +# When printing status, show number of candidates tried (eg. 123456p). +# This is added to the "+ Cracked" line in the log as well (and that figure +# will be exact while the screen output will be a multiple of batch size). StatusShowCandidates = N # Write cracked passwords to the log file (default is just the user name) diff --git a/src/cracker.c b/src/cracker.c index f5512693b4..34eb71ece4 100644 --- a/src/cracker.c +++ b/src/cracker.c @@ -343,7 +343,7 @@ static int crk_process_guess(struct db_salt *salt, struct db_password *pw, crk_db->options->flags & DB_LOGIN ? repuid : "", dupe ? NULL : crk_methods.source(pw->source, pw->binary), - repkey, key, crk_db->options->field_sep_char); + repkey, key, crk_db->options->field_sep_char, index); if (options.flags & FLG_CRKSTAT) event_pending = event_status = 1; diff --git a/src/logger.c b/src/logger.c index 3894f1a164..cc7fae6ffb 100644 --- a/src/logger.c +++ b/src/logger.c @@ -307,7 +307,8 @@ static char *components(char *string, int len) return out; } -void log_guess(char *login, char *uid, char *ciphertext, char *rep_plain, char *store_plain, char field_sep) +void log_guess(char *login, char *uid, char *ciphertext, char *rep_plain, + char *store_plain, char field_sep, int index) { int count1, count2; int len; @@ -387,7 +388,7 @@ void log_guess(char *login, char *uid, char *ciphertext, char *rep_plain, char * " as candidate #%llu", ((unsigned long long) status.cands.hi << 32) + - status.cands.lo); + status.cands.lo + index + 1); count2 += (int)sprintf(log.ptr + count2, "\n"); if (count2 > 0) diff --git a/src/logger.h b/src/logger.h index 89b857d719..3785a6f69c 100644 --- a/src/logger.h +++ b/src/logger.h @@ -26,7 +26,8 @@ extern void log_init(char *log_name, char *pot_name, char *session); * Prints a guessed password to stdout and logs it to john.pot (unless * ciphertext is NULL) and other related information to the log file. */ -extern void log_guess(char *login, char *uid, char *ciphertext, char *rep_plain, char *store_plain, char field_sep); +extern void log_guess(char *login, char *uid, char *ciphertext, char *rep_plain, + char *store_plain, char field_sep, int index); /* * Logs an arbitrary event.