예제 #1
0
    def activate(self, ctx=idaapi.action_activation_ctx_t):
        if not self.sync_on:
            # Get the name:
            name = idaapi.askstr(0, self.name, 'Override idb name:')
            if not name:
                return 1
            self.name = name
            self.init_broker()
        else:
            self.smooth_kill()

        # Swap state
        self.sync_on = not self.sync_on
        idaapi.update_action_icon(ctx.action, self.icon)
        return 1
예제 #2
0
    def activate(self, ctx=idaapi.action_activation_ctx_t):
        if not self.sync_on:
            # Get the name:
            name = idaapi.askstr(0, self.name, 'Override idb name:')
            if not name:
                return 1
            self.name = name
            self.init_broker()
        else:
            self.smooth_kill()

        # Swap state
        self.sync_on = not self.sync_on
        idaapi.update_action_icon(ctx.action, self.icon)
        return 1
예제 #3
0
 def update(self, ctx=idaapi.action_activation_ctx_t):
     idaapi.update_action_icon(ctx.action, self.icon)
     if idc.GetIdbPath():
         return idaapi.AST_ENABLE_FOR_IDB
     return idaapi.AST_DISABLE
예제 #4
0
    def finish_populating_widget_popup(self, form, popup):
        try:
            b = idaapi.get_widget_type(form) == idaapi.BWN_DISASM
        except:
            b = idaapi.get_tform_type(form) == idaapi.BWN_DISASM

        if b:
            # Add separator
            idaapi.attach_action_to_popup(form, popup, None, None)

            # Add actions
            try:
                currentAddress = idc.get_screen_ea()
            except:
                currentAddress = idc.ScreenEA()

            #if currentAddress in [node.node_id for node in self.cc.PatternGenerator.targetNodes]:
            if currentAddress in self.cc.PatternGenerator.coloredNodes:
                idaapi.attach_action_to_popup(form, popup,
                                              "grap:pg:match_default", None)
                idaapi.attach_action_to_popup(form, popup,
                                              "grap:pg:match_full", None)
                idaapi.update_action_label(
                    "grap:pg:match_full",
                    self.cc.PatternGenerator.preview_match(
                        currentAddress, "[grap] Full match", "match_full"))
                idaapi.attach_action_to_popup(form, popup,
                                              "grap:pg:match_opcode_arg1",
                                              None)
                idaapi.update_action_label(
                    "grap:pg:match_opcode_arg1",
                    self.cc.PatternGenerator.preview_match(
                        currentAddress, "[grap] Opcode+arg1",
                        "match_opcode_arg1"))
                idaapi.attach_action_to_popup(form, popup,
                                              "grap:pg:match_opcode_arg2",
                                              None)
                idaapi.update_action_label(
                    "grap:pg:match_opcode_arg2",
                    self.cc.PatternGenerator.preview_match(
                        currentAddress, "[grap] Opcode+arg2",
                        "match_opcode_arg2"))
                idaapi.attach_action_to_popup(form, popup,
                                              "grap:pg:match_opcode", None)
                idaapi.update_action_label(
                    "grap:pg:match_opcode",
                    self.cc.PatternGenerator.preview_match(
                        currentAddress, "[grap] Opcode", "match_opcode"))
                idaapi.attach_action_to_popup(form, popup,
                                              "grap:pg:match_wildcard", None)
                idaapi.attach_action_to_popup(form, popup,
                                              "grap:pg:remove_target", None)

                for type in [
                        "match_default", "match_full", "match_opcode_arg1",
                        "match_opcode_arg2", "match_opcode", "match_wildcard"
                ]:
                    idaapi.update_action_icon("grap:pg:" + type, -1)

                if currentAddress not in self.cc.PatternGenerator.targetNodeType:
                    type = "match_default"
                else:
                    type = self.cc.PatternGenerator.targetNodeType[
                        currentAddress]
                idaapi.update_action_icon("grap:pg:" + type,
                                          self.selected_icon_number)

            elif self.cc.PatternGenerator.rootNode is None or currentAddress != self.cc.PatternGenerator.rootNode.node_id:
                idaapi.attach_action_to_popup(form, popup, "grap:pg:set_root",
                                              None)
                idaapi.attach_action_to_popup(form, popup,
                                              "grap:pg:add_target", None)
예제 #5
0
 def update(brutal_self, brutal_context):
     idaapi.update_action_icon(brutal_context.action, brutal_self.icon)
     return idaapi.AST_ENABLE
예제 #6
0
 def update(self, ctx=idaapi.action_activation_ctx_t):
     idaapi.update_action_icon(ctx.action, self.icon)
     if idc.GetIdbPath():
         return idaapi.AST_ENABLE_FOR_IDB
     return idaapi.AST_DISABLE