Python unicorn.UC_MODE_32 Examples

The following are 2 code examples of unicorn.UC_MODE_32(). You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may also want to check out all available functions/classes of the module unicorn , or try the search function .
Example #1
Source File: x86.py    From rainbow with GNU Lesser General Public License v3.0 6 votes vote down vote up
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() 
Example #2
Source File: unicorn_trace.py    From bootloader_instrumentation_suite with MIT License 5 votes vote down vote up
def __init__(self):
        Emulator.__init__(self, "X86",
                          unicorn.UC_ARCH_X86, unicorn.UC_MODE_32,
                          "eip",
                          32,
                          ["esp", "eip", "gs", "fs", "ds"
                           ])
        # "ss", "cs", "ds", "es",

        self.syscall_regnames = ["edi", "esi", "ecx", "edx",
                                 "ebx", "eax", "ebp", "esp"]
        self.stackbot = "ebp"
        self.stacktop = "esp"