Follow @Openwall on Twitter for new release announcements and other news
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date: Fri, 8 Oct 2010 23:38:44 +0400
From: Solar Designer <solar@...nwall.com>
To: john-users@...ts.openwall.com
Subject: Re: Rule to replace strings

On Fri, Oct 08, 2010 at 12:15:05PM -0500, Charles Weir wrote:
> Just curious but is there a way to write a rule in JtR to replace
> strings instead of individual characters, (like how the AN"STR" works
> with inserts now)?

Yes, there is a way to do it, but it's not as pretty - you have to match
individual characters:

[List.Rules:Wordlist]
/2 Dp =p0 Dp =p0 Dp =p9 Dp Ap"2010"

(there are other ways to write a rule like this as well, including
without having to delete the individual characters being matched).

With this wordlist:

$ cat w
abc2009def
wrong2008year
test2009

the rule above produces:

$ john -w=w --rules --stdout
abc2010def
test2010
words: 2  time: 0:00:00:00 100%  w/s: 200  current: test2010

> I'm currently trying to convert a bunch of sed scripts to JtR format
> which do things like replace "2009" with "2010" but I'm hitting a
> brick  wall right now on how to do that. I realize I can just use the
> sed scripts with --stdin but I figure other people might like this
> ruleset as well and it would be easier for people to use if I covert
> it.

Yes, thanks.

No one has asked for a string match or a string substitution command
before (or at least I don't recall anyone asking), which is one reason
why they're not available.  Maybe they should be added in a new version
of John.

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.