init
This commit is contained in:
@@ -15,9 +15,10 @@ EXTERN_C NTKERNELAPI NTSTATUS ZwOpenThread(
|
||||
_In_ PCLIENT_ID ClientId
|
||||
);
|
||||
|
||||
|
||||
namespace thread_notify_routine
|
||||
{
|
||||
PKEVENT g_UserEvent = NULL; // 用户态传入的事件对象
|
||||
BOOL g_thread_protect;
|
||||
|
||||
// 打开线程句柄并终止
|
||||
NTSTATUS TerminateThreadByHandle(
|
||||
@@ -69,7 +70,6 @@ namespace thread_notify_routine
|
||||
{
|
||||
if (Create)
|
||||
{
|
||||
|
||||
PEPROCESS process{ 0 };
|
||||
auto status = PsLookupProcessByProcessId(ProcessId, &process);
|
||||
if (!NT_SUCCESS(status))
|
||||
@@ -80,7 +80,7 @@ namespace thread_notify_routine
|
||||
if (!NT_SUCCESS(status))
|
||||
goto end;*/
|
||||
|
||||
if(!protect_filter::is_protect_pid(0, process))
|
||||
if (!protect_filter::is_protect_pid(HandleToLong(ProcessId)))
|
||||
goto end;
|
||||
|
||||
/*if (protect_process != process)
|
||||
@@ -94,17 +94,19 @@ namespace thread_notify_routine
|
||||
{
|
||||
//DbgBreakPoint();
|
||||
|
||||
DbgPrintEx(77, 0, "[!] 恶意远程线程检测!\n");
|
||||
//DbgPrintEx(77, 0, "[!] 恶意远程线程检测!\n");
|
||||
//
|
||||
//DbgPrintEx(77, 0, "[!] 目标进程ID: %d\n", ProcessId);
|
||||
//
|
||||
//DbgPrintEx(77, 0, "[!] 创建者进程ID: %d\n", cutor_process_id);
|
||||
//
|
||||
//DbgPrintEx(77, 0, "[!] 被创建线程ID: %d\n", ThreadId);
|
||||
|
||||
DbgPrintEx(77, 0, "[!] 目标进程ID: %d\n", ProcessId);
|
||||
|
||||
DbgPrintEx(77, 0, "[!] 创建者进程ID: %d\n", cutor_process_id);
|
||||
|
||||
DbgPrintEx(77, 0, "[!] 被创建线程ID: %d\n", ThreadId);
|
||||
|
||||
|
||||
TerminateThreadByHandle(ProcessId, ThreadId);
|
||||
|
||||
if (g_thread_protect)
|
||||
{
|
||||
TerminateThreadByHandle(ProcessId, ThreadId);
|
||||
}
|
||||
//KeSetEvent(g_UserEvent, IO_NO_INCREMENT, FALSE);
|
||||
}
|
||||
end:
|
||||
ObDereferenceObject(process);
|
||||
|
||||
Reference in New Issue
Block a user