Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220824205041.GA25359@openwall.com>
Date: Wed, 24 Aug 2022 22:50:41 +0200
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: Re: JtR Rules Questions

On Wed, Aug 24, 2022 at 09:51:47PM +0300, Aleksey Cherepanov wrote:
> To append anything ascii, I use non-printable delimiters like the
> following. Among drawbacks, it is printed into log file without \x
> quoting.
> --rules=':Az\x01[ -~][ -~]\x01'

While you can do that, your specific example is probably better written
as simply:

--rules=':$[ -~]$[ -~]'

> Also 3 full ascii ranges is a bit too much for preprocessor (it starts
> very slowly), so to append them, I append 2 ranges through --rules=
> and 1 range through --rules-stack= .

We expand and verify all normal rules at startup, which for so many
expanded rules takes time... but perhaps we don't do that for stacked
rules, an omission?  The intent was to have any rule syntax errors
reported at startup rather than later in the run.

> To pack multiple rules into the same command, you can use parallel
> expansion, but it would create totally unreadable lines. Actually I
> don't use it in contests. But I can imagine a collection of
> copy-paste-ready gadgets to build complex one-liners (there is #4117
> making it more complicated though).
> 
> $0 ^A and T2 together:
> $ echo test | ./john/run/john --pipe --stdout --rules=':[$^T]\p[0A2]'
> test0
> Atest
> teSt
> 
> Az"1" Az"12" and Az"123" together using no-op padding and \r for
> repeats in ranges:
> $ echo test | ./john/run/john --pipe --stdout
> --rules=':Az"1\r["22]\p[:"3]\p\r[::"]'
> test1
> test12
> test123

While you can do that, in your examples it was simpler to list the 3
rules separated by semicolons, so:

--rules=':$0; ^A; T2'

and:

--rules=':$1; Az"12"; Az"123"'

The back-references are a powerful and sometimes useful instrument, but
are better suited for more uniform or/and more complex cases.

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.