Neo23x0 / Raccine

A Simple Ransomware Vaccine
The Unlicense
942 stars 123 forks source link

fix #76 #79

Closed Eran-YT closed 3 years ago

Eran-YT commented 3 years ago

This should fix #76 , and probably #77 as well, @Neo23x0 can you verify?

Neo23x0 commented 3 years ago

It fixes the suspended zombie processes, yes.

However, the behavior of the tool changes:

Without Raccine raccine-bug1-noissue

With Raccine (I have to press ENTER so that it returns to the cmd.exe session) raccine-bug1

Eran-YT commented 3 years ago

@Neo23x0 it works now

JohnLaTwC commented 3 years ago

@Neo23x0, do you knwo why there is this sleep in raccine.cpp: void find_and_kill_processes(bool log_only, const std::wstring& sCommandLine, std::wstring& sListLogs) std::this_thread::sleep_for(std::chrono::seconds(5)); <<<<< should be removed

Eran-YT commented 3 years ago

Can you explain what is going on at the C++ layer with this change? In particular, why temporary variables were allocated and destroyed for out parameters that are pass by reference? Is there some C++ documentation that explains what/why this is happening?

What happened is that the assignment operator create a temporary that closed the handle when it was assigned, this way the handle wrappers are only created in the return, and so don't close the handles

Eran-YT commented 3 years ago

@Neo23x0, do you knwo why there is this sleep in raccine.cpp: void find_and_kill_processes(bool log_only, const std::wstring& sCommandLine, std::wstring& sListLogs) std::this_thread::sleep_for(std::chrono::seconds(5)); <<<<< should be removed

No, is used to be a Sleep(5000), so I replaced it with the C++ equivalent, but I don't know why is was there in the first place

Neo23x0 commented 3 years ago

It now looks like this (no malicious cmdline). I have to press return, to proceed.

raccine-bug2

JohnLaTwC commented 3 years ago

@Neo23x0, remove this line: https://github.com/Neo23x0/Raccine/blob/87c9700cf9fdafadf10168c9c1e3422dda5ac606/source/RaccineLib/raccine.cpp#L467

raccine.cpp: std::this_thread::sleep_for(std::chrono::seconds(5));

Eran-YT commented 3 years ago

Sorry, that was a debug aid that I didn't remove

Neo23x0 commented 3 years ago

Okay, this seems to work. Let me do some more tests.