idapython

idapython的一些小例子

获取偏移地址所在的函数

使用pin做基本块的覆盖率统计,得到的基本块一般都是”dll+偏移” 的形式,当需要引入符号文件知道基本块在哪一个函数的时候,就用到这个脚本,借用 GetFuncOffset 接口

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
#coding=utf-8
from idaapi import *

def main():
print "base_address: %s" % hex(get_imagebase())
base_address = get_imagebase()

f = open(file_path, "r")
for line in f:
line = line.replace("\r", "").replace("\n", "")
offset_addr = int("0x" + line.split("+")[1], 16)
addr = offset_addr + base_address
print GetFuncOffset(addr)

if __name__ == "__main__":
main()

Linux 系统编程导读 - 简介 WebKit执行结合对应的源代码
Your browser is out-of-date!

Update your browser to view this website correctly. Update my browser now

×