eset / ipyida

IPython console integration for IDA Pro

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Issues with IDA6.9 & Jupyter

tmr232 opened this issue · comments

I know that the project is not tested for this setting, but I decided to give it a go. Naturally, there are errors.

  1. IPython.kernel.zmq was changed to ipykernel
  2. IPython.qt.console and IPython.qt are both qtconsole now. This conflicts with the qtconsole.py found in this project.
  3. IDA 6.9 is using a custom version of PyQt5. This version does not have QtSvg.pyd. This causes the imports to fail.

While (1) and (2) are easy to solve, I am not sure how to handle (3).

Hi @tmr232,

Thanks for reporting the issue. I've created a separate issue (#2) regarding Jupyther. ipyida was only been tested with IPython 3.2.x (see https://github.com/eset/ipyida#ipython-version--40-jupyter-not-yet-tested).

I'm curious about (3). Can you send the full traceback? On what OS are you running IDA? It does require some hackish monkey-patching (

# QtSvg binairies are not bundled with IDA. So we monkey patch PySide to avoid
) but I've tested with 6.9 and it's running without import error. I'll try to reproduce when you send the details.

Ok, some results.

  1. When using IPython 3.2.3, all works well. So I guess the error is due to changes in Jupyter.
  2. The error is
    Could not load requested Qt binding. Please ensure that
    PyQt4 >= 4.7, PyQt5 or PySide >= 1.0.3 is available,
    and only one is imported per session.

    Currently-imported Qt library:   'pyqt5'
    PyQt4 installed:                 True
    PyQt5 installed:                 False
    PySide >= 1.0.3 installed:       False
    Tried to load:                   ['pyqt5']

Traceback (most recent call last):
  File "C:\Program Files (x86)\IDA 6.9\python\idaapi.py", line 601, in IDAPython_ExecScript
    execfile(script, g)
  File "C:/Users/tbahar/Code/ipyida/ipyida_plugin_stub.py", line 10, in <module>
    from ipyida.ida_plugin import PLUGIN_ENTRY, IPyIDAPlugIn
  File "C:\Python27\lib\site-packages\ipyida\ida_plugin.py", line 10, in <module>
    from ipyida import ida_qtconsole, kernel
  File "C:\Python27\lib\site-packages\ipyida\ida_qtconsole.py", line 45, in <module>
    from qtconsole.rich_jupyter_widget import RichJupyterWidget
  File "C:\Python27\lib\site-packages\qtconsole\rich_jupyter_widget.
  1. When using IPython 3.2.3, and IDA 6.9, all loads, but PyQt5.QtSvg is None.

I will probably add more data later, as I keep debugging it.

OK. Progress report.

Jupyter adds some import management code that, so I had to go around it with this ugly hack (there is probably a better solution)

import imp

find_module = imp.find_module
def my_find_module(name, path=None):
    if name == 'QtSvg':
        return True
    return find_module(name, path)
imp.find_module = my_find_module

Now that this is done, it seems that the kernel initialization code needs some changes to match Jupyter. Here is my current traceback:

Traceback (most recent call last):
  File "C:/Users/me/ipyida\ipyida\ida_qtconsole.py", line 72, in OnCreate
    layout = self._createConsoleWidget()
  File "C:/Users/me/ipyida\ipyida\ida_qtconsole.py", line 83, in _createConsoleWidget
    connection_file = find_connection_file(self.connection_file)
  File "C:\Python27\lib\site-packages\ipykernel\connect.py", line 81, in find_connection_file
    return jupyter_client.find_connection_file(filename, path=['.', security_dir])
  File "C:\Python27\lib\site-packages\jupyter_client\connect.py", line 188, in find_connection_file
    raise IOError("Could not find %r in %r" % (filename, path))
IOError: Could not find u'kernel-12720.json' in ['.', u'C:\\Users\\me\\.ipython\\profile_default\\security']

Maybe we can use the relevant code from https://github.com/james91b/ida_ipython? @james91b @marc-etienne