|
Message-ID: <20090122020938.GA11265@openwall.com> Date: Thu, 22 Jan 2009 05:09:38 +0300 From: Solar Designer <solar@...nwall.com> To: john-users@...ts.openwall.com Subject: Re: Programming External azAZ09-5 without filter On Thu, Jan 22, 2009 at 01:50:05AM +0000, Ruben Lara wrote: > I'm trying to program an external mode of azAZ09 charsets of 5 length. > I want generate words cleanly, so i won't need use filter function() and earn time. > It's possible that? Indeed. > My try is next: ... > This produce 5 length words but can't avoid not alphanum characters... > Where is my mistake? I'm sorry, I did not review your code. The most straightforward and generic way to achieve what you need is by modifying the DumbForce external mode sample included in the bundled john.conf file with recent versions of JtR. Here it is, modified to achieve what you wanted: [List.External:DumbForce-azAZ09-5] 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 = 5; // Initial password length to try, must be at least 1 maxlength = 5; // Must be at least same as minlength /* This defines the character set. */ i = 0; c = 'a'; while (c <= 'z') charset[i++] = c++; c = 'A'; while (c <= 'Z') charset[i++] = c++; c = '0'; while (c <= '9') charset[i++] = c++; /* 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]; } Indeed, it is possible to achieve the same with less code, but then the code would not be as generic and it would be harder to modify for other charsets. If you ever need something like this, but with different charsets for different character positions, then the sample to modify would be KnownForce instead of DumbForce. Alexander -- 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
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.