diff --git a/plugins/cvutils-getoffset.py b/plugins/cvutils-getoffset.py index 0c2d7e0..994f6e9 100644 --- a/plugins/cvutils-getoffset.py +++ b/plugins/cvutils-getoffset.py @@ -17,10 +17,10 @@ major, minor = map(int, idaapi.get_kernel_version().split(".")) using_ida7api = (major > 6) -using_pyqt5 = using_ida7api or (major == 6 and minor >= 9) idaver_74newer = (major == 7 and minor >= 4) idaver_8newer = (major >= 8) +IDA_9_2_PLUS = (major > 9) or (major == 9 and minor >= 2) if idaver_74newer or idaver_8newer: newer_version_compatible = True @@ -29,6 +29,13 @@ IDA_9 = (major >= 9) +if IDA_9_2_PLUS: + using_pyside6 = True + using_pyqt5 = False +else: + using_pyside6 = False + using_pyqt5 = using_ida7api or (major == 6 and minor >= 9) + if newer_version_compatible: # IDA 7.4+ # https://hex-rays.com/products/ida/support/ida74_idapython_no_bc695_porting_guide.shtml @@ -46,12 +53,16 @@ BWN_PSEUDOCODE = idaapi.BWN_PSEUDOCODE SETMENU_APP = idaapi.SETMENU_APP -if using_pyqt5: +if using_pyside6: + import PySide6.QtGui as QtGui + import PySide6.QtCore as QtCore + import PySide6.QtWidgets as QtWidgets + from PySide6.QtWidgets import QApplication +elif using_pyqt5: import PyQt5.QtGui as QtGui import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets from PyQt5.Qt import QApplication - else: import PySide.QtGui as QtGui import PySide.QtCore as QtCore @@ -63,8 +74,12 @@ def setClipboardText(data): cb = QApplication.clipboard() - cb.clear(mode=cb.Clipboard) - cb.setText(data, mode=cb.Clipboard) + if using_pyside6: + cb.clear(mode=QtGui.QClipboard.Mode.Clipboard) + cb.setText(data, mode=QtGui.QClipboard.Mode.Clipboard) + else: + cb.clear(mode=cb.Clipboard) + cb.setText(data, mode=cb.Clipboard) def PLUGIN_ENTRY(): diff --git a/plugins/cvutils-gotooffset.py b/plugins/cvutils-gotooffset.py index 5e75b0e..b26e9d7 100644 --- a/plugins/cvutils-gotooffset.py +++ b/plugins/cvutils-gotooffset.py @@ -1,6 +1,6 @@ #------------------------------------------------------------------------------ # IDA Plugin to jump to an offset from the Imagebase. -# Copy the 'cvutils-getoffset.py' into the plugins directory of IDA +# Copy the 'cvutils-gotooffset.py' into the plugins directory of IDA #------------------------------------------------------------------------------ VERSION = '1.1.0' @@ -9,8 +9,6 @@ PLUGIN_NAME = "Go To Offset" PLUGIN_HOTKEY = "Shift+G" - - import os import sys import idc @@ -18,31 +16,41 @@ import idautils import string - major, minor = map(int, idaapi.get_kernel_version().split(".")) using_ida7api = (major > 6) -using_pyqt5 = using_ida7api or (major == 6 and minor >= 9) idaver_74newer = (major == 7 and minor >= 4) idaver_8newer = (major >= 8) +IDA_9_2_PLUS = (major > 9) or (major == 9 and minor >= 2) if idaver_74newer or idaver_8newer: newer_version_compatible = True else: newer_version_compatible = False +if IDA_9_2_PLUS: + using_pyside6 = True + using_pyqt5 = False +else: + using_pyside6 = False + using_pyqt5 = using_ida7api or (major == 6 and minor >= 9) + if newer_version_compatible: #IDA 7.4+ #https://hex-rays.com/products/ida/support/ida74_idapython_no_bc695_porting_guide.shtml import ida_ida import ida_kernwin -if using_pyqt5: +if using_pyside6: + import PySide6.QtGui as QtGui + import PySide6.QtCore as QtCore + import PySide6.QtWidgets as QtWidgets + from PySide6.QtWidgets import QApplication +elif using_pyqt5: import PyQt5.QtGui as QtGui import PyQt5.QtCore as QtCore import PyQt5.QtWidgets as QtWidgets from PyQt5.Qt import QApplication - else: import PySide.QtGui as QtGui import PySide.QtCore as QtCore @@ -50,7 +58,6 @@ QtCore.pyqtSignal = QtCore.Signal QtCore.pyqtSlot = QtCore.Slot from PySide.QtGui import QApplication - def PLUGIN_ENTRY(): @@ -94,22 +101,18 @@ def term(self): This is called by IDA when it is unloading the plugin. """ - # unregister our actions & free their resources self._del_action_goto_offset() - # done idaapi.msg("%s terminated...\n" % self.wanted_name) - #-------------------------------------------------------------------------- # IDA Actions #-------------------------------------------------------------------------- ACTION_GET_OFFSET = "prefix:goto_offset" - def _init_action_goto_offset(self): """ Register the copy bytes action with IDA. @@ -136,11 +139,9 @@ def _init_action_goto_offset(self): 31 # Copy icon ) - # register the action with IDA assert idaapi.register_action(action_desc), "Action registration failed" - def _del_action_goto_offset(self): """ Delete the bulk prefix action from IDA. @@ -165,7 +166,6 @@ def jump_to_address(jump_address): else: idc.Jump(jump_address) - #------------------------------------------------------------------------------ # Image Min EA #------------------------------------------------------------------------------ @@ -213,7 +213,6 @@ def isvalid_address(ea): return 1 - #------------------------------------------------------------------------------ # Go to offset #------------------------------------------------------------------------------ @@ -268,4 +267,4 @@ def activate(self, ctx): return 1 def update(self, ctx): - return idaapi.AST_ENABLE_ALWAYS \ No newline at end of file + return idaapi.AST_ENABLE_ALWAYS