def mouseDoubleClickEvent(self, QMouseEvent): registers = GDB_Engine.read_registers() current_flag = self.objectName().lower() label_text = "Enter the new value of flag " + self.objectName() register_dialog = InputDialogForm(item_list=[(label_text, ["0", "1", int(registers[current_flag])])]) if register_dialog.exec_(): GDB_Engine.set_register_flag(current_flag, register_dialog.get_values()) self.set_value(GDB_Engine.read_registers()[current_flag])
def mouseDoubleClickEvent(self, QMouseEvent): registers = GDB_Engine.read_registers() current_register = self.objectName().lower() register_dialog = InputDialogForm( item_list=[("Enter the new value of register " + self.objectName(), registers[current_register])]) if register_dialog.exec_(): GDB_Engine.set_convenience_variable(current_register, register_dialog.get_values()) self.set_value(GDB_Engine.read_registers()[current_register])
def mouseDoubleClickEvent(self, QMouseEvent): registers = GDB_Engine.read_registers() current_register = self.objectName().lower() register_dialog = DialogWithButtonsForm( label_text="Enter the new value of register " + self.objectName(), hide_line_edit=False, line_edit_text=registers[current_register]) if register_dialog.exec_(): GDB_Engine.set_convenience_variable(current_register, register_dialog.get_values()) self.set_value(GDB_Engine.read_registers()[current_register])
def mouseDoubleClickEvent(self, QMouseEvent): registers = GDB_Engine.read_registers() current_flag = self.objectName().lower() label_text = "Enter the new value of flag " + self.objectName() register_dialog = InputDialogForm( item_list=[(label_text, ["0", "1", int(registers[current_flag])])]) if register_dialog.exec_(): GDB_Engine.set_register_flag(current_flag, register_dialog.get_values()) self.set_value(GDB_Engine.read_registers()[current_flag])
def refresh(self, int_address, offset): self.breakpoint_list.clear() hex_list = GDB_Engine.hex_dump(int_address, offset) self.data_array = hex_list breakpoint_list = GDB_Engine.get_breakpoint_info() for breakpoint in breakpoint_list: difference = int(breakpoint.address, 16) - int_address if difference < 0: continue size = breakpoint.size for i in range(size): self.breakpoint_list.add(difference + i) self.layoutChanged.emit()
def refresh(self, int_address, offset, data_array=None, breakpoint_info=None): int_address = SysUtils.modulo_address(int_address, GDB_Engine.inferior_arch) self.breakpoint_list.clear() if data_array is None: self.data_array = GDB_Engine.hex_dump(int_address, offset) else: self.data_array = data_array if breakpoint_info is None: breakpoint_info = GDB_Engine.get_breakpoint_info() for breakpoint in breakpoint_info: breakpoint_address = int(breakpoint.address, 16) for i in range(breakpoint.size): self.breakpoint_list.add(SysUtils.modulo_address(breakpoint_address + i, GDB_Engine.inferior_arch)) self.current_address = int_address self.layoutChanged.emit()
def test_read_registers(self): register_dict = GDB_Engine.read_registers() if GDB_Engine.inferior_arch == type_defs.INFERIOR_ARCH.ARCH_64: test_register = "rax" else: test_register = "eax" self.assertRegex(register_dict[test_register], common_regexes.hex_number.pattern)
def test_read_registers(self): register_dict = GDB_Engine.read_registers() if GDB_Engine.inferior_arch == type_defs.INFERIOR_ARCH.ARCH_64: test_register = "rax" else: test_register = "eax" self.assertRegex(register_dict[test_register], common_defs.regex_hex)
def mouseDoubleClickEvent(self, QMouseEvent): registers = GDB_Engine.read_registers() current_flag = self.objectName().lower() label_text = "Enter the new value of flag " + self.objectName( ) + "(0 or 1)" register_dialog = DialogWithButtonsForm( label_text=label_text, hide_line_edit=False, line_edit_text=registers[current_flag]) if register_dialog.exec_(): result = register_dialog.get_values().strip() if result == "0" or result == "1": GDB_Engine.set_register_flag(current_flag, register_dialog.get_values()) self.set_value(GDB_Engine.read_registers()[current_flag]) else: QMessageBox.information(self, "Error", "That's clearly not 0 or 1") return
def refresh(self, int_address, offset, data_array=None, breakpoint_info=None): int_address = SysUtils.modulo_address(int_address, GDB_Engine.inferior_arch) self.breakpoint_list.clear() if data_array is None: self.data_array = GDB_Engine.hex_dump(int_address, offset) else: self.data_array = data_array if breakpoint_info is None: breakpoint_info = GDB_Engine.get_breakpoint_info() for breakpoint in breakpoint_info: breakpoint_address = int(breakpoint.address, 16) for i in range(breakpoint.size): self.breakpoint_list.add( SysUtils.modulo_address(breakpoint_address + i, GDB_Engine.inferior_arch)) self.current_address = int_address self.layoutChanged.emit()
type=str, default="", help="Path of the preloaded .so file, only can be used with -c, optional") args = parser.parse_args() if args.a: process_list = SysUtils.search_in_processes_by_name(args.a) if not process_list: parser.error("There's no process with the name " + args.a) if len(process_list) > 1: for item in process_list: print(item.name()) print("There are more than one process with the name " + args.a) exit() pid = process_list[0].pid if not GDB_Engine.can_attach(pid): parser.error("Failed to attach to the process with pid " + str(pid)) GDB_Engine.attach(pid) elif args.c: if not GDB_Engine.create_process(args.c, args.o, args.l): parser.error("Couldn't create the process with current args") else: parser.error("Provide at least one of these arguments: -a or -c") import sys print(sys.argv) unittest.main(module="tests.GDB_Engine_tests", exit=False, argv=[""]) unittest.main(module="tests.SysUtils_tests", exit=False, argv=[""]) unittest.main(module="tests.GuiUtils_tests", exit=False, argv=[""]) GDB_Engine.detach()
help="Path of the preloaded .so file, only can be used with -c, optional") args = parser.parse_args() if args.a: process_list = SysUtils.search_in_processes_by_name(args.a) if not process_list: parser.error("There's no process with the name " + args.a) if len(process_list) > 1: for p in process_list: try: name = p.name() except psutil.NoSuchProcess: print("Process with pid", p.pid, "does not exist anymore") continue print(name) print("There are more than one process with the name " + args.a) exit() pid = process_list[0].pid if not GDB_Engine.can_attach(pid): parser.error("Failed to attach to the process with pid " + str(pid)) GDB_Engine.attach(pid) elif args.c: if not GDB_Engine.create_process(args.c, args.o, args.l): parser.error("Couldn't create the process with current args") else: parser.error("Provide at least one of these arguments: -a or -c") unittest.main(module="tests.GDB_Engine_tests", exit=False, argv=[""]) unittest.main(module="tests.SysUtils_tests", exit=False, argv=[""]) unittest.main(module="tests.GuiUtils_tests", exit=False, argv=[""]) GDB_Engine.detach()