def initUI(self): config = DIE.Lib.DieConfig.get_config() self.setFixedSize(400, 330) self.setWindowTitle("About DIE") image = QtGui.QImage(os.path.join(config.icons_path, "logo.png")) pixmap = QtGui.QPixmap.fromImage(image) logo = QtWidgets.QLabel(self) logo.setFixedSize(pixmap.size()) logo.move(0.5 * (self.width() - logo.width()), 20) logo.setPixmap(pixmap) title = QtWidgets.QLabel("DIE", self) title.setAlignment(QtCore.Qt.AlignCenter) font = title.font() font.setPointSize(16) font.setBold(True) title.setFont(font) title.setFixedWidth(400) title.move(0, logo.height() + logo.y() + 20) subtitle = QtWidgets.QLabel("Dynamic IDA Enrichment framework", self) font = subtitle.font() font.setPointSize(14) subtitle.setFont(font) subtitle.setAlignment(QtCore.Qt.AlignCenter) subtitle.setFixedWidth(400) subtitle.move(0, title.height() + title.y() + 10) version = QtWidgets.QLabel("Version 0.1", self) font = subtitle.font() font.setPointSize(12) version.setFont(font) version.setAlignment(QtCore.Qt.AlignCenter) version.setFixedWidth(400) version.move(0, subtitle.height() + subtitle.y() + 30) author = QtWidgets.QLabel( "Written by Yaniv Balmas @ynvb - Check Point Software Technologies", self) font = subtitle.font() font.setPointSize(12) author.setFont(font) author.setAlignment(QtCore.Qt.AlignCenter) author.setFixedWidth(400) author.move(0, version.height() + version.y()) self.show()
def __init__(self, *args, **kwargs): super(Popup, self).__init__(*args, **kwargs) pm = QtGui.QPixmap(IDABUDDY_AVATAR_PATH) transform = QtGui.QTransform() transform.scale(0.5, 0.5) self.pm = pm.transformed(transform) self.slide = Slide(self) self.image_label = QtWidgets.QLabel(self.slide) self.image_label.setPixmap(self.pm) self.image_label.setFixedSize(self.pm.size()) self.image_label.setAlignment(QtCore.Qt.AlignTop) self.slide.initialize() self.talk_bubble = TalkBubble(self) self.talk_bubble.move(TALKBUBBLE_X_MOVE, TALKBUBBLE_Y_MOVE) self.talk_bubble.hide() self.slide.move(size_to_point(self.talk_bubble.size())) self.setFixedSize(self.talk_bubble.size() + self.slide.size() + get_extra_size()) connect_method_to_signal(self.talk_bubble, 'linkActivated(QString)', self.linkActivatedHandler) self._handlers = {} self._default_handler = None
def __init__(self): super(AboutWindow, self).__init__() self.setFixedSize(260, 120) self.setWindowTitle('About Classy') layout = QtWidgets.QVBoxLayout(self) aboutLabel = QtWidgets.QLabel('Classy\n\nRicBent, Treeki', self) aboutLabel.setAlignment(QtCore.Qt.AlignCenter) layout.addWidget(aboutLabel) self.show()
def OnCreate(self, form): """ Called when the view is created """ self.die_db = DIE.Lib.DIEDb.get_db() self.function_view = DIE.UI.FunctionViewEx.get_view() # Get parent widget self.parent = form_to_widget(form) self.valueModel = QtGui.QStandardItemModel() self.valueTreeView = QtWidgets.QTreeView() self.valueTreeView.setExpandsOnDoubleClick(False) self.valueTreeView.doubleClicked.connect(self.itemDoubleClickSlot) self._model_builder(self.valueModel) self.valueTreeView.setModel(self.valueModel) # Toolbar self.value_toolbar = QtWidgets.QToolBar() # Value type combobox type_list = [] if self.die_db: type_list = self.die_db.get_all_value_types() type_list.insert(0, "All Values") self.value_type_combo = QtWidgets.QComboBox() self.value_type_combo.addItems(type_list) self.value_type_combo.activated[str].connect( self.on_value_type_combobox_change) self.value_type_label = QtWidgets.QLabel("Value Type: ") self.value_toolbar.addWidget(self.value_type_label) self.value_toolbar.addWidget(self.value_type_combo) # Layout layout = QtWidgets.QGridLayout() layout.addWidget(self.value_toolbar) layout.addWidget(self.valueTreeView) self.parent.setLayout(layout)
def OnCreate(self, form): """ Called when the plugin form is created """ self.value_view = DIE.UI.ValueViewEx.get_view() self.bp_handler = DIE.Lib.BpHandler.get_bp_handler() self.die_icons = DIE.UI.Die_Icons.get_die_icons() self.die_db = DIE.Lib.DIEDb.get_db() # Get parent widget self.parent = form_to_widget(form) self.functionModel = QtGui.QStandardItemModel() self.functionTreeView = QtWidgets.QTreeView() self.functionTreeView.setExpandsOnDoubleClick(False) #self.functionTreeView.setSortingEnabled(True) delegate = TreeViewDelegate(self.functionTreeView) self.functionTreeView.setItemDelegate(delegate) self.functionTreeView.doubleClicked.connect(self.itemDoubleClickSlot) self._model_builder(self.functionModel) self.functionTreeView.setModel(self.functionModel) self.functionTreeView.setColumnWidth(0, 200) self.functionTreeView.setColumnWidth(1, 20) self.functionTreeView.setColumnWidth(2, 20) self.functionTreeView.setColumnWidth(3, 20) self.functionTreeView.setColumnWidth(4, 250) self.functionTreeView.setColumnWidth(5, 100) self.functionTreeView.setColumnWidth(6, 20) self.functionTreeView.setColumnWidth(7, 450) self.functionTreeView.setColumnWidth(8, 20) self.functionTreeView.setColumnWidth(9, 450) # Context menus self.functionTreeView.setContextMenuPolicy(QtCore.Qt.CustomContextMenu) self.functionTreeView.customContextMenuRequested.connect( self.onCustomContextMenu) # Actions self.context_menu_param = None # Parameter to be passed to context menu slots action_exclude_func = QtWidgets.QAction( "Exclude Function", self.functionTreeView, triggered=lambda: self.on_exclude_func(self.context_menu_param)) action_exclude_func_adrs = QtWidgets.QAction( "Exclude All Function Calls", self.functionTreeView, triggered=lambda: self.on_exclude_func_adrs(self.context_menu_param )) action_exclude_ea = QtWidgets.QAction( "Exclude Address", self.functionTreeView, triggered=lambda: self.on_exclude_ea(self.context_menu_param)) action_exclude_library = QtWidgets.QAction( "Exclude Library", self.functionTreeView, triggered=lambda: self.on_exclude_library(self.context_menu_param)) action_value_detail = QtWidgets.QAction( "Inspect Value Details", self.functionTreeView, triggered=lambda: self.on_value_detail(self.context_menu_param)) action_show_callgraph = QtWidgets.QAction( "Show Call-Graph", self.functionTreeView, triggered=lambda: self.on_show_callgraph(self.context_menu_param)) # Function ContextMenu self.function_context_menu = QtWidgets.QMenu(self.functionTreeView) self.function_context_menu.addAction(action_exclude_func) self.function_context_menu.addAction(action_exclude_library) self.function_context_menu.addAction(action_exclude_func_adrs) # Function ea ContextMenu self.ea_context_menu = QtWidgets.QMenu(self.functionTreeView) self.ea_context_menu.addAction(action_exclude_ea) self.ea_context_menu.addAction(action_show_callgraph) # Argument value ContextMenu self.value_context_menu = QtWidgets.QMenu(self.functionTreeView) self.value_context_menu.addAction(action_value_detail) # Therad ComboBox threads = [] if self.die_db is not None: threads = self.die_db.get_thread_list() thread_id_list = [] thread_id_list.append("All Threads") for thread in threads: thread_id_list.append(str(thread.thread_num)) self.thread_id_combo = QtWidgets.QComboBox() self.thread_id_combo.addItems(thread_id_list) self.thread_id_combo.activated[str].connect( self.on_thread_combobox_change) self.thread_id_label = QtWidgets.QLabel("Thread: ") # Toolbar self.function_toolbar = QtWidgets.QToolBar() self.function_toolbar.addWidget(self.thread_id_label) self.function_toolbar.addWidget(self.thread_id_combo) # Grid layout = QtWidgets.QGridLayout() layout.addWidget(self.function_toolbar) layout.addWidget(self.functionTreeView) self.parent.setLayout(layout)
def __init__(self, parent_gui): QtWidgets.QWidget.__init__(self) self.parent_gui = parent_gui self.edit_class = None layout = QtWidgets.QGridLayout(self) self.name = QtWidgets.QLabel() layout.addWidget(self.name, 0, 0) self.set_name = QtWidgets.QPushButton('Set') self.set_name.setMaximumWidth(50) self.set_name.clicked.connect(self.handle_set_name) layout.addWidget(self.set_name, 0, 1) self.base_class = QtWidgets.QLabel() layout.addWidget(self.base_class, 1, 0, 1, 2) self.derived_classes = QtWidgets.QLabel() layout.addWidget(self.derived_classes, 2, 0, 1, 2) self.struct = util.ClickableQLabel() self.struct.doubleClicked.connect(self.handle_struct_double_clicked) layout.addWidget(self.struct, 3, 0) self.set_struct = QtWidgets.QPushButton('Set') self.set_struct.setMaximumWidth(50) self.set_struct.clicked.connect(self.handle_set_struct) layout.addWidget(self.set_struct, 3, 1) self.vtable_range = QtWidgets.QLabel() layout.addWidget(self.vtable_range, 4, 0) self.set_vtable_range = QtWidgets.QPushButton('Set') self.set_vtable_range.setMaximumWidth(50) self.set_vtable_range.clicked.connect(self.handle_set_vtable_range) layout.addWidget(self.set_vtable_range, 4, 1) self.vtable = util.EnterPressQTableWidget() self.vtable.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.vtable.setColumnCount(4) self.vtable.setHorizontalHeaderLabels( ['ID', 'Address', 'Function', 'Type']) vtable_header = self.vtable.horizontalHeader() vtable_header.setSectionResizeMode(2, QtWidgets.QHeaderView.Stretch) self.vtable.verticalHeader().hide() self.vtable.setEditTriggers(QtWidgets.QAbstractItemView.NoEditTriggers) self.vtable.cellDoubleClicked.connect(self.handle_vtable_interaction) self.vtable.cellEnterPressed.connect(self.handle_vtable_interaction) layout.addWidget(self.vtable, 5, 0, 1, 2) self.methods = util.EnterPressQTableWidget() self.methods.setSizePolicy(QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Expanding) self.methods.setColumnCount(2) self.methods.setHorizontalHeaderLabels(['Address', 'Function']) methods_header = self.methods.horizontalHeader() methods_header.setSectionResizeMode(1, QtWidgets.QHeaderView.Stretch) self.methods.verticalHeader().hide() self.methods.setEditTriggers( QtWidgets.QAbstractItemView.NoEditTriggers) # self.methods.setSortingEnabled(True) Todo self.methods.cellDoubleClicked.connect(self.handle_methods_interaction) self.methods.cellEnterPressed.connect(self.handle_methods_interaction) layout.addWidget(self.methods, 6, 0, 1, 2) method_btn_layout = QtWidgets.QHBoxLayout() self.add_method_btn = QtWidgets.QPushButton('Add') self.add_method_btn.setMaximumWidth(50) self.add_method_btn.clicked.connect(self.handle_add_method) method_btn_layout.addWidget(self.add_method_btn) self.remove_method_btn = QtWidgets.QPushButton('Remove') self.remove_method_btn.setMaximumWidth(50) self.remove_method_btn.clicked.connect(self.handle_remove_method) method_btn_layout.addWidget(self.remove_method_btn) method_btn_layout.addItem( QtWidgets.QSpacerItem(0, 0, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)) layout.addLayout(method_btn_layout, 7, 0, 1, 2) self.update_fields()
def __init__(self, return_type='void', owner_type='', name='', args='', is_const=False, ctor_type=1, dtor_type=1, fixed_return_type=False, fixed_owner_type=False, fixed_name=False, fixed_args=False, fixed_is_const=False, fixed_ctor_type=False, fixed_dtor_type=False): super(SignatureDialog, self).__init__() self.return_type = return_type self.owner_type = owner_type self.name = name self.args = args self.is_const = is_const self.ctor_type = ctor_type self.dtor_type = dtor_type self.setWindowTitle('Set function signature') layout = QtWidgets.QGridLayout(self) self.signature_w = QtWidgets.QLabel() self.signature_w.setMinimumWidth(220) layout.addWidget(self.signature_w, 0, 0, 1, 2) layout.addWidget(QtWidgets.QLabel('Return type'), 1, 0) self.return_type_w = QtWidgets.QLineEdit() self.return_type_w.setText(self.return_type) self.return_type_w.setDisabled(fixed_return_type) self.return_type_w.textChanged.connect(self.update_signature) layout.addWidget(self.return_type_w, 1, 1) layout.addWidget(QtWidgets.QLabel('Owner type'), 2, 0) self.owner_type_w = QtWidgets.QLineEdit() self.owner_type_w.setText(self.owner_type) self.owner_type_w.setDisabled(fixed_owner_type) self.owner_type_w.textChanged.connect(self.update_signature) layout.addWidget(self.owner_type_w, 2, 1) layout.addWidget(QtWidgets.QLabel('Name'), 3, 0) self.name_w = QtWidgets.QLineEdit() self.name_w.setText(self.name) self.name_w.setDisabled(fixed_name) self.name_w.textChanged.connect(self.update_signature) layout.addWidget(self.name_w, 3, 1) layout.addWidget(QtWidgets.QLabel('Arguments'), 4, 0) self.args_w = QtWidgets.QLineEdit() self.args_w.setText(self.args) self.args_w.setDisabled(fixed_args) self.args_w.textChanged.connect(self.update_signature) layout.addWidget(self.args_w, 4, 1) layout.addWidget(QtWidgets.QLabel('Const'), 5, 0) self.is_const_w = QtWidgets.QCheckBox() self.is_const_w.setChecked(self.is_const) self.is_const_w.setDisabled(fixed_is_const) self.is_const_w.stateChanged.connect(self.update_signature) layout.addWidget(self.is_const_w, 5, 1) layout.addWidget(QtWidgets.QLabel('Ctor'), 6, 0) self.ctor_type_w = QtWidgets.QComboBox() self.ctor_type_w.addItem("C1: complete") self.ctor_type_w.addItem("C2: base") self.ctor_type_w.addItem("C3: complete allocating") self.ctor_type_w.setCurrentIndex(ctor_type - 1) self.ctor_type_w.setDisabled(fixed_ctor_type) self.ctor_type_w.currentIndexChanged.connect(self.update_signature) layout.addWidget(self.ctor_type_w, 6, 1) layout.addWidget(QtWidgets.QLabel('Dtor'), 7, 0) self.dtor_type_w = QtWidgets.QComboBox() self.dtor_type_w.addItem("D0: deleting") self.dtor_type_w.addItem("D1: complete") self.dtor_type_w.addItem("D2: base") self.dtor_type_w.setCurrentIndex(dtor_type) self.dtor_type_w.setDisabled(fixed_dtor_type) self.dtor_type_w.currentIndexChanged.connect(self.update_signature) layout.addWidget(self.dtor_type_w, 7, 1) layout.addWidget(QtWidgets.QLabel('Status'), 8, 0) self.status_w = QtWidgets.QLabel() layout.addWidget(self.status_w, 8, 1) layout.addWidget(QtWidgets.QLabel('Mangled'), 9, 0) self.mangled_w = QtWidgets.QLabel() layout.addWidget(self.mangled_w, 9, 1) self.buttonBox = QtWidgets.QDialogButtonBox() self.buttonBox.addButton("OK", QtWidgets.QDialogButtonBox.AcceptRole) self.buttonBox.addButton("Cancel", QtWidgets.QDialogButtonBox.RejectRole) layout.addWidget(self.buttonBox, 10, 0, 1, 2) self.buttonBox.accepted.connect(self.handle_ok) self.buttonBox.rejected.connect(self.reject) self.signature = None self.is_signature_valid = False self.mangled = None self.status = '' self.update_signature()