mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #723] Unify rar2john and rar5tojohn #364
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#364
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 @magnumripper on GitHub (Aug 26, 2014).
Original GitHub issue: https://github.com/openwall/john/issues/723
Originally assigned to: @kholia on GitHub.
We should only have one rar2john (be it python) and it should handle any RAR files we support.
@jfoug commented on GitHub (Nov 26, 2014):
Does the current rar2john (exe) handle all rar types? I see that the python script does not. Why are we so hell bent to put out python for these conversion projects?
@kholia commented on GitHub (Nov 26, 2014):
rar5tojohn.pyonly supports RAR 5 archives.rar2john.conly supports RAR 3.x archives.Python is really fun, productive, and easy for doing such stuff.
@jfoug commented on GitHub (Nov 26, 2014):
Does anyone have heartburn if I add rar5 to the rar2john project ?
@magnumripper commented on GitHub (Nov 26, 2014):
That would be great. For some reason Solar prefers C too.
@jfoug commented on GitHub (Nov 26, 2014):
Got a start. Appears pretty trivial. Should I reduce the complexity of the rar3 stuff also? There are several things that should have been done procedurally, vs tons of inline stuff. It would not 'need' to change, but I think it can be made quite a bit simpler. But first, I will work on putting rar5 into rar2john (incouding sfx support, but I doubt sfx is used too much).
@magnumripper commented on GitHub (Nov 26, 2014):
Yeah I'm a bit ashamed of some of the rar2john stuff. It grew organically as I figured stuff out and then I never cleaned it up.
@jfoug commented on GitHub (Nov 27, 2014):
POC code.
dc6f481I have not cleaned up anything, NOR is this code completed. It works on the simple test files I have provided but I am 99% sure it has more work needing done.
It would be nice to support solid files also (since that is pretty much a default mode??) but I do not think the program does this now. The rar5 was just a port from the python code (and not complete), but enough that my simple test files worked.
Keep this issue open, there is more work left, and we can get it looking better than it looks now. We should at a minimum have it able to walk the directory structure of pretty much any rar file before we call it good, probably hide some of the debugging output, and see if handing solid is an option (likely not, but possibly there is a lib that would allow us to do that).
I have family coming over to my house for the next few days. Only 2 extra now (my parents), but there will be 13 adults, and 5 kids, so I am not sure how much time I will have. On the other hand, with that many ppl, I may simply want to lock myself in my office to escape, lol.
@magnumripper commented on GitHub (Nov 27, 2014):
There are some very odd decoding stuff implemented for RAR3 (with help from that technote iirc) for parsing non-ASCII filenames correctly. I wonder if that also applies to RAR5. But my guess is it only uses UTF-8 now, or possibly UTF-16.
BTW speaking of var sized fields, that encoding is also for space saving iirc so maybe it's still used.
Edit: the function in rar2john is DecodeFileName() and it's not from the tech note but derived from unrar's encname.cpp
@jfoug commented on GitHub (Nov 28, 2014):
The variable sized ints (7 bits value per byte), is a huge savings. Yes, it takes 10 bytes to encode a full width 64 bit number, but how many of those are going to be seen? Most of these vint numbers are used for encoding lengths. A lot of items are 100k or less (many less than 10k). If you need to handle 64 bit values, then a flat encoding would use 8 bytes for all. So something like 126000 would take 8 bytes encoded with flat 64 bit value. But encoded with variable numbers, it only would take 3 bytes. a vint is a string of 7 bit ints, with the high bit reserved as 'continuation'. So to encode, simply convert the number into base-128, and set the high bit. The vint's from rar are LE, BUT can be preceded with 0x80 (i.e. 0 padded). The byte that signifies that the number is complete does not have high bit set. So for 126000,
so (7_128+88)_128+48 == 126000 The vint bytes would be (48|128), (88|128), 7
Here is the current code in rar2john to decode them (note, I need to switch to using uint64's, and the looping has to be from 0 to 10, but have not done so yet)
@jfoug commented on GitHub (Nov 28, 2014):
big bug in rar2john.c (rar5). Outputting a size value, and not the iteration count. Fixed in
222870e@jfoug commented on GitHub (Nov 28, 2014):
I think it is done now. Original rar2john code not changed much, except for:
memmem looks for all 7 bytes, not just rar! which is the first 4.
We always call rar5_file if we do not find the rar3 signature. Before, even though sfx code was added to rar5_file, it would never have been called, if the file did not start with 8 byte rar5 signature.
some debugging output muted (unless DEBUG set)
fp was NOT being set to null during rar5 check. So a non-rar5 file would have had a double file close (i..e core).
c8db452@jfoug commented on GitHub (Nov 28, 2014):
fb4fcdcmoved rar5tojohn.py to unused.