Compare commits

..

4 Commits

Author SHA1 Message Date
maowengrui 78278820eb test protect list 2026-06-03 14:11:43 +08:00
maowengrui e5df79f297 fix is_protect_pid par 2026-06-03 14:10:48 +08:00
maowengrui 9c5e70227f fix is_protect_pid par 2026-06-03 14:10:29 +08:00
maowengrui 891c183697 fix protect thread add list 2026-06-03 14:09:57 +08:00
5 changed files with 29 additions and 13 deletions
+10 -4
View File
@@ -1,5 +1,5 @@
#include "create_thread_callback.h"
#include "protect_filter.h"
@@ -19,13 +19,19 @@ namespace thread_notify_routine
if (!NT_SUCCESS(status))
goto end;
PEPROCESS protect_process{ 0 };
/*PEPROCESS protect_process{ 0 };
status = PsLookupProcessByProcessId(protect_id, &protect_process);
if (!NT_SUCCESS(status))
goto end;*/
if(!protect_filter::is_protect_pid(0, process))
goto end;
if (protect_process != process)
goto end;
/*if (protect_process != process)
goto end;*/
auto cutor_process_id = PsGetCurrentProcessId();
if (HandleToLong(cutor_process_id) == 4)
+4 -4
View File
@@ -16,14 +16,14 @@ EXTERN_C NTSTATUS DriverEntry(PDRIVER_OBJECT drv_obj, PUNICODE_STRING)
kernel_api::kernel_api_init();
protect_filter::Init();
protect_filter::add_list(7868, 0);
protect_filter::add_list(4504, 0);
protect_filter::add_list(8152, 0);
protect_filter::add_list(8224, 0);
protect_filter::is_protect_pid(0);
//protect_filter::is_protect_pid(0);
protect_filter::remove_list(7868,0);
protect_filter::is_protect_pid(0);
//protect_filter::remove_list(7868,0);
//protect_filter::is_protect_pid(0);
ob_call_back::register_ob_reg_callback();
+1 -1
View File
@@ -34,7 +34,7 @@ auto ob_call_back::register_ob_reg_callback() -> NTSTATUS
if(is_allow_process(image_file_name))
goto end;
if (protect_filter::is_protect_pid(HandleToLong(dwPid)))
if (protect_filter::is_protect_pid(HandleToLong(dwPid), nullptr))
{
pOperationInformation->Parameters->DuplicateHandleInformation.DesiredAccess = 0;
pOperationInformation->Parameters->DuplicateHandleInformation.OriginalDesiredAccess = 0;
+13 -3
View File
@@ -36,7 +36,7 @@ namespace protect_filter
return TRUE;
}
auto is_protect_pid(ULONG Pid) -> BOOL
auto is_protect_pid(ULONG Pid, PEPROCESS Eprocess)->BOOL
{
UNREFERENCED_PARAMETER(Pid);
if (IsListEmpty(&g_protect_list))
@@ -48,8 +48,18 @@ namespace protect_filter
auto list_data = reinterpret_cast<PFILTER>(CONTAINING_RECORD(list_head, FILTER, List));
list_head = list_head->Flink;
if (list_data->Pid == Pid)
return TRUE;
if (Pid)
{
if (list_data->Pid == Pid)
return TRUE;
}
if (Eprocess)
{
if (list_data->Eprocess == Eprocess)
return TRUE;
}
//DbgPrintEx(77, 0, "[+] pid:%d | eproecss:%p\n", list_data->Pid, list_data->Eprocess);
}
+1 -1
View File
@@ -15,7 +15,7 @@ namespace protect_filter
auto add_list(ULONG Pid, HWND hwnd)->BOOL;
auto is_protect_pid(ULONG Pid) -> BOOL;
auto is_protect_pid(ULONG Pid, PEPROCESS Eprocess) -> BOOL;
auto remove_list(ULONG Pid, HWND hwnd)->BOOL;
}