mirror of
https://github.com/openwall/john.git
synced 2026-12-03 18:45:21 +07:00
[GH-ISSUE #1954] New option: --queue #1300
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#1300
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 (Dec 16, 2015).
Original GitHub issue: https://github.com/openwall/john/issues/1954
Originally assigned to: @magnumripper on GitHub.
Basic idea, usage:
Session 1:
Session 2 (note that session 1 is still running):
Basic idea, how to implement:
If this scheme works, this is a super trivial KISS[tm] way to add ability to queue jobs that need to be run in sequence.
@magnumripper commented on GitHub (Dec 16, 2015):
Caveat: The
-queueoption must not be stored in the session file.@jfoug commented on GitHub (Dec 16, 2015):
I was going to comment about breaking out of the first process, but you handled that. I do like this, and yes, the caveat is valid.
One other thing. Yes, you mention KISS. but in the current form, you can only have a running process and 1 item in queue (if sequential processing is wanted.).
But a more simple KISS method would be:
#!/bin/sh
.....
:)
@magnumripper commented on GitHub (Dec 16, 2015):
I often start things like this:
This is akin to your shell script (btw I think you need to use
#!/bin/sh -eunless you end each john command with &&) and these are the simplest ways to achieve this of course. If a session is aborted or fails in any way, the rest of the line is aborted.However, the
-queueoption can be used after the first session is already running. You start a job and only then realize another job you want to start after the first one is done. To accomplish this today, you need to abort session 1 and then do this oneliner:@jfoug commented on GitHub (Dec 16, 2015):
Do not take my KISS mention of a shell script as a poo poo against this function. I do see that it can certainly be beneficial. I also simply listed that you can only queue 1 item at a time, for a running session, unless you do not care about order.
@frank-dittrich commented on GitHub (Dec 16, 2015):
One more caveat:
Decide how to handle LogFileProtect = Named | Always for --queue, and document that behavior.
@magnumripper commented on GitHub (Dec 16, 2015):
@jfoug but it's a valid concern. I actually had the idea you could queue more than one job but that won't work with the proposed design. I will ponder other options. If we can't make this really usable, we should just ditch this idea (after all it will add possible bugs!).
@frank-dittrich commented on GitHub (Dec 16, 2015):
If you are willing to change the .rec file format, you could allow --queue for a session which is not currently running, by just appending the information for the next task(s) to the existing .rec file.
When you restore and finish the first task, you just have to remove the information related to the first task, then proceed with the next task.
But then you need to address issues related to --fork=n and possibly varying n for different wueued tasks...
@jfoug commented on GitHub (Dec 16, 2015):
I am pretty sure we 'could' queue as many as we wanted, and they should be released 1 at a time, BUT there is no assurance of order. It would be classic uncontrolled multi-processing problem (i.e. dining philosophers problem). 1 of them should get released, but there is no assurance of any order, and no assurance that some process would not starve and never get to work.
@jfoug commented on GitHub (Dec 17, 2015):
Ok, how about this:
This is 'still' pretty KISS, and it allows ordered running, and only continuing upon full completion of the current run (we can talk about that also).
What do others 'think' about this. There would be NO additional command line args required. This would be driven by instruction file only.
TBD:
@magnumripper commented on GitHub (Dec 17, 2015):
It's too complicated to use. I have other vague ideas, will experiment a little.
@jfoug commented on GitHub (Dec 17, 2015):
Why could we not have john itself add lines the queue file (if the --queue switch was used) ???
Thus it would be 100% user interface the same as you suggested from the start. But then we would not have a process doing a busy wait to run. It would simply add a line to the queue file. Then when the first process completes, that process will launch the next process while exiting.
@magnumripper commented on GitHub (Dec 17, 2015):
Maybe. But this will be a good chunk of code, in core, with file locking and whatnot.
Another option would be a standalone thing, a wrapper for JtR, instead.
@jfoug commented on GitHub (Dec 17, 2015):
Are you thinking of adding this to core??? (john proper).
I would see only a couple of lines added. One right after loading command params. The other within main() right before exit.
Then the rest would be 'hidden' in a new source file (the real guts). This really should not be 'that' big of an addition.
@magnumripper commented on GitHub (Dec 17, 2015):
No I meant core code in Jumbo. And regardless of where we place the code, it will be a whole new world of possible bugs. There must be an easier way to do this!
@magnumripper commented on GitHub (Dec 17, 2015):
Like this scenario: First session is a single thread CPU format doing mask mode for lengths up to 4. Second session is an MPI job on several remote hosts with OpenCL, starting at length 5. Things like that was what I originally had in mind. And my original idea would work in that scenario, except it wouldn't be able to queue a third job.
@magnumripper commented on GitHub (Jan 7, 2016):
Here's an alternative that might work (needs more thought)
It would work something like this
@jfoug commented on GitHub (Jan 7, 2016):
That logic appears solid. However, what happens if session1 is killed (i.e. session 1.rec is not removed) ?
@frank-dittrich commented on GitHub (Jan 7, 2016):
Or, what happens if session 1 still runs, but session 2 gets killed?
@magnumripper commented on GitHub (Jan 7, 2016):
We'll still have code for ensuring the preceding session file was deleted. So session 2 get a lock but then bail out with an error message because 1.rec was not deleted. After that, session 3 will bail for the same reason.
Same code: Session 3 will get the lock of 2.rec but notices it wasn't deleted, so it bails out.
@magnumripper commented on GitHub (Feb 9, 2016):
1f34620is a first step. Unfortunately it looks like this type of queueing can't be made safe on Windows since that poor OS can't delete a locked file (if it has locks at all).@magnumripper commented on GitHub (Feb 9, 2016):
I'm regression testing a working commit implementing this. It will be completely disabled on Windows. It does support queueing after a session with same name as "our" session. Also, it does filter out the "--queue-after" from the session file.
@frank-dittrich commented on GitHub (Feb 9, 2016):
Should john warn on Windows if it processes such a session file?
@magnumripper commented on GitHub (Feb 9, 2016):
There will be no such session files. The option is used and then discarded. When resuming, there is no queueing.
However, I'm considering the alternative to support adding queueing on resume:
john -resume:yyy -queue=zzz. This is a core change (and may be tricky). Again, it will be used and then discarded so if resuming again later, there will be no--queueinvolved.@frank-dittrich commented on GitHub (Feb 9, 2016):
Yes, you can't produce such session files on Windows. But what if you copy them from a Linux machine and try to restore on Windows?
@magnumripper commented on GitHub (Feb 9, 2016):
Read it again. The option never ends up in the session file even on Linux. It happens for first run, not for resume (unless you give the option again when resuming).
@magnumripper commented on GitHub (Feb 9, 2016):
Some testing indicates this works very poorly on NFS file systems due to cache incoherence. I'm currently considering ditching the whole idea or going for a completely different solution, possibly with a standalone wrapper.
@magnumripper commented on GitHub (Oct 12, 2016):
Ditching this. One could implement a stand-alone tool but that'd be a new issue.
@magnumripper commented on GitHub (Sep 28, 2017):
Here's a KISS solution
filewait.c
gcc -O2 -Wpedantic -o /usr/local/bin/filewait filewait.c