Follow us on Twitter or via RSS feeds with tweets or complete announcement texts or excerpts
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Thu, 01 Sep 2011 22:35:09 +0200
From: magnum <rawsmooth@...dband.net>
To: john-users@...ts.openwall.com
Subject: New rule reject flag added [was: Couple of questions regarding rules
 (preprocessor) and truncation]

On 2011-03-20 02:43, Solar Designer wrote:
> On my to do list, I have this item: "new reject flag: unless passwords
> of length N or longer are supported". This would let you do what you
> wanted by using the new rule reject flag along with the preprocessor's
> backreferences. The syntax could be something like:
>
> ->[2-9A-Z]>\0 '\0 A[0z]"1234"

In fact I implemented this myself the very same day but completely 
lacking error checking. I've used it heavily since. I recently added 
error checking too, and I think this is a proper patch now.

magnum

>From 53b48a8273cd6fd3c569a4fef16c1c0050d5f308 Mon Sep 17 00:00:00 2001
From: magnum <magnum>
Date: Thu, 1 Sep 2011 01:29:51 +0200
Subject: [PATCH 09/13] ->N reject flag (reject unless length N is supported)

---
 doc/RULES   |    1 +
 src/rules.c |    9 +++++++++
 2 files changed, 10 insertions(+), 0 deletions(-)

diff --git a/doc/RULES b/doc/RULES
index b387e01..57218c6 100644
--- a/doc/RULES
+++ b/doc/RULES
@@ -30,6 +30,7 @@ john rule to start with a period, so at this time, this is not a problem.
 -p	reject this rule unless word pair commands are currently allowed
 -u	reject this rule unless the --encoding=utf8 flag is used
 -U	reject this rule if the --encoding=utf8 flag is used
+->N	reject this rule unless length N or longer is supported
 
 
 	Numeric constants and variables.
diff --git a/src/rules.c b/src/rules.c
index 06b91b9..e0f4182 100644
--- a/src/rules.c
+++ b/src/rules.c
@@ -623,6 +623,15 @@ char *rules_reject(char *rule, int split, char *last, struct db_main *db)
 			if (split >= 0) continue;
 			return NULL;
 
+		case '>':
+			if (!db && RULE) continue;
+			if (!NEXT) {
+				rules_errno = RULES_ERROR_END;
+				return NULL;
+			}
+			if (rules_vars[ARCH_INDEX(RULE)] <= db->format->params.plaintext_length ) continue;
+			return NULL;
+
 		case '\0':
 			rules_errno = RULES_ERROR_END;
 			return NULL;
-- 
1.7.4.1


Powered by blists - more mailing lists

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