【逆向工具】IDA Python安装与使用
2017-11-05 01:03
435 查看
1、IDA Pyhon介绍
IDA Python是IDA6.8后自带插件,可以使用Python做很多的辅助操作,非常方便的感觉。2、IDA Python安装
从github上IDAPython项目获取跟自己电脑IDA、Python对应的版本。项目地址:https://github.com/idapython
IDA Python手册:https://www.hex-rays.com/products/ida/support/idapython_docs/
我的IDA是6.8,Python是2.7版本。
IDA Python安装的说明:
1. Install 2.6 or 2.7 from http://www.python.org/ 2. Copy the whole "python" directory to %IDADIR% 3. Copy the contents of the "plugins" directory to the %IDADIR%\plugins\ 4. Copy "python.cfg" to %IDADIR%\cfg
翻译:
1、从http://www.python.org/安装Python 2.7版本。
2、复制安装包内的python目录到%IDADIR%(IDA)目录,%IDADIR%\python
3、复制安装包内的plugins目录到%IDADIR%(IDA)目录,%IDADIR%\plugins
4、复制安装包内的"python.cfg" 到 %IDADIR%\cfg内
3、使用方法
3.1、快捷键使用
运行IDA脚本文件: (Alt-F7)单行执行Python (Ctrl-F3)
查看现有的IDA脚本文件 (Alt+F9)
3.2、测试代码
网上找到的Python代码是拿printf做的测试,可是我这边好像没有能解析printf函数,所以我用了IsProcessorFeaturePresent函数做示例。单个函数测试:
#coding:utf-8 from idaapi import * danger_funcs = ["IsProcessorFeaturePresent"] # 需要寻找的函数名 for func in danger_funcs: addr = LocByName( func ) if addr != BADADDR: #找到交叉引用的地址 cross_refs = CodeRefsTo( addr, 0 ) print "Cross References to %s" % func print "-------------------------------" for ref in cross_refs: print "%08x" % ref # 函数的颜色为红色 SetColor( ref, CIC_ITEM, 0x0000ff)
多个函数需要识别的时候就可以把代码写得更加规范一些。
# ## another way to search all not safe functions # #coding:utf-8 from idaapi import * # 设置颜色 def judgeAduit(addr): ''' not safe function handler ''' MakeComm(addr,"### AUDIT HERE ###") SetColor(addr,CIC_ITEM,0x0000ff) #set backgroud to red pass # 函数标识 def flagCalls(danger_funcs): ''' not safe function finder ''' count = 0 for func in danger_funcs: faddr = LocByName( func ) if faddr != BADADDR: # Grab the cross-references to this address cross_refs = CodeRefsTo( faddr, 0 ) for addr in cross_refs: count += 1 Message("%s[%d] calls 0x%08x\n"%(func,count,addr)) judgeAduit(addr) if __name__ == '__main__': ''' handle all not safe functions ''' print "-------------------------------" # 列表存储需要识别的函数 danger_funcs = ["strcpy","sprintf","strncpy"] flagCalls(danger_funcs) print "-------------------------------"
4、测试效果
5、参考链接
IDAPython安装 | All Righthttp://spd.dropsec.xyz/2016/10/05/IDAPython%E5%AE%89%E8%A3%85/
IDAPython脚本之收集函数的调用信息 | All Right
http://spd.dropsec.xyz/2016/10/16/IDAPython%E8%84%9A%E6%9C%AC%E4%B9%8B%E6%94%B6%E9%9B%86%E5%87%BD%E6%95%B0%E7%9A%84%E8%B0%83%E7%94%A8%E4%BF%A1%E6%81%AF/
IDAPython学习(一)
http://www.cnblogs.com/blacksunny/p/7214645.html
11 IDAPYTHON --- IDA 脚本
https://wizardforcel.gitbooks.io/grey-hat-python/content/44.html
相关文章推荐
- Openwrt/Wifidog/PythonTool开发工具1(PythonQt的安装和使用)
- python自动安装工具easy_install的使用
- windows 下python包管理工具pip的安装与使用
- python的web压力测试工具-pylot安装使用
- CentOS中Python pip包管理工具的安装和使用
- Python的包管理工具pip的安装与使用
- python 自动安装工具 setuptools(easy_install) 的使用
- 在Ubuntu系统下安装使用Python的GUI工具wxPython
- Google开源的Python格式化工具YAPF的安装和使用教程
- Python的包管理工具--PIP安装使用
- Google开源的Python格式化工具YAPF的安装和使用教程
- python自动安装工具easy_install的使用
- 好用的python代码练习工具jupyter-notebook安装及使用
- CentOS中Python pip包管理工具的安装和使用
- python包管理工具pip 的安装和使用
- python 包管理工具pip安装与使用
- windows 下python包管理工具pip的安装与使用
- Python机器学习数据挖掘工具sklearn安装和使用
- python的web压力测试工具-pylot安装使用
- python模块管理工具pip安装与使用