GP-2567 IDA Python 3 plugins

Updated IDA Pro plugins to be compatable with both python 2 and 3.
Installation instructions are the same, however idaxml can alternatively
be placed in the IDA python, IDA python/3, or IDA python/2 directories.
This commit is contained in:
ghidraGander 2022-10-19 20:35:02 -04:00
parent ff503596ac
commit e6a86e91ca
4 changed files with 70 additions and 30 deletions

View file

@ -22,12 +22,18 @@ This file must be placed in the IDA plugins directory.
The file idaxml.py must be placed in the IDA python directory.
"""
from __future__ import print_function
import ida_idaapi
import ida_pro
import idaxml
import idc
import sys
if sys.version_info.major >= 3:
from idaxml import _exc_info
sys.exc_value = lambda: _exc_info()[1]
sys.exc_type = lambda: _exc_info()[0]
class XmlImporterPlugin(ida_idaapi.plugin_t):
"""
XML Importer plugin class
@ -68,17 +74,17 @@ class XmlImporterPlugin(ida_idaapi.plugin_t):
xml.import_xml()
except idaxml.Cancelled:
msg = "XML Import cancelled!"
print "\n" + msg
print("\n" + msg)
idc.warning(msg)
except idaxml.MultipleAddressSpacesNotSupported:
msg = "XML Import cancelled!"
msg += "\n\nXML Import does not currently support"
msg += "\nimporting multiple address spaces."
print "\n" + msg
print("\n" + msg)
idc.warning(msg)
except:
msg = "***** Exception occurred: XML Importer failed! *****"
print "\n" + msg + "\n", sys.exc_type, sys.exc_value
print("\n" + msg + "\n", sys.exc_type, sys.exc_value)
idc.warning(msg)
finally:
xml.cleanup()