diff --git a/src/john.c b/src/john.c index aa043a5..80cf173 100644 --- a/src/john.c +++ b/src/john.c @@ -368,6 +368,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) @@ -386,7 +387,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 14e9e9f..9bdb10f 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 Some formats such as MD5-gen have subformats\n" \ " (like md5_gen(0), md5_gen(7), etc).\n" \ " This allows them to be specified.\n" \ @@ -158,10 +148,31 @@ MAYBE_CRYPT "\n" \ " (say 100 loops for a fast algorithm).\n" \ " For slow algorithms it should not be used.\n" +void list_formats(void) +{ + int col = 27; + struct fmt_main *format; + if ((format = fmt_list)) { + printf(" "); + do { + if (col + strlen(format->params.label) > 79) { + printf("\n "); + col = 27; + } + col += strlen(format->params.label) + 1; + printf("%s/", format->params.label); + } while ((format = format->next)); + } else + printf("** Error listing formats **"); + printf("\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); }