1 Star 1 Fork 0

Python3WebSpider/AndroidNativeEmu

加入 Gitee
与超过 1400万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
该仓库未声明开源许可证文件(LICENSE),使用请关注具体项目描述及其代码上游依赖。
克隆/下载
debug_utils.py 1.63 KB
一键复制 编辑 原始数据 按行查看 历史
AeonLucid 提交于 2020-05-09 16:16 +08:00 . Added more syscalls
import logging
from unicorn.arm_const import *
logger = logging.getLogger(__name__)
def hook_code(mu, address, size, user_data):
instruction = mu.mem_read(address, size)
instruction_str = ''.join('{:02x} '.format(x) for x in instruction)
logger.debug('# Tracing instruction at 0x%x, instruction size = 0x%x, instruction = %s' %
(address, size, instruction_str))
if instruction == b"\x00\x00\x00\x00":
logger.error("Uh oh, we messed up.")
mu.emu_stop()
def hook_block(mu, address, size, user_data):
instruction = mu.mem_read(address, size)
instruction_str = ''.join('{:02x} '.format(x) for x in instruction)
logger.debug('# Block at 0x%x, instruction size = 0x%x, instruction = %s' %
(address, size, instruction_str))
def hook_unmapped(mu, access, address, length, value, context):
pc = mu.reg_read(UC_ARM_REG_PC)
logger.debug("mem unmapped: pc: %x access: %x address: %x length: %x value: %x" %
(pc, access, address, length, value))
mu.emu_stop()
return True
def hook_mem_write(uc, access, address, size, value, user_data):
pc = uc.reg_read(UC_ARM_REG_PC)
logger.debug(">>> Memory WRITE at 0x%x, data size = %u, data value = 0x%x, pc: %x" % (address, size, value, pc))
def hook_mem_read(uc, access, address, size, value, user_data):
pc = uc.reg_read(UC_ARM_REG_PC)
data = uc.mem_read(address, size)
logger.debug(">>> Memory READ at 0x%x, data size = %u, pc: %x, data value = 0x%s" % (address, size, pc, data.hex()))
def hook_interrupt(uc, intno, data):
logger.debug(">>> Triggering interrupt %d" % intno)
return
Loading...
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化
Python
1
https://gitee.com/python3webspider/AndroidNativeEmu.git
git@gitee.com:python3webspider/AndroidNativeEmu.git
python3webspider
AndroidNativeEmu
AndroidNativeEmu
master

搜索帮助