Пример #1
0
    def displayLink(self):
        """creates a graphical dialog to select an edge and display its information"""
        currEdges = self.graph.edges(data = True)
        link, ok = dialogs.DisplayLink.getDataDialog(currEdges)
        if ok: # gets the user selected edge
            (node1, node2) = link.getNodes()
            nodeName1 = node1.getName()
            nodeName2 = node2.getName()
            protocol = link.getProtocol()
            risk = link.getRisk()

            # display the data for the edge in a message box
            message = QtGui.QMessageBox.information(self, "View Edge", "Name: {0}\nNode 1: {1}\nNode 2: {2}\nProtocol: {3}\nRisk: {4}".format(link.getName(), nodeName1, nodeName2, protocol, risk))
Пример #2
0
    def getNewLink(self):
        """creates a graphical dialog to create a new edge and ensures
        that the edge is between two compatible nodes"""
        currNodes = self.graph.nodes(data = True)
        if len(currNodes) < 2: # ensures that 2 or more nodes are present in order ot make an edge
            message = QtGui.QMessageBox.warning(self, "Black Hat Risk", "Not enough nodes to create an edge!")
            return

        link, ok = dialogs.AddLink.getDataDialog(currNodes)

        if ok:
            (n1, n2) = link.getNodes()
            proto = link.getProtocol()
            if self.checkLinkCompat(n1, n2, proto): # checks compatability of the nodes and protocol and adds the edge if possible
                self.addLink(link)
            else:
                message = QtGui.QMessageBox.warning(self, "Black Hat Risk", "Incompatible Link between storage devices!")