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


Python unicorn.UC_HOOK_CODE属性代码示例

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


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

示例1: setup

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_HOOK_CODE [as 别名]
def setup(self, sca_mode):
        """ Sets up a stack and adds base hooks to the engine """
        ## Add a stack
        self.map_space(*self.STACK)

        ## Add hooks
        self.mem_unmapped_hook = self.emu.hook_add(uc.UC_HOOK_MEM_UNMAPPED, self.unmapped_hook)
        self.block_hook = self.emu.hook_add(uc.UC_HOOK_BLOCK, self.block_handler)
        if sca_mode:
            if (self.sca_HD):
                self.ct_hook = self.emu.hook_add(uc.UC_HOOK_CODE, self.sca_code_traceHD)
            else:
                self.ct_hook = self.emu.hook_add(uc.UC_HOOK_CODE, self.sca_code_trace)
            self.tm_hook = self.emu.hook_add(
                uc.UC_HOOK_MEM_READ | uc.UC_HOOK_MEM_WRITE, self.sca_trace_mem
            )
        else:
            self.code_hook = self.emu.hook_add(uc.UC_HOOK_CODE, self.code_trace)
            self.mem_access_hook = self.emu.hook_add( uc.UC_HOOK_MEM_READ | uc.UC_HOOK_MEM_WRITE, self.trace_mem) 
开发者ID:Ledger-Donjon,项目名称:rainbow,代码行数:21,代码来源:rainbow.py

示例2: setup_emulator

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_HOOK_CODE [as 别名]
def setup_emulator(self):
        # init register values
        for r in self.machine.initregs:
            regval = self.controller.get_reg_value(r, True)
            regnum = self.machine.get_reg_id(r)
            self.emu.reg_write(regnum, regval)

        mappings = self.machine.get_mappings()
        for m in mappings:
            self.emu.mem_map(m.start, m.size, unicorn.UC_PROT_ALL)
            bs = self.machine.read_memory(m.start, m.size)
            self.emu.mem_write(m.start, bs)
        self.emu.hook_add(unicorn.UC_HOOK_MEM_WRITE,
                          self.write_hook)
        self.emu.hook_add(unicorn.UC_HOOK_CODE,
                          self.i_hook)
        self.emu.hook_add(unicorn.UC_HOOK_MEM_READ_UNMAPPED |
                          unicorn.UC_HOOK_MEM_WRITE_UNMAPPED,
                            self.hook_mem_invalid)
        self.machine.hook_syscall(self.emu, self.hook_syscall) 
开发者ID:bx,项目名称:bootloader_instrumentation_suite,代码行数:22,代码来源:unicorn_trace.py

示例3: verbose_mode

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_HOOK_CODE [as 别名]
def verbose_mode(self):
        self.mu.hook_add(unicorn.UC_HOOK_MEM_READ_UNMAPPED, self.hook_mem_invalid)
        self.mu.hook_add(unicorn.UC_HOOK_CODE, self.hook_code) 
开发者ID:cea-sec,项目名称:Sibyl,代码行数:5,代码来源:qemu.py

示例4: create_new_vm

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_HOOK_CODE [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

示例5: set_breakpoint

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_HOOK_CODE [as 别名]
def set_breakpoint(self, line, hardware=True, temporary=False, regex=False, condition=None,
                       ignore_count=0, thread=0):
        """Insert a breakpoint.

        :param line:         address to break at
        :param hardware:     whether this breakpoint is hardware (ignored, always True)
        :param temporary:    whether this breakpoint is temporary (one shot)
        :param regex:        not supported
        :param condition:    not supported
        :param ignore_count: amount of times the breakpoint should be ignored before firing
        :param thread:       not supported
        :return: breakpoint number
        """
        if not hardware:
            self.log.warning('Software breakpoints are not supported, falling back to hardware')
        if regex:
            self.log.warning('Regex breakpoints are not supported, ignoring regex')
        if condition is not None:
            self.log.warning('Conditional breakpoints are not supported, ignoring condition')
        if thread:
            self.log.warning('Thread-specific breakpoints are not supported, ignoring thread')
        # TODO line <-> addr
        bkptno = len(self._breakpoints)
        hook = self.uc.hook_add(unicorn.UC_HOOK_CODE, self._breakpoint_hook, begin=line,
                                end=line, user_data=bkptno)
        self._breakpoints.append(UnicornBreakpoint(hooks=[hook], temporary=temporary,
                                                   ignore_count=ignore_count))
        return bkptno 
开发者ID:avatartwo,项目名称:avatar2,代码行数:30,代码来源:unicorn_protocol.py


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