Esempio n. 1
0
    def actionXref(self):
        cursor = self.textCursor()
        start = cursor.selectionStart()
        end = cursor.selectionEnd()
        selection = cursor.selection().toPlainText()
        androconf.debug("Xref asked for '%s' (%d, %d)" %
                        (selection, start, end))

        if start not in self.doc.binding.keys():
            self.mainwin.showStatus("Xref not available. No info for: '%s'." %
                                    selection)
            return

        class_ = None
        method_ = None
        t = self.doc.binding[start]
        if t[0] == 'NAME_METHOD_PROTOTYPE':
            class_ = self.path
            method_ = t[1]
            if method_ == self.title:
                method_ = 'init'
        elif t[0] == 'NAME_METHOD_INVOKE':
            class_, method_ = t[2].split(' -> ')
            if class_ == 'this':
                class_ = self.path
            else:
                class_ = classdot2class(class_)
        elif t[0] == 'NAME_PROTOTYPE':
            class_ = classdot2class(t[2] + '.' + t[1])
        else:
            self.mainwin.showStatus(
                "Xref not available. Info ok: '%s' but object not supported." %
                selection)
            return

        androconf.debug(
            "Found corresponding method: %s -> %s in source file: %s" %
            (class_, method_, self.path))

        from androguard.gui.xrefwindow import XrefDialog
        xrefs_list = XrefDialog.get_xrefs_list(self.mainwin.d,
                                               path=class_,
                                               method=method_)
        if not xrefs_list:
            self.mainwin.showStatus("No xref returned")
            return

        xwin = XrefDialog(parent=self,
                          win=self.mainwin,
                          xrefs_list=xrefs_list,
                          path=class_,
                          method=method_)
        xwin.show()
Esempio n. 2
0
    def actionXref(self):
        item = self.currentItem()
        path, path_elts = self.item2path(item)
        if item.childCount() != 0:
            self.mainwin.showStatus("Xref not available. %s is not a class" % path)
            return

        xrefs_list = XrefDialog.get_xrefs_list(self.mainwin.d, path=path)
        if not xrefs_list:
            self.mainwin.showStatus("No xref returned.")
            return
        xwin = XrefDialog(parent=self.mainwin, win=self.mainwin, xrefs_list=xrefs_list, path=path)
        xwin.show()
Esempio n. 3
0
    def actionXref(self):
        item = self.currentItem()
        path, path_elts = self.item2path(item)
        if item.childCount() != 0:
            self.mainwin.showStatus("Xref not available. %s is not a class" %
                                    path)
            return

        xrefs_list = XrefDialog.get_xrefs_list(self.mainwin.d, path=path)
        if not xrefs_list:
            self.mainwin.showStatus("No xref returned.")
            return
        xwin = XrefDialog(parent=self.mainwin,
                          win=self.mainwin,
                          xrefs_list=xrefs_list,
                          path=path)
        xwin.show()
Esempio n. 4
0
    def actionXref(self):
        cursor = self.textCursor()
        start = cursor.selectionStart()
        end = cursor.selectionEnd()
        selection = cursor.selectedText()
        androconf.debug("Xref asked for '%s' (%d, %d)" % (selection, start, end))

        if start not in self.doc.binding.keys():
            self.mainwin.showStatus("Xref not available. No info for: '%s'." % selection)
            return

        class_ = None
        method_ = None
        t = self.doc.binding[start]
        if t[0] == 'NAME_METHOD_PROTOTYPE':
            class_ = self.path
            method_ = t[2].method
            if t[1] == self.title:
                method_ = 'init'
        elif t[0] == 'NAME_METHOD_INVOKE':
            class_, method_ = t[2].split(' -> ')
            if class_ == 'this':
                class_ = self.path
            else:
                class_ = classdot2class(class_)
        elif t[0] == 'NAME_PROTOTYPE':
            class_ = classdot2class(t[2] + '.' + t[1])
        else:
            self.mainwin.showStatus("Xref not available. Info ok: '%s' but object not supported." % selection)
            return

        androconf.debug("Found corresponding method: %s -> %s in source file: %s" % (class_, method_, self.path))

        from androguard.gui.xrefwindow import XrefDialog
        xrefs_list = XrefDialog.get_xrefs_list(self.mainwin.d, path=class_, method=method_)
        if not xrefs_list:
            self.mainwin.showStatus("No xref returned")
            return

        xwin = XrefDialog(parent=self, win=self.mainwin, xrefs_list=xrefs_list, path=class_, method=method_)
        xwin.show()