Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20130731053809.GA25055@openwall.com>
Date: Wed, 31 Jul 2013 09:38:09 +0400
From: Solar Designer <solar@...nwall.com>
To: john-dev@...ts.openwall.com
Subject: Re: wordlist for mask mode

Sayantan,

On Wed, Jul 31, 2013 at 10:00:33AM +0530, Sayantan Datta wrote:
> I'm unable to get command the line option -wordlist with -mask. I tried
> modifying some parameters in options.h but the option checking won't allow
> two modes together. Help!!

getopt.h contains this comment:

/* Option flags to set and clear, respectively. If a bit is set in both
 * flg_set and flg_clr, that flag is set, and required not to be set by
 * the time the option appeared (used to detect duplicate options). */
        opt_flags flg_set, flg_clr;

Note this portion of it: "If a bit is set in both [it is] required not
to be set by the time the option appeared".

Both "--wordlist" and "--mask" have FLG_CRACKING_CHK in flg_clr, which
is also included in FLG_WORDLIST_SET and FLG_MASK_SET.  This is on
purpose, so that a user is only able to specify one cracking mode (not
two at once).

For an exception to this - that is, a cracking mode that can exist both
on its own and as an add-on to other modes - see "--external":

	{"external", FLG_EXTERNAL_SET, FLG_EXTERNAL_CHK,
		0, OPT_REQ_PARAM, OPT_FMT_STR_ALLOC, &options.external},

Note that its flg_clr is not FLG_CRACKING_CHK, but merely
FLG_EXTERNAL_CHK, which is a one-bit flag unique for this option.
This way, there's no conflict with other cracking modes (as far as the
option parser is aware), yet there is detection of the possible error of
having the "--external" option itself specified more than once.

Thus, what you probably want to do is change:

	{"mask", FLG_MASK_SET, FLG_CRACKING_CHK,
		0, OPT_REQ_PARAM, OPT_FMT_STR_ALLOC, &options.mask},

to:

	{"mask", FLG_MASK_SET, FLG_MASK_CHK,
		0, OPT_REQ_PARAM, OPT_FMT_STR_ALLOC, &options.mask},

This will permit "--mask" to be specified along with many other options
(except only for those that themselves declare conflicts either with any
other option or with "--mask" specifically).  Since initially you're
going to support "--mask" only on its own and with wordlist mode (but
not e.g. with incremental mode), you'll probably want to restrict this
somewhat.  You may do so e.g. by introducing a FLG_MASK_SUP flag,
similar to how I had FLG_NODE_SUP for a little while (before completing
"--node" support for all cracking modes):

http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/john/john/src/options.c.diff?r1=1.26;r2=1.27
http://cvsweb.openwall.com/cgi/cvsweb.cgi/Owl/packages/john/john/src/options.h.diff?r1=1.3;r2=1.4

Alexander

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.