radare2-r2pipe icon indicating copy to clipboard operation
radare2-r2pipe copied to clipboard

Handle batched commands with python API

Open jmerdich opened this issue 8 years ago • 4 comments

Putting in commands with multiple parts (eg. foo.cmd('aa; axt foo')) desyncs at least the python API, as r2 sends a NULL as each command finishes, and r2pipe only expects one and stops reading there. Can we handle this or put a note somewhere obvious?

jmerdich avatar Oct 20 '17 16:10 jmerdich

That depends on the channel . With spawn is like this but will work on http and maybe in pipe mode too

On 20 Oct 2017, at 18:02, Jake Merdich [email protected] wrote:

Putting in commands with multiple parts (eg. foo.cmd('aa; axt foo')) desyncs at least the python API, as r2 sends a NULL as each command finishes, and r2pipe only expects one and stops reading there. Can we handle this or at put a note somewhere obvious?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.

radare avatar Oct 20 '17 17:10 radare

running ‘aa’ is not recommended, but this could be the reason why in some cases aa/aaa unsyncs the r2pipe communication

On 20 Oct 2017, at 19:20, Pancake Nopcode [email protected] wrote:

That depends on the channel . With spawn is like this but will work on http and maybe in pipe mode too

On 20 Oct 2017, at 18:02, Jake Merdich <[email protected] mailto:[email protected]> wrote:

Putting in commands with multiple parts (eg. foo.cmd('aa; axt foo')) desyncs at least the python API, as r2 sends a NULL as each command finishes, and r2pipe only expects one and stops reading there. Can we handle this or at put a note somewhere obvious?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/radare/radare2-r2pipe/issues/32, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-lrfF401An_Xnn7DKtby2g1DaGCMmks5suMQggaJpZM4QA4Uz.

radare avatar Oct 24 '17 14:10 radare

Actually, I was able to replicate it with any command with a semicolon, the aa was just an example. This was specifically on the python backend using e.g. r2pipe.open("/bin/ls") (can't remember which backend that is).

On Oct 24, 2017 10:57 AM, "radare" [email protected] wrote:

running ‘aa’ is not recommended, but this could be the reason why in some cases aa/aaa unsyncs the r2pipe communication

On 20 Oct 2017, at 19:20, Pancake Nopcode [email protected] wrote:

That depends on the channel . With spawn is like this but will work on http and maybe in pipe mode too

On 20 Oct 2017, at 18:02, Jake Merdich <[email protected] mailto:[email protected]> wrote:

Putting in commands with multiple parts (eg. foo.cmd('aa; axt foo')) desyncs at least the python API, as r2 sends a NULL as each command finishes, and r2pipe only expects one and stops reading there. Can we handle this or at put a note somewhere obvious?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/radare/radare2-r2pipe/issues/32>, or mute the thread < https://github.com/notifications/unsubscribe-auth/AA3-lrfF401An_ Xnn7DKtby2g1DaGCMmks5suMQggaJpZM4QA4Uz>.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/radare/radare2-r2pipe/issues/32#issuecomment-339019478, or mute the thread https://github.com/notifications/unsubscribe-auth/AGDRSaNEwgXN0pBOFH2oWMsSXW_nGkpMks5svfrhgaJpZM4QA4Uz .

jmerdich avatar Oct 24 '17 15:10 jmerdich

so the \0 terminator should be stripped down until the command ends, this can reuse the mutex logic to avoid printing that

but from your test i cant reproduce the issue, which OS are you running this?

also which version of r2

On 24 Oct 2017, at 17:05, Jake Merdich [email protected] wrote:

Actually, I was able to replicate it with any command with a semicolon, the aa was just an example. This was specifically on the python backend using e.g. r2pipe.open("/bin/ls") (can't remember which backend that is).

On Oct 24, 2017 10:57 AM, "radare" [email protected] wrote:

running ‘aa’ is not recommended, but this could be the reason why in some cases aa/aaa unsyncs the r2pipe communication

On 20 Oct 2017, at 19:20, Pancake Nopcode [email protected] wrote:

That depends on the channel . With spawn is like this but will work on http and maybe in pipe mode too

On 20 Oct 2017, at 18:02, Jake Merdich <[email protected] mailto:[email protected]> wrote:

Putting in commands with multiple parts (eg. foo.cmd('aa; axt foo')) desyncs at least the python API, as r2 sends a NULL as each command finishes, and r2pipe only expects one and stops reading there. Can we handle this or at put a note somewhere obvious?

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub < https://github.com/radare/radare2-r2pipe/issues/32>, or mute the thread < https://github.com/notifications/unsubscribe-auth/AA3-lrfF401An_ Xnn7DKtby2g1DaGCMmks5suMQggaJpZM4QA4Uz>.

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/radare/radare2-r2pipe/issues/32#issuecomment-339019478, or mute the thread https://github.com/notifications/unsubscribe-auth/AGDRSaNEwgXN0pBOFH2oWMsSXW_nGkpMks5svfrhgaJpZM4QA4Uz .

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/radare/radare2-r2pipe/issues/32#issuecomment-339022353, or mute the thread https://github.com/notifications/unsubscribe-auth/AA3-luvdJz4MJ5cH1ldVmG-tEMf27Jymks5svfzJgaJpZM4QA4Uz.

radare avatar Oct 24 '17 16:10 radare