From 7b45ee1f647d0ef61706aaa6304f6e6fdf505474 Mon Sep 17 00:00:00 2001 From: Mas0nShi <60805843+Mas0nShi@users.noreply.github.com> Date: Thu, 19 Sep 2024 16:49:09 +0800 Subject: [PATCH] Add compatibility for IDA 9 SDK --- plugins/lighthouse/util/disassembler/ida_api.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/lighthouse/util/disassembler/ida_api.py b/plugins/lighthouse/util/disassembler/ida_api.py index c1644dd..fb458c1 100644 --- a/plugins/lighthouse/util/disassembler/ida_api.py +++ b/plugins/lighthouse/util/disassembler/ida_api.py @@ -226,7 +226,12 @@ def _get_ida_bg_color_from_file(self): # attempt to generate an 'html' dump of the first 0x20 bytes (instructions) ida_fd = idaapi.fopenWT(path) idaapi.gen_file(idaapi.OFILE_LST, ida_fd, imagebase, imagebase+0x20, idaapi.GENFLG_GENHTML) - idaapi.eclose(ida_fd) + # IDA 9.0 removed `eclose`, added `qfclose` in `ida_fpro` + if int(idaapi.get_kernel_version()[0]) >= 9: + import ida_fpro + ida_fpro.qfclose(ida_fd) + else: + idaapi.eclose(ida_fd) # read the dumped text with open(path, "r") as fd: