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="/bin/ls"
#path="/bin/ls"
core.bin.load (path, 0, 0, 0, 0, 0)
# 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 (None)
core.bin_load ("", 0)
 
a = core.cmd_str ("af @ entry0")
# show entrypoint
print ("Entrypoint : 0x%x"%(core.num.get ("entry0")))
print (core.cmd_str ("pd 12 @ entry0"))
 
a = core.cmd_str ("pdc @ entry0")
print a
# Load file in core
#core.config.set ("asm.arch", "x86");
#core.config.set ("asm.bits", "32");
#core.config.set ("asm.bits", "64");
core.config.set ("cfg.debug", "true")

f = core.file_open(dbgpath, False, 0)
#core.bin_load (None)
core.bin_load (path, 0)

# show entrypoint
print ("Entrypoint : 0x%x"%(core.num.get ("entry0")))

core.cmd0 ("dpa `i~^fd[1]`")
print (core.cmd_str ("dh native")) # TODO must be implicit
print (core.cmd_str ("dm"))
print (core.cmd_str ("dr="))
core.cmd0(".dr*")

for i in range(1,32):
	core.cmd0("ds")
	core.cmd0(".dr*")
	print (core.cmd_str ("pi 1 @ rip"))

print (core.cmd_str ("dc"))
print ("REASON IS %d"%(core.dbg.reason))
print ("SIGNUM IS %d"%(core.dbg.signum))
core.cmd0(".dr*")
print (core.cmd_str ("dr="))
Exemple #3
0
core = RCore()
#core.file_open("/bin/ls", False, 0)

# Detect sub-bins in fatmach0
path = "/tmp/fatmach0-3true"
#path="/bin/ls"
core.bin.load(path, 0, 0, 0, 0, 0)
print("Supported archs: %d" % core.bin.narch)

if core.bin.narch > 1:
    for i in range(0, core.bin.narch):
        core.bin.select_idx(i)
        info = core.bin.get_info()
        if 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 (None)
core.bin_load("", 0)

print("33+3 = ", core.num.math("33+3"))

# show entrypoint
print("Entrypoint : 0x%x" % (core.num.get("entry0")))
print(core.cmd_str("pd 12 @ entry0"))
core = RCore()
#core.file_open("/bin/ls", False, 0)

# Detect sub-bins in fatmach0
path="/tmp/fatmach0-3true"
path="/bin/ls"
core.bin.load (path, 0, 0, 0, 0, 0)
print ("Supported archs: %d"%core.bin.narch)

if core.bin.narch>1:
	for i in range (0,core.bin.narch):
		core.bin.select_idx (i)
		info = core.bin.get_info ()
		if 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 (None)
core.bin_load ("", 0)

print ("33+3 = ",core.num.math("33+3"));

# show entrypoint
print ("Entrypoint : 0x%x"%(core.num.get ("entry0")))
print (core.cmd_str ("pd 12 @ entry0"))
Exemple #5
0
# Load file in core
#core.config.set ("asm.arch", "x86");
#core.config.set ("asm.bits", "32");
#core.config.set ("asm.bits", "64");
core.config.set("cfg.debug", "true")

f = core.file_open(dbgpath, False, 0)
#core.bin_load (None)
core.bin_load(path, 0)

# show entrypoint
print("Entrypoint : 0x%x" % (core.num.get("entry0")))

core.cmd0("dpa `i~^fd[1]`")
print(core.cmd_str("dh native"))  # TODO must be implicit
print(core.cmd_str("dm"))
print(core.cmd_str("dr="))
core.cmd0(".dr*")

for i in range(1, 32):
    core.cmd0("ds")
    core.cmd0(".dr*")
    print(core.cmd_str("pi 1 @ rip"))

print(core.cmd_str("dc"))
print("REASON IS %d" % (core.dbg.reason))
print("SIGNUM IS %d" % (core.dbg.signum))
core.cmd0(".dr*")
print(core.cmd_str("dr="))
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 = "/bin/ls"
#path="/bin/ls"
core.bin.load(path, 0, 0, 0, 0, 0)
# 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 (None)
core.bin_load("", 0)

a = core.cmd_str("af @ entry0")
# show entrypoint
print("Entrypoint : 0x%x" % (core.num.get("entry0")))
print(core.cmd_str("pd 12 @ entry0"))

a = core.cmd_str("pdc @ entry0")
print a