Exemplo n.º 1
0
    raise RuntimeError(
        f"Failed to identify any buffers passed to syscalls for process(es): {', '.join(procnames_of_interest)}"
    )

# 3) Now we know where the buffers are. Analyze the recording again to identify the last write to each

# No longer need syscalls2 callbacks
panda.unload_plugin("syscalls2")

instr_counts = [hex(truple[0][2]) for truple in identified_buffers.values()]
panda.load_plugin(
    "memorymap",
    {"instr_counts": "-".join(instr_counts)})  # Get base address of target

# Turn on memory callbacks so virtual_mem_before_write works
panda.enable_memcb()

# update the program counter within basic blocks
panda.enable_precise_pc()

# XXX: PRI only supports 32-bit linux :( Leaving this disabled
# Use PRI to map program counters back to line numbers. Note these arguments correspond to the target
#panda.load_plugin("pri")
#panda.load_plugin("pri_dwarf", {"proc":"test", "h_debugpath": "./target/", "g_debugpath": "/root/target/" })
# PRI isn't well supported by the python interface, tell cffi all it needs to know
#header = """
#typedef struct { const char *filename; const char *funct_name; unsigned long line_number; } SrcInfo;
#int pri_get_pc_source_info (CPUState *env, target_ulong pc, SrcInfo *info);
#"""
#ffi.cdef(header)