|
Message-ID: <CAHNEV5T-Fk6=Cz1tCrDm7gsJOFnqDEUeB0gjMGoOmk4E6=jSMg@mail.gmail.com>
Date: Fri, 8 May 2015 13:43:16 -0400
From: Mathieu Laprise <mathlaprise@...il.com>
To: john-dev@...ts.openwall.com
Subject: Re: [core john] [Johnny] Windows event loop
On Fri, May 8, 2015 at 12:39 PM, Aleksey Cherepanov <lyosha@...nwall.com>
wrote:
> If you AttachConsole(), can't you just send Ctrl-C?
>
> Though it is not clear to me: does CTRL_BREAK make john to save state
> on exit? Or is it just a way to kill the process?
>
If you mean sending Ctrl-C to stdin, I saw there
http://www.qtcentre.org/threads/36911-Can-t-send-a-Ctrl-C-to-a-QProcess-%28Win32%29,
that it didn't work the same way if we send it with stdin(at least on unix).
If you mean sending CTRL_C_EVENT,
In John, signal.c, all CTRL_XXX_EVENTS are handled by this code for
Windows.
#ifdef __CYGWIN32__
SetConsoleCtrlHandler(sig_handle_abort_ctrl, TRUE);
#endif
#ifdef __CYGWIN32__
static CALLBACK BOOL sig_handle_abort_ctrl(DWORD ctrltype)
{
sig_handle_abort(SIGINT);
return TRUE;
}
#endif
So, sending event CTRL_C_EVENT or CTRL_BREAK_EVENT, both call
sig_handle_abord(SIGINT) which will handle cleaning or other stuff needed
by John like if it was from the tty. So john saves its state.
However, in my tests, I got the same result as Shaktra for CTRL_C (returned
true but wasn't sent). Here is what he said on stackoverflow.
> It is very important that each step is done like this. I've been trying
> all different kinds of combinations but this combination is the only one
> that works. You can't send a CTRL_C event. It will return success but will
> be ignored by the process. CTRL_BREAK is the only one that works. Doesn't
> really matter since they will both call ExitProcess() in the end. (EDIT by
> me: In our specific case, we reimplemented the handler so
> sig_handle_abort_ctrl() will be called before)
Aleksey said:
> I am pretty sure that you've tried `taskkill` without /f to kill john
> from cmd. It did not work, right?
Yeah exactly, I didn't get it to work.
Content of type "text/html" skipped
Powered by blists - more mailing lists
Confused about mailing lists and their use? Read about mailing lists on Wikipedia and check out these guidelines on proper formatting of your messages.