Files
root 25f2286cb6 Trim both READMEs and add the tutorial primer
README 242 -> 180 lines: the 14-row tool table becomes three sentences pointing at capabilities.py, Read this first merges into Scope, and the six-script maintenance block becomes a table. Every path, command and anchor is unchanged.

README.zh-CN follows the same eight sections, and picks up two drifts: it named hwprobe.py as the cheapest first command (SKILL.md and the English README say doctor.py), and it translated triage as 'three categories', which sends a reader looking for categories that do not exist.

docs/primer is the Windows reverse-engineering tutorial series with an index, corrected in three places: x64dbg instead of OllyDbg, offsets fixed only within one build, and IAT hooking assuming the target imports the API it hooks.

docs/tool-acquisition keeps the part capabilities.py does not answer: licence classes, id resolution on the host, and what proves a tool runs.
2026-10-24 13:51:21 +08:00

94 lines
2.9 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters
This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
Windows逆向分析入门(三)——方法篇
前言
  上一篇,聊到逆向分析是找偏移,有依据地找,效率会快。这一篇聊下找偏移方法。只说概念,具体的细节,后续会配合实战再展开细说。
 
找偏移的方法
1、内存
  逆向的目的,是找功能或者数据在内存的地址。最直接的方法,就是在内存里面搜索。
 
  对于数据:可以直接在内存搜索。
  对于功能:如果知道代码的特征码,也可以直接在内存寻找。
  (所谓代码的特征码,具体是一串字符串,在内存是唯一的,可以用来搜索定位)。
 
2、界面
  带界面的软件,一般流程就是:
    1、软件生成界面,界面上会有按钮,编辑框这些控件。
    2、用户操作界面,点击按钮或者输入文字等等。
    3、软件接收到用户的操作,调用对应的功能。
    4、调用的功能对数据进行处理。
    5、处理结果显示在界面上。
 
  如果知道这个流程在代码里面是怎么实现的,就能找到对应的功能和数据。
 
3、日志
  软件运行的过程,是没办法像视频那样可以倒放。
  想了解软件的运行过程,需要在软件里面埋下标记。
  当软件运行过程,经过做标记的位置,就可以输出信息。(也就是所谓的日志)
  而逆向分析,通过日志找到标记,能知道对应的功能在哪里。
 
4、字符串
  代码里面写的字符串,编译成软件的过程,会被当作全局数据,存在固定的地方。
  而字符串可能有对应的功能,比如 send msg,可能出现在发送信息的功能附近。
  通过搜索字符串,看看哪里用了这个字符串,就可以找到对应的功能。
 
5、系统函数
  写代码的过程中,需要用到一些比较基础的功能。(比如读写文件,收发网络信息)
  这个时候直接用系统提供的接口就可以了。
  这些接口是公用的,所以偏移固定的。
  通过拦截这些接口,就可以定位了。
  但这招有个前提:目标确实经过导入表(IAT)调用这个接口。现在的软件常在运行时才解析API地址,或者直接发系统调用,导入表里根本没有这一行,这时拦截就落空了,要换别的方法定位。
 
6、第三方库
  软件可以看成由多个模块组成的,像搭积木那样。
  而这些模块大多通用的,比如:界面模块,日志模块。
  为了加快开发速度,一般会使用别人写好的第三方模块。
  如果第三方模块是开源的,相当知道软件的一部分代码。
  通过第三方的代码,可以推算出软件还没解开的另一部分。
 
下一篇,找到偏移之后,聊聊利用偏移写代码的思路。