Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Tue, 23 Aug 2011 04:21:30 +0400
From: Aleksey Cherepanov <aleksey.4erepanov@...il.com>
To: john-dev@...ts.openwall.com
Subject: check for filter() is added, patch and questions about it

To start being more involved in John development I tried to solve
problem that John does not check for filter() function when external
mode is used in conjunction with other mode. (I described this problem
on john-users list.)

This check seems to be like check for generate() function in
external.c . So I considered that it would be easier to be kept inside
ext_filter() function called from different placed. ext_filter() is
called for every word. So I added for every word wasteful check
'if (!f_filter) { error(); }'. It gave me 3% speed decrease with
external mode containing empty filter() function with dummy format
(echo 'a:$dummy$61' > hashes) and with rather big wordlist
(seq 10000000 > w). I tried to run it several times to figure out real
difference in speed but I am not sure my 3% are accurate. Is it good
even with such speed decrease?

So I searched for better place for this check. Finally I stoped on john.c
file right after ext_init() call. So I check options.flags to have any
mode flag or make-char-set flag and if so I check that filter() is
defined and so on like with generate(). Is it right place for the
check?

However I found that in John there is no Markov mode while in Jumbo
there is it. So I tried to make patch applicable for both John and
Jumbo using ifdef with Markov mode flag. Should I prepare separated
patches for John and Jumbo? Or should I prepare patch only for John?
Or should I prepare patch only for Jumbo?

I enclose patch applicable for both John and Jumbo that adds check for
filter() function right after ext_init() call.

Regards,
Aleksey Cherepanov

diff -urpN john-1.7.8.orig//src/john.c john-1.7.8/src/john.c
--- john-1.7.8.orig//src/john.c	2011-02-27 12:31:36.000000000 +0000
+++ john-1.7.8/src/john.c	2011-08-23 00:01:26.000000000 +0000
@@ -129,8 +129,23 @@ static void john_load(void)
 
 	umask(077);
 
-	if (options.flags & FLG_EXTERNAL_CHK)
+	if (options.flags & FLG_EXTERNAL_CHK) {
 		ext_init(options.external);
+		if (options.flags & (FLG_BATCH_CHK | FLG_SINGLE_CHK |
+			    FLG_WORDLIST_CHK | FLG_INC_CHK | FLG_MAKECHR_CHK))
+#ifdef FLG_MKV_CHK
+		if (options.flags & FLG_MKV_CHK)
+#endif
+		if (!f_filter) {
+			log_event("! No filter() function defined");
+#ifdef HAVE_MPI
+			if (mpi_id == 0)
+#endif
+			fprintf(stderr, "No filter() for external mode: %s\n",
+				ext_mode);
+			error();
+		}
+	}
 
 	if (options.flags & FLG_MAKECHR_CHK) {
 		options.loader.flags |= DB_CRACKED;

Powered by blists - more mailing lists

Your e-mail address:

Powered by Openwall GNU/*/Linux - Powered by OpenVZ