eset / ipyida

IPython console integration for IDA Pro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

expression results only printed to Jupyter console

skochinsky opened this issue · comments

IDA: 7.7.220218 Windows x64 (32-bit address size)
IPyIDA: 1.7.2 from pypi.org
Windows: 10 x64.

Once IPyIDA is loaded, results of expressions entered in the Python prompt at the bottom of IDA's Output window are only printed in the Jupyter console and not in the Output window itself (as happens without plugin). One has to use print() or msg() to see the output.

Hi @skochinsky,

Thanks for reporting the issue. I was able to reproduce on the Mac version of IDA has well. IPyIDA must monkey-patches sys.stdout, which is also monkey-patches by IDAPython. It seems IPython also messes with sys.displayhook which I think where the problem it.

In [3]: sys.displayhook
Out[3]: <ipykernel.displayhook.ZMQShellDisplayHook at 0x11e8d14c0>

I'll include a fix in the next release that will properly handle the displayhook change so it doesn't break IDAPython's.

Cheers,
M-E

I had the same issue a while back and was able to patch it. I'm including my patch in case any one wants to fix the issue until the next release. The patch fixes the following issues:

  1. Fix "Task was destroyed but it is pending!" message that shows up in the console on startup
  2. Console output to the IPython console stops working after closing and opening an IDA file. It works correctly the first time. The issue appears to be due to the console being restored back on closing the file, and then not being reinitialized on opening
    the second file.
  3. Once the iPython console is started, if you enter a variable or expression in the built-in console, the output is sent to the iPython console.
  4. Once the iPython console is started, any "print" statements are output to both consoles. I fixed the issue so that each console output is independent of the other.
  5. While running the text version of IDA Pro (idat), this plugin was generating an exception on startup.

This is NOT an official patch and may not work with your version of IDA. I've only tested it on 7.7

ipyida-rohitab.patch.zip