diff --git a/src/john.c b/src/john.c index a5dbd97..2570cf4 100644 --- a/src/john.c +++ b/src/john.c @@ -967,7 +967,7 @@ static void john_load(void) ldr_show_pw_file(&database, current->data); } while ((current = current->next)); - if (john_main_process) + if (john_main_process && !options.loader.showtypes) printf("%s%d password hash%s cracked, %d left\n", database.guess_count ? "\n" : "", database.guess_count, diff --git a/src/loader.c b/src/loader.c index 9323a95..9e67026 100644 --- a/src/loader.c +++ b/src/loader.c @@ -459,7 +459,7 @@ static int ldr_split_line(char **login, char **ciphertext, /* TODO: right field_sep_char? What about prepare that insert username into the hash? */ /* field_sep_char is not possible in any field too. */ /* The format: - * Once for hash: + * Once for each hash even if it can't be loaded (7 fields): * login, * original ciphertext, * uid, @@ -470,25 +470,27 @@ static int ldr_split_line(char **login, char **ciphertext, * For each valid format (may be nothing): * label, * is format disabled? (1/0), - * number of parts. - * For each part of splitted/canonical hash: - * is it same as oringal ciphertext? (1/0), - * canonical hash or empty string (if the format is disabled). + * canonical hash or hashes (if there are several parts) * All fields are separated by field_sep_char. + * Formats are separated by empty field. * Additional field_sep_char occurs at the end of line: * it does not break numeration of fields but * it allows parser to get field_sep_char from the line. + * + * It should look like the following: + * login:hash:u:g:g:h:shell:LM:0:h1:h2::someformat:0:h3: */ - /* TODO: at the moment NONE from uid field becomes empty line. Is it ok? */ - printf("%s%c%s%c%s%c%s%c%s%c%s%c%s%c", + printf("%s%c%s%c%s%c%s%c%s%c%s%c%s", *login, fs, *ciphertext, fs, *uid, fs, gid, fs, *gecos, fs, *home, - fs, shell, - fs); + fs, shell); + /* TODO: Right about uid, gid and shell fields? */ + /* Only uid, gid and shell fields may be empty. */ + /* Empty fields are separators after this point. */ alt = fmt_list; do { char *prepared; @@ -511,21 +513,21 @@ static int ldr_split_line(char **login, char **ciphertext, ldr_set_encoding(alt); /* TODO: alt->params.label is the name of format? */ /* TODO: Is it guaranteed that format's label does not contain spaces? */ - printf("%c%s%c%d%c%d", + printf("%c%s%c%d", fs, alt->params.label, - fs, disabled, - fs, valid); + fs, disabled); /* Canonical hash or hashes (like halfs of LM) */ for (part = 0; part < valid; part++) { char *splitted = alt->methods.split(*ciphertext, part, alt); /* TODO: handle splitted == 0; it should be a bug then */ int same = !strcmp(splitted, *ciphertext); - printf("%c%d%c%s", - fs, same, - fs, same ? "" : splitted); + printf("%c%s", fs, splitted); } + /* Format is surrounded by separaters. + * They provide empty field between formats. */ + printf("%c", fs); } while ((alt = alt->next)); - printf("%c\n", fs); + printf("\n"); return 0; }