当前位置: 首页>>代码示例>>Python>>正文


Python Analysis.set_address_view方法代码示例

本文整理汇总了Python中Analysis.set_address_view方法的典型用法代码示例。如果您正苦于以下问题:Python Analysis.set_address_view方法的具体用法?Python Analysis.set_address_view怎么用?Python Analysis.set_address_view使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Analysis的用法示例。


在下文中一共展示了Analysis.set_address_view方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: DisassemblerView

# 需要导入模块: import Analysis [as 别名]
# 或者: from Analysis import set_address_view [as 别名]

#.........这里部分代码省略.........
			self.view.commit_undo()

	def skip_and_return_zero(self, addr):
		instr = self.find_instr(addr)
		if instr != None:
			self.view.begin_undo()
			instr.patch_to_zero_return(self.data)
			self.view.commit_undo()

	def skip_and_return_value(self, addr):
		instr = self.find_instr(addr)
		if instr != None:
			value, ok = QInputDialog.getText(self, "Skip and Return Value", "Return value:", QLineEdit.Normal)
			if ok:
				try:
					value = int(value, 0)
				except:
					QMessageBox.critical(self, "Error", "Expected numerical address")
					return
	
			self.view.begin_undo()
			instr.patch_to_fixed_return_value(self.data, value)
			self.view.commit_undo()

	def view_in_hex_editor(self, addr):
		if not self.view.navigate("exe", addr):
			self.view.navigate("hex", addr)

	def show_address(self):
		if "address" in self.analysis.options:
			addr = False
		else:
			addr = True
		self.analysis.set_address_view(addr)

	def context_menu(self, addr):
		popup = QMenu()
		view_in_hex = popup.addAction("View in &hex editor")
		view_in_hex.triggered.connect(lambda : self.view_in_hex_editor(addr))
		view_in_hex.setShortcut(QKeySequence(Qt.Key_H))
		popup.addAction("Copy address", self.copy_address)
		enter_name_action = popup.addAction("Re&name symbol", self.enter_name)
		enter_name_action.setShortcut(QKeySequence(Qt.Key_N))
		undefine_name_action = popup.addAction("&Undefine symbol", self.undefine_name)
		undefine_name_action.setShortcut(QKeySequence(Qt.Key_U))
		show_address_action = popup.addAction("Show &address", self.show_address)
		show_address_action.setCheckable(True)
		show_address_action.setChecked("address" in self.analysis.options)
		popup.addSeparator()

		patch = popup.addMenu("&Patch")
		patch.addAction("Convert to NOP").triggered.connect(lambda : self.nop_out(addr))
		instr = self.find_instr(addr)
		if instr:
			if instr.is_patch_branch_allowed():
				patch.addAction("Never branch").triggered.connect(lambda : self.nop_out(addr))
				patch.addAction("Always branch").triggered.connect(lambda : self.always_branch(addr))
				patch.addAction("Invert branch").triggered.connect(lambda : self.invert_branch(addr))
			if instr.is_patch_to_zero_return_allowed():
				patch.addAction("Skip and return zero").triggered.connect(lambda : self.skip_and_return_zero(addr))
			if instr.is_patch_to_fixed_return_value_allowed():
				patch.addAction("Skip and return value...").triggered.connect(lambda : self.skip_and_return_value(addr))

		popup.exec_(QCursor.pos())

	def mousePressEvent(self, event):
开发者ID:0x31323334,项目名称:deprecated-binaryninja-python,代码行数:70,代码来源:DisassemblerView.py


注:本文中的Analysis.set_address_view方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。