def btn_imp_ghidra_funcs(self, code=0): """ 导入Ghidra函数列表 """ ghidra_filepath = os.path.join(os.getcwd(), 'ghidra_func_addrs.csv') ghidra_path = ida_kernwin.ask_str(ghidra_filepath, 0, '导入的Ghidra导出函数文件路径') func_addrs = list(idautils.Functions()) make_func_addrs = [] if ghidra_path and ghidra_path != '': if os.path.exists(ghidra_path): with open(ghidra_path, 'rb') as f: next(f) reader = csv.reader(f) for row in reader: addr = int(row[0].strip('\"'), 16) if ida_funcs.add_func(addr) == True: make_func_addrs.append(addr) else: if addr not in func_addrs: FELogger.info("创建函数%s失败" % hexstr(addr)) FELogger.info("Ghidra导出函数文件:%s,已导入" % ghidra_path) else: FELogger.erro("未找到Ghidra导出函数文件:%s" % ghidra_path) else: FELogger.warn("请输入Ghidra导出函数文件路径") FELogger.info("成功创建%d个新函数" % len(make_func_addrs))
def PLUGIN_ENTRY(): try: return Firmeye() except Exception as e: FELogger.erro(e.__str__())
def init(self): try: self._init_actions() except Exception as e: FELogger.erro(e.__str__()) return ida_idaapi.PLUGIN_KEEP