I am still going through the files you pointed to, but I want this option from your email:
"Do you want to use rasm api by providing its bytes" Basically pass in a chunk of bytes and then have it disassembled with the instruction/opcode context On Wed, Jul 17, 2013 at 12:59 PM, pancake <[email protected]> wrote: > Hi andrew, been busy irl. > > Sorry for the readme false hint. Will fix soon. > > You may like to read bokken source code as another source for python examples > using r2 api. > > Do you want to use rasm api by providing its bytes or just read binaries with > rcore like r2 does and call rasm api obeying the rules imposed by rbin > (arch/os/bits) and rio maps/sections? > > Im answering from phone right now, but you may find the test-asm.py example > which should assemble and disassemble an opcode. Just change the arch to arm > and bits to 16, 32 or 64. > > Ranal is used to analyze code. This is: extract low level information from > the opcode. > > To assemble/Disaseemble you should use the rasm api. > > Nope, the full r2 api is binded with ctypes and swig. No textual parsing is > required. The radare.py is there for historic reasons, but it shouldnt be > used for any serious task. > > I'll try to type some more examples and will commit them, so you can check > them for your needs. > > > On Jul 16, 2013, at 7:07, Andrew Case <[email protected]> wrote: > >> Thanks. Using the git version and the sys/python.sh I was able to get >> it installed with the Python bindings. >> >> Also, I got the --enable-devel and general process from the README >> file and its still mentioned in the last version of that file. >> >> And, I had another question(s) that hopefully you could help with. >> What I really want to use radare for is disasm of ARM instructions >> through python scripting. I am having trouble figuring out how to get >> it to work though.. >> >> I have read the documents for libr (e.g. >> http://radare.org/vdoc/libr/Radare.RAnal.Op.html ) and I see there are >> classes defined for them, but after grepping through the source code >> and using dir() throughout different parts of r2 python bindings, I >> still cannot find what I am supposed to be using. >> >> From what I see of other scripts throughout the git checkout, it seems >> like much of the python scripting is just calling out to radare and >> then getting back the text output. Is that the correct way to use it >> or is there a structured/API for the Python use? >> >> The only thing I really found close was "libr/lang/p/radare.py", but >> this seems to be based on radare v1. >> >> If you could just point me to the correct documents and some sample >> code to get the process started with the latest version of radare that >> would be great. >> >> On Mon, Jul 15, 2013 at 10:01 AM, pancake <[email protected]> wrote: >>> Various comments here: >>> >>> - in debian/arch/void/gentoo there are binary packages for those bindings (i >>> also built a version for windows too) >>> - it's recommended to use git version >>> - enable-devel is deprecated >>> - bindings are inside r2-bindings subdirectory >>> - r.py is just a r_core_cmd() wrapper api, not real api, just parses >>> commands text instead. >>> - current git have two different implementation of the python bindings, both >>> based on valabind (ctypes and swig) >>> - both implementations should be compatible and same code should run on both >>> - there are scripts in sys/*.sh to automate those builds >>> - You may like to run sys/python.sh >>> - the bindings are compiled by the farm (see bin.rada.re and ci.rada.re) >>> - "import radare" are the old text-based bindings for radare1 >>> - see r2-bindings/python/test-*.py to see some code examples. >>> - if you want to build bindings for windows see doc/windows >>> >>> Hope this helps :) >>> >>> Here's a sample program: >>> >>> from r2.r_bin import * >>> b = RBin () >>> b.load ("/bin/ls", False) >>> baddr= b.get_baddr () >>> print '-> Sections' >>> for i in b.get_sections (): >>> print 'offset=0x%08x va=0x%08x size=%05i %s' % ( >>> i.offset, baddr+i.rva, i.size, i.name) >>> >>> >>> >>> >>> On 07/15/13 04:20, Andrew Case wrote: >>>> >>>> Hello, >>>> >>>> I have compiled radare with python bindings following the instructions >>>> in the source code: >>>> >>>> ./configure --prefix=/usr --enable-devel --enable=python >>>> >>>> but I cannot import radare as it will error with being unable to find >>>> a module named 'r', which from reading docs and source code seems to >>>> be the module that drives everything. >>>> >>>> I did a search across disk and could not find a "r.py" file. >>>> >>>> Is there other documentation I should be following? >>>> _______________________________________________ >>>> radare mailing list >>>> [email protected] >>>> http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org >>> >>> _______________________________________________ >>> radare mailing list >>> [email protected] >>> http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org >> _______________________________________________ radare mailing list [email protected] http://lists.nopcode.org/listinfo.cgi/radare-nopcode.org
