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


Python unicorn.UC_MEM_WRITE属性代码示例

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


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

示例1: _forward_hook

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def _forward_hook(self, uc, access, address, size, value, user_data):
        """Unicorn hook for memory forwarding."""
        pc = self.read_register(self.arch.pc_name)
        if access == unicorn.UC_MEM_READ or access == unicorn.UC_MEM_FETCH:
            msg = RemoteMemoryReadMessage(self._origin, 0, pc, address, size)
            write_back = True
        elif access == unicorn.UC_MEM_WRITE:
            msg = RemoteMemoryWriteMessage(self._origin, 0, pc, address, value, size)
            write_back = False
        else:
            raise ValueError('Forward hook with unknown access {}'.format(access))

        self._avatar_queue.put(msg)
        value, success = self._rmp_queue.get()
        if not success:
            self.log.debug('Remote memory request returned 0x{:x}'.format(value))
        elif write_back and not self.write_memory(address, size, value):
            self.log.debug('Failed to write back remote memory') 
开发者ID:avatartwo,项目名称:avatar2,代码行数:20,代码来源:unicorn_protocol.py

示例2: hook_mem_access

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def hook_mem_access(self, uc, access, address, size, value, user_data):
        if self.loading_required_maps:
            return

        self.mem_access_count += 1

        if self.report:
            if access == unicorn.UC_MEM_WRITE:
                self.write_to_session(
                    '%s<strong>WRITE</strong> at <span style="color: #C36969">0x%x</span>, '
                    'data size = <strong>%u</strong>, '
                    'data value = <span style="color: #74AA7A">0x%x</span>' % (self.apix, address, size, value))
            else:
                try:
                    self.write_to_session('%s<strong>READ</strong> at <span style="color: #C36969">0x%x</span>,'
                                          ' data size = <strong>%u</strong>, '
                                          'data value = <span style="color: #74AA7A">0x%x</span>'
                                          % (self.apix, address, size, int(self.uc.mem_read(address, size).hex(), 16)))
                except Exception as e:
                    self.write_to_session('%sfailed to <strong>READ</strong> at '
                                          '<span style="color: #C36969">0x%x</span> - err: %s' % (
                                              self.apix, address, e)) 
开发者ID:iGio90,项目名称:frick,代码行数:24,代码来源:main.py

示例3: hook_mem_write

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def hook_mem_write(uc, access, address, size, value, userData):
    """
    Hook all memory read and write events. Count memory writes and record written address locations.
    :param uc: Unicorn object
    :param access: memory access type
    :param address: memory address
    :param size: memory address size
    :param value: memory value
    :param userData: user-provided data
    :return: None
    """
    eh = userData["EmuHelper"]
    pc = eh.getRegVal("pc")

    # only record and count memory writes, create write log
    if access == unicorn.UC_MEM_WRITE:
        # IMPROVEMENT store multiple locations where address was written
        userData["mem_writes"][address] = pc
        userData["mem_write_count"] += 1
        userData["writelog"].add((address, address + size)) 
开发者ID:fireeye,项目名称:flare-ida,代码行数:22,代码来源:ironstrings.py

示例4: hook_mem_access

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def hook_mem_access(self, emu, access, address, size, value, user_data):
        if access == unicorn.UC_MEM_WRITE:
            self.pprint("Write: *%#x = %#x (size = %u)"% (address, value, size), "Memory")
        elif access == unicorn.UC_MEM_READ:
            self.pprint("Read: *%#x (size = %u)" % (address, size), "Memory")
        return 
开发者ID:hugsy,项目名称:cemu,代码行数:8,代码来源:emulator.py

示例5: sca_trace_mem

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def sca_trace_mem(self, uci, access, address, size, value, user_data):
        """ Hook that stores memory accesses in side-channel mode. Stores read and written values """
        if self.mem_trace:
            if access == uc.UC_MEM_WRITE:
                self.sca_values_trace.append(value)
            else:
                self.sca_values_trace.append( int.from_bytes( uci.mem_read(address, size), self.endianness, signed=False)) 
开发者ID:Ledger-Donjon,项目名称:rainbow,代码行数:9,代码来源:rainbow.py

示例6: trace_mem

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def trace_mem(self, uci, access, address, size, value, user_data):
        """ Hook that shows a visual trace of memory accesses in the form '[address written to] <- value written' or 'value read <- [address read]' """
        if self.mem_trace:
            if address in self.OTHER_REGS_NAMES.keys():
                addr = self.OTHER_REGS_NAMES[address]
            else:
                addr = color("BLUE", f"0x{address:08x}")
            if access == uc.UC_MEM_WRITE:
                val = color("CYAN", f"{value:x}")
                print(f"  [{addr}] <- {val} ", end=" ")
            else:
                val = int.from_bytes(uci.mem_read(address, size), self.endianness)
                val = color("CYAN", f"{val:8x}")
                print(f"  {val} <- [{addr}]", end=" ") 
开发者ID:Ledger-Donjon,项目名称:rainbow,代码行数:16,代码来源:rainbow.py

示例7: gen_trace_state

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def gen_trace_state(self, instr_addr, access, mem_addr, prev_value, value, size):
        if access == UC_MEM_WRITE:
            state = namedtuple("MemState", 'instr_addr, access, mem_addr, prev_value, value, size')
            state.prev_value = prev_value
        else:
            state = namedtuple("MemState", 'instr_addr, access, mem_addr value, size')

        state.instr_addr = instr_addr
        state.access = access
        state.mem_addr = mem_addr
        state.value = value
        state.size = size

        return state 
开发者ID:RUB-SysSec,项目名称:syntia,代码行数:16,代码来源:tracer.py

示例8: add_trace

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def add_trace(self, instr_addr, access, mem_addr, prev_value, value, size):
        state = self.gen_trace_state(instr_addr, access, mem_addr, prev_value, value, size)

        self.append(state)

        if state.instr_addr not in self._instr_to_mem_states:
            self._instr_to_mem_states[state.instr_addr] = []
        self._instr_to_mem_states[state.instr_addr].append(state)

        if access == UC_MEM_WRITE:
            self._writes.append(state)
        else:
            self._reads.append(state) 
开发者ID:RUB-SysSec,项目名称:syntia,代码行数:15,代码来源:tracer.py

示例9: get_modified_writes

# 需要导入模块: import unicorn [as 别名]
# 或者: from unicorn import UC_MEM_WRITE [as 别名]
def get_modified_writes(mem_trace):
    differences = OrderedDict()

    for state in mem_trace:
        if state.access != UC_MEM_WRITE:
            continue
        if state.mem_addr not in differences:
            differences[state.mem_addr] = [state.prev_value, state.value, state.size]
        else:
            differences[state.mem_addr][1] = state.value

    return differences 
开发者ID:RUB-SysSec,项目名称:syntia,代码行数:14,代码来源:assembly_oracle.py


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