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


Python unicorn.x86_const方法代码示例

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


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

示例1: unicorn_register

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import x86_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)) 
开发者ID:hugsy,项目名称:cemu,代码行数:23,代码来源:emulator.py

示例2: __init__

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import x86_const [as 别名]
def __init__(self, trace=True, sca_mode=False, local_vars={}):
        super().__init__(trace, sca_mode)
        self.emu = uc.Uc(uc.UC_ARCH_X86, uc.UC_MODE_64)
        self.disasm = cs.Cs(cs.CS_ARCH_X86, cs.CS_MODE_64)
        self.disasm.detail = True
        self.word_size = 8
        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.x86_const.UC_X86_REG_RIP

        # workaround for capstone 4
        uc.x86_const.UC_X86_REG_RFLAGS = uc.x86_const.UC_X86_REG_EFLAGS

        known_regs = [i[len('UC_X86_REG_'):] for i in dir(uc.x86_const) if '_REG' in i]
        self.reg_map = {r.lower(): getattr(uc.x86_const, 'UC_X86_REG_'+r) for r in known_regs}

        self.stubbed_functions = local_vars
        self.setup(sca_mode)

        self.reset_stack() 
开发者ID:Ledger-Donjon,项目名称:rainbow,代码行数:23,代码来源:x64.py

示例3: __init__

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import x86_const [as 别名]
def __init__(self, trace=True, sca_mode=False, local_vars={}):
        super().__init__(trace, sca_mode)
        self.emu = uc.Uc(uc.UC_ARCH_X86, uc.UC_MODE_32)
        self.disasm = cs.Cs(cs.CS_ARCH_X86, cs.CS_MODE_32)
        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.x86_const.UC_X86_REG_EIP

        known_regs = [i[len('UC_X86_REG_'):] for i in dir(uc.x86_const) if '_REG' in i]
        self.reg_map = {r.lower(): getattr(uc.x86_const, 'UC_X86_REG_'+r) for r in known_regs}

        self.stubbed_functions = local_vars
        self.setup(sca_mode)

        self.reset_stack() 
开发者ID:Ledger-Donjon,项目名称:rainbow,代码行数:20,代码来源:x86.py

示例4: __init__

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import x86_const [as 别名]
def __init__(self, *args, **kwargs):
        import unicorn.x86_const as csts
        self.regs = {
            "EAX": csts.UC_X86_REG_EAX, "EBX": csts.UC_X86_REG_EBX,
            "ECX": csts.UC_X86_REG_ECX, "EDI": csts.UC_X86_REG_EDI,
            "EDX": csts.UC_X86_REG_EDX, "ESI": csts.UC_X86_REG_ESI,
            "EBP": csts.UC_X86_REG_EBP, "ESP": csts.UC_X86_REG_ESP,
        }
        self.pc_reg_name = "EIP"
        self.pc_reg_value = csts.UC_X86_REG_EIP
        super(UcWrapCPU_x86_32, self).__init__(*args, **kwargs) 
开发者ID:cea-sec,项目名称:Sibyl,代码行数:13,代码来源:qemu.py

示例5: create_new_vm

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import x86_const [as 别名]
def create_new_vm(self) -> None:
        """
        Create a new VM, and sets up the hooks
        """
        arch, mode, endian = get_arch_mode("unicorn", self.root.arch)
        self.vm = unicorn.Uc(arch, mode | endian)
        self.vm.hook_add(unicorn.UC_HOOK_BLOCK, self.hook_block)
        self.vm.hook_add(unicorn.UC_HOOK_CODE, self.hook_code)
        self.vm.hook_add(unicorn.UC_HOOK_INTR, self.hook_interrupt)
        self.vm.hook_add(unicorn.UC_HOOK_MEM_WRITE, self.hook_mem_access)
        self.vm.hook_add(unicorn.UC_HOOK_MEM_READ, self.hook_mem_access)
        if is_x86(self.root.arch):
            self.vm.hook_add(unicorn.UC_HOOK_INSN, self.hook_syscall, None, 1, 0, unicorn.x86_const.UC_X86_INS_SYSCALL)
        return 
开发者ID:hugsy,项目名称:cemu,代码行数:16,代码来源:emulator.py

示例6: reset_stack

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import x86_const [as 别名]
def reset_stack(self):
        self.emu.reg_write(uc.x86_const.UC_X86_REG_RBP, self.STACK_ADDR)
        self.emu.reg_write(uc.x86_const.UC_X86_REG_RSP, self.STACK_ADDR) 
开发者ID:Ledger-Donjon,项目名称:rainbow,代码行数:5,代码来源:x64.py

示例7: reset_stack

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import x86_const [as 别名]
def reset_stack(self):
        self.emu.reg_write(uc.x86_const.UC_X86_REG_EBP, self.STACK_ADDR)
        self.emu.reg_write(uc.x86_const.UC_X86_REG_ESP, self.STACK_ADDR) 
开发者ID:Ledger-Donjon,项目名称:rainbow,代码行数:5,代码来源:x86.py


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