diff -r -c ../../dist/john-1.6.37/src/batch.c ./batch.c *** ../../dist/john-1.6.37/src/batch.c Wed Aug 20 23:00:00 2003 --- ./batch.c Fri Jul 8 13:08:39 2005 *************** *** 14,21 **** --- 14,24 ---- #include "wordlist.h" #include "inc.h" + extern int mode; + static void do_single_pass(struct db_main *db) { + mode = MODE_SINGLE_CRACK; do_single_crack(db); } *************** *** 27,37 **** --- 30,42 ---- if (!(name = cfg_get_param(SECTION_OPTIONS, NULL, "Wordfile"))) name = WORDLIST_NAME; + mode = MODE_WORDLIST_CRACK; do_wordlist_crack(db, name, 1); } static void do_incremental_pass(struct db_main *db) { + mode = MODE_INCREMENTAL_CRACK; do_incremental_crack(db, NULL); } diff -r -c ../../dist/john-1.6.37/src/cracker.c ./cracker.c *** ../../dist/john-1.6.37/src/cracker.c Tue Sep 30 20:26:25 2003 --- ./cracker.c Fri Jul 8 13:08:39 2005 *************** *** 101,107 **** key = crk_methods.get_key(index); log_guess(crk_db->options->flags & DB_LOGIN ? pw->login : "?", ! dupe ? NULL : pw->source, key); crk_db->password_count--; crk_db->guess_count++; --- 101,107 ---- key = crk_methods.get_key(index); log_guess(crk_db->options->flags & DB_LOGIN ? pw->login : "?", ! dupe, pw->source, key); crk_db->password_count--; crk_db->guess_count++; diff -r -c ../../dist/john-1.6.37/src/john.c ./john.c *** ../../dist/john-1.6.37/src/john.c Mon Sep 15 03:17:17 2003 --- ./john.c Fri Jul 8 13:08:39 2005 *************** *** 46,51 **** --- 46,53 ---- static struct db_main database; static struct fmt_main dummy_format; + int mode = MODE_NULL; + static void john_register_one(struct fmt_main *format) { if (options.format) *************** *** 185,191 **** if ((options.flags & FLG_CRACKING_CHK) && database.password_count) { ! log_init(LOG_NAME, NULL, options.session); if (status_restored_time) log_event("Continuing an interrupted session"); else --- 187,193 ---- if ((options.flags & FLG_CRACKING_CHK) && database.password_count) { ! log_init(LOG_NAME, NULL, CEL_NAME, options.session); if (status_restored_time) log_event("Continuing an interrupted session"); else *************** *** 260,266 **** else if (options.flags & FLG_CRACKING_CHK) { if (!(options.flags & FLG_STDOUT)) { ! log_init(LOG_NAME, POT_NAME, options.session); john_log_format(); if (cfg_get_bool(SECTION_OPTIONS, NULL, "Idle")) log_event("- Configured to use otherwise idle " --- 262,268 ---- else if (options.flags & FLG_CRACKING_CHK) { if (!(options.flags & FLG_STDOUT)) { ! log_init(LOG_NAME, POT_NAME, CEL_NAME, options.session); john_log_format(); if (cfg_get_bool(SECTION_OPTIONS, NULL, "Idle")) log_event("- Configured to use otherwise idle " *************** *** 268,288 **** } 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(); --- 270,300 ---- } tty_init(); ! if (options.flags & FLG_SINGLE_CHK) { ! mode = MODE_SINGLE_CRACK; do_single_crack(&database); ! } else { ! if (options.flags & FLG_WORDLIST_CHK) { ! mode = MODE_WORDLIST_CRACK; ! do_wordlist_crack(&database, options.wordlist, ! (options.flags & FLG_RULES) != 0); ! } else { ! if (options.flags & FLG_INC_CHK) { ! mode = MODE_INCREMENTAL_CRACK; ! do_incremental_crack(&database, options.charset); ! } else { ! if (options.flags & FLG_EXTERNAL_CHK) { ! mode = MODE_EXTERNAL_CRACK; ! do_external_crack(&database); ! } else { ! if (options.flags & FLG_BATCH_CHK) { ! mode = MODE_BATCH_CRACK; ! do_batch_crack(&database); ! } ! } ! } ! } ! } status_print(); tty_done(); Only in .: john.c.orig diff -r -c ../../dist/john-1.6.37/src/logger.c ./logger.c *** ../../dist/john-1.6.37/src/logger.c Tue Sep 30 20:26:25 2003 --- ./logger.c Fri Jul 8 18:54:37 2005 *************** *** 38,46 **** --- 38,53 ---- static struct log_file log = {NULL, NULL, NULL, 0, -1}; static struct log_file pot = {NULL, NULL, NULL, 0, -1}; + /* + * CEL: "Cracking Elapsed-time Log" + * Used to log information about what was cracked, and how long it took. + */ + static struct log_file cel = {NULL, NULL, NULL, 0, -1}; static int in_logger = 0; + extern int mode; + static void log_file_init(struct log_file *f, char *name, int size) { f->name = name; *************** *** 107,128 **** MEM_FREE(f->buffer); } ! static int log_time(void) { unsigned int time; time = status_get_time(); ! return (int)sprintf(log.ptr, "%u:%02u:%02u:%02u ", time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60); } ! void log_init(char *log_name, char *pot_name, char *session) { char *p; in_logger = 1; if (log_name && log.fd < 0) { if (session) { --- 114,136 ---- MEM_FREE(f->buffer); } ! static int log_time(struct log_file *f) { unsigned int time; time = status_get_time(); ! return (int)sprintf(f->ptr, "%u:%02u:%02u:%02u ", time / 86400, time % 86400 / 3600, time % 3600 / 60, time % 60); } ! void log_init(char *log_name, char *pot_name, char *cel_name, char *session) { char *p; in_logger = 1; + //fprintf(stderr, "Log init: %d\n", (pot_name == NULL ? 0 : 1)); if (log_name && log.fd < 0) { if (session) { *************** *** 143,152 **** cfg_beep = cfg_get_bool(SECTION_OPTIONS, NULL, "Beep"); } in_logger = 0; } ! void log_guess(char *login, char *ciphertext, char *plaintext) { int count1, count2; --- 151,164 ---- cfg_beep = cfg_get_bool(SECTION_OPTIONS, NULL, "Beep"); } + if (cel_name && cel.fd < 0) { + log_file_init(&cel, cel_name, CEL_BUFFER_SIZE); + } + in_logger = 0; } ! void log_guess(char *login, int dupe, char *ciphertext, char *plaintext) { int count1, count2; *************** *** 154,160 **** in_logger = 1; ! if (pot.fd >= 0 && ciphertext && strlen(ciphertext) + strlen(plaintext) <= LINE_BUFFER_SIZE - 3) { count1 = (int)sprintf(pot.ptr, "%s:%s\n", ciphertext, plaintext); --- 166,172 ---- in_logger = 1; ! if (pot.fd >= 0 && !dupe && strlen(ciphertext) + strlen(plaintext) <= LINE_BUFFER_SIZE - 3) { count1 = (int)sprintf(pot.ptr, "%s:%s\n", ciphertext, plaintext); *************** *** 163,169 **** if (log.fd >= 0 && strlen(login) < LINE_BUFFER_SIZE - 64) { ! count1 = log_time(); if (count1 > 0) { log.ptr += count1; count2 = (int)sprintf(log.ptr, --- 175,181 ---- if (log.fd >= 0 && strlen(login) < LINE_BUFFER_SIZE - 64) { ! count1 = log_time(&log); if (count1 > 0) { log.ptr += count1; count2 = (int)sprintf(log.ptr, *************** *** 175,186 **** } } ! /* Try to keep the two files in sync */ ! if (log_file_write(&pot)) log_file_flush(&log); ! else ! if (log_file_write(&log)) ! log_file_flush(&pot); in_logger = 0; --- 187,230 ---- } } ! if ((cel.fd >= 0) && ! ((strlen(login)+strlen(ciphertext)+strlen(plaintext)) ! < LINE_BUFFER_SIZE - 64)) { ! count1 = log_time(&cel); ! if (count1 > 0) { ! cel.ptr += count1-1; ! count2 = (int)sprintf(cel.ptr, ! "\t%s\t%s\t%s\t%s\n", ! (mode == MODE_SINGLE_CRACK ? "single" ! : (mode == MODE_WORDLIST_CRACK ? "wordlist" ! : (mode == MODE_INCREMENTAL_CRACK ? "inc" ! : "unknown" ))), ! login, ciphertext, plaintext); ! if(count2 > 0) ! cel.ptr += count2; ! else ! cel.ptr -= count1; ! } ! } else { ! fprintf(stderr, "Insufficient buffer: aborting.\n"); ! exit(1); ! } ! ! /* Try to keep the three files in sync */ ! if (log_file_write(&pot)) { log_file_flush(&log); ! log_file_flush(&cel); ! } else { ! if (log_file_write(&log)) { ! log_file_flush(&pot); ! log_file_flush(&cel); ! } else { ! if(log_file_write(&cel)) { ! log_file_flush(&log); ! log_file_flush(&pot); ! } ! } ! } in_logger = 0; *************** *** 202,208 **** if (in_logger) return; in_logger = 1; ! count1 = log_time(); if (count1 > 0 && count1 + strlen(format) < LINE_BUFFER_SIZE - 500 - 1) { log.ptr += count1; --- 246,252 ---- if (in_logger) return; in_logger = 1; ! count1 = log_time(&log); if (count1 > 0 && count1 + strlen(format) < LINE_BUFFER_SIZE - 500 - 1) { log.ptr += count1; *************** *** 235,240 **** --- 279,285 ---- log_file_fsync(&log); log_file_fsync(&pot); + log_file_fsync(&cel); in_logger = 0; } *************** *** 250,255 **** --- 295,301 ---- log_file_done(&log); log_file_done(&pot); + log_file_done(&cel); in_logger = 0; } diff -r -c ../../dist/john-1.6.37/src/logger.h ./logger.h *** ../../dist/john-1.6.37/src/logger.h Sat Sep 6 07:55:47 2003 --- ./logger.h Fri Jul 8 13:08:39 2005 *************** *** 13,25 **** /* * Initializes the logger (opens john.pot and a log file). */ ! extern void log_init(char *log_name, char *pot_name, char *session); /* * Prints a guessed password to stdout and logs it to john.pot (unless * ciphertext is NULL) and other related information to the log file. */ ! extern void log_guess(char *login, char *ciphertext, char *plaintext); /* * Logs an arbitrary event. --- 13,27 ---- /* * Initializes the logger (opens john.pot and a log file). */ ! extern void log_init(char *log_name, char *pot_name, char *cel_name, ! char *session); /* * Prints a guessed password to stdout and logs it to john.pot (unless * ciphertext is NULL) and other related information to the log file. */ ! extern void log_guess(char *login, int dupe, ! char *ciphertext, char *plaintext); /* * Logs an arbitrary event. diff -r -c ../../dist/john-1.6.37/src/params.h ./params.h *** ../../dist/john-1.6.37/src/params.h Mon Feb 23 10:07:38 2004 --- ./params.h Fri Jul 8 13:08:39 2005 *************** *** 74,83 **** --- 74,85 ---- #define CFG_PRIVATE_ALT_NAME JOHN_PRIVATE_HOME "/john.ini" #define POT_NAME JOHN_PRIVATE_HOME "/john.pot" #define LOG_NAME JOHN_PRIVATE_HOME "/john.log" + #define CEL_NAME JOHN_PRIVATE_HOME "/john.cel" #define RECOVERY_NAME JOHN_PRIVATE_HOME "/john.rec" #else #define POT_NAME "$JOHN/john.pot" #define LOG_NAME "$JOHN/john.log" + #define CEL_NAME "$JOHN/john.cel" #define RECOVERY_NAME "$JOHN/john.rec" #endif #define LOG_SUFFIX ".log" *************** *** 214,219 **** --- 216,222 ---- */ #define POT_BUFFER_SIZE 0x1000 #define LOG_BUFFER_SIZE 0x1000 + #define CEL_BUFFER_SIZE 0x1000 /* * Buffer size for path names. *************** *** 225,227 **** --- 228,240 ---- #endif #endif + + /* + * So we can report what mode we were using for the CEL + */ + #define MODE_NULL 0 + #define MODE_SINGLE_CRACK 1 + #define MODE_WORDLIST_CRACK 2 + #define MODE_INCREMENTAL_CRACK 3 + #define MODE_EXTERNAL_CRACK 4 + #define MODE_BATCH_CRACK 5