Exemplo n.º 1
0
    def _on_imports_contextmenu(self, pos):
        """ ImportList ContextMenu
        """
        index = self.imports_list.indexAt(pos).row()
        if index != -1:
            context_menu = QMenu(self)
            func_name = self.imports_model.item(index, 0).text()
            addr = self.imports_model.item(index, 1).text()
            context_menu.addAction(
                'Add Breakpoint',
                lambda: self._add_breakpoint(addr, func_name))
            context_menu.addSeparator()
            context_menu.addAction(
                'Copy address', lambda: utils.copy_hex_to_clipboard(
                    self.imports_model.item(index, 1).text()))
            context_menu.addSeparator()
            context_menu.addAction(
                'Copy FunctionName',
                lambda: utils.copy_str_to_clipboard(func_name))
            context_menu.addAction(
                'Copy ModuleName', lambda: utils.copy_str_to_clipboard(
                    self.imports_model.item(index, 2).text()))

            if self.imports_list.search_enabled:
                context_menu.addSeparator()
                context_menu.addAction('Search',
                                       self.imports_list._on_cm_search)

            # show context menu
            glbl_pt = self.imports_list.mapToGlobal(pos)
            context_menu.exec_(glbl_pt)
Exemplo n.º 2
0
    def _on_native_contextmenu(self, pos):
        index = self._nativectx_list.indexAt(pos).row()
        glbl_pt = self._nativectx_list.mapToGlobal(pos)
        context_menu = QMenu(self)
        if index != -1:
            item = self._nativectx_model.item(index, 1)
            dec = self._nativectx_model.item(index, 2)
            telescope = self._nativectx_model.item(index, 3)
            # show contextmenu
            if self._nativectx_model.item(index, 0).data(Qt.UserRole + 1):
                context_menu.addAction(
                    'Jump to {0}'.format(item.text()),
                    lambda: self._app_window.jump_to_address(item.text()))
                context_menu.addSeparator()
            # copy menu
            context_sub_menu = QMenu('Copy', context_menu)
            context_sub_menu.addAction(
                'Value', lambda: utils.copy_str_to_clipboard(item.text()))
            if dec.text():
                context_sub_menu.addAction(
                    'Decimal', lambda: utils.copy_str_to_clipboard(dec.text()))
            if telescope.text():
                context_sub_menu.addAction(
                    'Telescope',
                    lambda: utils.copy_str_to_clipboard(telescope.text()))
            context_menu.addMenu(context_sub_menu)

            context_menu.exec_(glbl_pt)
Exemplo n.º 3
0
 def _on_java_contextmenu(self, pos):
     index = self._javactx_list.indexAt(pos).row()
     glbl_pt = self._javactx_list.mapToGlobal(pos)
     context_menu = QMenu(self)
     if index != -1:
         # show contextmenu
         argument = self._javactx_model.item(index, 1)
         _class = self._javactx_model.item(index, 2)
         value = self._javactx_model.item(index, 3)
         context_sub_menu = QMenu('Copy', context_menu)
         context_sub_menu.addAction('Argument', lambda: utils.copy_str_to_clipboard(argument.text()))
         if _class.text():
             context_sub_menu.addAction('Class', lambda: utils.copy_str_to_clipboard(_class.text()))
         if value:
             if value.text():
                 context_sub_menu.addAction('Value', lambda: utils.copy_str_to_clipboard(value.text()))
         context_menu.addMenu(context_sub_menu)
         context_menu.exec_(glbl_pt)
