zerotypic / ipyida

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

Print address-looking numbers as Hex addresses #5

Open gaasedelen opened 3 years ago

gaasedelen commented 3 years ago

We should hook the iPython console output to print integers that fall within IDB segments as addresses.

eg:

In [4]: idaapi.get_screen_ea()
Out[4]: 5372018224

should print out 0x140327e30 instead.

It would also be nice to make these clickable, like the default IDA console.

gaasedelen commented 3 years ago

I made addresses clickable, but we should probably try to resolve #3 before implementing the other part of this issue (print integers as hex). It's possible fixing #3 may resolve this issue too.

zerotypic commented 3 years ago

I've gotten ints printed as hex using this line in my .ipyidarc:

get_ipython().display_formatter.formatters["text/plain"].for_type(
    int,
    lambda n, p, cycle: p.text("0x%x (%d)" % (n, n))
)

so it should be pretty simple to add. I'm wondering if it might be better to keep it as an optional thing, since not everybody might want ints be printed as hex by default.

Also, HTML rendering in the ipython console doesn't seem to work 100%. Same with images. We might want to fix those too. Agreed that we should look at #3 first though.