1. Daniel Plohmann
  2. simpliFiRE.IDAscope

Commits

Daniel Plohmann  committed 108e6c9

WinApi shortcut now truncates trailing suffixes of the form _%d before lookup

  • Participants
  • Parent commits 0a3a30d
  • Branches master

Comments (0)

Files changed (2)

File idascope/core/helpers/Misc.py

View file
  • Ignore whitespace
 
 import operator
 
-def lrange(num1, num2 = None, step = 1):
+
+def lrange(num1, num2=None, step=1):
     """
     Allows iteration over arbitrary numbers instead of dword long numbers.
     Credits go to:
     while op(num1, num2):
         yield num1
         num1 += step
+
+
+def cleanCountingSuffix(name):
+    """
+    IDA does not support multiple identical names, thus often a suffix like _0, _1 is used to signal identity.
+    This function will check a name for presence of such a suffix and remove to allow easier post-processing.
+    """
+    if "_" in name:
+        try:
+            int(name[1 + name.rindex("_"):])
+            return name[:name.rindex("_")]
+        except:
+            return name
+    else:
+        return name

File idascope/widgets/WinApiWidget.py

View file
  • Ignore whitespace
 from PySide import QtGui, QtCore
 from PySide.QtGui import QCompleter, QLineEdit, QStringListModel, QTextBrowser, QIcon
 
+import idascope.core.helpers.Misc as Misc
+
 
 class WinApiWidget(QtGui.QWidget):
     """
         A function exposed to allow navigating the widget to the currently highlighted identifier from the IDA view.
         """
         if self.winapi.hasOfflineMsdnAvailable():
-            highlighted_identifier = self.ida_proxy.get_highlighted_identifier()
+            highlighted_identifier = Misc.cleanCountingSuffix(self.ida_proxy.get_highlighted_identifier())
             self.navigate(highlighted_identifier)
             self.parent.setTabFocus(self.name)