示例#1
0
    def __init__(self, csh, all_info, arch):
        self.id = all_info.id
        self.address = all_info.address
        self.size = all_info.size
        self.mnemonic = all_info.mnemonic[:]    # copy string
        self.op_str = all_info.op_str[:]    # copy string
        self.regs_read = all_info.regs_read[:all_info.regs_read_count]
        self.regs_write = all_info.regs_write[:all_info.regs_write_count]
        self.groups = all_info.groups[:all_info.groups_count]
        self.bytes = bytearray(all_info.bytes)[:self.size]

        if arch == CS_ARCH_ARM:
            (self.cc, self.update_flags, self.writeback, self.operands) = \
                arm.get_arch_info(all_info.arch.arm)
        elif arch == CS_ARCH_ARM64:
            (self.cc, self.update_flags, self.writeback, self.operands) = \
                arm64.get_arch_info(all_info.arch.arm64)
        elif arch == CS_ARCH_X86:
            (self.prefix, self.segment, self.opcode, self.op_size, self.addr_size, \
             self.disp_size, self.imm_size, self.modrm, self.sib, self.disp, \
             self.sib_index, self.sib_scale, self.sib_base, self.operands) = x86.get_arch_info(all_info.arch.x86)
        elif arch == CS_ARCH_MIPS:
             self.operands = mips.get_arch_info(all_info.arch.mips)

        self.csh = csh
示例#2
0
 def __gen_detail(self):
     arch = self._cs.arch
     detail = self._raw.detail.contents
     if arch == CS_ARCH_ARM:
         (self.cc, self.update_flags, self.writeback, self.operands) = \
             arm.get_arch_info(detail.arch.arm)
     elif arch == CS_ARCH_ARM64:
         (self.cc, self.update_flags, self.writeback, self.operands) = \
             arm64.get_arch_info(detail.arch.arm64)
     elif arch == CS_ARCH_X86:
         (self.prefix, self.segment, self.opcode, self.op_size, self.addr_size, \
             self.disp_size, self.imm_size, self.modrm, self.sib, self.disp, \
             self.sib_index, self.sib_scale, self.sib_base, self.operands) = x86.get_arch_info(detail.arch.x86)
     elif arch == CS_ARCH_MIPS:
             self.operands = mips.get_arch_info(detail.arch.mips)
     elif arch == CS_ARCH_PPC:
         (self.bc, self.bh, self.update_cr0, self.operands) = \
             ppc.get_arch_info(detail.arch.ppc)
示例#3
0
文件: capstone.py 项目: zunc/binflow
 def __gen_detail(self):
     arch = self._cs.arch
     detail = self._raw.detail.contents
     if arch == CS_ARCH_ARM:
         (self.cc, self.update_flags, self.writeback, self.operands) = \
             arm.get_arch_info(detail.arch.arm)
     elif arch == CS_ARCH_ARM64:
         (self.cc, self.update_flags, self.writeback, self.operands) = \
             arm64.get_arch_info(detail.arch.arm64)
     elif arch == CS_ARCH_X86:
         (self.prefix, self.segment, self.opcode, self.op_size, self.addr_size, \
             self.disp_size, self.imm_size, self.modrm, self.sib, self.disp, \
             self.sib_index, self.sib_scale, self.sib_base, self.operands) = x86.get_arch_info(detail.arch.x86)
     elif arch == CS_ARCH_MIPS:
         self.operands = mips.get_arch_info(detail.arch.mips)
     elif arch == CS_ARCH_PPC:
         (self.bc, self.bh, self.update_cr0, self.operands) = \
             ppc.get_arch_info(detail.arch.ppc)