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 = "john"; else if ((name = strrchr(argv[0], '/'))) name++; #if defined(__CYGWIN32__) || defined (__MINGW32__) || defined (_MSC_VER) else if ((name = strrchr(argv[0], '\\'))) name++; #endif else name = argv[0]; #endif #if defined(__CYGWIN32__) || defined (__MINGW32__) || defined (_MSC_VER) strlwr(name); if (strlen(name) > 4 && !strcmp(name + strlen(name) - 4, ".exe")) name[strlen(name) - 4] = 0; #endif if (!strcmp(name, "unshadow")) return unshadow(argc, argv); if (!strcmp(name, "unafs")) return unafs(argc, argv); if (!strcmp(name, "unique")) return unique(argc, argv); if (!strcmp(name, "undrop")) return undrop(argc, argv); john_init(name, argc, argv); john_run(); john_done(); return exit_status; }
int main(int argc, char **argv) { char *name; #ifdef _MSC_VER // Send all reports to STDOUT _CrtSetReportMode( _CRT_WARN, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_WARN, _CRTDBG_FILE_STDOUT ); _CrtSetReportMode( _CRT_ERROR, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ERROR, _CRTDBG_FILE_STDOUT ); _CrtSetReportMode( _CRT_ASSERT, _CRTDBG_MODE_FILE ); _CrtSetReportFile( _CRT_ASSERT, _CRTDBG_FILE_STDOUT ); #endif #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 = "john"; else if ((name = strrchr(argv[0], '/'))) name++; #if defined(__CYGWIN32__) || defined (__MINGW32__) || defined (_MSC_VER) else if ((name = strrchr(argv[0], '\\'))) name++; #endif else name = argv[0]; #endif #if defined(__CYGWIN32__) || defined (__MINGW32__) || defined (_MSC_VER) strlwr(name); if (strlen(name) > 4 && !strcmp(name + strlen(name) - 4, ".exe")) name[strlen(name) - 4] = 0; #endif if (!strcmp(name, "unshadow")) { CPU_detect_or_fallback(argv, 0); return unshadow(argc, argv); } if (!strcmp(name, "unafs")) { CPU_detect_or_fallback(argv, 0); return unafs(argc, argv); } if (!strcmp(name, "undrop")) { CPU_detect_or_fallback(argv, 0); return undrop(argc, argv); } if (!strcmp(name, "unique")) { CPU_detect_or_fallback(argv, 0); return unique(argc, argv); } #ifndef _MSC_VER if (!strcmp(name, "ssh2john")) { CPU_detect_or_fallback(argv, 0); return ssh2john(argc, argv); } if (!strcmp(name, "pdf2john")) { CPU_detect_or_fallback(argv, 0); return pdf2john(argc, argv); } if (!strcmp(name, "rar2john")) { CPU_detect_or_fallback(argv, 0); return rar2john(argc, argv); } if (!strcmp(name, "racf2john")) { CPU_detect_or_fallback(argv, 0); return racf2john(argc, argv); } if (!strcmp(name, "pwsafe2john")) { CPU_detect_or_fallback(argv, 0); return pwsafe2john(argc, argv); } #endif #ifdef HAVE_NSS if (!strcmp(name, "mozilla2john")) { CPU_detect_or_fallback(argv, 0); return mozilla2john(argc, argv); } #endif if (!strcmp(name, "zip2john")) { CPU_detect_or_fallback(argv, 0); return zip2john(argc, argv); } #ifdef HAVE_MPI mpi_setup(argc, argv); #endif john_init(name, argc, argv); john_run(); john_done(); #ifdef _MSC_VER _CrtDumpMemoryLeaks(); #endif return exit_status; }