diff --git a/DIE.py b/DIE.py index 5e6a419..4d0445a 100644 --- a/DIE.py +++ b/DIE.py @@ -328,11 +328,11 @@ def add_menu_items(self): # Parser View self.add_menu_item_helper("DIE:parsersview", "Parsers View", 'DIE Parsers View', - self.DIE_show_parsersview_Handler(self), self.icon_list["plugins"], '') # todo crash + self.DIE_show_parsersview_Handler(self), self.icon_list["plugins"], '') # Exceptions View self.add_menu_item_helper("DIE:exceptionsview", "Exceptions View", 'DIE Exceptions View', - self.DIE_show_exceptionsview_Handler(self), self.icon_list["exception_view"], '') # todo crash + self.DIE_show_exceptionsview_Handler(self), self.icon_list["exception_view"], '') # Value View self.add_menu_item_helper("DIE:valueview", "Value View", 'DIE Value View', @@ -360,7 +360,7 @@ def add_menu_items(self): # About self.add_menu_item_helper("DIE:about", "About", 'DIE About', - self.DIE_show_about_Handler(self), -1, '') # todo crash + self.DIE_show_about_Handler(self), -1, '') def del_menu_items(self): @@ -440,7 +440,7 @@ def show_parser_view(self): self.parser_view.Show() ########################################################################### - # Parser View + # Exceptions View def show_breakpoint_view(self): self.bp_view.Show() diff --git a/DIE/UI/AboutScreen.py b/DIE/UI/AboutScreen.py index 5395743..d348d47 100644 --- a/DIE/UI/AboutScreen.py +++ b/DIE/UI/AboutScreen.py @@ -1,10 +1,7 @@ - - -from idaapi import Form import os import DIE.Lib.DieConfig +from PyQt5 import QtGui, QtCore, QtWidgets -from sark.qt import QtGui, QtCore, QtWidgets class AboutWindow(QtWidgets.QDialog): def __init__(self): @@ -20,13 +17,12 @@ def initUI(self): image = QtGui.QImage(os.path.join(config.icons_path, "logo.png")) pixmap = QtGui.QPixmap.fromImage(image) - - logo = QtGui.QLabel(self) + logo = QtWidgets.QLabel(self) logo.setFixedSize(pixmap.size()) logo.move(0.5*(self.width() - logo.width()), 20) logo.setPixmap(pixmap) - title = QtGui.QLabel("DIE",self) + title = QtWidgets.QLabel("DIE", self) title.setAlignment(QtCore.Qt.AlignCenter) font = title.font() font.setPointSize(16) @@ -35,7 +31,7 @@ def initUI(self): title.setFixedWidth(400) title.move(0, logo.height() + logo.y() + 20) - subtitle = QtGui.QLabel("Dynamic IDA Enrichment framework",self) + subtitle = QtWidgets.QLabel("Dynamic IDA Enrichment framework", self) font = subtitle.font() font.setPointSize(14) subtitle.setFont(font) @@ -43,7 +39,7 @@ def initUI(self): subtitle.setFixedWidth(400) subtitle.move(0, title.height() + title.y() + 10) - version = QtGui.QLabel("Version 0.1",self) + version = QtWidgets.QLabel("Version 0.1", self) font = subtitle.font() font.setPointSize(12) version.setFont(font) @@ -51,9 +47,9 @@ def initUI(self): version.setFixedWidth(400) version.move(0, subtitle.height() + subtitle.y() + 30) - author = QtGui.QLabel("Written by Yaniv Balmas @ynvb - Check Point Software Technologies",self) + author = QtWidgets.QLabel("Written by Yaniv Balmas @ynvb - Check Point Software Technologies",self) font = subtitle.font() - font.setPointSize(12) + font.setPointSize(10) author.setFont(font) author.setAlignment(QtCore.Qt.AlignCenter) author.setFixedWidth(400) diff --git a/DIE/UI/BPView.py b/DIE/UI/BPView.py index eac1233..b057929 100644 --- a/DIE/UI/BPView.py +++ b/DIE/UI/BPView.py @@ -1,5 +1,4 @@ from PyQt5 import QtGui, QtCore, QtWidgets - from idaapi import PluginForm from DIE.Lib import BpHandler @@ -25,22 +24,22 @@ def OnCreate(self, form): """ Called when the view is created """ - self.bp_tree_widget = QtGui.QTreeWidget() + self.bp_tree_widget = QtWidgets.QTreeWidget() self.bp_handler = BpHandler.get_bp_handler() self.die_icons = DIE.UI.Die_Icons.get_die_icons() # Get parent widget - self.parent = self.FormToPySideWidget(form) + self.parent = self.FormToPyQtWidget(form) self._add_parser_data() - toolbar = QtGui.QToolBar() - action_refresh = QtGui.QAction(self.die_icons.icon_refresh, "Refresh", toolbar) + toolbar = QtWidgets.QToolBar() + action_refresh = QtWidgets.QAction(self.die_icons.icon_refresh, "Refresh", toolbar) action_refresh.triggered.connect(self.refresh) toolbar.addAction(action_refresh) - layout = QtGui.QGridLayout() + layout = QtWidgets.QGridLayout() layout.addWidget(toolbar) layout.addWidget(self.bp_tree_widget) @@ -59,46 +58,46 @@ def _add_parser_data(self): if self.bp_tree_widget is not None: self.bp_tree_widget.clear() else: - self.bp_tree_widget = QtGui.QTreeWidget() + self.bp_tree_widget = QtWidgets.QTreeWidget() root_item = self.bp_tree_widget.invisibleRootItem() self.bp_tree_widget.setHeaderLabel("Breakpoints") # Excluded Modules - module_item = QtGui.QTreeWidgetItem() + module_item = QtWidgets.QTreeWidgetItem() module_item.setText(0, "Excluded Modules") module_item.setFlags(QtCore.Qt.ItemIsEnabled) row = 0 for module in self.bp_handler.excluded_modules: - current_row_item = QtGui.QTreeWidgetItem() + current_row_item = QtWidgets.QTreeWidgetItem() current_row_item.setFlags(QtCore.Qt.ItemIsEnabled) current_row_item.setText(0, module) module_item.insertChild(row, current_row_item) row += 1 # Excluded Functions - function_item = QtGui.QTreeWidgetItem() + function_item = QtWidgets.QTreeWidgetItem() function_item.setText(0, "Excluded Functions") function_item.setFlags(QtCore.Qt.ItemIsEnabled) row = 0 for function in self.bp_handler.excluded_funcNames: - current_row_item = QtGui.QTreeWidgetItem() + current_row_item = QtWidgets.QTreeWidgetItem() current_row_item.setFlags(QtCore.Qt.ItemIsEnabled) current_row_item.setText(0, function) function_item.insertChild(row, current_row_item) row += 1 # Excluded Addresses - ea_item = QtGui.QTreeWidgetItem() + ea_item = QtWidgets.QTreeWidgetItem() ea_item.setText(0, "Excluded Addresses") ea_item.setFlags(QtCore.Qt.ItemIsEnabled) row = 0 for ea in self.bp_handler.excluded_bp_ea: - current_row_item = QtGui.QTreeWidgetItem() + current_row_item = QtWidgets.QTreeWidgetItem() current_row_item.setFlags(QtCore.Qt.ItemIsEnabled) current_row_item.setText(0, hex(ea)) ea_item.insertChild(row, current_row_item) diff --git a/DIE/UI/FunctionViewEx.py b/DIE/UI/FunctionViewEx.py index cb708da..d71352e 100644 --- a/DIE/UI/FunctionViewEx.py +++ b/DIE/UI/FunctionViewEx.py @@ -6,20 +6,19 @@ import idautils import idc from idaapi import PluginForm -#from PySide import QtGui, QtCore from PyQt5 import QtCore, QtGui, QtWidgets import DIE.UI.Die_Icons import DIE.UI.ValueViewEx import DIE.UI.ParserView import DIE.UI.BPView - import DIE.Lib.IDAConnector import DIE.Lib.DIEDb import DIE.Lib.BpHandler import sark.ui + class FunctionView(PluginForm): """ DIE Function View @@ -656,7 +655,7 @@ def highlight_item(self, item): @param item: module item """ try: - item.setBackground(QtCore.Qt.GlobalColor.yellow) + item.setBackground(QtCore.Qt.yellow) cur_font = item.font() cur_font.setBold(True) item.setFont(cur_font) @@ -708,7 +707,7 @@ def clear_highlights(self): for persistent_index in self.highligthed_items: if persistent_index.isValid(): item = self.functionModel.itemFromIndex(persistent_index) - item.setBackground(QtCore.Qt.GlobalColor.white) + item.setBackground(QtCore.Qt.white) cur_font = item.font() cur_font.setBold(False) item.setFont(cur_font) @@ -733,7 +732,7 @@ def find_function(self, function_name): for item in matched_items: self.functionTreeView.expand(item.index()) - self.functionTreeView.scrollTo(item.index(), QtGui.QAbstractItemView.ScrollHint.PositionAtTop) + self.functionTreeView.scrollTo(item.index(), QtWidgets.QAbstractItemView.PositionAtTop) self.highlight_item_row(item) def find_context_list(self, context_list): @@ -749,7 +748,7 @@ def find_context_list(self, context_list): for func_context in context_list: context_id = id(func_context) - matched_items = self.functionModel.match(root_index, DIE.UI.ContextId_Role, context_id, -1, QtCore.Qt.MatchFlag.MatchRecursive|QtCore.Qt.MatchFlag.MatchExactly) + matched_items = self.functionModel.match(root_index, DIE.UI.ContextId_Role, context_id, -1, QtCore.Qt.MatchRecursive|QtCore.Qt.MatchExactly) for index in matched_items: if not index.isValid(): @@ -760,7 +759,7 @@ def find_context_list(self, context_list): item = self.functionModel.itemFromIndex(index) self.functionTreeView.expand(index) - self.functionTreeView.scrollTo(index, QtGui.QAbstractItemView.ScrollHint.PositionAtTop) + self.functionTreeView.scrollTo(index, QtWidgets.QAbstractItemView.PositionAtTop) self.highlight_item_row(item) return True @@ -772,7 +771,6 @@ def find_context_list(self, context_list): ############################################################################################### # Slots. - #@QtCore.Slot(QtCore.QModelIndex) @QtCore.pyqtSlot(QtCore.QModelIndex) def itemDoubleClickSlot(self, index): """ @@ -798,7 +796,6 @@ def itemDoubleClickSlot(self, index): idc.Jump(ea) return True - #@QtCore.Slot(QtCore.QPoint) @QtCore.pyqtSlot(QtCore.QPoint) def onCustomContextMenu(self, point): index = self.functionTreeView.indexAt(point) @@ -818,7 +815,6 @@ def onCustomContextMenu(self, point): self.context_menu_param = is_value_item self.value_context_menu.exec_(self.functionTreeView.mapToGlobal(point)) - #@QtCore.Slot(str) @QtCore.pyqtSlot(str) def on_exclude_func(self, function): @@ -831,7 +827,6 @@ def on_exclude_func(self, function): self.bp_handler.add_bp_funcname_exception(function.function_name) return - #@QtCore.Slot(str) @QtCore.pyqtSlot(str) def on_exclude_func_adrs(self, function): @@ -847,7 +842,6 @@ def on_exclude_func_adrs(self, function): return - #@QtCore.Slot(str) @QtCore.pyqtSlot(str) def on_exclude_ea(self, function_context): @@ -860,7 +854,6 @@ def on_exclude_ea(self, function_context): self.bp_handler.add_bp_ea_exception(function_context.calling_ea) return - #@QtCore.Slot(str) @QtCore.pyqtSlot(str) def on_show_callgraph(self, function_context): @@ -887,7 +880,6 @@ def on_show_callgraph(self, function_context): return - #@QtCore.Slot(str) @QtCore.pyqtSlot(str) def on_exclude_library(self, function): @@ -902,7 +894,6 @@ def on_exclude_library(self, function): return - #@QtCore.Slot(str) @QtCore.pyqtSlot(str) def on_value_detail(self, value): if not self.value_view.isVisible(): @@ -921,7 +912,7 @@ def on_thread_combobox_change(self, thread_id): hidden_threads = ".*" + self._make_thread_id_data(thread_id) + ".*" - threadProxyModel = QtGui.QSortFilterProxyModel() + threadProxyModel = QtCore.QSortFilterProxyModel() threadProxyModel.setFilterRole(DIE.UI.ThreadId_Role) threadProxyModel.setFilterRegExp(hidden_threads) @@ -946,7 +937,6 @@ def on_bpview_button(self): ############################################################################################### # View Delegates. -#class TreeViewDelegate(QtGui.QStyledItemDelegate): class TreeViewDelegate(QtWidgets.QStyledItemDelegate): """ Delegate for parsed value viewing in the tree view @@ -967,7 +957,7 @@ def createEditor(self, parent, option, index): line_txt = "%d, %s, %s" % (parsed_val.score, parsed_val.data, parsed_val.description) lines.append(line_txt) - combo_box = QtGui.QComboBox(parent) + combo_box = QtWidgets.QComboBox(parent) combo_box.addItems(lines) return combo_box diff --git a/DIE/UI/ParserView.py b/DIE/UI/ParserView.py index b4d868d..25616ba 100644 --- a/DIE/UI/ParserView.py +++ b/DIE/UI/ParserView.py @@ -1,8 +1,8 @@ from DIE.Lib import DataParser from idaapi import PluginForm -#from PySide import QtGui, QtCore from PyQt5 import QtGui, QtCore, QtWidgets + class ParserView(PluginForm): """ DIE Value View @@ -23,14 +23,14 @@ def OnCreate(self, form): Called when the view is created """ self.data_parser = DataParser.getParser() - self.ptable_widget = QtGui.QTreeWidget() + self.ptable_widget = QtWidgets.QTreeWidget() # Get parent widget - self.parent = self.FormToPySideWidget(form) + self.parent = self.FormToPyQtWidget(form) self._add_parser_data() - layout = QtGui.QGridLayout() + layout = QtWidgets.QGridLayout() layout.addWidget(self.ptable_widget) self.parent.setLayout(layout) @@ -61,7 +61,7 @@ def _add_parser_data(self): root_item = self.ptable_widget.invisibleRootItem() for parser in parser_list: - current_row_item = QtGui.QTreeWidgetItem() + current_row_item = QtWidgets.QTreeWidgetItem() current_row_item.setFlags(QtCore.Qt.ItemIsEnabled) current_row_item.setText(0, parser) @@ -71,7 +71,7 @@ def _add_parser_data(self): current_row_item.setText(column+1, currext_text) root_item.insertChild(row, current_row_item) - row +=1 + row += 1 diff --git a/DIE/UI/ValueViewEx.py b/DIE/UI/ValueViewEx.py index 630b104..610b43c 100644 --- a/DIE/UI/ValueViewEx.py +++ b/DIE/UI/ValueViewEx.py @@ -1,4 +1,3 @@ -#from PySide import QtGui, QtCore from PyQt5 import QtGui, QtCore, QtWidgets import idaapi @@ -150,7 +149,7 @@ def highlight_item(self, item): @param item: module item """ try: - item.setBackground(QtCore.Qt.GlobalColor.yellow) + item.setBackground(QtCore.Qt.yellow) cur_font = item.font() cur_font.setBold(True) item.setFont(cur_font) @@ -201,7 +200,7 @@ def clear_highlights(self): for persistent_index in self.highligthed_items: if persistent_index.isValid(): item = self.valueModel.itemFromIndex(persistent_index) - item.setBackground(QtCore.Qt.GlobalColor.white) + item.setBackground(QtCore.Qt.white) cur_font = item.font() cur_font.setBold(False) item.setFont(cur_font) @@ -226,7 +225,7 @@ def find_value(self, value): return matched_items = self.valueModel.match(root_index, DIE.UI.Value_Role, value.__hash__(), -1, - QtCore.Qt.MatchFlag.MatchRecursive | QtCore.Qt.MatchFlag.MatchExactly) + QtCore.Qt.MatchRecursive | QtCore.Qt.MatchExactly) for index in matched_items: if not index.isValid(): @@ -234,7 +233,7 @@ def find_value(self, value): item = self.valueModel.itemFromIndex(index) self.valueTreeView.expand(index) - self.valueTreeView.scrollTo(index, QtGui.QAbstractItemView.ScrollHint.PositionAtTop) + self.valueTreeView.scrollTo(index, QtWidgets.QAbstractItemView.ScrollHint.PositionAtTop) self.highlight_item_row(item) except Exception as ex: