这是IDA 如何做到的一个非常简单的概述:
- 将所有已知入口点或用户指定的地址添加到分析队列
- 当队列不为空时,弹出下一个地址
- 要求处理器模块反汇编指令
- 要求处理器模块分析指令
- 处理器模块
在最简单的情况下为所有可能的目标添加代码交叉引用,它是
条件跳转和调用的下一条指令,它是下一条指令和
间接跳转的目标- 未知,除非它是可识别的开关模式
- 将所有这些交叉引用的尚未分析的目标放入队列中
- 转到第 2 步
当然,实际上事情要复杂得多。首先,不是一个队列,而是多个队列。从 SDK 的auto.hpp
:
//
// This file contains functions that work with the autoanalyzer
// queue. The autoanalyzer works when IDA is not busy processing
// the user keystrokes.
// The autoanalyzer has several queues. Each queue has its priority.
// A queue contains addresses or address ranges.
// The addresses are kept sorted by their values.
// The analyzer will process all addresses from the first queue, then
// switch to the second queue and so on.
// There are no limitations on the size of the queues.
// The analyzer stops when all queues are empty.
//
// Also this file contains functions that deal with the IDA status
// indicator and the autoanalysis indicator.
// You may use these functions to change the indicator value.
//
// Names and priorities of the analyzer queues
typedef int atype_t;
const atype_t // priority, description
AU_NONE = 00, // placeholder, not used
AU_UNK = 10, // 0 convert to unexplored
AU_CODE = 20, // 1 convert to instruction
AU_WEAK = 25, // 2 convert to instruction (ida decision)
AU_PROC = 30, // 3 convert to procedure start
AU_TAIL = 35, // 4 add a procedure tail
AU_TRSP = 38, // 5 trace stack pointer (not used yet)
AU_USED = 40, // 6 reanalyze
AU_TYPE = 50, // 7 apply type information
AU_LIBF = 60, // 8 apply signature to address
AU_LBF2 = 70, // 9 the same, second pass
AU_LBF3 = 80, // 10 the same, third pass
AU_CHLB = 90, // 11 load signature file (file name is kept separately)
AU_FINAL=200; // 12 final pass