當前位置: 首頁>>代碼示例>>Python>>正文


Python unicorn.UC_MODE_ARM屬性代碼示例

本文整理匯總了Python中unicorn.UC_MODE_ARM屬性的典型用法代碼示例。如果您正苦於以下問題:Python unicorn.UC_MODE_ARM屬性的具體用法?Python unicorn.UC_MODE_ARM怎麽用?Python unicorn.UC_MODE_ARM使用的例子?那麽, 這裏精選的屬性代碼示例或許可以為您提供幫助。您也可以進一步了解該屬性所在unicorn的用法示例。


在下文中一共展示了unicorn.UC_MODE_ARM屬性的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: __init__

# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import UC_MODE_ARM [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() 
開發者ID:Ledger-Donjon,項目名稱:rainbow,代碼行數:20,代碼來源:arm.py

示例2: __init__

# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import UC_MODE_ARM [as 別名]
def __init__(self, trace=True, sca_mode=False, local_vars=[]):
        super().__init__(trace, sca_mode)
        self.emu = uc.Uc(uc.UC_ARCH_ARM64, uc.UC_MODE_ARM)
        self.disasm = cs.Cs(cs.CS_ARCH_ARM64, cs.CS_MODE_ARM)
        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.arm64_const.UC_ARM64_REG_PC

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

        self.stubbed_functions = local_vars
        self.setup(sca_mode)
        
        self.reset_stack() 
開發者ID:Ledger-Donjon,項目名稱:rainbow,代碼行數:20,代碼來源:aarch64.py

示例3: __init__

# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import UC_MODE_ARM [as 別名]
def __init__(self):
        Emulator.__init__(self, "ARM64",
                          unicorn.UC_ARCH_ARM64,
                          unicorn.UC_MODE_ARM,
                          "pc",
                          64,
                          ["sp", "cpsr"])
        self.syscall_regnames = map(lambda x: "x%d" % x, range(0, 8)) + ["x8",
                                                                         "pc"]
        self.stackbot = "fp"
        self.stacktop = "sp"
        self.syscall_reg = "x8" 
開發者ID:bx,項目名稱:bootloader_instrumentation_suite,代碼行數:14,代碼來源:unicorn_trace.py

示例4: __init__

# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import UC_MODE_ARM [as 別名]
def __init__(self):
        super(Arm, self).__init__()
        self.unicorn_arch = unicorn.UC_ARCH_ARM
        self.unicorn_mode = unicorn.UC_MODE_ARM
        self.capstone_arch = capstone.CS_ARCH_ARM
        self.capstone_mode = capstone.CS_MODE_ARM 
開發者ID:iGio90,項目名稱:frick,代碼行數:8,代碼來源:main.py

示例5: __init__

# 需要導入模塊: import unicorn [as 別名]
# 或者: from unicorn import UC_MODE_ARM [as 別名]
def __init__(self, controller, r, stage):
        # controller.gdb_print("creating longwrite break\n")
        self.emptywrite = {'start': None,
                           'end': None,
                           'pc': None}
        self.writeinfo = self.emptywrite
        self.breakaddr = r['breakaddr']
        self.contaddr = r['contaddr']
        self.writeaddr = r['writeaddr']
        self.thumb = r['thumb']
        r2.gets(stage.elf, "s 0x%x" % self.writeaddr)
        if self.thumb:
            self.emu = unicorn.Uc(unicorn.UC_ARCH_ARM, unicorn.UC_MODE_THUMB)
            r2.gets(stage.elf, "ahb 16")
            r2.gets(stage.elf, "e asm.bits=16")
            self.cs = capstone.Cs(capstone.CS_ARCH_ARM, capstone.CS_MODE_THUMB)
        else:
            self.emu = unicorn.Uc(unicorn.UC_ARCH_ARM, unicorn.UC_MODE_ARM)
            r2.gets(stage.elf, "ahb 32")
            r2.gets(stage.elf, "e asm.bits=32")
            self.cs = capstone.Cs(capstone.CS_ARCH_ARM, capstone.CS_MODE_ARM)
        r2.get(stage.elf, "pdj 1")

        self.cs.detail = True
        self.info = staticanalysis.LongWriteInfo(stage.elf, r['start'],
                                                 r['end'], self.thumb)
        self.inss = []
        self.regs = set()
        self.bytes = b""
        self.dst_addrs = []
        self.write_size = r['writesize']
        for i in self.info.bbs:
            self.inss.append(i)
            bs = i["bytes"].decode("hex")
            self.bytes += b"%s" % bs
            ci = next(self.cs.disasm(bs, i["offset"], 1))
            if i["offset"] == self.writeaddr:
                self.write_ins = ci
            (read, write) = ci.regs_access()
            for rs in (read, write):
                self.regs.update([ci.reg_name(rn).encode('ascii') for rn in rs])
        self.emu.mem_map(0, 0xFFFFFFFF + 1, unicorn.UC_PROT_ALL)
        self.emu.mem_write(self.inss[0]["offset"], self.bytes)
        self.emu.hook_add(unicorn.UC_HOOK_MEM_WRITE, self.write_hook)
        self.spec = "*(0x%x)" % r['breakaddr']
        TargetBreak.__init__(self, self.spec, controller, True, stage, r=r) 
開發者ID:bx,項目名稱:bootloader_instrumentation_suite,代碼行數:48,代碼來源:gdb_tools.py


注:本文中的unicorn.UC_MODE_ARM屬性示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。