int main(int argc, char * argv[]) { printf("Bruteforcer alpha\n\n"); global_data_t global_data = { .hash = argv[argc - 1], .result_founded = 0, .alph = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM1234567890", .alph_len = 62, .pass_len = 6, .n_thrds = (int) sysconf(_SC_NPROCESSORS_ONLN), .run_mode = RM_MULTI, .brute_mode = BM_ITER }; if (get_options(&global_data, argc, argv) == EXIT_FAILURE) { printf("No hash detected or corrupter options\nRestart program with MD5 hash to brute as an argument\n"); return EXIT_FAILURE; } printf("Captured threads amount: %d\nPassword maximum length: %d\nAlphabet: %s\nBrute mode: %s\nRun mode: %s\nHash: %s\n\n", global_data.n_thrds, global_data.pass_len, global_data.alph, global_data.brute_mode == BM_ITER ? "iterative" : global_data.brute_mode == BM_REC ? "recursive" : "unknown", global_data.run_mode == RM_MULTI ? "multi-threaded" : global_data.run_mode == RM_SINGLE ? "single-threaded" : "unknown", global_data.hash); global_data.brute_func = (global_data.brute_mode == BM_ITER) ? iter : (global_data.brute_mode == BM_REC ? rec : NULL); switch (global_data.run_mode) { case RM_MULTI: run_multi (&global_data); break; case RM_SINGLE: brute(&global_data, check_crypt); break; default: printf("Smth went wrong\n"); } printf("\nThanks for using, hope you liked it\n"); return (EXIT_SUCCESS); }
int transition_machine() { int i; while(transition!=DEATH) { switch(transition) { case MULTI: run_multi(); break; case SINGLE: run_single(); break; } } syslog(LOG_EMERG,"Killing all existing sessions..."); /* Kill all sessions */ kill(-1,SIGKILL); /* Be nice and wait for them */ while(waitpid(-1,(int *)0,WNOHANG|WUNTRACED)>0) continue; unmount("/",0); reboot(RB_AUTOBOOT); /* NOTREACHED */ }