mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #2108] Enhance --single mode to also use --extern:case and or -extern:leet #1411
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#1411
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 (Apr 3, 2016).
Original GitHub issue: https://github.com/openwall/john/issues/2108
I think this could be a great win, for the -single mode cracking. Not sure how easy it would be to do, but I would think it could be done.
@jfoug commented on GitHub (Apr 3, 2016):
I have seen many cases like this:
deeznuts2:d33znuts
Homerj:hom3rj
billy:b111y1
Single currently does not get these, but it would be very trivial to do so, if we could call the external hybrid scripts.
@magnumripper commented on GitHub (Apr 4, 2016):
Doesn't single mode support external hybrid? It definitely should. It does support external filters, right?
I recall that neither me nor Sayantan could figure out how to stack mask upon Single mode. That too would definitely be a win. A thing like
-single -mask:?w20?d?dwould add years to the login name etc.@jfoug commented on GitHub (Apr 4, 2016):
You can certainly put --single:leet on the command line with single, but it does not do anything.
Digging 'deeper', I think we can easily hook both mask, extern (or anything we want) into single mode, with almost no change to single. To do this, we simply hook them in the loader.c ldr_init_words() function. That is the function which chops up login, home and gecos fields into words.
NOTE, to do this, a user would also have to bump the total number of words to use (SingleWordsPairMax = x) quite a bit. Hooking here, simply provides single with a lot more candidate words. Also, restore would be TRIVIAL. There is no restore at all for the mask/ext_leet/ext_case, etc. They simply build the same words next time load happens.
NOTE, single restore sux, and there likely is nothing we can really do to fix it, since there is SOOOOO much state information that may be almost impossible to save/restore.
@jfoug commented on GitHub (Apr 4, 2016):
This is how I see 'hooking' into loader.c NOTE, this is just pseudo code
the mangle_start() and mangle_next() are simply pseudo code for whatever word modification function is being used (hybrid-something). So rexgen, extern, mask, even pp (I think), could be hooked into the ldr_mangle_start()/next() functions.
@jfoug commented on GitHub (Apr 4, 2016):
single rules already do this, but I know what you mean about being able to use mask.
Actually, if stacking like this, then the SingleWordMaxPairs should be very high, and single-rules should likely be redone to avoid certain things (like any rules doing things like l, u, c if something like -extern:case were used).
@jfoug commented on GitHub (Apr 4, 2016):
This is the hackish insert of any external-hybrid stacked script, into single. this 'does' run
>>>> Code Updated <<<<Note, if running extern:leet, I had to set the max number of words to 5. Well, I may not have 'had' to set it that low, but 3^5 is 243, and there could be 2 words with this many words, if the user was assas.sassa etc where there were at least 2 words in the name, and the first 5 matched letters were either a or s.
NOTE, in the interim, I have also seen that -single:l33t does somewhat the same thing.
@frank-dittrich commented on GitHub (Apr 4, 2016):
I think that's a very good idea.
But users would certainly prefer if SingleWordsPairMax wouln't need to be adjusted according to the mask you want to use or according to how many candidates the external mode will generate.
@jfoug commented on GitHub (Apr 5, 2016):
Agreed. NOTE, this is just a hack that is working. It is not 'fully' thought out.
Single is a bitch. I am just seeing what works, and what does not work. Yes, rules work well for single. and it is done with a 'special' way of using the rules. It may be that making adjustments INSIDE single.c ends up being a better way in the end. Note, for external, I already had to make 'special' iterated methods within external, HOWEVER, that iterated method is not a bad tool to have in our arsenal.
Back to your concern, it would be easy to override what is in the .conf file, if we know that we are bumping up the words, using some stacked modes.
@jfoug commented on GitHub (Apr 6, 2016):
The patch has been updated. This is looking like it may be a viable option.
One concern, is we use list_add_unique() function, which is pretty slow. Since it is only at load time, I guess it is ok, and only done one time. BUT it makes loading take bit. I just did a 5m salted load, and it took about 12 minutes to start.
@magnumripper commented on GitHub (Apr 7, 2016):
Except mask mode will (often) be GPU accelerated, perhaps 1000x faster... We absolutely have to keep that property of mask mode even together with single mode!
And SingleStackedMaxPairs will be a subset of that? I think it should be the other way round: SingleStackedMaxPairs should override (bump) SingleWordMaxPairs for hybrid external, only. Also, I think the default for SingleStackedMaxEach should be WAY higher than 256.
@magnumripper commented on GitHub (Apr 7, 2016):
list_add_unique is O(n^2) and we have the same problem with loopback mode assembling LM halves. The workaround hack in that case is we skip list_add_unique once we reach 0x10000 items, and just use list_add instead (after merely checking consecutive dupes). I've been thinking about ways to fix this problem. We could have a faster list_add_unique that keeps context in allocated memory, something like this:
The actual code for list_add_unique_fast could be similar to the one used in wordlist.c that was nicked from unique.c and modified. That's very fast.
@jfoug commented on GitHub (Apr 7, 2016):
Several things I have dug in and found out (I actually nearly understand single mode now !.!.!).
So, there really is no way to improve for GPU, OTHER than making some changes to push down the mask stuff. Rules would be run to fill the buffers, but then we would really need some sort of numeric type rules done in mask to make the GPU smoke any type fast format. For slow formats, it may not matter, as the format running overhead is so high, that the GPU still ends up being a win.
But the addition of external may not be the hugest win for CPU. That is unless there simply was no other way to do this using rules. And even then, we should be pushing this down INTO single, not messing with original words being produced. As I do more work with -single, I should learn it better, and then hopefully find where to properly insert stacked modes for CPU. Again, the only thing stacked that I would think useful for GPU would be mask. Without stacked mask, single in GPU is probably not a good option other than extremely slow hashes.
@magnumripper commented on GitHub (Apr 7, 2016):
Yep. If we can get it to work with GPU-side mask, that would be great. Ideally with the (enhancement request already) option to have a mask where one of the resulting candidates is the baseword alone.
At some point in time, the RAR OpenCL support was built into the CPU format. There was just --format:rar and if you had a GPU, it would be used - otherwise it would be CPU. This had several advantages and one of them was that the format could automatically switch to CPU instead when single mode was used.
As no-one else jumped that train, I ended up splitting RAR to two separate formats like all the others.
@solardiz commented on GitHub (Apr 8, 2016):
You're doing something really weird here. Why pre-mangle the single mode "words" instead of having the ruleset call into external modes (a feature I've been meaning to add)?
list_add_unique() was never meant to be used on more than just a few "words", and maybe we shouldn't change that.
@jfoug commented on GitHub (Apr 8, 2016):
Like mentioned, this was just a POC. I have been digging deeper into single, and do understand some of the logic better than I did. I have found the insertion of logic in the manner shown above was not close to ideal. However, it has allowed some limited testing of the concepts.
@magnumripper commented on GitHub (Apr 8, 2016):
What Solar said is obviously a superior solution, for speed and for dramatically less memory use. But like I said I never figured out how to accomplish that with mask mode, GPU-side or not.
@jfoug commented on GitHub (Apr 8, 2016):
I am not sure how to get mask (especially on GPU) working. But I am pretty sure I can get external working just fine, especially since I now have this code in external.c:
With the ability to iterate, adding extern should be trivial. But this is still all CPU.
Now, for mask on GPU (which 'could' be a HUGE benefit), I still would have to figure out how to hook that in.