openwall / openwall/john

Improve --rules=[section1,section2]

Open
#2,479 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
C
Stars
13.6k
Forks
2.6k
PR merge metrics
No merged PRs in 30d

Description

Now that --rules= and --single= allow multiple sections, some adjustments are required.

doc/OPTIONS mentions the syntax:

(bleeding-jumbo)doc $ git grep -n SECTIONn
OPTIONS:27:--single[=(SECTION[,SECTION2,....,SECTIONn]|:rule)] "single crack" mode
OPTIONS:75:--rules[=(SECTION[,SECTION2,....,SECTIONn]|:rule)]  enable word mangling rules

Nevertheless, the description could be enhanced.
E.g., instead of

Enables word mangling rules that are read from the specified section, which
defaults to [List.Rules:Wordlist] if not given.

use

Enables word mangling rules that are read from the specified
List.Rules section(s), default is [List.Rules:Wordlist] if not given.

Since , is now used to separate section names, bleeding-jumbo shouldn't allow section names using a comma.
For now, this seems to apply to List.Rules section names, but I think we could enforce this generally.
Also, it would be good if core john would at least warn when , appears in a section name.

Currently, we have this bleeding-jumbo behaviour:

(bleeding-jumbo)run $ head -n 3 john-local.conf 
[List.Rules:fd_test1,fd_test2]
$1
$2
$ ./john --stdout --wordlist --rules=fd_[tab]

completes to

$ ./john --shdout --wordlist --rules=fd_test1,fd_test2 
(bleeding-jumbo)run $ ./john --stdout --wordlist --rules=fd_test1,fd_test2 
No "fd_test1,fd_test2" mode rules found in ./john.conf

Since --single= and --rules= accept (lists of) rules instead of section names (when prefixed with :), we shouldn't allow section names starting with :.

This restriction should be added to core john as well, if possible.

Current bleeding-jumbo behaviour:

(bleeding-jumbo)run $ head -n 3 john-local.conf 
[List.Rules::fd_test1]
$1
$2
(bleeding-jumbo)run $ ./john --stdout --wordlist --rules=::fd_test1 
Invalid rule in Command Line Rule at line 0: Invalid position code

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with doc/OPTIONS and the existing --rules= and --single= command-line parsing paths. Reproduce the comma-containing and colon-prefixed section-name examples, then trace how core and bleeding-jumbo resolve sections; done means the documentation explains lists clearly and the requested invalid-name handling is covered.

Written by the indexing model from the issue text.

Assessment

Tech stack
c
Domain
cli, documentation
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.