rizin/r2-bindings/python/test-r_core.py
pancake 1e52015eee Add px[QW], fix segmented io and handle ! pipes
Handle `!` with r_core_cmd_str_pipe
Fix 'afl' output
Add help for 'px' command
Add pxQ and pxW to show one word per line
Fix segmented io with maps and sections
Some test cases got fixed
Add test-r_anal.py
2012-10-25 12:55:28 +02:00

34 lines
785 B
Python
Executable file

#!/usr/bin/python2
#
# Python example for using loading fatmach0 binaries
# test file:
# http://radare.org/get/bin/fatmach0-3true
import sys
try:
from r_core import RCore
except:
from r2.r_core import RCore
core = RCore()
#core.file_open("/bin/ls", False, 0)
# Detect sub-bins in fatmach0
path="/tmp/fatmach0-3true"
core.bin.load (path, 0)
print ("Supported archs: %d"%core.bin.narch)
for i in range (0,core.bin.narch):
core.bin.select_idx (i)
info = core.bin.get_info ()
print ("%d: %s %s"%(i,info.arch,info.bits))
# Load file in core
core.config.set ("asm.arch", "x86");
core.config.set ("asm.bits", "32");
#core.config.set ("asm.bits", "64");
f = core.file_open(path, False, 0)
core.bin_load ("")
# show entrypoint
print ("Entrypoint : 0x%x"%(core.num.get ("entry0")))