本文整理匯總了Python中unicorn.arm_const方法的典型用法代碼示例。如果您正苦於以下問題:Python unicorn.arm_const方法的具體用法?Python unicorn.arm_const怎麽用?Python unicorn.arm_const使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類unicorn
的用法示例。
在下文中一共展示了unicorn.arm_const方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: __init__
# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import arm_const [as 別名]
def __init__(self, *args, **kwargs):
import unicorn.arm_const as csts
self.regs = {
'CPSR': csts.UC_ARM_REG_CPSR, 'SPSR': csts.UC_ARM_REG_SPSR,
'R4': csts.UC_ARM_REG_R4, 'R5': csts.UC_ARM_REG_R5,
'R6': csts.UC_ARM_REG_R6, 'R1': csts.UC_ARM_REG_R1,
'R7': csts.UC_ARM_REG_R7, 'R0': csts.UC_ARM_REG_R0,
'R2': csts.UC_ARM_REG_R2, 'R3': csts.UC_ARM_REG_R3,
'R8': csts.UC_ARM_REG_R8, 'R15': csts.UC_ARM_REG_R15,
'R9': csts.UC_ARM_REG_R9, 'R14': csts.UC_ARM_REG_R14,
'R12': csts.UC_ARM_REG_R12, 'R13': csts.UC_ARM_REG_R13,
'R10': csts.UC_ARM_REG_R10, 'SL': csts.UC_ARM_REG_SL,
'R11': csts.UC_ARM_REG_R11, 'SP': csts.UC_ARM_REG_SP,
'SB': csts.UC_ARM_REG_SB, 'LR': csts.UC_ARM_REG_LR,
}
self.pc_reg_name = "PC"
self.pc_reg_value = csts.UC_ARM_REG_PC
super(UcWrapCPU_arml, self).__init__(*args, **kwargs)
示例2: unicorn_register
# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import arm_const [as 別名]
def unicorn_register(self, reg):
curarch = self.parent.arch
if is_x86(curarch):
return getattr(unicorn.x86_const, "UC_X86_REG_%s"%reg.upper())
if is_arm(curarch) or is_arm_thumb(curarch):
return getattr(unicorn.arm_const, "UC_ARM_REG_%s"%reg.upper())
if is_aarch64(curarch):
return getattr(unicorn.arm64_const, "UC_ARM64_REG_%s"%reg.upper())
# if is_ppc(curarch):
# return getattr(unicorn.ppc_const, "UC_PPC_REG_%s" % reg.upper())
if is_mips(curarch) or is_mips64(curarch):
return getattr(unicorn.mips_const, "UC_MIPS_REG_%s" % reg.upper())
if is_sparc(curarch) or is_sparc64(curarch):
return getattr(unicorn.sparc_const, "UC_SPARC_REG_%s" %reg.upper())
raise Exception("Cannot find register '%s' for arch '%s'" % (reg, curarch))
示例3: __init__
# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import arm_const [as 別名]
def __init__(self, trace=True, sca_mode=False, local_vars={}):
super().__init__(trace, sca_mode)
self.emu = uc.Uc(uc.UC_ARCH_ARM, uc.UC_MODE_ARM)
self.disasm = cs.Cs(cs.CS_ARCH_ARM, cs.CS_MODE_ARM | cs.CS_MODE_THUMB)
self.disasm.detail = True
self.word_size = 4
self.endianness = "little"
self.page_size = self.emu.query(uc.UC_QUERY_PAGE_SIZE)
self.page_shift = self.page_size.bit_length() - 1
self.pc = uc.arm_const.UC_ARM_REG_PC
known_regs = [i[len('UC_ARM_REG_'):] for i in dir(uc.arm_const) if '_REG' in i]
self.reg_map = {r.lower(): getattr(uc.arm_const, 'UC_ARM_REG_'+r) for r in known_regs}
self.stubbed_functions = local_vars
self.setup(sca_mode)
self.reset_stack()
示例4: __init__
# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import arm_const [as 別名]
def __init__(self, trace=True, sca_mode=False, local_vars={}):
super().__init__(trace, sca_mode)
self.emu = uc.Uc(uc.UC_ARCH_ARM, uc.UC_MODE_THUMB | uc.UC_MODE_MCLASS)
self.disasm = cs.Cs(cs.CS_ARCH_ARM, cs.CS_MODE_THUMB | cs.CS_MODE_MCLASS)
self.disasm.detail = True
self.word_size = 4
self.endianness = "little"
self.page_size = self.emu.query(uc.UC_QUERY_PAGE_SIZE)
self.page_shift = self.page_size.bit_length() - 1
self.pc = uc.arm_const.UC_ARM_REG_PC
known_regs = [i[len('UC_ARM_REG_'):] for i in dir(uc.arm_const) if '_REG' in i]
self.reg_map = {r.lower(): getattr(uc.arm_const, 'UC_ARM_REG_'+r) for r in known_regs}
self.stubbed_functions = local_vars
self.setup(sca_mode)
self.reset_stack()
# Force mapping of those addresses so that
# exception returns can be caught in the base
# block hook rather than a code fetch hook
self.map_space(0xfffffff0, 0xffffffff)
self.emu.hook_add(uc.UC_HOOK_INTR, self.intr_hook)
示例5: reset_stack
# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import arm_const [as 別名]
def reset_stack(self):
self.emu.reg_write(uc.arm_const.UC_ARM_REG_SP, self.STACK_ADDR)
示例6: _do_import
# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import arm_const [as 別名]
def _do_import(self):
if not self._import_done:
self._import_done = True
global Main
if not self.run_standalone:
from config import Main
global substage
global doit_manager
global substage
global staticanalysis
global ia
global pure_utils
global db_info
global utils
global unicorn_utils
global unicorn
global uniarm
global capstone
global caparm
global r2
import unicorn
import unicorn.arm_const as uniarm
import capstone
import capstone.arm as caparm
import r2_keeper as r2
import ia
if not self.run_standalone:
import substage, staticanalysis, doit_manager, db_info
import testsuite_utils as utils
import pure_utils
import unicorn_utils
if not self.run_standalone:
self.cc = Main.cc
self.stage_order = [Main.stages[0]] # default is first stage only
self._stages = {s.stagename: TargetStageData(s, self.bp_hooks)
for s in Main.stages}
else:
self.cc = "gcc"
self.stages = {}
self.stage_order = ["local"]
self.ia = ia.InstructionAnalyzer()