参考自单总发的帖子 : 帖子传送门 作者: @xiaofu
原理如上贴
优点:
用代码写 方便维护(?)
不用添加一个.asm文件 (一个算不上优点的优点)
缺点:
体积不够小
上代码:
用处:拿到nto_base以后可以自己检索导出表,获取函数地址,全程均无API调用(防止被人挂钩导入表 黑盒分析) 等...
如果写错了 或者 觉得哪里写的不好 望指正~
uintptr_t get_ntos_base()
{
auto Idt_base
=
reinterpret_cast<uintptr_t>(KeGetPcr()
-
>IdtBase);
auto align_page
=
*
reinterpret_cast<uintptr_t
*
>(Idt_base
+
4
) >>
0xc
<<
0xc
;
for
(; align_page; align_page
-
=
PAGE_SIZE)
{
for
(
int
index
=
0
; index < PAGE_SIZE
-
0x7
; index
+
+
)
{
auto current_address
=
static_cast<intptr_t>(align_page)
+
index;
if
(
*
reinterpret_cast<uint8_t
*
>(current_address)
=
=
0x48
&&
*
reinterpret_cast<uint8_t
*
>(current_address
+
1
)
=
=
0x8D
&&
*
reinterpret_cast<uint8_t
*
>(current_address
+
2
)
=
=
0x1D
&&
*
reinterpret_cast<uint8_t
*
>(current_address
+
6
)
=
=
0xFF
)
/
/
48
8d
1D
?? ?? ?? FF
{
auto nto_base_offset
=
*
reinterpret_cast<
int
*
>(current_address
+
3
);
auto nto_base_
=
(current_address
+
nto_base_offset
+
7
);
if
(!(nto_base_ &
0xfff
))
{
return
nto_base_;
}
}
}
}
return
0
;
}
uintptr_t get_ntos_base()
{
auto Idt_base
=
reinterpret_cast<uintptr_t>(KeGetPcr()
-
>IdtBase);
auto align_page
=
*
reinterpret_cast<uintptr_t
*
>(Idt_base
+
4
) >>
0xc
<<
0xc
;
for
(; align_page; align_page
-
=
PAGE_SIZE)
{
for
(
int
index
=
0
; index < PAGE_SIZE
-
0x7
; index
+
+
)
{
auto current_address
=
static_cast<intptr_t>(align_page)
+
index;
if
(
*
reinterpret_cast<uint8_t
*
>(current_address)
=
=
0x48
[注意]传递专业知识、拓宽行业人脉——看雪讲师团队等你加入!
最后于 2021-4-16 11:55
被淡然他徒弟编辑
,原因: