igogo-x86 / HexRaysPyTools

IDA Pro plugin which improves work with HexRays decompiler and helps in process of reconstruction structures and classes
1.42k stars 226 forks source link

IDA 7.0 Support? #43

Closed MegaBor closed 4 years ago

MegaBor commented 4 years ago

Any way to get the current state of the plugin to work on IDA 7.0? It fails to load on initialization:

C:\Program Files\IDA 7.0\plugins\HexRaysPyTools.py: No module named configparser
Traceback (most recent call last):
  File "C:\Program Files\IDA 7.0\python\ida_idaapi.py", line 553, in IDAPython_ExecScript
    execfile(script, g)
  File "C:/Program Files/IDA 7.0/plugins/HexRaysPyTools.py", line 7, in <module>
    import HexRaysPyTools.settings as settings
  File "C:/Program Files/IDA 7.0/plugins\HexRaysPyTools\settings.py", line 2, in <module>
    import configparser
ImportError: No module named configparser

I fixed that one using the ConfigParser module instead, but then other failures on actions.py

TIA!

igogo-x86 commented 4 years ago

Have you tried version for IDA 7.2 that is in release?

MegaBor commented 4 years ago

Have you tried version for IDA 7.2 that is in release?

Unfortunately I'm sticking to IDA 7.0 for the time being :( I'm sad that you decided to drop support for IDA 7.0, as I used to use this plugin for quiet a while now and now I can't get the latest changes. I hope you'll decide to keep backwards compatibility at some point. Wishing you a happy new year and thanks a lot for your work here! 🎉

Koluchy commented 4 years ago

7.2 has a completely similar story ( After renaming "configparser" I get the following:

C:\Program Files\IDA 7.2\plugins\HexRaysPyTools.py: invalid syntax (actions.py, line 68)
Traceback (most recent call last):
  File "C:\Program Files\IDA 7.2\python\ida_idaapi.py", line 572, in IDAPython_ExecScript
    execfile(script, g)
  File "C:/Program Files/IDA 7.2/plugins/HexRaysPyTools.py", line 8, in <module>
    from HexRaysPyTools.callbacks import hx_callback_manager, action_manager
  File "C:/Program Files/IDA 7.2/plugins\HexRaysPyTools\callbacks\__init__.py", line 1, in <module>
    from .actions import *
  File "C:/Program Files/IDA 7.2/plugins\HexRaysPyTools\callbacks\actions.py", line 68
    def check(self, hx_view: idaapi.vdui_t):
                           ^
SyntaxError: invalid syntax
igogo-x86 commented 4 years ago

@Koluchy, you are using python3 version from master. Try ida_7_2 from release instead

@MegaBor, What about aforementioned plugin version tagged ida_7_2? As far as I remember there wasn't much changes in API between IDA 7.0 and IDA 7.2 and it should work. I've checked my PC and seems like IDA 7.0 nowhere to be found.

Koluchy commented 4 years ago

I downloaded plugin with the tag ide_7_2 - everything started without errors. I will check further. IMHO it is better to describe it in readme... Thanks for your work!

MegaBor commented 4 years ago

@igogo-x86, if I understand you correctly, you recommend to use an older version of this plugin? If that's the case, it's still doesn't solve the problem in case this plugin will have more changes and improvements, I'll not be able to get them.

igogo-x86 commented 4 years ago

@Koluchy, yeah, add warning info about in readme

@MegaBor, supporting several versions would be too bothersome. If you or someone else interested I can make branches for them. Anyway, I barely do reverse engineering since starting working as compiler engineer, so I wouldn't expect to many new changes or improvement in the near future

igogo-x86 commented 4 years ago

Thanks to @p-state I hope we now have backward compatibitility. Could you check?

MegaBor commented 4 years ago

It seems as the plugin gets loaded, however I get warning now every time I open IDA: Capture

Thanks @p-state and @igogo-x86!

MegaBor commented 4 years ago

I fixed it by changing:

short_name = idc.demangle_name(name, idc.INF_SHORT_DEMNAMES)

To:

short_name = idc.demangle_name(name, idc.INF_SHORT_DN)

But I'm not sure if it breaks on newer versions based on here: https://www.hex-rays.com/products/ida/support/ida74_idapython_no_bc695_porting_guide.shtml

MegaBor commented 4 years ago

Another unresolved error when ALT + F8 to build a structure with vtable:

Syntax error near: }
Traceback (most recent call last):
  File "C:/Program Files/IDA 7.0/plugins\HexRaysPyTools\forms.py", line 93, in <lambda>
    btn_finalize.clicked.connect(lambda: self.structure_model.finalize())
  File "C:/Program Files/IDA 7.0/plugins\HexRaysPyTools\core\temporary_structure.py", line 692, in finalize
    if self.pack():
  File "C:/Program Files/IDA 7.0/plugins\HexRaysPyTools\core\temporary_structure.py", line 560, in pack
    structure_name = idaapi.idc_parse_decl(idaapi.cvar.idati, cdecl, idaapi.PT_TYP)[0]
TypeError: 'NoneType' object has no attribute '__getitem__'
p-state commented 4 years ago

@MegaBor this error comes when you set invalid name of structure (e.g. starts with a number).

MegaBor commented 4 years ago

Another error when I'm using the sizeof(type) feature:

Traceback (most recent call last):
  File "C:/Program Files/IDA 7.0/plugins\HexRaysPyTools\callbacks\structs_by_size.py", line 52, in activate
    ordinal = _choose_structure_by_size(number_value)
  File "C:/Program Files/IDA 7.0/plugins\HexRaysPyTools\callbacks\structs_by_size.py", line 9, in _choose_structure_by_size
    result = type_library.choose_til()
  File "C:/Program Files/IDA 7.0/plugins\HexRaysPyTools\core\type_library.py", line 52, in choose_til
    [["Library", 10 | idaapi.CHCOL_PLAIN], ["Description", 30 | idaapi.CHCOL_PLAIN]],
AttributeError: 'module' object has no attribute 'CHCOL_PLAIN'

@p-state, thanks for the fixes! you rock!

p-state commented 4 years ago

@MegaBor could you check #52 please?

MegaBor commented 4 years ago

Still playing around with the plugin in IDA 7.0. So far no issues due to the backwards support. Will keep this post updated if I find any more issues.

Thanks for the awesome work!

igogo-x86 commented 4 years ago

As no more problems arised I close the issue