[ida]使用pycharm编写IDApython

使用pycharm来编写IDApython

一、导入IDApython的模块

  IDA目录下有一个Python目录,将其添加到项目的跟目录下。

  

  放到python项目目录下

  

   修改文件夹属性,否则会出现引用报错

  

、配置python2.7解释器

  使用IDA中自带的python解释器(免安装版都会打包python解释器,现在很少使用 2.x 版本了)

  

 

三、测试代码

  可以正常编写

from idautils import *
from idaapi import *
from idc import *


funcs = Functions()
for f in funcs:
    name = Name(f)
    end = GetFunctionAttr(f,FUNCATTR_END)
    locals = GetFunctionAttr(f,FUNCATTR_FRSIZE)
    frame = GetFrame(f)
    if frame is None:
        continue
    ret = GetMemberOffset(frame, " r")
    if ret == -1:
        continue
    firstArg = ret + 4
    args = GetStrucSize(frame) - firstArg
    Message("Function: %s,starts at %x, ends at %x\n" % (name,f,end))
    Message("   Local variable area is %d bytes\n" % locals)
    Message("   Arguments occupy %d bytes (%d args)\n" % (args, args/4))
posted @ 2020-03-05 12:11  OneTrainee  阅读(2100)  评论(4编辑  收藏  举报