本文整理汇总了Python中idaapi.idadir方法的典型用法代码示例。如果您正苦于以下问题:Python idaapi.idadir方法的具体用法?Python idaapi.idadir怎么用?Python idaapi.idadir使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类idaapi
的用法示例。
在下文中一共展示了idaapi.idadir方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import idadir [as 别名]
def __init__(self):
self.is_windows = sys.platform.startswith('win')
self.is_ida64 = GetIdbPath().endswith(".i64") # hackhackhack - check if we're ida64 or ida32
logger.debug("[+] is_windows: %r" % self.is_windows)
logger.debug("[+] is_ida64: %r" % self.is_ida64)
self.my_path = os.path.abspath(__file__)
self.temp_path = None
self._init_target()
# settings (form)
# todo: load from configfile if available.
self.output_path = None
self.chk_annotate_stackvar_size = False
self.chk_annotate_xrefs = False
self.chk_decompile_imports = False
self.chk_decompile_imports_recursive = False
self.chk_decompile_alternative = False
# self.ida_home = idaapi.idadir(".")
self.ida_home = GetIdaDirectory()
# wait for ida analysis to finish
self.wait_for_analysis_to_finish()
if not idaapi.init_hexrays_plugin():
logger.warning("forcing hexrays to load...")
self.load_plugin_decompiler()
if not idaapi.init_hexrays_plugin():
raise Exception("hexrays decompiler is not available :(")
示例2: _ida_lib
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import idadir [as 别名]
def _ida_lib():
ea_name = 'ida64' if idc.__EA64__ else 'ida'
if sys.platform == 'win32':
functype = ctypes.WINFUNCTYPE
lib = ctypes.WinDLL(ea_name)
elif sys.platform == 'darwin':
functype = ctypes.CFUNCTYPE
lib = ctypes.CDLL(idaapi.idadir("lib" + ea_name + ".dylib"))
else:
functype = ctypes.CFUNCTYPE
lib = ctypes.CDLL('lib' + ea_name + '.so')
return functype, lib
示例3: set_config_path
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import idadir [as 别名]
def set_config_path(self):
"""
Set the JSON configuration file path.
"""
# Get the path of the config file
# plugins_path = idaapi.idadir(idaapi.PLG_SUBDIR)
# ghida_plugin_path = os.path.join(
# plugins_path, "ghida_plugin", "config")
# self.__config_path = os.path.join(ghida_plugin_path, CONFIG_FILENAME)
self.__config_path = os.path.join(
tempfile.gettempdir(), CONFIG_FILENAME)
示例4: loadAllPythonPlugins
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import idadir [as 别名]
def loadAllPythonPlugins():
plugins_dir = idaapi.idadir('plugins')
print("idascript: loading all .py plugins in %s" % plugins_dir)
files = [f for f in os.listdir(plugins_dir) if re.match(r'.*\.py', f)]
for path in files:
idaapi.load_plugin(path)
示例5: popeye
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import idadir [as 别名]
def popeye(self):
g = globals()
idahome = idaapi.idadir("plugins\\Code editor")
IDAPython_ExecScript(idahome + "\\pyeditor.py", g)
示例6: __load_ida_native_version
# 需要导入模块: import idaapi [as 别名]
# 或者: from idaapi import idadir [as 别名]
def __load_ida_native_version():
sysdir = _os.path.dirname(idaapi.idadir(idaapi.CFG_SUBDIR))
exe_name = 'ida' if ea == 32 else 'ida64'
if os == 'win':
path = _os.path.join(sysdir, exe_name + '.exe')
with open(path, 'rb') as f:
data = f.read()
needle = b'F\0i\0l\0e\0V\0e\0r\0s\0i\0o\0n\0\0\0\0\0'
offset = data.rfind(needle) + len(needle)
offset2 = data.find(b'\0\0', offset) + 1
version_str = data[offset:offset2].decode('utf16')
version_str = version_str[:version_str.rfind(
'.')] + version_str[version_str.rfind('.') + 1:]
elif os == 'mac':
path = _os.path.join(sysdir, exe_name)
with open(path, 'rb') as f:
data = f.read()
needle = b'<key>CFBundleShortVersionString</key>'
offset = data.rfind(needle)
offset = data.find(b'<string>', offset) + 8
offset2 = data.find(b'</string', offset)
version_str = data[offset:offset2].decode('utf8')
result = version_info_cls._make(int(_) for _ in version_str.split('.'))
return result