21.3 Debugging with bochs and python

radare can be easily adapted to be a frontend for other debuggers. Ero Carrera has written a python interface for instrumentating bochs. Having python embedded on a debugger is just simple to use radare as a frontend to launch scripts.

So, understand this bochs implementation as simple as for the immunity debugger or vtrace. for example :)

The magic resides in the 'radapy.py' python module included in the scripts/ directory of the sources. It should be installed in the /usr/lib/python2.5 or similar directory, so you can type from any python console "import radapy" to test it.

$ python
>>> import radapy

This module implements a python version of the network protocol of radare to be used together with connect://.

There's also another python module called 'radapy_bochs' which implements the interface of radapy to interact between ero's python-bochs instrumentation api and a remote radare. The port can be configured if we just call 'radapy.listen_tcp( PORT )' from the bochs-python console.

To open the debugger interface in radare we just have to append 'dbg://' to the end of the 'connect://' uri.