keystone-engine / keypatch

Multi-architecture assembler for IDA Pro. Powered by Keystone Engine.
http://www.keystone-engine.org/keypatch
GNU General Public License v2.0
1.47k stars 355 forks source link

Update to IDA 7 and Python 3 #66

Closed Rupan closed 4 years ago

Rupan commented 4 years ago

The import names have been different since IDA 7. The old names are still accessible in idc_bc695 but will eventually go away, so I guess its better to just switch given how long IDA has been out now. Also switch away from old-style exception handling; this should be compatible with both Python 2 and 3.

aquynh commented 4 years ago

is this compatible with older IDA versions?

Rupan commented 4 years ago

To an extent. Very old versions, prior to IDA 7.0, will break. A quick test with IDA 7.1 confirms that the imports will likely work back until IDA 7.0.

Rupan commented 4 years ago

Hold off on merging for now, I found another bug. Unsure whether this is just breakage introduced by IDA 7.4 or if these changes caused it:

Traceback (most recent call last):
  File "/home/michael/.idapro/plugins/keypatch.py", line 1451, in activate
    self.plugin.patcher()
  File "/home/michael/.idapro/plugins/keypatch.py", line 1710, in patcher
    selection, addr_begin, addr_end = idaapi.read_selection()
  File "/opt/idapro-7.4/python/3/ida_kernwin.py", line 3851, in read_selection
    return _ida_kernwin.read_selection(*args)
TypeError: read_selection expected 3 arguments, got 0
aquynh commented 4 years ago

Please make sure we still support all the older versions.

hotwinter commented 4 years ago

Hold off on merging for now, I found another bug. Unsure whether this is just breakage introduced by IDA 7.4 or if these changes caused it:

Traceback (most recent call last):
  File "/home/michael/.idapro/plugins/keypatch.py", line 1451, in activate
    self.plugin.patcher()
  File "/home/michael/.idapro/plugins/keypatch.py", line 1710, in patcher
    selection, addr_begin, addr_end = idaapi.read_selection()
  File "/opt/idapro-7.4/python/3/ida_kernwin.py", line 3851, in read_selection
    return _ida_kernwin.read_selection(*args)
TypeError: read_selection expected 3 arguments, got 0

This should be solved from the new pull request I submitted, but it probably will break for versions before 7.0, I will try to test it later for versions before 7.0

Rupan commented 4 years ago

Let's address this in #67 - it looks more complete.