From c8a03ac08fd7dd5952ce09a8f9c1ac165719f1d2 Mon Sep 17 00:00:00 2001 From: machinewu Date: Thu, 17 Feb 2022 16:06:23 +0800 Subject: [PATCH 1/2] bytes call hex() should not take arguments --- qiling/arch/utils.py | 4 +++- qiling/os/os.py | 2 +- qiling/os/posix/syscall/random.py | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/qiling/arch/utils.py b/qiling/arch/utils.py index 76149024f..038ed3a69 100644 --- a/qiling/arch/utils.py +++ b/qiling/arch/utils.py @@ -36,8 +36,10 @@ def disassembler(self, ql: Qiling, address: int, size: int): qd = ql.arch.create_disassembler() offset, name = self.get_offset_and_name(address) - log_data = f'{address:0{ql.archbit // 4}x} [{name:20s} + {offset:#08x}] {tmp.hex(" "):30s}' + tmp_formated = ' '.join([f'{b:02X}' for b in tmp]) + log_data = f'{address:0{ql.archbit // 4}x} [{name:20s} + {offset:#08x}] {tmp_formated:30s}' log_insn = '\n> '.join(f'{insn.mnemonic:20s} {insn.op_str}' for insn in qd.disasm(tmp, address)) + log_insn = '\n> ' + log_insn ql.log.info(log_data + log_insn) diff --git a/qiling/os/os.py b/qiling/os/os.py index b5824b921..0e5244978 100644 --- a/qiling/os/os.py +++ b/qiling/os/os.py @@ -241,7 +241,7 @@ def emu_error(self): pc_info = ' (unreachable)' else: self.ql.log.error('Hexdump:') - self.ql.log.error(data.hex(' ')) + self.ql.log.error(' '.join([f'{b:02X}' for b in data or []])) self.ql.log.error('Disassembly:') self.ql.arch.utils.disassembler(self.ql, pc, 64) diff --git a/qiling/os/posix/syscall/random.py b/qiling/os/posix/syscall/random.py index 3914da3d9..04f93844b 100644 --- a/qiling/os/posix/syscall/random.py +++ b/qiling/os/posix/syscall/random.py @@ -14,7 +14,8 @@ def ql_syscall_getrandom(ql: Qiling, buf: int, buflen: int, flags: int): except: retval = -1 else: - ql.log.debug(f'getrandom() CONTENT: {data.hex(" ")}') + data_formated = ' '.join([f'{b:02X}' for b in data]) + ql.log.debug(f'getrandom() CONTENT: {data_formated}') retval = len(data) return retval From 122059dfd79d09a93294fad58ea3a9ebcc7ee344 Mon Sep 17 00:00:00 2001 From: machinewu Date: Thu, 17 Feb 2022 17:05:45 +0800 Subject: [PATCH 2/2] change deprecated interfaces of IDA --- qiling/extensions/idaplugin/qilingida.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/qiling/extensions/idaplugin/qilingida.py b/qiling/extensions/idaplugin/qilingida.py index ad6f3709d..b82de01ea 100644 --- a/qiling/extensions/idaplugin/qilingida.py +++ b/qiling/extensions/idaplugin/qilingida.py @@ -334,7 +334,7 @@ def get_filetype(): @staticmethod def get_ql_arch_string(): info = IDA.get_info_structure() - proc = info.get_procName().lower() + proc = info.procname.lower() result = None if proc == "metapc": result = "x86" @@ -814,7 +814,7 @@ def __init__(self, handler, action): self.action_type = action def activate(self, ctx): - if ctx.form_type == BWN_DISASM: + if ctx.widget_type == BWN_DISASM: self.action_handler.ql_handle_menu_action(self.action_type) return 1