From 3468f71fb822ec740d49e257d2a95d1a56eeaa59 Mon Sep 17 00:00:00 2001 From: magnum Date: Wed, 12 Jun 2013 22:57:58 +0200 Subject: [PATCH] Add time_now external variable that maps to time(NULL) when session was started. --- run/john.conf | 2 +- src/external.c | 11 ++++++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/run/john.conf b/run/john.conf index c2694a7..30beaef 100644 --- a/run/john.conf +++ b/run/john.conf @@ -1262,7 +1262,7 @@ int charset_length, password_length, endTime, startTime, msec; void init() { password_length = 8; /* Change this to match config */ - endTime = 1375279200; /* Aug 1 2013 - Change this as necessary */ + endTime = time_now; startTime = 1343743200; /* Aug 1 2012 - Change this as necessary */ msec = 1; /* msec is never 0 - it would crash the applet */ diff --git a/src/external.c b/src/external.c index 5794560..6fd88eb 100644 --- a/src/external.c +++ b/src/external.c @@ -44,6 +44,7 @@ static char *ext_mode; static c_int ext_word[PLAINTEXT_BUFFER_SIZE]; c_int ext_abort, ext_status, ext_cipher_limit, ext_minlen, ext_maxlen; +c_int ext_time; static struct c_ident ext_ident_status = { NULL, @@ -75,8 +76,14 @@ static struct c_ident ext_ident_maxlen = { &ext_maxlen }; -static struct c_ident ext_globals = { +static struct c_ident ext_ident_time = { &ext_ident_maxlen, + "time_now", + &ext_time +}; + +static struct c_ident ext_globals = { + &ext_ident_time, "word", ext_word }; @@ -146,6 +153,8 @@ void ext_init(char *mode, struct db_main *db) } else ext_cipher_limit = options.length; + ext_time = (int) time(NULL); + ext_maxlen = options.force_maxlength; if (options.force_minlength > 0) ext_minlen = options.force_minlength; -- 1.8.2.3