Beispiel #1
0
    def pre_hook(self):
        self.unhook()
        hooks.idb.unhook()

        idc.SetCharPrm(idc.INF_AUTO, True)
        idc.Wait()
        idaapi.request_refresh(idaapi.IWID_STRUCTS | idaapi.IWID_ENUMS | idaapi.IWID_XREFS)
        idc.SetCharPrm(idc.INF_AUTO, False)
        idaapi.request_refresh(idaapi.IWID_STRUCTS | idaapi.IWID_ENUMS | idaapi.IWID_XREFS)

        self.hook()
        hooks.idb.hook()
Beispiel #2
0
    def pre_hook(self):
        self.unhook()
        hooks.idb.unhook()

        idc.set_inf_attr(idc.INFFL_AUTO, True)
        idc.Wait()
        idaapi.request_refresh(idaapi.IWID_STRUCTS | idaapi.IWID_ENUMS
                               | idaapi.IWID_XREFS)
        idc.set_inf_attr(idc.INFFL_AUTO, False)
        idaapi.request_refresh(idaapi.IWID_STRUCTS | idaapi.IWID_ENUMS
                               | idaapi.IWID_XREFS)

        self.hook()
        hooks.idb.hook()
Beispiel #3
0
    def rename_symbol(self):
        """
        Rename the symbol "symbol" with the new name
        provided by the user in the Pop-Up
        """
        # Get the symbol
        symbol = get_highlighted_identifier()
        if not symbol:
            idaapi.warning("Select a symbol")
            return False

        # Get the address
        address = gl.get_address_for_symbol(symbol)
        if not address:
            print("GhIDA:: [!] Symbol %s not found" % symbol)
            return False

        # Display a Pop-up to get the new name
        new_name = gl.display_rename_form(address, symbol)
        if not new_name or len(new_name) == 0:
            return

        # Check for white_spaces in the new symbol name
        for letter in new_name:
            if not (letter.isdigit() or letter.isalpha() or letter == '_'):
                print("GhIDA:: [!] symbol name contains invalid char")
                return

        # Check if new_name is already used
        if gl.check_if_symbol_is_used(new_name):
            print("GhIDA:: [!] symble name already used")
            return

        # Update symbol name in SYMBLE DICT:
        gl.updated_symbol_name_for_address(symbol, address, new_name)

        # Update symbol name in IDA DISASM view.
        print("GhIDA:: [DEBUG] New symbol name: %s" % new_name)

        # Update symbol name in the decompiled view
        new_code = gl.rename_variable_in_text(self.__decompiled, symbol,
                                              new_name)
        self.update(self.__ea, new_code)

        # Add comments
        comment_list = COMMENTS_CACHE.get_comments_cache(self.__ea)
        if comment_list:
            self.add_comments(comment_list)

        print("GhIDA:: [INFO] Symbol name updated in IDA DECOMP view.")

        if idc.set_name(address, new_name):
            # Refresh the view
            idaapi.request_refresh(idaapi.IWID_DISASMS)
            # Highlight the new identifier
            gl.highlight_symbol_in_DISASM()
            print("GhIDA:: [INFO] Symbol name updated in IDA DISASM view.")
            return

        print("GhIDA:: [!] IDA DISASM rename error")
        return
Beispiel #4
0
 def run(self, arg):
     self.hook.toggle_active()
     idaapi.request_refresh(idaapi.IWID_DISASMS)
Beispiel #5
0
 def toggle_active(self):
     self.active = not self.active
     idaapi.request_refresh(idaapi.IWID_DISASMS)
Beispiel #6
0
 def toggle_hider(self):
     self.hide = not self.hide
     idaapi.request_refresh(idaapi.IWID_DISASMS)
Beispiel #7
0
 def run(self, arg):
     self.hook.toggle_active()
     idaapi.request_refresh(idaapi.IWID_DISASMS)
Beispiel #8
0
 def __call__(self):
     msg(self.message)
     request_refresh(BWN_OUTPUT)
Beispiel #9
0
 def force_update():
     """Forcefuly requests IDA kernel to update all widgets and views. Useful
 for when delayed actions modify the program and/or plugin state without
 IDA's awareness"""
     iwid_all = 0xFFFFFFFF
     idaapi.request_refresh(iwid_all)
Beispiel #10
0
 def toggle_active(self):
     self.active = not self.active
     idaapi.request_refresh(idaapi.IWID_DISASMS)
Beispiel #11
0
 def toggle_hider(self):
     self.hide = not self.hide
     idaapi.request_refresh(idaapi.IWID_DISASMS)