Exemplo n.º 4
0
    def _on_context_menu(self, pos):
        index = self.indexAt(pos).row()
        glbl_pt = self.mapToGlobal(pos)
        context_menu = QMenu(self)
        if index != -1:
            if self._mode == 'native':
                addr_item = self.model().item(index, 0).text()
                symbol_item = self.model().item(index, 1).text()
                # show contextmenu
                context_menu.addAction(
                    'Jump to {0}'.format(addr_item),
                    lambda: self.onShowMemoryRequest.emit(['bt', addr_item]))
                context_menu.addSeparator()
                context_menu.addAction(
                    'Copy Address',
                    lambda: utils.copy_hex_to_clipboard(addr_item))
                if symbol_item and symbol_item != '-':
                    context_menu.addAction(
                        'Copy Symbol',
                        lambda: utils.copy_str_to_clipboard(symbol_item))
            elif self._mode == 'java':
                method_item = self.model().item(index, 0).text()
                if method_item.startswith('at '):
                    method_item = method_item.replace('at ', '')

                source_item = self.model().item(index, 1).text()
                if ':' in source_item:
                    source_item = source_item.split(':')[0]
                # show contextmenu
                # context_menu.addAction('Jump to', lambda: self._app_window.jump_to_address(addr_item.text()))
                # context_menu.addSeparator()
                # TODO: add jumpto java
                context_menu.addAction(
                    'Copy Method',
                    lambda: utils.copy_str_to_clipboard(method_item))
                context_menu.addAction(
                    'Copy Source',
                    lambda: utils.copy_str_to_clipboard(source_item))

            context_menu.exec_(glbl_pt)
Exemplo n.º 5
0
    def _on_modules_contextmenu(self, pos):
        """ Modules ContextMenu
        """
        index = self.modules_list.indexAt(pos).row()
        glbl_pt = self.modules_list.mapToGlobal(pos)
        context_menu = QMenu(self)
        if index != -1:
            context_menu.addAction(
                'Dump Binary', lambda: self._on_dumpmodule(
                    self.modules_model.item(index, 1).text(),
                    self.modules_model.item(index, 2).text()))
            context_menu.addSeparator()
            context_menu.addAction(
                'Copy address', lambda: utils.copy_hex_to_clipboard(
                    self.modules_model.item(index, 1).text()))
            context_menu.addAction(
                'Copy Name', lambda: utils.copy_str_to_clipboard(
                    self.modules_model.item(index, 0).text()))
            context_menu.addAction(
                'Copy Path', lambda: utils.copy_str_to_clipboard(
                    self.modules_model.item(index, 3).text()))
            context_menu.addSeparator()
            file_path = self.modules_model.item(index, 3).text()
            if self._app_window.dwarf._platform == 'linux':
                context_menu.addAction('Show ELF Info',
                                       lambda: self._on_parse_elf(file_path))
                context_menu.addSeparator()
            # elif file_path and (file_path.endswith('.dll') or file_path.endswith('.exe')):
            #   context_menu.addAction('Show PE Info', lambda: self._on_parse_pe(file_path))
            #   context_menu.addSeparator()

            if self.modules_list.search_enabled:
                context_menu.addSeparator()
                context_menu.addAction('Search',
                                       self.modules_list._on_cm_search)
                context_menu.addSeparator()

        context_menu.addAction('Refresh', self.update_modules)
        context_menu.exec_(glbl_pt)
Exemplo n.º 6
0
    def _on_contextmenu(self, pos):
        """ ContextMenu
        """
        index = self.indexAt(pos).row()
        glbl_pt = self.mapToGlobal(pos)
        context_menu = QMenu(self)
        if index != -1:
            mem_prot = self._ranges_model.item(index, 2).text()
            # is readable
            if 'r' in mem_prot:
                context_menu.addAction(
                    'Dump Binary', lambda: self._on_dumprange(
                        self._ranges_model.item(index, 0).text(),
                        self._ranges_model.item(index, 1).text()))
                context_menu.addSeparator()

            context_menu.addAction(
                'Add Watchpoint', lambda: self._on_addwatchpoint(
                    self._ranges_model.item(index, 0).text()))

            context_menu.addAction(
                'Copy address', lambda: utils.copy_hex_to_clipboard(
                    self._ranges_model.item(index, 0).text()))
            context_menu.addSeparator()

            if self._ranges_model.item(index, 5):
                file_path = self._ranges_model.item(index, 5).text()
                if file_path:
                    context_menu.addAction(
                        'Copy Path',
                        lambda: utils.copy_str_to_clipboard(file_path))
                    context_menu.addSeparator()
                    if self._app_window.dwarf._platform == 'linux':
                        context_menu.addAction(
                            'Show ELF Info',
                            lambda: self._on_parse_elf(file_path))
                        context_menu.addSeparator()

            if self.search_enabled:
                context_menu.addSeparator()
                context_menu.addAction('Search', self._on_cm_search)
                context_menu.addSeparator()

        context_menu.addAction('Refresh', self.update_ranges)
        context_menu.exec_(glbl_pt)