當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。