/* add IDC functions for interacting with the emulator
EmuRun();
EmuTrace();
EmuStepOne();
EmuTraceOne();
EmuSync();
EmuGetReg(regno);
EmuSetReg(regno, value);
EmuAddBpt(addr);
*/
此函数在idc中效果很好。我在
idaapi.py
中找到了一个调用idc函数的类。class _IdcFunction(object):
"""
Internal class that calls pyw_call_idc_func() with a context
"""
def \_\_init\_\_(self, ctxptr):
self.ctxptr = ctxptr
# Take a reference to the ctypes callback
# (note: this will create a circular reference)
self.cb = _IDCFUNC_CB_T(self)
fp_ptr = property(lambda self: ctypes.cast(self.cb, ctypes.c_void_p).value)
def \_\_call\_\_(self, args, res):
return call_idc_func__(self.ctxptr, args, res)
当我键入此内容时:
出现以下错误:
import ctypes
idaapi._IdcFuntion( ctypes ).\_\_call\_\_( 'EmuStepOne', ctypes.c_voidp )
我不知道为什么会收到此错误,有人知道吗?
#1 楼
之所以会出现这些错误,是因为您尝试使用ctypes
,它使用从python对象到低级C类类型的转换来从python调用本机函数。可以转换为本机表示形式,因此失败。有一种非常简单的方法,可以使用
idc.Eval
在IDAPython中调用IDC代码,如下所示: >
评论
如果不需要,请调用idaapi.run_statements(IDC_SCRIPT_HERE),它将返回boolidc.Eval(“某些IDC表达式”)是另一个选项。