Skip to content

Commit

Permalink
Improve StatusShowCandidates so it logs the exact candidate
Browse files Browse the repository at this point in the history
number for a crack. Screen output will still be rounded up to
batch size. Closes #1269.
  • Loading branch information
magnumripper committed May 5, 2015
1 parent 3906840 commit ff5419c
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 7 deletions.
6 changes: 3 additions & 3 deletions run/john.conf
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion src/cracker.c
Expand Up @@ -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;
Expand Down
5 changes: 3 additions & 2 deletions src/logger.c
Expand Up @@ -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;
Expand Down Expand Up @@ -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)
Expand Down
3 changes: 2 additions & 1 deletion src/logger.h
Expand Up @@ -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.
Expand Down

0 comments on commit ff5419c

Please sign in to comment.