radareorg / radare2-bindings

Bindings of the r2 api for Valabind and friends
GNU Lesser General Public License v3.0
131 stars 92 forks source link

Switch python bin plugin to memoryview #217

Closed aronsky closed 5 years ago

aronsky commented 5 years ago

Use a MemoryView in check_bytes and accesses to RBuffer->buf->buf.

Note: the function init_pybinfile_module was not called anywhere, and the module was unusable (the type wasn't initialized properly). I'm calling it in the initialization code of the bin plugin now.

Also, the signature of py_anal was changed in the newest radare2, so I updated it (unrelated to the subject of this PR).

aronsky commented 5 years ago

Not sure what causes the failure in Travis... :/

XVilka commented 5 years ago

@aronsky see RBuffer definition: https://github.com/radare/radare2/blob/master/libr/include/r_util/r_buf.h#L11

It was on made on purpose to force everyone to use RBuffer API instead of direct dereference of its contents.

aronsky commented 5 years ago

Ah, OK. SO this has nothing to do with my changes :)

aronsky commented 5 years ago

After the recent updates, all the tests pass correctly. Any reason not to merge this?

radare commented 5 years ago

None :) merged!

Could you add some more example scripts?

aronsky commented 5 years ago

None :) merged!

Thanks!

Could you add some more example scripts?

In the book, for writing Python asm/anal/bin plugins?

radare commented 5 years ago

in the examples directory

On 14 Apr 2019, at 14:11, Lev Aronsky notifications@github.com wrote:

None :) merged!

Thanks!

Could you add some more example scripts?

In the book, for writing Python asm/anal/bin plugins?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/radare/radare2-bindings/pull/217#issuecomment-482960946, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-luDFMpMdB66jBqwWbLYcetoCnEXuks5vgxsOgaJpZM4b4cmI.

aronsky commented 5 years ago

I'll be happy to add examples, but I can find the relevant directory neither in this repo, nor in the main one. I see Python examples in r2pipe, but they aren't relevant to these Python bindings, AFAIK...

radare commented 5 years ago

Create the directory if it doesnt exist. well, if the examples relay on r2pipe should be theree, if they depend on r2lang, should be in here

On 16 Apr 2019, at 10:33, Lev Aronsky notifications@github.com wrote:

I'll be happy to add examples, but I can find the relevant directory neither in this repo, nor in the main one. I see Python examples in r2pipe, but they aren't relevant to these Python bindings, AFAIK...

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/radare/radare2-bindings/pull/217#issuecomment-483564991, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-ltumlS1fspAeLJcwTiGnJmIqi3Dfks5vhYrOgaJpZM4b4cmI.