Skip to content
Browse files

Move some --list= options handling earlier, so we can show it even if we

lack a config file.
  • Loading branch information...
1 parent 6458c4a commit c7895157b9bdb7566e7628d155761fb35e03b300 @magnumripper magnumripper committed May 16, 2012
Showing with 45 additions and 39 deletions.
  1. +45 −39 src/john.c
View
84 src/john.c
@@ -535,6 +535,19 @@ static void john_init(char *name, int argc, char **argv)
john_register_all(); /* for printing by opt_init() */
opt_init(name, argc, argv);
+ if (options.listconf && !strcasecmp(options.listconf, "?"))
+ {
+ puts("inc-modes, rules, externals, ext-filters, ext-filters-only,");
+ puts("ext-modes, build-info, hidden-options, <conf section name>");
+ exit(0);
+ }
+ if (options.listconf && !strcasecmp(options.listconf, "hidden-options"))
+ {
+ puts("--list=NAME list configuration, rules, etc");
+ puts("--mkpc=N force a lower max. keys per crypt");
+ exit(0);
+ }
+
if (!make_check) {
#if defined(_OPENMP) && OMP_FALLBACK
#if defined(__DJGPP__) || defined(__CYGWIN32__)
@@ -550,6 +563,35 @@ static void john_init(char *name, int argc, char **argv)
path_init(argv);
+ if (options.listconf && !strcasecmp(options.listconf,
+ "build-info"))
+ {
+ puts("Version: " JOHN_VERSION);
+ puts("Build: " JOHN_BLD _MP_VERSION);
+ printf("Arch: %d-bit %s\n", ARCH_BITS,
+ ARCH_LITTLE_ENDIAN ? "LE" : "BE");
+#if JOHN_SYSTEMWIDE
+ puts("System-wide exec: " JOHN_SYSTEMWIDE_EXEC);
+ puts("System-wide home: " JOHN_SYSTEMWIDE_HOME);
+ puts("Private home: " JOHN_PRIVATE_HOME);
+#endif
+ printf("$JOHN is %s\n", path_expand("$JOHN/"));
+ puts("Rec file version: " RECOVERY_V);
+ printf("CHARSET_MIN: %d (0x%02x)\n", CHARSET_MIN,
+ CHARSET_MIN);
+ printf("CHARSET_MAX: %d (0x%02x)\n", CHARSET_MAX,
+ CHARSET_MAX);
+ printf("CHARSET_LENGTH: %d\n", CHARSET_LENGTH);
+#ifdef __GNUC__
+ printf("gcc version: %d.%d.%d\n", __GNUC__,
+ __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
+#endif
+#ifdef __ICC
+ printf("icc version: %d\n", __ICC);
+#endif
+ exit(0);
+ }
+
if (options.flags & FLG_CONFIG_CLI)
{
path_init_ex(options.config);
@@ -571,23 +613,12 @@ static void john_init(char *name, int argc, char **argv)
if (options.subformat && !strcasecmp(options.subformat, "list"))
{
dynamic_DISPLAY_ALL_FORMATS();
- // NOTE if we have other 'generics', like sha1, sha2, rc4, .... then EACH of
- // them should have a DISPLAY_ALL_FORMATS() function and we can call them here.
+ /* NOTE if we have other 'generics', like sha1, sha2, rc4, ...
+ * then EACH of them should have a DISPLAY_ALL_FORMATS()
+ * function and we can call them here. */
exit(0);
}
- if (options.listconf && !strcasecmp(options.listconf, "?"))
- {
- puts("inc-modes, rules, externals, ext-filters, ext-filters-only,");
- puts("ext-modes, build-info, hidden-options or <conf section name>");
- exit(0);
- }
- if (options.listconf && !strcasecmp(options.listconf, "hidden-options"))
- {
- puts("--list=NAME list configuration, rules, etc");
- puts("--mkpc=N force a lower max. keys per crypt");
- exit(0);
- }
if (options.listconf && !strcasecmp(options.listconf, "inc-modes"))
{
cfg_print_subsections("Incremental", NULL, NULL);
@@ -618,31 +649,6 @@ static void john_init(char *name, int argc, char **argv)
cfg_print_subsections("List.External", "generate", NULL);
exit(0);
}
- if (options.listconf && !strcasecmp(options.listconf, "build-info"))
- {
- puts("Version: " JOHN_VERSION);
- puts("Build: " JOHN_BLD _MP_VERSION);
- printf("Arch: %d-bit %s\n", ARCH_BITS, ARCH_LITTLE_ENDIAN ?
- "LE" : "BE");
-#if JOHN_SYSTEMWIDE
- puts("System-wide exec: " JOHN_SYSTEMWIDE_EXEC);
- puts("System-wide home: " JOHN_SYSTEMWIDE_HOME);
- puts("Private home: " JOHN_PRIVATE_HOME);
-#endif
- printf("$JOHN is %s\n", path_expand("$JOHN/"));
- puts("Rec file version: " RECOVERY_V);
- printf("CHARSET_MIN: %d (0x%02x)\n", CHARSET_MIN, CHARSET_MIN);
- printf("CHARSET_MAX: %d (0x%02x)\n", CHARSET_MAX, CHARSET_MAX);
- printf("CHARSET_LENGTH: %d\n", CHARSET_LENGTH);
-#ifdef __GNUC__
- printf("gcc version: %d.%d.%d\n", __GNUC__, __GNUC_MINOR__,
- __GNUC_PATCHLEVEL__);
-#endif
-#ifdef __ICC
- printf("icc version: %d\n", __ICC);
-#endif
- exit(0);
- }
/* Catch-all for any other john.conf section name :-) */
if (options.listconf)
{

0 comments on commit c789515

Please sign in to comment.
Something went wrong with that request. Please try again.