Openwall GNU/*/Linux - a small security-enhanced Linux distro for servers
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Sun, 26 Jul 2009 17:17:49 +0400
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: Re: DumbForce init() function

On Sun, Jul 26, 2009 at 02:42:10PM +0200, websiteaccess wrote:
>  I have modified JTR to add french charset "" "" etc... with your 
> help.
> 
>  It works fine, but I had to rebuild the alpha, alnum, all charsets 
> (older with not compatible with). Now my JTR is less powerfull (crack 
> less words in same time than yours), because original charset was 
> highly optimized. I can't rebuild the same.

Instead of rebuilding all .chr files, you could have kept a separate
build of JtR (with the original params.h) for use in all cases except
when you have a need to use your new .chr file with the 4 extra
characters in it.

>  There is an other way, to keep your highly charset, and add french 
> char.
> 
>  You told me :
> -------------------------------------------
> An even simpler approach, not requiring a recompile, would be to use the
> DumbForce external mode sample, configuring it for your desired charset.
> In the init() function, you'll specify:
> 
> 	i = 0;
> 	c = 'a';
> 	while (c <= 'z')
> 		charset[i++] = c++;
> 	charset[i++] = '';
> 	charset[i++] = '';
> 	charset[i++] = '';
> 	charset[i++] = '';
> 
> replacing the existing lines (many of them) defining another charset
> after the "This defines the character set." comment.
> -------------------------------------------
> 
>  I'm really stupid with programming, could you add the code above (in 
> differents rights place) in the john.conf and return me the john.conf 
> correctly modified ?

I've modified the original DumbForce mode sample from JtR 1.7.3.1,
tested it briefly, and attached it to this message.  You'll need to
append this to your john.conf.

Also, just to demonstrate what my changes were, I generated and attached
a diff file comparing the original DumbForce sample with my modified
version.

Alexander

[List.External:DumbForce-alpha-fr]
int maxlength;		// Maximum password length to try
int last;		// Last character position, zero-based
int lastid;		// Character index in the last position
int id[0x7f];		// Current character indices for other positions
int charset[0x100], c0;	// Character set

void init()
{
	int minlength;
	int i, c;

	minlength = 1;	// Initial password length to try, must be at least 1
	maxlength = 8;	// Must be at least same as minlength

/* This defines the character set */
	i = 0;
	c = 'a';
	while (c <= 'z')
		charset[i++] = c++;
	charset[i++] = '';
	charset[i++] = '';
	charset[i++] = '';
	charset[i++] = '';

/* Zero-terminate it, and cache the first character */
	charset[i] = 0;
	c0 = charset[0];

	last = minlength - 1;
	i = 0;
	while (i <= last) {
		id[i] = 0;
		word[i++] = c0;
	}
	lastid = -1;
	word[i] = 0;
}

void generate()
{
	int i;

/* Handle the typical case specially */
	if (word[last] = charset[++lastid]) return;

	lastid = 0;
	word[i = last] = c0;
	while (i--) {			// Have a preceding position?
		if (word[i] = charset[++id[i]]) return;
		id[i] = 0;
		word[i] = c0;
	}

	if (++last < maxlength) {	// Next length?
		id[last] = lastid = 0;
		word[last] = c0;
	} else				// We're done
		word = 0;
}

void restore()
{
	int i, c;

/* Calculate the current length and infer the character indices */
	last = 0;
	while (c = word[last]) {
		i = 0; while (charset[i] != c && charset[i]) i++;
		if (!charset[i]) i = 0;	// Not found
		id[last++] = i;
	}
	lastid = id[--last];
}

--- DumbForce-1.7.3.1	2009-03-26 02:27:15 +0000
+++ DumbForce-alpha-fr	2009-07-26 13:08:42 +0000
@@ -1,4 +1,4 @@
-[List.External:DumbForce]
+[List.External:DumbForce-alpha-fr]
 int maxlength;		// Maximum password length to try
 int last;		// Last character position, zero-based
 int lastid;		// Character index in the last position
@@ -11,42 +11,17 @@ void init()
 	int i, c;
 
 	minlength = 1;	// Initial password length to try, must be at least 1
-	maxlength = 7;	// Must be at least same as minlength
+	maxlength = 8;	// Must be at least same as minlength
 
-/*
- * This defines the character set.
- *
- * Let's say, we want to try TAB, all non-control ASCII characters, and all
- * 8-bit characters, including the 8-bit terminal controls range (as these are
- * used as regular national characters with some 8-bit encodings), but except
- * for known terminal controls (risky for the terminal we may be running on).
- *
- * Also, let's say our hashes are case-insensitive, so skip lowercase letters
- * (this is right for LM hashes).
- */
+/* This defines the character set */
 	i = 0;
-	charset[i++] = 9;		// Add horizontal TAB (ASCII 9), then
-	c = ' ';			// start with space (ASCII 32) and
-	while (c < 'a')			// proceed till lowercase 'a'
-		charset[i++] = c++;
-	c = 'z' + 1;			// Skip lowercase letters and
-	while (c <= 0x7e)		// proceed for all printable ASCII
-		charset[i++] = c++;
-	c++;				// Skip DEL (ASCII 127) and
-	while (c < 0x84)		// proceed over 8-bit codes till IND
-		charset[i++] = c++;
-	charset[i++] = 0x86;		// Skip IND (84 hex) and NEL (85 hex)
-	charset[i++] = 0x87;
-	c = 0x89;			// Skip HTS (88 hex)
-	while (c < 0x8d)		// Proceed till RI (8D hex)
-		charset[i++] = c++;
-	c = 0x91;			// Skip RI, SS2, SS3, DCS
-	while (c < 0x96)		// Proceed till SPA (96 hex)
-		charset[i++] = c++;
-	charset[i++] = 0x99;		// Skip SPA, EPA, SOS
-	c = 0xa0;			// Skip DECID, CSI, ST, OSC, PM, APC
-	while (c <= 0xff)		// Proceed with the rest of 8-bit codes
+	c = 'a';
+	while (c <= 'z')
 		charset[i++] = c++;
+	charset[i++] = '';
+	charset[i++] = '';
+	charset[i++] = '';
+	charset[i++] = '';
 
 /* Zero-terminate it, and cache the first character */
 	charset[i] = 0;


-- 
To unsubscribe, e-mail john-users-unsubscribe@...ts.openwall.com and reply
to the automated confirmation request that will be sent to you.

Powered by blists - more mailing lists

Your e-mail address:

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