McGill-DMaS / Kam1n0-Community

The Kam1n0 Assembly Analysis Platform
Apache License 2.0
613 stars 127 forks source link

IDA 7.3 - ValueError: Invalid chooser passed #34

Open dedmen opened 5 years ago

dedmen commented 5 years ago

Kam1n0 v2.1 freshly installed.

Traceback (most recent call last):
  File "J:/Installs/IDA 7.3/plugins\Kam1n0\Manager.py", line 406, in activate
    self.callback(ctx)
  File "J:/Installs/IDA 7.3/plugins\Kam1n0\Manager.py", line 332, in open_cnn_manager
    form = ConnectionManagementForm(self)
  File "J:/Installs/IDA 7.3/plugins\Kam1n0\forms\ConnectionManagementForm.py", line 98, in __init__
    self.listView),
  File "J:\Installs\IDA 7.3\python\ida_kernwin.py", line 6035, in __init__
    raise ValueError("Invalid chooser passed.")
ValueError: Invalid chooser passed.

Ref: https://github.com/danielplohmann/apiscout/issues/8

I tested Kam1n0 in late 2017 and couldn't get it to work, sad that now it again.. doesn't work.

dedmen commented 5 years ago

Okey this is weird.

            print (chooser)
            print (isinstance(chooser, Choose))
            print (isinstance(chooser, Choose2))

-> <Kam1n0.forms.ConnectionManagementForm.ConnectionListView object at 0x0000005CEE526668> False True

It's creating a Choose2. But inside ConnectionListView.init print (IDAUtils.is_hexrays_v7()) prints "True" so it should be loading Choose, not Choose2.

Just editing ConnectionManagementForm.py and removing the is_hexrays_v7 check fixes it. but that's ofc not a valid fix as that would break 6.x compat

steven-hh-ding commented 5 years ago

Let me check. I am getting an IDA 7.3. Haven't tested on 7.3 yet. It looks like they change the Choose api again. Thanks!

dedmen commented 5 years ago

The Choose API is not the problem I think. https://github.com/McGill-DMaS/Kam1n0-Community/blob/master2.x/kam1n0-clients/ida-plugin/Kam1n0/forms/ConnectionManagementForm.py#L23-L29 This code, loads Choose2. Even though print (IDAUtils.is_hexrays_v7()) prints "True" If I just force it to load Choose instead of Choose2 by just replacing that with

    from idaapi import Choose as Choose
    from ida_kernwin import Form, info
    from ida_idaapi import plugin_t

It works just fine. For some reason that v7 check there doesn't work right.

MilesQLi commented 5 years ago

This could be solved by replacing

   def is_hexrays_v7():
       return idaapi.cvar.inf.version >= 700

with

   def is_hexrays_v7():
       return idaapi.IDA_SDK_VERSION >= 700

in Kam1n0/kam1n0-clients/ida-plugin/Kam1n0/IDAUtils.py

So, the pull request I started on 26 Mar should be able to solve it.