IDA逆向分析总结
总结
前提: 先通过So方式去跑通流程,再去做调试会事半功倍
- 理清楚大概的流程再进行细节上的逆向,可从正向去思考
- 熟悉IDA的操作,比如IDAPython可以节省很多时间(学习的点)
- 函数的输入输出是比较重要的,可以先从这一方面入手
- 注意:F5的结果是大概率不准确的,需要通过调试的方式去确定函数的参数
- 注意: 参数的类型,比如double是使用两个寄存器
- c++ 结构体、类的分析,c++逆向分析(学习的点)
- 通过多个关键函数的断点,打印输入输出(利用IDApython等),观察前后变化,可以达到事半功倍的效果
- 先去看整体流程,再去扣细节
IDA脚本
打印内存浮点数
#--*-- coding:utf-8 --*--
import idaapi
import idc
import numpy as np
np.set_printoptions(suppress=True)
import struct
import binascii
from matplotlib.pyplot import *
class IDAMath(object):
"""
@desc: The tool to deal with Numbers
"""
def __init__(self):
pass
@staticmethod
def readNum(num,isBigEndian,dtype=float):
"""
@desc:根据dtype读取数组,目前仅支持读取float、int、double
@note: 读出来是大端,内存中是小端
"""
numOut = str(hex(num)).replace("0x","")
flag = ""
if isBigEndian:
flag = flag + ">"
else:
flag = flag + "<"
if dtype == float:
flag = flag + "f"
elif dtype == int:
flag = flag + "i"
else:
flag = flag + "d"
re2 = struct.unpack(flag, binascii.unhexlify(numOut))
return re2[0]
class IDAKit(object):
"""docstring for IDAKit"""
def __init__(self):
self._is64bit = False
self._pointerSize = 0
self._isDebug = True
self.init()
def init(self):
if idaapi.get_inf_structure().is_64bit():
self._is64bit = True
self._pointerSize = 8
else:
self._is64bit = False
self._pointerSize = 4
def readPointer(self,ea):
"""
@desc:返回ea地址的内容,即读取指针
"""
if self._is64bit: