diff --git a/src/john.c b/src/john.c index 948a0b8..b492a22 100644 --- a/src/john.c +++ b/src/john.c @@ -382,6 +382,7 @@ static void john_init(char *name, int argc, char **argv) path_init(argv); status_init(NULL, 1); + john_register_all(); opt_init(name, argc, argv); if (options.flags & FLG_CONFIG_CLI) @@ -400,7 +401,6 @@ static void john_init(char *name, int argc, char **argv) } } - john_register_all(); common_init(); sig_init(); diff --git a/src/options.c b/src/options.c index a28afa9..0ac36b1 100644 --- a/src/options.c +++ b/src/options.c @@ -102,12 +102,6 @@ static struct opt_entry opt_list[] = { #define JOHN_COPYRIGHT \ "Solar Designer and others" -#ifdef HAVE_CRYPT -#define MAYBE_CRYPT "/crypt" -#else -#define MAYBE_CRYPT "" -#endif - #define JOHN_USAGE \ "John the Ripper password cracker, version " JOHN_VERSION "\n" \ "Copyright (c) 1996-2011 by " JOHN_COPYRIGHT "\n" \ @@ -134,15 +128,11 @@ static struct opt_entry opt_list[] = { "--salts=[-]COUNT[:MAX] load salts with[out] at least COUNT passwords only\n" \ " (or in range of COUNT to MAX)\n" \ "--pot=NAME pot file to use\n" \ -"--format=NAME force hash type NAME:\n" \ -" DES/BSDI/MD5/BF/AFS/LM/NT/XSHA/PO/raw-MD5/MD5-gen/\n" \ -" IPB2/raw-sha1/md5a/hmac-md5/phpass-md5/KRB5/bfegg/\n" \ -" nsldap/ssha/openssha/oracle/oracle11/MYSQL/\n" \ -" mysql-sha1/mscash/mscash2/lotus5/DOMINOSEC/\n" \ -" NETLM/NETNTLM/NETLMv2/NETNTLMv2/NETHALFLM/MSCHAPv2/\n" \ -" mssql/mssql05/epi/phps/mysql-fast/pix-md5/sapG/\n" \ -" sapB/md5ns/HDAA/DMD5/raw-md4/md4-gen/sha1-gen" \ -MAYBE_CRYPT "\n" \ +"--format=NAME force hash type NAME:\n" + +/* The format-list is automatically generated now */ + +#define JOHN_USAGE_TAIL \ "--subformat=NAME Kept for 'legacy' reasons. md5-gen subformats can\n" \ " now be used within the 'format' switch.\n" \ " If -format=md5 and -sub=LIST, then john will show\n" \ @@ -157,10 +147,50 @@ MAYBE_CRYPT "\n" \ " (say 100 loops for a fast algorithm).\n" \ " For slow algorithms it should not be used.\n" +void formatted_print_item(char *label) +{ + static int col = 27; + static int doslash = 0; + if (col + strlen(label) > 79) { + printf("\n "); + col = 27; + doslash = 0; + } + col += strlen(label) + 1; + if (doslash++) + printf("/"); + printf("%s", label); +} + +void list_formats(void) +{ + int md5gens = 0; + struct fmt_main *format; + if ((format = fmt_list)) { + printf(" "); + + do { + // Skip all md5-gens, print it last + if (!strncmp(format->params.label, "md5-gen", 7)) + md5gens++; + else + formatted_print_item(format->params.label); + } while ((format = format->next)); + + if (md5gens) + formatted_print_item("md5-gen(n)"); + + printf("\n"); + } else + printf("** Error listing formats **\n"); +} + void opt_init(char *name, int argc, char **argv) { if (argc < 2) { printf(JOHN_USAGE, name); + list_formats(); + printf(JOHN_USAGE_TAIL); exit(0); }