rizinorg / rz-pipe

Access rizin via pipe from any programming language!
33 stars 11 forks source link

Disable some stdout message when using rzpipe #35

Closed xrkk closed 2 years ago

xrkk commented 2 years ago

When open some file with rizin, it might print a huge amount of messages like unimplemented ELF/PPC reloc type 22, which is very annoying. Can this be disabled?

When using rzpipe to open some file, there should be params to disable some output, so my important debug message won't be messed up with huge amount of rizin messages.

wargio commented 2 years ago

i belive those are on stderr, try with -2 parameter for rizin.

xrkk commented 2 years ago

i belive those are on stderr, try with -2 parameter for rizin.

With -2 cmdj returns nothing.

xrkk commented 2 years ago

BTW, this happends too with rizin command line, not only rzpipe.

wargio commented 2 years ago

weird, because -2 close stderr file descriptor (silent warning messages) does this which should silent all the eprintf can you share a snippet on how you use rzpipe ?

this is what i do with rzpipe: https://github.com/wargio/fufluns/blob/master/ios/ipa.py#L40

wargio commented 2 years ago

also i can't reproduce your issue with stderr

$ rizin -2
 -- Set 'e bin.dbginfo=true' to load debug information at startup.
[0x00000000]> zfd aaaa
[0x00000000]> q
$ rizin
 -- Change your fortune types with 'e cfg.fortunes.file=fun,tips' in your ~/.rizinrc
[0x00000000]> zfd aaaa
Can't open aaaa
[0x00000000]> q

which OS & version are you using

ret2libc commented 2 years ago

@xrkk Could you provide the full binary and the script you are using?

xrkk commented 2 years ago

@xrkk Could you provide the full binary and the script you are using?

I'm sorry, I was wrong. With rizin -2 d88fc28122885fcd34712f69127059fec9a3fdae1d44381016f187ec8d9c827a, the unimplemented ELF/PPC reloc type message disappears and command works fine.

Below is the file I tested. d88fc28122885fcd34712f69127059fec9a3fdae1d44381016f187ec8d9c827a.zip

But with below rzpipe code, the message still appears:

import rzpipe
rz = rzpipe.open("d88fc28122885fcd34712f69127059fec9a3fdae1d44381016f187ec8d9c827a")  # happens here
rz.cmd('Ps xxx.rzdb')

rz2 = rzpipe.open('--')
rz2.cmd('Po xxx.rzdb')  # happens here too.

Any workaround?

wargio commented 2 years ago

try with rz = rzpipe.open("d88fc28122885fcd34712f69127059fec9a3fdae1d44381016f187ec8d9c827a" flags=["-2"])

xrkk commented 2 years ago

flags=["-2"])

Oh, I forget this thing... Thank for your time. Closing it...