zerotypic / ipyida

IPython console integration for IDA Pro
Other
2 stars 0 forks source link

iPython console breaks some of IDA's default console functionality #3

Open gaasedelen opened 3 years ago

gaasedelen commented 3 years ago

I've noticed that the iPython console seems to break/change at least some of IDA's console functionality. Specifically, I've noticed that the default IDA console/output window no longer prints the result of a statement being evaluated.

eg, this is what IDA does normally:

Python>idaapi.get_screen_ea()
0x1801c5977

But with iPython running/installed, the address does not get printed out. It seems that iPython is swallowing these prints or something. Also, related (or maybe a side effect?) is that the IDA console will no longer print integers as hex by default. I think this was maybe some hook they had on STDOUT but I am not sure.

zerotypic commented 3 years ago

I've noticed the console not working properly as well. Suspect its due to some of the rewiring of stdout that's being done in kernel.py; might be it doesn't work properly in newer versions of IDA/ipython. Might be OS-specific too.

gaasedelen commented 3 years ago

FYI this is where IDA hooks the python interpreter display hook: https://github.com/idapython/src/blob/17a1c5445736e9f1967ee392e140c39abd6d949c/pywraps/py_idaapi.py#L780

This is where they install a proxy on interpreters stdout stream: https://github.com/idapython/src/blob/5958995d66c7446bdbc8fcc1914b022511f8bdb4/python/init.py#L102

I think that should give you some direction, if you want to tinker around with kernel.py's hooking of the streams...

zerotypic commented 3 years ago

Thanks! I might give it a look, but I'm busy with another project right now. I'll let you know when I start digging into it.