Loading... 项目包 链接:https://pan.baidu.com/s/1zlcn8EZHxF0es_2wbxRn9Q 提取码:f4sd * #### 调试器的实现流程 1. CreateProcess(DEBUG_ONLY_THIS_PROCESS) 调试方式创建进程 2. WaitForDebugEvent(),等待调试事件 3. 根据异常类型处理异常(设置断点、清除断点、恢复断点等) 1. 反汇编 \ 汇编引擎 2. Set\GetThreadContext() 3. VirtualProtectEx() 4. Write/ReadProcessMemory() 5. OpenProcess\Thread() 4. ContinueDebugEvent() 恢复程序的运行,重新返回第2步 * #### 断点的实现 * ##### 单步断点的实现 * 步入:设置 flag 标志位中的 TF(陷阱标志位) 位为1 0x100 * 步过:通过计算当前指令的OPCODE长度,找到下一个指令的起始位置,设置一个断点 * ##### 硬件断点的实现 1. 在Dr0~Dr3中设置断点地址 2. 在Dr7中设置断点的类型、长度并且激活断点 3. 断点命中后在Dr6的低4位获取触发的位置 * ##### 软件断点的实现 1. 在目标代码的执行流程中修改指令的**首字节**为 int3(0xCC) 并保存原有指令 2. 断点断下后恢复原有的数据 3. **将EIP指向的位置 - 1 ** * ##### 内存断点的实现 1. 通过设置内存断点为不可读写来触发异常 * 由于分页属性都是以分页来设置,所以需要不断的重新设置,效率极低 * 功能图片 ![image.png](http://www.irohane.top/usr/uploads/2020/12/3701373281.png) ![image.png](http://www.irohane.top/usr/uploads/2020/12/2851054239.png) ![image.png](http://www.irohane.top/usr/uploads/2020/12/1491367401.png) 最后修改:2021 年 03 月 11 日 © 允许规范转载 赞 0 如果觉得我的文章对你有用,请随意赞赏
1 条评论
博主真是太厉害了!!!