mirror of
https://github.com/radareorg/radare.git
synced 2026-11-08 17:43:16 -10:00
language binding APIs (python/ruby/perl/...) * Update TODO file --HG-- rename : src/plug/hack/perl/Radare/Remote.pm => api/perl/Radare/Remote.pm rename : src/plug/hack/perl/test.pl => api/perl/test.pl rename : src/plug/hack/radare.py => api/python/radare/api.py rename : src/plug/hack/ruby/Makefile => api/ruby/Makefile rename : src/plug/hack/ruby/radare/api.rb => api/ruby/radare/api.rb rename : src/plug/hack/ruby/radare/remote.rb => api/ruby/radare/remote.rb rename : src/plug/hack/ruby/test.rb => api/ruby/server.rb
44 lines
778 B
Python
44 lines
778 B
Python
#!/usr/bin/python
|
|
#
|
|
# python example using the radapy (remote radare API for python)
|
|
#
|
|
# -- pancake // nopcode .org
|
|
#
|
|
|
|
import radare.remote
|
|
from string import *
|
|
|
|
PORT = 8888
|
|
|
|
def fun_system(str):
|
|
print "CURRENT SEEK IS %d"%radapy.offset
|
|
return str
|
|
|
|
def fun_open(file,flags):
|
|
return str
|
|
|
|
def fun_seek(off,type):
|
|
return str
|
|
|
|
def fun_write(buf):
|
|
print "WRITING %d bytes (%s)"%(len(buf),buf)
|
|
return 6
|
|
|
|
def fun_read(len):
|
|
global rs
|
|
print "READ %d bytes from %d\n"% (len, rs.offset)
|
|
str = "patata"
|
|
str = str[rs.offset:]
|
|
return str
|
|
|
|
# main
|
|
|
|
#radapy.handle_cmd_open = fun_open
|
|
#radapy.handle_cmd_close = fun_close
|
|
rs = radare.remote.RapServer()
|
|
rs.handle_cmd_system = fun_system
|
|
rs.handle_cmd_read = fun_read
|
|
rs.handle_cmd_write = fun_write
|
|
rs.size = 10
|
|
rs.listen_tcp (PORT)
|