Страница: 9/11
} while ((current = current->next));
printf("%s%d password%s cracked, %d left\n",
database.guess_count ? "\n" : "",
database.guess_count,
database.guess_count != 1 ? "s" : "",
database.password_count -
database.guess_count);
return;
}
if (options.flags & (FLG_SINGLE_CHK | FLG_BATCH_CHK))
options.loader.flags |= DB_WORDS;
else
if (mem_saving_level)
options.loader.flags &= ~DB_LOGIN;
ldr_init_database(&database, &options.loader);
if ((current = options.passwd->head))
do {
ldr_load_pw_file(&database, current->data);
} while ((current = current->next));
ldr_load_pot_file(&database, LOG_NAME);
ldr_fix_database(&database);
printf("Loaded %d password%s%s",
database.password_count,
database.password_count != 1 ? "s" : "",
database.password_count ? "" : ", exiting .");
if (database.password_count > 1) {
printf(" with ");
printf(database.salt_count != 1 ? "%d" : "no",
database.salt_count);
printf(" different salts");
}
if (database.password_count)
printf(" (%s [%s])\n",
database.format->params.format_name,
database.format->params.algorith_name);
else
putchar('\n');
if ((options.flags & FLG_PWD_REQ) && !database.salts) exit(0);
}
}
static void john_init(int argc, char **argv)
{
#if CPU_DETECT
if (!CPU_detect()) {
#if CPU_REQ
fprintf(stderr, "Sorry, %s is required\n", CPU_NAME);
error();
#endif
}
#endif
path_init(argv);
cfg_init(CFG_NAME);
status_init(NULL, 1);
opt_init(argc, argv);
john_register_all();
common_init();
sig_init(idle_yield);
john_load();
}
static void john_run()
{
if (options.flags & FLG_TEST_CHK)
benchmark_all();
else
if (options.flags & FLG_MAKECHARS_CHK)
do_makechars(&database, options.charset);
else
if (options.flags & FLG_CRACKING_CHK) {
if (!(options.flags & FLG_STDOUT)) log_init(LOG_NAME);
tty_init();
if (options.flags & FLG_SINGLE_CHK)
do_single_crack(&database);
else
if (options.flags & FLG_WORDLIST_CHK)
do_wordlist_crack(&database, options.wordlist,
(options.flags & FLG_RULES) != 0);
else
if (options.flags & FLG_INC_CHK)
do_incremental_crack(&database, options.charset);
else
if (options.flags & FLG_EXTERNAL_CHK)
do_external_crack(&database);
else
if (options.flags & FLG_BATCH_CHK)
do_batch_crack(&database);
status_print();
tty_done();
if (!(options.flags & FLG_STDOUT)) log_done();
}
}
static void john_done()
{
path_done();
check_abort();
}
int main(int argc, char **argv)
{
char *name;
#ifdef DJGPP
if (--argc <= 0) return 1;
if ((name = strrchr(argv[0], '/')))
strcpy(name + 1, argv[1]);
name = argv[1];
argv[1] = argv[0];
argv++;
#else
if (!argv[0])
name = "";
else
if ((name = strrchr(argv[0], '/')))
name++;
else
name = argv[0];
#endif
#ifdef CYGWIN32
if (strlen(name) > 4)
if (!strcmp(strlwr(name) + strlen(name) - 4, ".exe"))
name[strlen(name) - 4] = 0;
#endif
if (!strcmp(name, "john")) {
john_init(argc, argv);
john_run();
john_done();
return 0;
}
if (!strcmp(name, "unshadow"))
return unshadow(argc, argv);
if (!strcmp(name, "unafs"))
return unafs(argc, argv);
if (!strcmp(name, "unique"))
return unique(argc, argv);
fprintf(stderr, "Sorry, I can't find myself\n");
return 1;
}
Файл des_bs.c
#include <string.h>
#include "arch.h"
Реферат опубликован: 25/10/2008