mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #725] Add first check local section(s) to john.local.conf #368
Labels
No labels
bug
core branch
documentation
enhancement
enhancement
fixed - pending verify
fuzz bug
good first issue
invalid
invalid
maintenance/cleanup
new cracking mode
new format
new tool
non-trivial
notes/external issues
portability
question
RFC / discussion
testing
WONTFIX
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
openwall/john#368
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @jfoug on GitHub (Aug 27, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/725
From another issue thread
what I would call a 'first' check section, would be something like [Options:Local:OpenCL] This would NEVER be added to john.conf, but would be in john.local.conf. If we did not find a rar5_LWS in [Options:Local:OpenCL], then we would check in
[Options:OpenCL](which is in john.conf). That value could be set as a 'good value' for most cards, if we choose.But we should look at using logic like this for all TRUE local configuration items, or simply ADD logic that always adds a [header:Local:key] to any check for [header:section] loads, and only falls back to [header:section] if the Local is not found.
In this way, you can easily setup a system the way you want it, without either losing john.conf each time you get pull, or running the chance of polluting the global (github) john.conf with your local changes.
I have known JtR has needed this type enhancement for a while, but until I thought it through a bit, I was not sure quite how to do it. I think we could easily get JtR to auto do this for us, giving highest precedence to a Local hive, IF it exists.
@magnumripper commented on GitHub (Aug 27, 2014):
That's certainly a way to go. I'd rather just have john.local.conf override anything in john.conf but I have no idea how to implement that in a safe and KISS manner.
@jfoug commented on GitHub (Aug 28, 2014):
I have a POC. This was SUPPPPPPER easy. Since john.local.conf is the last include in john.conf, this works great. I simply added 1 function to config.c (static so it does not even need to be in config.h), and it works find. I use [Local:whatever] as the signal that this is a local override. NOTE, if the original config block was a [List.xxxx] block, then there is no way to override. We can not edit a list. Well we 'could' edit the externs in some manner, but that was what the .include [section] was meant to do. For externs, we 'could' do local for some function within the extern, but that really does not make sense. The only thing you can really do within john.local.conf when it comes to a List. block, is to completely replace it. If you put a new section out there, it WILL be the one JtR uses, but it will be used in full.
But with the local, we can do things like this:
[Local:Options]
DynamicAlwaysUseBareHashes = Y
Idle = N
That would leave Options intact, but force idle off, and force dyna raw hashes on, overriding what is in john.conf.
The code is simple. It will not add any new options, only changing existing ones.
The caveat to this code, is you want to have a dummy section at the bottom of john.local.conf, since the merge happens at the start of the next section.
Here is my john.local.conf
Comments wanted. This code works as is. It is very simple. There might be better ways to do this, BUT this really is KISS.
@jfoug commented on GitHub (Aug 28, 2014):
Note if we had simply put
into john.local.conf, then that would be the ENTIRE options config set. All other params from the Options block would be lost. With the Local:Options, we merge them into the original Options block. There IS a Local:Options, and you can drop it out with a -list= switch
But the original Options block has been 100% original, except for the 2 modified params done by the local change:
@jfoug commented on GitHub (Aug 28, 2014):
If this code is added to bottom of cfg_init() then the caveat of having to have an empty section block at the end of john.local.conf goes away.
@magnumripper commented on GitHub (Aug 28, 2014):
Interesting. Is there no way to make this happen without using the "Local:" prefix? What if anything read from john.local.conf implies that, instead?
I would like that even more, although it actually has a downside: You would not be able to replace a complete section. You'd always merge.
@jfoug commented on GitHub (Aug 28, 2014):
the reason I wrote it the way I did, is so that replacement by name still works.
of course we could track the file name being processed, and reverse the logic. In this mode merge would be default if running from John.local.conf and we use something like Replace:secttion_name to do a replacement. I like the way it is in my code. The logic is very simple.
If I rev logic, I would change any section name with replace: by stopping it, and add local: to others, then keep the code I have added.
But I find that to be messy and for little gain for end user.
Sent with my 4G LTE LG G2.
@jfoug commented on GitHub (Aug 29, 2014):
This has been commited here:
0aadb4eThere is documentation on how to use it. Also configure.ac changed (and a new macro created) that will build a 'good' skeleton john.local.conf file, but ONLY do it if that file is not there. The john.local.conf gets good commenting, and it builds empty local sections (with a comment) for each non List. section found in john.conf.
Here is the skeleton john.local.conf file created by configure:
Note, working with non paired [ ] in autoconfig SUX. My awk line, I had to go to quadragraph usage for 3 types characters # [ and $ I could not seem to get it to compile with autoconf (or later run) any other way. The grep line above it uses [ and ], but they are matched, and simple [] quoting was enough. The awk line outputs the final stuff, and there were unmatched [ chars. That causes the m4 processing for autoconf to go tits up.
@ghost commented on GitHub (Aug 29, 2014):
Should we changed the JtR message from:
BTW: I put some LWS/GWS "examples" inside john.conf. We should remove that, no?
@magnumripper commented on GitHub (Aug 29, 2014):
Those examples could be moved to the skeleton file but the downside would be any later updates will never reach your existing file. So I'm not sure. Yes maybe that autotune message should say john.local.conf... although my preference is to ditch that output and aim for auto-tune good and quick enough to make the john.conf stuff a very rare exception for expert users only.
@jfoug commented on GitHub (Aug 30, 2014):
Those 'examples' should be in john.conf. BUT there should be a comment with them listing that the example comment should be overridden in the john.local.conf file.
@ghost commented on GitHub (Aug 30, 2014):