Exemplo n.º 1
0
static void john_init(char *name, int argc, char **argv)
{
	int make_check = (argc == 2 && !strcmp(argv[1], "--make_check"));
	if (make_check)
		argv[1] = "--test=0";

#if CPU_DETECT
	if (!CPU_detect()) {
#if CPU_REQ
#if CPU_FALLBACK
#if defined(__DJGPP__) || defined(__CYGWIN32__)
#error CPU_FALLBACK is incompatible with the current DOS and Win32 code
#endif
		if (!make_check) {
#define CPU_FALLBACK_PATHNAME JOHN_SYSTEMWIDE_EXEC "/" CPU_FALLBACK_BINARY
			execv(CPU_FALLBACK_PATHNAME, argv);
			perror("execv: " CPU_FALLBACK_PATHNAME);
		}
#endif
		fprintf(stderr, "Sorry, %s is required\n", CPU_NAME);
		if (make_check)
			exit(0);
		error();
#endif
	}
#endif

	if (!make_check) {
		path_init(argv);

    status_init(NULL, 1);
    opt_init(name, argc, argv);

    if (options.flags & FLG_CONFIG_CLI)
    {
      cfg_init(options.config, 1);
      cfg_init(CFG_ALT_NAME, 0);
    }
    else
    {
#if JOHN_SYSTEMWIDE
		cfg_init(CFG_PRIVATE_FULL_NAME, 1);
		cfg_init(CFG_PRIVATE_ALT_NAME, 1);
#endif
		cfg_init(CFG_FULL_NAME, 1);
		cfg_init(CFG_ALT_NAME, 0);
	}
	}

	john_register_all();
	common_init();

	sig_init();

	john_load();
}
Exemplo n.º 2
0
static void john_init(char *name, int argc, char **argv)
{
	int make_check = (argc == 2 && !strcmp(argv[1], "--make_check"));
	if (make_check)
		argv[1] = "--test=0";

	CPU_detect_or_fallback(argv, make_check);

	status_init(NULL, 1);
	if (argc < 2)
		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__)
#error OMP_FALLBACK is incompatible with the current DOS and Win32 code
#endif
		if (!getenv("JOHN_NO_OMP_FALLBACK") &&
		    omp_get_max_threads() <= 1) {
#define OMP_FALLBACK_PATHNAME JOHN_SYSTEMWIDE_EXEC "/" OMP_FALLBACK_BINARY
			execv(OMP_FALLBACK_PATHNAME, argv);
			perror("execv: " OMP_FALLBACK_PATHNAME);
		}
#endif

		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);
			cfg_init(options.config, 1);
			cfg_init(CFG_FULL_NAME, 1);
			cfg_init(CFG_ALT_NAME, 0);
		}
		else
		{
#if JOHN_SYSTEMWIDE
			cfg_init(CFG_PRIVATE_FULL_NAME, 1);
			cfg_init(CFG_PRIVATE_ALT_NAME, 1);
#endif
			cfg_init(CFG_FULL_NAME, 1);
			cfg_init(CFG_ALT_NAME, 0);
		}
	}

	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. */
		exit(0);
	}

	if (options.listconf && !strcasecmp(options.listconf, "inc-modes"))
	{
		cfg_print_subsections("Incremental", NULL, NULL);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "rules"))
	{
		cfg_print_subsections("List.Rules", NULL, NULL);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "externals"))
	{
		cfg_print_subsections("List.External", NULL, NULL);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "ext-filters"))
	{
		cfg_print_subsections("List.External", "filter", NULL);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "ext-filters-only"))
	{
		cfg_print_subsections("List.External", "filter", "generate");
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "ext-modes"))
	{
		cfg_print_subsections("List.External", "generate", NULL);
		exit(0);
	}
	/* Catch-all for any other john.conf section name :-) */
	if (options.listconf)
	{
		cfg_print_subsections(options.listconf, NULL, NULL);
		exit(0);
	}

	initUnicode(UNICODE_UNICODE); /* Init the unicode system */

	john_register_all(); /* maybe restricted to one format by options */
	common_init();
	sig_init();

	john_load();

	if (options.encodingStr && options.encodingStr[0])
		log_event("- %s input encoding enabled", options.encodingStr);

