Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Date: Thu, 3 Mar 2016 17:31:31 -0600
From: jfoug <jfoug@...nwall.net>
To: john-users@...ts.openwall.com
Subject: New 'mode' in JtR external

I have added a new 'mode'  (still working on it, but it is actually 
running already) to JtR's external scripting language.

There currently are 2 modes.

1. filter: This mode simply says yea or nay on each word.

2. generate: this mode is self containing, and generates candidates.

The new mode is a hybrid-external mode.  This mode will run a script on 
each word, generating zero to however many words from the original 
word.   This would be like hybrid rexgen or rules, which modify a word, 
and can convert a word into zero to many input words.

This is what I have done so far:

1. 2 new external functions:    new() and next()
2. 2 new globals:  tot_candi and cur_candi  (not sure these are needed)

new() is called once per word. It passes in a 'new' word to be worked on.
next() is called to iterate the word.  When it returns word[0]==0 it 
lists that this word has been completed.  I was looking at having new 
set tot_candi to the number of candidate words that will be generated, 
and then within resume, using cur_candi to know how far we had worked on 
this word, but I am not sure that is the way to go or not.

This is currently only being worked on within jumbo.  Solar may want to 
look at this as something nice to have within core john also.   I have a 
bit more work to do.  I have not added any node processing in, but that 
should be trivial.  I also may add logic for tot_candi and cur_candi, 
allowing a script to say that it has no idea how many candidates there 
are.  If there are these 2 vars, then I would also need to add them to 
the .rec format.  I also have doc to do (hate that, lol).

Hopefully, I will get most of this done shortly, and checked into the 
bleeding tree.  I was pretty surprised a few hours ago, when I sat down 
to construct an external script, and realized that there was no external 
mode at all, which dealt with multiple words from a word list.  Yes, a 
filter can 'adjust' the word, but not generate words from it, and the 
generate generates a bunch of words, but does not use any prior input.  
So I wrote what would do just that.

Now, if people see things which I have missed (i.e. additional globals 
or other 'hook' functions) that would help make this more useful, then 
by all means speak up.

Jim.

PS:  Here is the 'reference' script I am working from  (Note, I do not 
need to be told this is just rule $[0-9]$[0=9]]  I know that, lol)

# Example word list mode external. same as jtr-rule: $[0-9]$[0-9]
[List.External:Wordlist_example]
int original[124], cnt, length, total;

void init()
{
}

/* new word */
void new()
{
     /* get the word stored */
     length = cnt = 0;
     while (original[length] = word[length]) length++;

     /* setup for word[], and compute total candidates */
     total = 100;  /* this is a VERY simple example */

     /* now that we have setup for this word, tell john what to expect */
     tot_candi = total;
     /* note, we 'can' start at some location higher than 0!  Here we do 
not */
     cur_candi = cnt;

     /* word will be too long to be used. NOTE, if we know that we grow 
by a */
     /* fixed size, we should check against things like global max size 
(125) */
     /* or max length of the run, or max length of the format (min len 
also) */
     if (length > 123) {
         tot_candi = cur_candi = 0;
     }
}

void next()
{
     if (cnt == 100) { word[0] = 0; return; }
     /* set word[] to the next candidate */
     word[length] = '0'+cnt/10;
     word[length+1] = '0'+cnt%10;
     word[length+2] = 0;
     ++cnt;
}

/* Called when restoring an interrupted session */
void restore()
{
/* Import the word back */
     length = 0;
     while (original[length] = word[length]) length++;
     total=tot_candi;
     cnt=cur_candi;
}

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.