Menu

Rules Processing

Rules Processing

Introduction

Rules are very similar to the "John The Ripper" rules. In fact, I really want to implement the whole JTR rules conditions and commands, but it isn´t an easy work...

In JBrute, you have 2 main components: the rule preprocessor and the processor. The preprocessor does several things related to validation of rules, and it generates multiple rules from one rule if it uses masks. The processor checks the rule conditions and applies commands to the processing word.
First of all, JBrute read all wordlist from file to memory. Then, for each rule, it process each word. There is no action related to save processed words, so, when it finish whit a rule, just starts again with the next rule and the original wordlist.
In the parsing of a rule the processor checks all conditions and actions from left to right, so, the condition/command´s order matters. Also, each condition/action in a rule must be separed from the next one by a space character. So, JTR rules with conditions/actions not separed will not work on JBrute.

As I said, rules syntax are very similar to the "John The Ripper" rules syntax, but with some limitations:

1) There are partial support for masking
Actually masks are only supported for the "^" and "$" actions. Only the next mask are supported: a-z, A-Z, 0-9, a-z0-9, a-zA-z, A-Z0-9, a-zA-Z0-9
So:
^[0-9]
will be:
^0
^1
^2
^3
^4
^5
^6
^7
^8
^9
You could use your own custom charsets in that way:
^[6789]
should be:
^6
^7
^8
^9

2) The next conditions are not working (JBrute just ignore it for compatibility reasons):
-c reject this rule unless current hash type is case-sensitive
-8 reject this rule unless current hash type uses 8-bit characters
-s reject this rule unless some password hashes were split at loading
-p reject this rule unless word pair commands are currently allowed

3) Because 1) and 2), this beginning condition are not supported:
-[:c]

4) The next actions (memory access commands) are not working (JBrute just ignore it for compatibility reasons):
XNMI extract substring NM from memory and insert into current word at I

5) The next Insert/delete commands are not working (JBrute will tell you that it is an invalid action)
xNM extract substring from position N for up to M characters
iNX insert character X in position N and shift the rest right
oNX overstrike character in position N with character X

Some examples:

Use a word as is
-:

Capitalize the word
-: c

Capitalize the word and append at the end the 'r' character if it length is grater than 5
>5 c $r

Append all digits to the end of the word
$[0-9]

Append some birthdays years to the end of the word
$1 $9 $[789] $[0-9]

Convert the word to uppercase if it length is grater than 5
>5 u

Convert the word to uppercase and insert the '9' character at the beginning if it length is grater than 3 and it starts with 'c' character
>3 =0c c ^9

For the complete list of options, please refer to the "John The Ripper" rules syntax:
http://www.openwall.com/john/doc/RULES.shtml

You can always check your rule conditions/commands with the next command:
$ ./jbrute.sh --decrypt --method=dictionary --dict_file=words.txt --rule_file=rules.txt --stdout

Note: JBrute will not try to decrypt, it will just read the dictionary file "words.txt" and process it with the specifies rules on "rules.txt" file.

If you found a functionality that is not implemented (except the mentioned limitations), or it is not working as expected, please tell me and I will be happy to fix it.


Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.