#ifdef CL_VERSION_1_0
	if (!options.ocl_platform)
	if ((options.ocl_platform =
	     cfg_get_param(SECTION_OPTIONS, SUBSECTION_OPENCL, "Platform")))
		platform_id = atoi(options.ocl_platform);

	if (!options.ocl_device)
	if ((options.ocl_device =
	     cfg_get_param(SECTION_OPTIONS, SUBSECTION_OPENCL, "Device")))
		gpu_id = atoi(options.ocl_device);
#endif
}
Exemplo n.º 3
0
static void john_init(char *name, int argc, char **argv)
{
	int show_usage = 0;
	int make_check = (argc == 2 && !strcmp(argv[1], "--make_check"));
	if (make_check)
		argv[1] = "--test=0";

	CPU_detect_or_fallback(argv, make_check);

	status_init(NULL, 1);
	if (argc < 2 ||
            (argc == 2 &&
             (!strcasecmp(argv[1], "--help") ||
              !strcasecmp(argv[1], "-h") ||
              !strcasecmp(argv[1], "-help"))))
	{
		john_register_all(); /* for printing by opt_init() */
		show_usage = 1;
	}
	opt_init(name, argc, argv, show_usage);

	/*
	 * --list=? needs to be supported, because it has been supported in the released
	 * john-1.7.9-jumbo-6 version, and it is used by the bash completion script.
	 * --list=? is, however, not longer mentioned in doc/OPTIONS and in the usage
	 * output. Instead, --list=help is.
	 */
	if (options.listconf &&
	    (!strcasecmp(options.listconf, "help") ||
	     !strcmp(options.listconf, "?")))
	{
		john_list_options();
		exit(0);
	}
	if (options.listconf &&
	    (!strcasecmp(options.listconf, "help:help") ||
	     !strcasecmp(options.listconf, "help:")))
	{
		john_list_help_options();
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "help:format-methods"))
	{
		john_list_method_names();
		exit(0);
	}
	if (options.listconf && !strncasecmp(options.listconf, "help:", 5))
	{
		if (strcasecmp(options.listconf, "help:parameters") &&
		    strcasecmp(options.listconf, "help:list-data"))
		{
			fprintf(stderr,
			        "%s is not a --list option that supports additional values.\nSupported options:\n",
			        options.listconf+5);
			john_list_help_options();
			exit(1);
		}
	}
	if (options.listconf && !strcasecmp(options.listconf, "hidden-options"))
	{
		puts("--help                    print usage summary, just like running the command");
		puts("                          without any parameters");
		puts("--subformat=FORMAT        pick a benchmark format for --format=crypt");
		puts("--mkpc=N                  force a lower max. keys per crypt");
		puts("--length=N                force a lower max. length");
		puts("--field-separator-char=C  use 'C' instead of the ':' in input and pot files");
		puts("--fix-state-delay=N       performance tweak, see documentation");
		puts("--log-stderr              log to screen instead of file\n");
		exit(0);
	}

	if (!make_check) {
#if defined(_OPENMP) && OMP_FALLBACK
#if defined(__DJGPP__) || defined(__CYGWIN32__)
#error OMP_FALLBACK is incompatible with the current DOS and Win32 code
#endif
		if (!getenv("JOHN_NO_OMP_FALLBACK") &&
		    omp_get_max_threads() <= 1) {
#define OMP_FALLBACK_PATHNAME JOHN_SYSTEMWIDE_EXEC "/" OMP_FALLBACK_BINARY
			execv(OMP_FALLBACK_PATHNAME, argv);
			perror("execv: " OMP_FALLBACK_PATHNAME);
		}
#endif

		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/"));
			printf("Format interface version: %d\n", FMT_MAIN_VERSION);
			puts("Rec file version: " RECOVERY_V);
			puts("Charset file version: " CHARSET_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);
			printf("Max. Markov mode level: %d\n", MAX_MKV_LVL);
			printf("Max. Markov mode password length: %d\n", MAX_MKV_LEN);
#ifdef __VERSION__
		printf("Compiler version: %s\n", __VERSION__);
#endif
#ifdef __GNUC__
			printf("gcc version: %d.%d.%d\n", __GNUC__,
			       __GNUC_MINOR__, __GNUC_PATCHLEVEL__);
#endif
#ifdef __ICC
			printf("icc version: %d\n", __ICC);
#endif
#ifdef __clang_version__
			printf("clang version: %s\n", __clang_version__);
#endif
#ifdef OPENSSL_VERSION_NUMBER
			// The man page suggests the type of OPENSSL_VERSION_NUMBER is long,
			// gcc insists it is int.
			printf("OpenSSL library version: %lx", (unsigned long)OPENSSL_VERSION_NUMBER);
			// FIXME: How do I detect a missing library?
			// Even if if is extremely unlikely that openssl is missing,
			// at least flush all output buffers...
			fflush(NULL);
			if ((unsigned long)OPENSSL_VERSION_NUMBER != (unsigned long)SSLeay())
				printf("\t(loaded: %lx)", (unsigned long)SSLeay());
			printf("\n");
#endif
			exit(0);
		}
	}

	if (options.listconf && !strcasecmp(options.listconf, "encodings"))
	{
		listEncodings();
		exit(0);
	}
