Exemplo n.º 1
0
def main(): # type: () -> None
    if hr.init_hexrays_plugin():
        existing = ida_kernwin.unregister_action(ACTION_NAME)
        ida_kernwin.register_action(
            ida_kernwin.action_desc_t(ACTION_NAME, "sead::SafeString", sead_string_ah_t(), "F12"))
        if not existing:
            hr.install_hexrays_callback(cb)
Exemplo n.º 2
0
    def hook(self):
        if self._available is None:
            if not ida_hexrays.init_hexrays_plugin():
                self._available = False
            else:
                ida_hexrays.install_hexrays_callback(self._hxe_callback)
                self._available = True

        if self._available:
            self._installed = True
Exemplo n.º 3
0
    def hook(self):
        if self._available is None:
            if not ida_hexrays.init_hexrays_plugin():
                self._plugin.logger.info("Hex-Rays SDK is not available")
                self._available = False
            else:
                ida_hexrays.install_hexrays_callback(self._hxe_callback)
                self._available = True

        if self._available:
            self._installed = True
Exemplo n.º 4
0
            if c == delim:
                delim = None  # literal ended
        elif c == '"' or c == "'":
            delim = c  # string/char literal started
        elif c.isspace():
            end = l.lstrip()
            nptr = my_tag_skipcodes(end, out)
            dbg("end: '%s', nptr: '%s'" % (end, nptr))
            # do not concatenate idents
            if not is_cident_char(last) or not is_cident_char(nptr[0]):
                l = end
                c = l[0] if l else ''
                dbg("new l: '%s'" % l)
        last = l[0] if l else ''

    sl.line = "".join(out)


def cb(event, *args):
    if event == ida_hexrays.hxe_func_printed:
        cf = args[0]
        for sl in cf.get_pseudocode():
            remove_spaces(sl)
    return 0


if ida_hexrays.init_hexrays_plugin():
    ida_hexrays.install_hexrays_callback(cb)
else:
    print 'remove spaces: hexrays is not available.'
Exemplo n.º 5
0
 def plugin_loaded(self, plugin_info):
     if plugin_info.name == "Hex-Rays Decompiler":
         if ida_hexrays.init_hexrays_plugin():
             self.hexrays_support = True
             ida_hexrays.install_hexrays_callback(self.hxe_callback)
             print("[AMIE] Hex-Rays decompiler is supported")
Exemplo n.º 6
0
def install_hexrays_hooks():
    return ida_hexrays.install_hexrays_callback(_callback)
Exemplo n.º 7
0
If the object under the cursor is:
 - a function call, prefix the original decompiler hint with "==> "
 - a local variable declaration, replace the hint with our own in the form of "!{varname}" (where '{varname}' is replaced w/ the variable name)
 - an 'if' statement, replace the hint with our own, saying "condition"
"""

import ida_hexrays


def create_hint_cb(event, *args):
    if event == ida_hexrays.hxe_create_hint:
        vu = args[0]
        if vu.get_current_item(ida_hexrays.USE_MOUSE):
            cit = vu.item.citype
            if cit == ida_hexrays.VDI_LVAR:
                return 1, "!%s" % vu.item.l.name, 1
            elif cit == ida_hexrays.VDI_EXPR:
                ce = vu.item.e
                if ce.op == ida_hexrays.cot_call:
                    return 2, "==> ", 1
                if ce.op == ida_hexrays.cit_if:
                    return 1, "condition", 1
            return 0
    return 0


if ida_hexrays.init_hexrays_plugin():
    ida_hexrays.install_hexrays_callback(create_hint_cb)
else:
    print 'hexrays is not available.'