Exemplo n.º 1
0
void dynamic_DISPLAY_ALL_FORMATS()
{
	int i;
	for (i = 0; i < 1000; ++i)
	{
		char *sz = dynamic_PRELOAD_SIGNATURE(i);
		char Type[14], *cp;
		if (!sz)
			break;
		strncpy(Type, sz, sizeof(Type));
		Type[13] = 0;
		cp = strchr(Type, ':');
		if (cp) *cp = 0;
		printf ("Format = %s%s  type = %s\n", Type, strlen(Type)<10?" ":"", sz);
	}

	// The config has not been loaded, so we have to load it now, if we want to 'check'
	// and show any user set md5-generic functions.
#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);

	for (i = 1000; i < 10000; ++i)
	{
		char *sz = dynamic_LOAD_PARSER_SIGNATURE(i);
		if (sz &&
		    // dynamic_IS_PARSER_VALID(i)) // this would include "reserved" formats
		    dynamic_IS_VALID(i) == 1) // skip "reserved" formats
			printf ("UserFormat = dynamic_%d  type = %s\n", i, sz);
	}
}
Exemplo n.º 2
0
int dynamic_IS_PARSER_VALID(int which)
{
	struct cfg_line *gen_line;
	if (!dynamic_LOAD_PARSER_SIGNATURE(which))
		return 0;

	gen_line = gen_source->head;
	while (gen_line)
	{
		if (!strncasecmp(gen_line->data, "ColonChar", 9))
		{
			// not sse2, but we do not handle this in the long bench.
			// we can still bench if we specify JUST this one.
			return 0;
		}
		if (strstr(gen_line->data, "MGF_ColonNOTValid"))
			return 0;  // same as above, ColonChar.
		gen_line = gen_line->next;
	}
	return 1;
}
Exemplo n.º 3
0
int dynamic_LOAD_PARSER_FUNCTIONS(int which, struct fmt_main *pFmt)
{
	int ret, cnt;
	struct cfg_line *gen_line;

	nPreloadCnt = 0;
	nFuncCnt = 0;

	if (!dynamic_LOAD_PARSER_SIGNATURE(which))
	{
#ifdef HAVE_MPI
		if (mpi_id == 0)
#endif
		fprintf(stderr, "Could not find section [List.Generic:dynamic_%d] in the john.ini/conf file\n", which);
		error();
	}

	// Setup the 'default' format name
	sprintf(SetupName, "$dynamic_%d$", which);
	sprintf(SetupNameID, "dynamic_%d", which);
	Setup.szFORMAT_NAME = str_alloc_copy(SetupName);

	// allocate (and set null) enough file pointers
	cnt = Count_Items("Func=");
	Setup.pFuncs = mem_alloc_tiny((cnt+1)*sizeof(DYNAMIC_primitive_funcp), MEM_ALIGN_WORD);
	memset(Setup.pFuncs, 0, (cnt+1)*sizeof(DYNAMIC_primitive_funcp));

	// allocate (and set null) enough Preloads
	cnt = Count_Items("Test=");
	cnt += Count_Items("TestU=");
	cnt += Count_Items("TestA=");
	Setup.pPreloads = mem_alloc_tiny((cnt+1)*sizeof(struct fmt_tests), MEM_ALIGN_WORD);
	memset(Setup.pPreloads, 0, (cnt+1)*sizeof(struct fmt_tests));

	// allocate (and set null) enough constants (if we have 8, we still need a null to specify the end of the list)
	cnt = Count_Items("CONST");
	Setup.pConstants = mem_alloc_tiny((cnt+1)*sizeof(DYNAMIC_Constants), MEM_ALIGN_WORD);
	memset(Setup.pConstants, 0, (cnt+1)*sizeof(DYNAMIC_Constants));

	Setup.flags = 0;
	Setup.startFlags = 0;
	Setup.SaltLen = 0;
	Setup.MaxInputLen = 0;

	// Ok, now 'grind' through the data  I do know know how to use
	// the config stuff too much, so will grind for now, and later
	// go back over this, and do it 'right', if there is a right way
	gen_line = gen_source->head;

	while (gen_line)
	{
		if (!dynamic_LOAD_PARSER_FUNCTIONS_LoadLINE(gen_line))
		{
#ifdef HAVE_MPI
			if (mpi_id == 0)
#endif
			fprintf(stderr, "Error parsing section [List.Generic:dynamic_%d]\nError in line %d file is %s\n", which, gen_line->number, gen_line->cfg_name);
			error();
		}
		gen_line = gen_line->next;
	}

	ret = dynamic_SETUP(&Setup, pFmt);

	return ret;
}