#ifdef CL_VERSION_1_0
	if (options.listconf && !strcasecmp(options.listconf, "opencl-devices"))
	{
		listOpenCLdevices();
		exit(0);
	}
#endif
#ifdef HAVE_CUDA
	if (options.listconf && !strcasecmp(options.listconf, "cuda-devices"))
	{
		cuda_device_list();
		exit(0);
	}
#endif

	if (!make_check) {
		if (options.config)
		{
			path_init_ex(options.config);
			cfg_init(options.config, 1);
			cfg_init(CFG_FULL_NAME, 1);
			cfg_init(CFG_ALT_NAME, 0);
		}
		else
		{
#if JOHN_SYSTEMWIDE
			cfg_init(CFG_PRIVATE_FULL_NAME, 1);
			cfg_init(CFG_PRIVATE_ALT_NAME, 1);
#endif
			cfg_init(CFG_FULL_NAME, 1);
			cfg_init(CFG_ALT_NAME, 0);
		}
	}

	/* This is --crack-status. We toggle here, so if it's enabled in
	   john.conf, we can disable it using the command line option */
	if (cfg_get_bool(SECTION_OPTIONS, NULL, "CrackStatus", 0))
		options.flags ^= FLG_CRKSTAT;

	initUnicode(UNICODE_UNICODE); /* Init the unicode system */

	john_register_all(); /* maybe restricted to one format by options */
	if ((options.subformat && !strcasecmp(options.subformat, "list")) ||
	    (options.listconf && !strcasecmp(options.listconf, "subformats")))
	{
		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. */
		exit(0);
	}

	if (options.listconf && !strcasecmp(options.listconf, "inc-modes"))
	{
		cfg_print_subsections("Incremental", NULL, NULL, 0);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "rules"))
	{
		cfg_print_subsections("List.Rules", NULL, NULL, 0);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "externals"))
	{
		cfg_print_subsections("List.External", NULL, NULL, 0);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "sections"))
	{
		cfg_print_section_names(0);
		exit(0);
	}
	if (options.listconf &&
	    !strncasecmp(options.listconf, "parameters", 10) &&
	    (options.listconf[10] == '=' || options.listconf[10] == ':') &&
	    options.listconf[11] != '\0')
	{
		cfg_print_section_params(&options.listconf[11], NULL);
		exit(0);
	}
	if (options.listconf &&
	    !strncasecmp(options.listconf, "list-data", 9) &&
	    (options.listconf[9] == '=' || options.listconf[9] == ':') &&
	    options.listconf[10] != '\0')
	{
		cfg_print_section_list_lines(&options.listconf[10], NULL);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "ext-filters"))
	{
		cfg_print_subsections("List.External", "filter", NULL, 0);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "ext-filters-only"))
	{
		cfg_print_subsections("List.External", "filter", "generate", 0);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "ext-modes"))
	{
		cfg_print_subsections("List.External", "generate", NULL, 0);
		exit(0);
	}

	if (options.listconf &&
	    !strcasecmp(options.listconf, "formats")) {
		int column;
		struct fmt_main *format;
		int i, dynamics = 0;
		char **formats_list;

		i = 0;
		format = fmt_list;
		while ((format = format->next))
			i++;

		formats_list = malloc(sizeof(char*) * i);

		i = 0;
		format = fmt_list;
		do {
			char *label = format->params.label;
			if (!strncmp(label, "dynamic", 7)) {
				if (dynamics++)
					continue;
				else
					label = "dynamic_n";
			}
			formats_list[i++] = label;
		} while ((format = format->next));
		formats_list[i] = NULL;

		column = 0;
		i = 0;
		do {
			int length;
			char *label = formats_list[i++];
			length = strlen(label) + 2;
			column += length;
			if (column > 78) {
				printf("\n");
				column = length;
			}
			printf("%s%s", label, formats_list[i] ? ", " : "\n");
		} while (formats_list[i]);
		free(formats_list);
		exit(0);
	}
	if (options.listconf &&
	    !strcasecmp(options.listconf, "format-details")) {
		struct fmt_main *format;
		format = fmt_list;
		do {
			int ntests = 0;

			if(format->params.tests) {
				while (format->params.tests[ntests++].ciphertext);
				ntests--;
			}
			printf("%s\t%d\t%d\t%d\t%08x\t%d\t%s\t%s\t%s\t%d\t%d\t%d\n",
			       format->params.label,
			       format->params.plaintext_length,
			       format->params.min_keys_per_crypt,
			       format->params.max_keys_per_crypt,
			       format->params.flags,
			       ntests,
			       format->params.algorithm_name,
			       format->params.format_name,
			       format->params.benchmark_comment,
			       format->params.benchmark_length,
			       format->params.binary_size,
			       ((format->params.flags & FMT_DYNAMIC) && format->params.salt_size) ?
			       // salts are handled internally within the format. We want to know the 'real' salt size
			       // dynamic will alway set params.salt_size to 0 or sizeof a pointer.
			       dynamic_real_salt_length(format) : format->params.salt_size);
		} while ((format = format->next));
		exit(0);
	}
	if (options.listconf &&
	    !strcasecmp(options.listconf, "format-all-details")) {
		struct fmt_main *format;
		format = fmt_list;
		do {
			int ntests = 0;

			if(format->params.tests) {
				while (format->params.tests[ntests++].ciphertext);
				ntests--;
			}
			/*
			 * attributes should be printed in the same sequence
			 * as with format-details, but human-readable
			 */
			printf("Format label                    \t%s\n", format->params.label);
			printf("Max. password length in bytes   \t%d\n", format->params.plaintext_length);
			printf("Min. keys per crypt             \t%d\n", format->params.min_keys_per_crypt);
			printf("Max. keys per crypt             \t%d\n", format->params.max_keys_per_crypt);
			printf("Flags\n");
			printf(" Case sensitive                 \t%s\n", (format->params.flags & FMT_CASE) ? "yes" : "no");
			printf(" Supports 8-bit characters      \t%s\n", (format->params.flags & FMT_8_BIT) ? "yes" : "no");
			printf(" Converts 8859-1 to UTF-16/UCS-2\t%s\n", (format->params.flags & FMT_UNICODE) ? "yes" : "no");
			printf(" Honours --encoding=NAME        \t%s\n", (format->params.flags & FMT_UTF8) ? "yes" : "no");
			printf(" False positives possible       \t%s\n", (format->params.flags & FMT_NOT_EXACT) ? "yes" : "no");
			printf(" Uses a bitslice implementation \t%s\n", (format->params.flags & FMT_BS) ? "yes" : "no");
			printf(" The split() method unifies case\t%s\n", (format->params.flags & FMT_SPLIT_UNIFIES_CASE) ? "yes" : "no");
			printf(" A $dynamic$ format             \t%s\n", (format->params.flags & FMT_DYNAMIC) ? "yes" : "no");
#ifdef _OPENMP
			printf(" Parallelized with OpenMP       \t%s\n", (format->params.flags & FMT_OMP) ? "yes" : "no");
#endif
			printf("Number of test cases for --test \t%d\n", ntests);
			printf("Algorithm name                  \t%s\n", format->params.algorithm_name);
			printf("Format name                     \t%s\n", format->params.format_name);
			printf("Benchmark comment               \t%s\n", format->params.benchmark_comment);
			printf("Benchmark length                \t%d\n", format->params.benchmark_length);
			printf("Binary size                     \t%d\n", format->params.binary_size);
			printf("Salt size                       \t%d\n",
			       ((format->params.flags & FMT_DYNAMIC) && format->params.salt_size) ?
			       // salts are handled internally within the format. We want to know the 'real' salt size/
			       // dynamic will alway set params.salt_size to 0 or sizeof a pointer.
			       dynamic_real_salt_length(format) : format->params.salt_size);
			printf("\n");
		} while ((format = format->next));
		exit(0);
	}
	if (options.listconf &&
	    !strncasecmp(options.listconf, "format-methods", 14)) {
		struct fmt_main *format;
		format = fmt_list;
		do {
			int ShowIt = 1, i;
			if (options.listconf[14] == '=' || options.listconf[14] == ':') {
				ShowIt = 0;
				if (!strcasecmp(&options.listconf[15], "set_key")   ||
					!strcasecmp(&options.listconf[15], "get_key")   ||
					!strcasecmp(&options.listconf[15], "crypt_all") ||
					!strcasecmp(&options.listconf[15], "cmp_all")   ||
					!strcasecmp(&options.listconf[15], "cmp_one")  ||
					!strcasecmp(&options.listconf[15], "cmp_exact"))
					ShowIt = 1;
				else if (strcasecmp(&options.listconf[15], "init") && strcasecmp(&options.listconf[15], "prepare") &&
					strcasecmp(&options.listconf[15], "valid") && strcasecmp(&options.listconf[15], "split") &&
					strcasecmp(&options.listconf[15], "binary") && strcasecmp(&options.listconf[15], "clear_keys") &&
					strcasecmp(&options.listconf[15], "salt") && strcasecmp(&options.listconf[15], "get_hash") &&
					strcasecmp(&options.listconf[15], "get_hash[0]") && strcasecmp(&options.listconf[15], "get_hash[1]") &&
					strcasecmp(&options.listconf[15], "get_hash[2]") && strcasecmp(&options.listconf[15], "get_hash[3]") &&
					strcasecmp(&options.listconf[15], "get_hash[4]") && strcasecmp(&options.listconf[15], "get_hash[5]") &&
					strcasecmp(&options.listconf[15], "set_salt") && strcasecmp(&options.listconf[15], "binary_hash") &&
					strcasecmp(&options.listconf[15], "binary_hash[0]") && strcasecmp(&options.listconf[15], "binary_hash[1]") &&
					strcasecmp(&options.listconf[15], "binary_hash[2]") && strcasecmp(&options.listconf[15], "binary_hash[3]") &&
					strcasecmp(&options.listconf[15], "binary_hash[3]") && strcasecmp(&options.listconf[15], "binary_hash[5]") &&
					strcasecmp(&options.listconf[15], "salt_hash"))
				{
					fprintf(stderr, "Error, invalid option (invalid method name) %s\n", options.listconf);
					fprintf(stderr, "Valid method names are:\n");
					john_list_method_names();
					exit(1);
				}
				if (format->methods.init != fmt_default_init && !strcasecmp(&options.listconf[15], "init"))
					ShowIt = 1;
				if (format->methods.prepare != fmt_default_prepare && !strcasecmp(&options.listconf[15], "prepare"))
					ShowIt = 1;
				if (format->methods.valid != fmt_default_valid && !strcasecmp(&options.listconf[15], "valid"))
					ShowIt = 1;
				if (format->methods.split != fmt_default_split && !strcasecmp(&options.listconf[15], "split"))
					ShowIt = 1;
				if (format->methods.binary != fmt_default_binary && !strcasecmp(&options.listconf[15], "binary"))
					ShowIt = 1;
				if (format->methods.salt != fmt_default_salt && !strcasecmp(&options.listconf[15], "salt"))
					ShowIt = 1;
				if (format->methods.clear_keys != fmt_default_clear_keys && !strcasecmp(&options.listconf[15], "clear_keys"))
					ShowIt = 1;
				for (i = 0; i < 6; ++i) {
					char Buf[20];
					sprintf(Buf, "get_hash[%d]", i);
					if (format->methods.get_hash[i] && format->methods.get_hash[i] != fmt_default_get_hash && !strcasecmp(&options.listconf[15], Buf))
						ShowIt = 1;
				}
				if (format->methods.get_hash[0] && format->methods.get_hash[0] != fmt_default_get_hash && !strcasecmp(&options.listconf[15], "get_hash"))
					ShowIt = 1;

				for (i = 0; i < 6; ++i) {
					char Buf[20];
					sprintf(Buf, "binary_hash[%d]", i);
					if (format->methods.binary_hash[i] && format->methods.binary_hash[i] != fmt_default_binary_hash && !strcasecmp(&options.listconf[15], Buf))
						ShowIt = 1;
				}
				if (format->methods.binary_hash[0] && format->methods.binary_hash[0] != fmt_default_binary_hash && !strcasecmp(&options.listconf[15], "binary_hash"))
					ShowIt = 1;
				if (format->methods.salt_hash != fmt_default_salt_hash && !strcasecmp(&options.listconf[15], "salt_hash"))
					ShowIt = 1;
				if (format->methods.set_salt != fmt_default_set_salt && !strcasecmp(&options.listconf[15], "set_salt"))
					ShowIt = 1;
			}
			if (ShowIt) {
				int i;
				printf("Methods overridden for:   %s [%s] %s\n", format->params.label, format->params.algorithm_name, format->params.format_name);
				if (format->methods.init != fmt_default_init)
					printf("\tinit()\n");
				if (format->methods.prepare != fmt_default_prepare)
					printf("\tprepare()\n");
				if (format->methods.valid != fmt_default_valid)
					printf("\tvalid()\n");
				if (format->methods.split != fmt_default_split)
					printf("\tsplit()\n");
				if (format->methods.binary != fmt_default_binary)
					printf("\tbinary()\n");
				if (format->methods.salt != fmt_default_salt)
					printf("\tsalt()\n");
				for (i = 0; i < 6; ++i)
					if (format->methods.binary_hash[i] != fmt_default_binary_hash) {
						if (format->methods.binary_hash[i])
							printf("\t\tbinary_hash[%d]()\n", i);
						else
							printf("\t\tbinary_hash[%d]()  (NULL pointer)\n", i);
					}
				if (format->methods.salt_hash != fmt_default_salt_hash)
					printf("\tsalt_hash()\n");
				if (format->methods.set_salt != fmt_default_set_salt)
					printf("\tset_salt()\n");
				// there is no default for set_key() it must be defined.
				printf("\tset_key()\n");
				// there is no default for get_key() it must be defined.
				printf("\tget_key()\n");
				if (format->methods.clear_keys != fmt_default_clear_keys)
					printf("\tclear_keys()\n");
				for (i = 0; i < 6; ++i)
					if (format->methods.get_hash[i] != fmt_default_get_hash) {
						if (format->methods.get_hash[i])
							printf("\t\tget_hash[%d]()\n", i);
						else
							printf("\t\tget_hash[%d]()  (NULL pointer)\n", i);
					}
				// there is no default for crypt_all() it must be defined.
				printf("\tcrypt_all()\n");
				// there is no default for cmp_all() it must be defined.
				printf("\tcmp_all()\n");
				// there is no default for cmp_one() it must be defined.
				printf("\tcmp_one()\n");
				// there is no default for cmp_exact() it must be defined.
				printf("\tcmp_exact()\n");
				printf("\n\n");
			}
		} while ((format = format->next));
		exit(0);
	}
	/*
	 * Other --list=help:WHAT are processed earlier, but these require
	 * a valid config:
	 */
	if (options.listconf && !strcasecmp(options.listconf, "help:parameters"))
	{
		cfg_print_section_names(1);
		exit(0);
	}
	if (options.listconf && !strcasecmp(options.listconf, "help:list-data"))
	{
		cfg_print_section_names(2);
		exit(0);
	}

	/* --list last resort: list subsections of any john.conf section name */
	if (options.listconf)
	{
		//printf("Subsections of [%s]:\n", options.listconf);
		if (cfg_print_subsections(options.listconf, NULL, NULL, 1))
			exit(0);
		else {
			fprintf(stderr, "Section [%s] not found.\n", options.listconf);
			/* Just in case the user specified an invalid value
			 * like help or list...
			 * print the same list as with --list=?, but exit(1)
			 */
			john_list_options();
			exit(1);
		}
	}

#ifdef CL_VERSION_1_0
	if (!options.ocl_platform) {
		if ((options.ocl_platform =
		     cfg_get_param(SECTION_OPTIONS, SUBSECTION_OPENCL, "Platform")))
			platform_id = atoi(options.ocl_platform);
		else
			platform_id = -1;
	}
	if (!options.gpu_device) {
		if ((options.gpu_device =
		     cfg_get_param(SECTION_OPTIONS, SUBSECTION_OPENCL, "Device")))
			ocl_gpu_id = atoi(options.gpu_device);
		else
			ocl_gpu_id = -1;
	}
	if (platform_id == -1 || ocl_gpu_id == -1)
		opencl_find_gpu(&ocl_gpu_id, &platform_id);
#endif

	common_init();
	sig_init();

	john_load();

	if (options.encodingStr && options.encodingStr[0])
		log_event("- %s input encoding enabled", options.encodingStr);
}