Program-Understanding / oxide

11 stars 1 forks source link

[Issue]: Disassembly core library has invalid imports from capstone #4

Open ReversingWithMe opened 1 year ago

ReversingWithMe commented 1 year ago

Summary

The disassembly utils in core libraries has imports that are invalid from capstone.

Steps to reproduce (if applicable)

  1. plugin compare
  2. compare_insns

Expected behavior (if applicable)

The import command should continue noting failed files, and print a list of corrupted or failed files at the end.

Matrix of instructions found in both tool x and tool y
         Read as Above has N instructions not found in Left

----------------------------------------------------------
<output table with installed tools>

Actual behavior (if applicable)

 oxide > plugin compare
 oxide > compare_insns 08951f191dfb326ee66d2d17ae88357f2773c09e
  * compare.INFO.242:   On tool objdump
------------------------------------------------------------
Traceback (most recent call last):
    func = getattr(self, 'do_' + cmd)
AttributeError: 'OxideShell' object has no attribute 'do_compare_insns'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "oxide\core\oshell.py", line 68, in wrapper
    return f(self, *args, **kwargs)
  File "oxide\core\oshell.py", line 426, in default
    self.parse_pipe(commands)
  File "oxide\core\oshell.py", line 1193, in parse_pipe
    res = func(args, opts)
  File "oxide\plugins\compare.py", line 262, in compare_insns
    disasm = api.retrieve('disassembly', oid, options)
  File "oxide\core\oxide.py", line 275, in retrieve
    ret_val = single_call_module(module_type, mod_name, oid_list, opts)
  File "oxide\core\oxide.py", line 109, in single_call_module
    return initialized_modules[mod_name].results(oid_list, opts)
  File "oxide\modules\analyzers\disassembly\module_interface.py", line 104, in results
    disasm = disassemble_wcap(file_size, data, header, tool_insns)
  File "oxide\core\libraries\disasm_utils.py", line 229, in disassemble_wcap
    dump_x86(insn, instruction)
  File "oxide\core\libraries\disasm_utils.py", line 368, in dump_x86
    updated_flags.append(get_eflag_name(1 << i))
  File "oxide\core\libraries\disasm_utils.py", line 249, in get_eflag_name
    if eflag == X86_EFLAGS_UNDEFINED_OF:
NameError: name 'X86_EFLAGS_UNDEFINED_OF' is not defined
------------------------------------------------------------

Context/Environment

Possible solutions (optional)

Additional information (optional)

The crash handles gracefully.

File is rpisec bomb lab, not relevant to error, input file is not crucial to reproduction.


Please make sure to:

Thank you for contributing to this open source project!

ReversingWithMe commented 1 year ago

image

Proper import is capstone.x86...