I have written a small module in python to enable python applications by
adding a radare-remote interface using TCP. That is by wrapping the
basic IO operations+system thru the network.

You can make your favorite python debugger be controlled by radare
easily (read vtrace or py-ptrace(pygdb)) or any other (like ero's bochs
+python) in a very simple way:

Here's the source:

---

import radapy
from string import *

PORT = 9999

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):
        print "READ %d bytes from %d\n"% (len, radapy.offset)
        str = "patata"
        str = str[radapy.offset:]
        return str


# main

#radapy.handle_cmd_open = fun_open
#radapy.handle_cmd_close = fun_close
radapy.handle_cmd_system = fun_system
radapy.handle_cmd_read = fun_read
radapy.handle_cmd_write = fun_write
radapy.size = 10

radapy.listen_tcp (PORT)

---

As you see this task is as stupid as it seems. so feel happy to extend
your favorite apps with radapy!

For the other side just use:

 radare connect://<ip>:<port>/<file>

And that is!

I will extend the radare python api to enable applications to interact
with radare externally and be able to use all the radare features
externally.

The idea is to enable radare interact with python in different ways:

- internally (used as scripting from radare)
- externally (managing radare from python outside the shell)
- remotely   (using radare remote api from/to the core)
- extending  (extending the core with python hooks)
- exornally  (weird word..but that is like an exokernel using external
python scripts to interact with the core)

I hope to finish all these bindings and write the proper documentation
for the book.

Enjoy!

PD: Thanks to the ppl who joined the hackaton the past tuesday night :)
The OSX support is nicer thanks to the job done by revenge by
integrating a MACHO parser and Nibble for the PE one. For me i just
fixed some points of the TODO by enabling 64bit support for the network
protocol.

--pancake
_______________________________________________
radare mailing list
[email protected]
http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org

Reply via email to