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