Exemplo n.º 1
0
    def buildNode(self, dimName, objtName):
        b = Borg()
        actorFile = b.assetDir + '/modelActor.png'
        attackerFile = b.assetDir + '/modelAttacker.png'
        roleFile = b.assetDir + '/modelRole.png'
        objtUrl = dimName + '#' + str(objtName)
        if (dimName == 'persona'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           label='',
                           xlabel=objtName,
                           shapefile=actorFile,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl,
                           peripheries='0'))
        elif (dimName == 'tag'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='note',
                           style='filled',
                           margin=0,
                           pencolor='black',
                           color='yellow',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'attacker'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           label='',
                           xlabel=objtName,
                           shapefile=attackerFile,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl,
                           peripheries='0'))
        elif (dimName == 'asset'):
            assetObjt = self.dbProxy.dimensionObject(objtName, 'asset')
            borderColour = 'black'
            if (assetObjt.critical()):
                borderColour = 'red'
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='record',
                           color=borderColour,
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl,
                           width='0',
                           height='0',
                           style='filled',
                           pencolor='black',
                           fillcolor='white',
                           label=arrayToAssetSecurityPropertiesTable(
                               assetObjt.securityProperties(
                                   self.theEnvironmentName), objtName)))
        elif (dimName == 'threat'):
            thrObjt = self.dbProxy.dimensionObject(objtName, 'threat')
            thrLhood = thrObjt.likelihood(
                self.theEnvironmentName,
                self.theEnvironmentObject.duplicateProperty(),
                self.theEnvironmentObject.overridingEnvironment())
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='record',
                           style='filled',
                           margin=0,
                           color='black',
                           fontcolor=threatTextColour(thrLhood),
                           fillcolor=threatLikelihoodColourCode(thrLhood),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl,
                           label=arrayToThreatSecurityPropertiesTable(
                               thrObjt.securityProperties(
                                   self.theEnvironmentName), objtName)))
        elif (dimName == 'vulnerability'):
            vulObjt = self.dbProxy.dimensionObject(objtName, 'vulnerability')
            vulSev = vulObjt.severity(
                self.theEnvironmentName,
                self.theEnvironmentObject.duplicateProperty(),
                self.theEnvironmentObject.overridingEnvironment())
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='record',
                           style='filled',
                           margin=0,
                           colorscheme='orrd4',
                           fontcolor=vulnerabilityTextColour(vulSev),
                           fillcolor=vulnerabilitySeverityColourCode(vulSev),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'risk'):
            riskObjt = self.dbProxy.dimensionObject(objtName, 'risk')
            riskScores = self.dbProxy.riskScore(riskObjt.threat(),
                                                riskObjt.vulnerability(),
                                                self.theEnvironmentName,
                                                objtName)
            highestScore = 0
            for riskScore in riskScores:
                currentScore = riskScore[2]
                if (currentScore > highestScore):
                    highestScore = currentScore
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='diamond',
                           style='filled',
                           margin=0,
                           color='black',
                           fillcolor=threatColourCode(highestScore),
                           fontcolor=riskTextColourCode(highestScore),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'response'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='note',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'countermeasure'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='component',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'component'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='component',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'requirement'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='circle',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'goal'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='parallelogram',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'obstacle'):
            obsId = self.dbProxy.getDimensionId(objtName, 'obstacle')
            envId = self.dbProxy.getDimensionId(self.theEnvironmentName,
                                                'environment')
            obsProb, obsRationale = self.dbProxy.obstacleProbability(
                obsId, envId)
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='polygon',
                           margin=0,
                           skew='-0.4',
                           style='filled',
                           pencolor='black',
                           colorscheme='ylorrd9',
                           fillcolor=obstacleColourCode(obsProb),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           fontcolor=probabilityTextColourCode(obsProb),
                           URL=objtUrl))
        elif (dimName == 'role'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           label='',
                           xlabel=objtName,
                           shapefile=roleFile,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl,
                           peripheries='0'))
        elif (dimName == 'responsibility'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='doubleoctagon',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'environment'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='doublecircle',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'domainproperty'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='house',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'inconsistency'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='polygon',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'task'):
            taskScore = self.dbProxy.taskUsabilityScore(
                objtName, self.theEnvironmentName)
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='ellipse',
                           margin=0,
                           style='filled',
                           color=usabilityColourCode(taskScore),
                           pencolor='black',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           fontcolor=usabilityTextColourCode(taskScore),
                           URL=objtUrl))

        else:
            raise UnknownNodeType(dimName)
Exemplo n.º 2
0
  def buildNode(self,dimName,objtName):
    objtUrl = dimName + '#' + objtName
    if (dimName == 'goal'):
      self.theGraph.add_node(pydot.Node(objtName,shape='parallelogram',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
# soft-goal attributes      self.theGraph.add_node(pydot.Node(objtName,shape='polygon',style='rounded',sides='6',distortion='-0.537997',orientation='52',skew='-0.960726',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'obstacle'):
      obsId = self.dbProxy.getDimensionId(objtName,'obstacle')
      envId = self.dbProxy.getDimensionId(self.theEnvironmentName,'environment')
      self.theGraph.add_node(pydot.Node(objtName,shape='polygon',skew='-0.4',style='filled',pencolor='black',colorscheme='ylorrd9',fillcolor=obstacleColourCode(self.dbProxy.obstacleProbability(obsId,envId)),fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'domainproperty'):
      self.theGraph.add_node(pydot.Node(objtName,shape='house',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'requirement'):
      self.theGraph.add_node(pydot.Node(objtName,shape='parallelogram',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'countermeasure'):
      self.theGraph.add_node(pydot.Node(objtName,shape='hexagon',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif ((dimName == 'role') and (self.theKaosModel != 'task')):
      self.theGraph.add_node(pydot.Node(objtName,shape='hexagon',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif ((dimName == 'role') and (self.theKaosModel == 'task')):
      self.theGraph.add_node(pydot.Node(objtName,shape='ellipse',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'usecase'):
      self.theGraph.add_node(pydot.Node(objtName,shape='ellipse',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'task'):
      objt = self.dbProxy.dimensionObject(objtName,'task')
      if (objt.assumption() == True):
        objtLabel = "<<Assumption>>" + objtName 
      else:
        objtLabel = objtName
      taskScore = self.dbProxy.taskUsabilityScore(objtName,self.theEnvironmentName)
      self.theGraph.add_node(pydot.Node(objtName,label=objtLabel,shape='ellipse',style='filled',color=usabilityColourCode(taskScore),fontcolor=usabilityTextColourCode(taskScore),fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'misusecase'):
      ellipseColour = 'black'
      if (self.theKaosModel == 'task'):
        riskName = objtName[8:]
        riskObjt = self.dbProxy.dimensionObject(riskName,'risk')
        riskScores = self.dbProxy.riskScore(riskObjt.threat(),riskObjt.vulnerability(),self.theEnvironmentName,riskName)
        highestScore = 0
        for riskScore in riskScores:
          currentScore = riskScore[2]
          if (currentScore > highestScore):
            highestScore = currentScore
        ellipseColour = threatColourCode(highestScore)
        ellipseFontColour = 'white'
        if highestScore < 2:
          ellipseFontColour = 'black'
      self.theGraph.add_node(pydot.Node(objtName,shape='ellipse',style='filled',color=ellipseColour,fontcolor=ellipseFontColour,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'persona'):
      objt = self.dbProxy.dimensionObject(objtName,'persona')
      if (objt.assumption() == True):
        objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName 
        self.theGraph.add_node(pydot.Node(objtName,label=objtLabel,shape='circle',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
      else: 
        self.theGraph.add_node(pydot.Node(objtName,shape='circle',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'attacker'):
      self.theGraph.add_node(pydot.Node(objtName,shape='circle',style='filled',color='black',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'response'):
      self.theGraph.add_node(pydot.Node(objtName,shape='note',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'asset'):
      fontColour = 'black'
      nodeColour = 'black'
      if (self.theKaosModel == 'task'):
        fontColour = 'blue'
        nodeColour = 'blue'
      self.theGraph.add_node(pydot.Node(objtName,shape='record',fontname=self.fontName,fontsize=self.fontSize,fontcolor=fontColour,color=nodeColour,URL=objtUrl))
    else:
      raise ARM.UnknownNodeType(dimName)
Exemplo n.º 3
0
    def buildNode(self, dimName, objtName):
        objtUrl = dimName + '#' + objtName
        if (dimName == 'goal'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='parallelogram',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
# soft-goal attributes      self.theGraph.add_node(pydot.Node(objtName,shape='polygon',style='rounded',sides='6',distortion='-0.537997',orientation='52',skew='-0.960726',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
        elif (dimName == 'obstacle'):
            obsId = self.dbProxy.getDimensionId(objtName, 'obstacle')
            envId = self.dbProxy.getDimensionId(self.theEnvironmentName,
                                                'environment')
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='polygon',
                           skew='-0.4',
                           style='filled',
                           pencolor='black',
                           colorscheme='ylorrd9',
                           fillcolor=obstacleColourCode(
                               self.dbProxy.obstacleProbability(obsId, envId)),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'domainproperty'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='house',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'requirement'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='parallelogram',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'countermeasure'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='hexagon',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif ((dimName == 'role') and (self.theKaosModel != 'task')):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='hexagon',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif ((dimName == 'role') and (self.theKaosModel == 'task')):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='ellipse',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'usecase'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='ellipse',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'task'):
            objt = self.dbProxy.dimensionObject(objtName, 'task')
            if (objt.assumption() == True):
                objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName
            else:
                objtLabel = objtName
            taskScore = self.dbProxy.taskUsabilityScore(
                objtName, self.theEnvironmentName)
            self.theGraph.add_node(
                pydot.Node(objtName,
                           label=objtLabel,
                           shape='ellipse',
                           style='filled',
                           color=usabilityColourCode(taskScore),
                           fontcolor=usabilityTextColourCode(taskScore),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'misusecase'):
            ellipseColour = 'black'
            if (self.theKaosModel == 'task'):
                riskName = objtName[8:]
                riskObjt = self.dbProxy.dimensionObject(riskName, 'risk')
                riskScores = self.dbProxy.riskScore(riskObjt.threat(),
                                                    riskObjt.vulnerability(),
                                                    self.theEnvironmentName,
                                                    riskName)
                highestScore = 0
                for riskScore in riskScores:
                    currentScore = riskScore[2]
                    if (currentScore > highestScore):
                        highestScore = currentScore
                ellipseColour = threatColourCode(highestScore)
                ellipseFontColour = 'white'
                if highestScore < 2:
                    ellipseFontColour = 'black'
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='ellipse',
                           style='filled',
                           color=ellipseColour,
                           fontcolor=ellipseFontColour,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'persona'):
            objt = self.dbProxy.dimensionObject(objtName, 'persona')
            if (objt.assumption() == True):
                objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName
                self.theGraph.add_node(
                    pydot.Node(objtName,
                               label=objtLabel,
                               shape='circle',
                               fontname=self.fontName,
                               fontsize=self.fontSize,
                               URL=objtUrl))
            else:
                self.theGraph.add_node(
                    pydot.Node(objtName,
                               shape='circle',
                               fontname=self.fontName,
                               fontsize=self.fontSize,
                               URL=objtUrl))
        elif (dimName == 'attacker'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='circle',
                           style='filled',
                           color='black',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'response'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='note',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'asset'):
            fontColour = 'black'
            nodeColour = 'black'
            if (self.theKaosModel == 'task'):
                fontColour = 'blue'
                nodeColour = 'blue'
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='record',
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           fontcolor=fontColour,
                           color=nodeColour,
                           URL=objtUrl))
        else:
            raise ARM.UnknownNodeType(dimName)
Exemplo n.º 4
0
  def buildNode(self,dimName,objtName):
    b = Borg()
    actorFile = b.assetDir + '/modelActor.png'
    attackerFile = b.assetDir + '/modelAttacker.png'
    roleFile = b.assetDir + '/modelRole.png'
    objtUrl = dimName + '#' + str(objtName)
    if (dimName == 'persona'):
      self.theGraph.add_node(pydot.Node(objtName,shapefile=actorFile,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,peripheries='0'))
    elif (dimName == 'tag'):
      self.theGraph.add_node(pydot.Node(objtName,shape='note',style='filled',margin=0,pencolor='black',color='yellow',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'attacker'):
      self.theGraph.add_node(pydot.Node(objtName,shapefile=attackerFile,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,peripheries='0'))
    elif (dimName == 'asset'):
      assetObjt = self.dbProxy.dimensionObject(objtName,'asset')
      borderColour = 'black'
      if (assetObjt.critical()):
        borderColour = 'red'
      self.theGraph.add_node(pydot.Node(objtName,shape='record',color=borderColour,margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,width='0',height='0',style='filled',pencolor='black',fillcolor='white',label=arrayToAssetSecurityPropertiesTable(assetObjt.securityProperties(self.theEnvironmentName),objtName)))
    elif (dimName == 'threat'):
      thrObjt = self.dbProxy.dimensionObject(objtName,'threat')
      thrLhood = thrObjt.likelihood(self.theEnvironmentName,self.theEnvironmentObject.duplicateProperty(),self.theEnvironmentObject.overridingEnvironment())
      self.theGraph.add_node(pydot.Node(objtName,shape='record',style='filled',margin=0,color='black',fillcolor=threatLikelihoodColourCode(thrLhood),fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,label=arrayToThreatSecurityPropertiesTable(thrObjt.securityProperties(self.theEnvironmentName),objtName)))
    elif (dimName == 'vulnerability'):
      vulObjt = self.dbProxy.dimensionObject(objtName,'vulnerability')
      vulSev = vulObjt.severity(self.theEnvironmentName,self.theEnvironmentObject.duplicateProperty(),self.theEnvironmentObject.overridingEnvironment())
      self.theGraph.add_node(pydot.Node(objtName,shape='record',style='filled',margin=0,colorscheme='orrd4',color='black',fillcolor=vulnerabilitySeverityColourCode(vulSev),fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'risk'):
      riskObjt = self.dbProxy.dimensionObject(objtName,'risk')
      riskScores = self.dbProxy.riskScore(riskObjt.threat(),riskObjt.vulnerability(),self.theEnvironmentName,objtName)
      highestScore = 0
      for riskScore in riskScores:
        currentScore = riskScore[2]
        if (currentScore > highestScore):
          highestScore = currentScore
      self.theGraph.add_node(pydot.Node(objtName,shape='diamond',style='filled',margin=0,color='black',fillcolor=threatColourCode(highestScore),fontcolor=riskTextColourCode(highestScore),fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'response'):
      self.theGraph.add_node(pydot.Node(objtName,shape='note',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'countermeasure'):
      self.theGraph.add_node(pydot.Node(objtName,shape='component',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'component'):
      self.theGraph.add_node(pydot.Node(objtName,shape='component',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'requirement'):
      self.theGraph.add_node(pydot.Node(objtName,shape='circle',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'goal'):
      self.theGraph.add_node(pydot.Node(objtName,shape='parallelogram',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'obstacle'):
      obsId = self.dbProxy.getDimensionId(objtName,'obstacle')
      envId = self.dbProxy.getDimensionId(self.theEnvironmentName,'environment')
      obsProb,obsRationale = self.dbProxy.obstacleProbability(obsId,envId)
      self.theGraph.add_node(pydot.Node(objtName,shape='polygon',margin=0,skew='-0.4',style='filled',pencolor='black',colorscheme='ylorrd9',fillcolor=obstacleColourCode(obsProb),fontname=self.fontName,fontsize=self.fontSize,fontcolor=probabilityTextColourCode(obsProb),URL=objtUrl))
    elif (dimName == 'role'):
      self.theGraph.add_node(pydot.Node(objtName,shapefile=roleFile,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,peripheries='0'))
    elif (dimName == 'responsibility'):
      self.theGraph.add_node(pydot.Node(objtName,shape='doubleoctagon',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'environment'):
      self.theGraph.add_node(pydot.Node(objtName,shape='doublecircle',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'domainproperty'):
      self.theGraph.add_node(pydot.Node(objtName,shape='house',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'inconsistency'):
      self.theGraph.add_node(pydot.Node(objtName,shape='polygon',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
    elif (dimName == 'task'):
      taskScore = self.dbProxy.taskUsabilityScore(objtName,self.theEnvironmentName)
      self.theGraph.add_node(pydot.Node(objtName,shape='ellipse',margin=0,style='filled',color=usabilityColourCode(taskScore),pencolor='black',fontname=self.fontName,fontsize=self.fontSize,fontcolor=usabilityTextColourCode(taskScore),URL=objtUrl))

    elif (dimName == 'misusecase'):
      self.theGraph.add_node(pydot.Node(objtName,shape='ellipse',margin=0,fontname=self.fontName,fontsize=self.fontSize,style='filled',color='black',fontcolor='white',URL=objtUrl))
    else: 
      raise UnknownNodeType(dimName)
Exemplo n.º 5
0
    def buildNode(self, dimName, objtName):
        if ((self.theKaosModel == 'template_goal') and (dimName == 'goal')):
            dimName = 'template_goal'
        objtUrl = dimName + '#' + objtName
        b = Borg()
        actorFile = b.assetDir + '/modelActor.png'
        attackerFile = b.assetDir + '/modelAttacker.png'

        if ((dimName == 'goal') or (dimName == 'template_goal')):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='parallelogram',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'obstacle'):
            obsId = self.dbProxy.getDimensionId(objtName, 'obstacle')
            envId = self.dbProxy.getDimensionId(self.theEnvironmentName,
                                                'environment')
            obsProb, obsRationale = self.dbProxy.obstacleProbability(
                obsId, envId)
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='polygon',
                           margin=0,
                           skew='-0.4',
                           style='filled',
                           pencolor='black',
                           colorscheme='ylorrd9',
                           fillcolor=obstacleColourCode(obsProb),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           fontcolor=probabilityTextColourCode(obsProb),
                           URL=objtUrl))
        elif (dimName == 'domainproperty'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='house',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'requirement'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='parallelogram',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'countermeasure'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='hexagon',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif ((dimName == 'role') and (self.theKaosModel != 'task')):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='hexagon',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif ((dimName == 'role') and (self.theKaosModel == 'task')):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shapefile=actorFile,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl,
                           peripheries='0'))
        elif (dimName == 'usecase'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='ellipse',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'task'):
            objt = self.dbProxy.dimensionObject(objtName, 'task')
            if (objt.assumption() == True):
                objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName
            else:
                objtLabel = objtName
            taskScore = self.dbProxy.taskUsabilityScore(
                objtName, self.theEnvironmentName)
            self.theGraph.add_node(
                pydot.Node(objtName,
                           label=objtLabel,
                           shape='ellipse',
                           margin=0,
                           style='filled',
                           color=usabilityColourCode(taskScore),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           fontcolor=usabilityTextColourCode(taskScore),
                           URL=objtUrl))
        elif (dimName == 'misusecase'):
            ellipseColour = 'black'
            if (self.theKaosModel == 'task'):
                riskName = objtName[8:]
                riskObjt = self.dbProxy.dimensionObject(riskName, 'risk')
                riskScores = self.dbProxy.riskScore(riskObjt.threat(),
                                                    riskObjt.vulnerability(),
                                                    self.theEnvironmentName,
                                                    riskName)
                highestScore = 0
                for riskScore in riskScores:
                    currentScore = riskScore[2]
                    if (currentScore > highestScore):
                        highestScore = currentScore
                ellipseColour = threatColourCode(highestScore)
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='ellipse',
                           margin=0,
                           style='filled',
                           color=ellipseColour,
                           fontcolor=riskTextColourCode(highestScore),
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'persona'):
            objt = self.dbProxy.dimensionObject(objtName, 'persona')
            if (objt.assumption() == True):
                objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName
                self.theGraph.add_node(
                    pydot.Node(objtName,
                               label=objtLabel,
                               shapefile=actorFile,
                               fontname=self.fontName,
                               fontsize=self.fontSize,
                               URL=objtUrl,
                               peripheries='0'))
            else:
                self.theGraph.add_node(
                    pydot.Node(objtName,
                               shapefile=actorFile,
                               fontname=self.fontName,
                               fontsize=self.fontSize,
                               URL=objtUrl,
                               peripheries='0'))
        elif (dimName == 'attacker'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shapefile=attackerFile,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl,
                           peripheries='0'))
        elif (dimName == 'response'):
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='note',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           URL=objtUrl))
        elif (dimName == 'asset'):
            fontColour = 'black'
            nodeColour = 'black'
            if (self.theKaosModel == 'task'):
                fontColour = 'blue'
                nodeColour = 'blue'
            self.theGraph.add_node(
                pydot.Node(objtName,
                           shape='record',
                           margin=0,
                           fontname=self.fontName,
                           fontsize=self.fontSize,
                           fontcolor=fontColour,
                           color=nodeColour,
                           URL=objtUrl))
        else:
            raise UnknownNodeType(dimName)
Exemplo n.º 6
0
 def buildNode(self,dimName,objtName):
   if ((self.theKaosModel == 'template_goal') and (dimName == 'goal')):
     dimName = 'template_goal'
   objtUrl = dimName + '#' + objtName
   b = Borg()
   actorFile = b.assetDir + '/modelActor.png'
   attackerFile = b.assetDir + '/modelAttacker.png'
     
   if ((dimName == 'goal') or (dimName == 'template_goal')):
     self.theGraph.add_node(pydot.Node(objtName,shape='parallelogram',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
   elif (dimName == 'obstacle'):
     obsId = self.dbProxy.getDimensionId(objtName,'obstacle')
     envId = self.dbProxy.getDimensionId(self.theEnvironmentName,'environment')
     obsProb,obsRationale = self.dbProxy.obstacleProbability(obsId,envId)
     self.theGraph.add_node(pydot.Node(objtName,shape='polygon',margin=0,skew='-0.4',style='filled',pencolor='black',colorscheme='ylorrd9',fillcolor=obstacleColourCode(obsProb),fontname=self.fontName,fontsize=self.fontSize,fontcolor=probabilityTextColourCode(obsProb),URL=objtUrl))
   elif (dimName == 'domainproperty'):
     self.theGraph.add_node(pydot.Node(objtName,shape='house',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
   elif (dimName == 'requirement'):
     self.theGraph.add_node(pydot.Node(objtName,shape='parallelogram',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
   elif (dimName == 'countermeasure'):
     self.theGraph.add_node(pydot.Node(objtName,shape='hexagon',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
   elif ((dimName == 'role') and (self.theKaosModel != 'task')):
     self.theGraph.add_node(pydot.Node(objtName,shape='hexagon',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
   elif ((dimName == 'role') and (self.theKaosModel == 'task')):
     self.theGraph.add_node(pydot.Node(objtName,shapefile=actorFile,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,peripheries='0'))
   elif (dimName == 'usecase'):
     self.theGraph.add_node(pydot.Node(objtName,shape='ellipse',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
   elif (dimName == 'task'):
     objt = self.dbProxy.dimensionObject(objtName,'task')
     if (objt.assumption() == True):
       objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName 
     else:
       objtLabel = objtName
     taskScore = self.dbProxy.taskUsabilityScore(objtName,self.theEnvironmentName)
     self.theGraph.add_node(pydot.Node(objtName,label=objtLabel,shape='ellipse',margin=0,style='filled',color=usabilityColourCode(taskScore),fontname=self.fontName,fontsize=self.fontSize,fontcolor=usabilityTextColourCode(taskScore),URL=objtUrl))
   elif (dimName == 'misusecase'):
     ellipseColour = 'black'
     if (self.theKaosModel == 'task'):
       riskName = objtName[8:]
       riskObjt = self.dbProxy.dimensionObject(riskName,'risk')
       riskScores = self.dbProxy.riskScore(riskObjt.threat(),riskObjt.vulnerability(),self.theEnvironmentName,riskName)
       highestScore = 0
       for riskScore in riskScores:
         currentScore = riskScore[2]
         if (currentScore > highestScore):
           highestScore = currentScore
       ellipseColour = threatColourCode(highestScore)
     self.theGraph.add_node(pydot.Node(objtName,shape='ellipse',margin=0,style='filled',color=ellipseColour,fontcolor=riskTextColourCode(highestScore),fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
   elif (dimName == 'persona'):
     objt = self.dbProxy.dimensionObject(objtName,'persona')
     if (objt.assumption() == True):
       objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName 
       self.theGraph.add_node(pydot.Node(objtName,label=objtLabel,shapefile=actorFile,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,peripheries='0'))
     else: 
       self.theGraph.add_node(pydot.Node(objtName,shapefile=actorFile,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,peripheries='0'))
   elif (dimName == 'attacker'):
     self.theGraph.add_node(pydot.Node(objtName,shapefile=attackerFile,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl,peripheries='0'))
   elif (dimName == 'response'):
     self.theGraph.add_node(pydot.Node(objtName,shape='note',margin=0,fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
   elif (dimName == 'asset'):
     fontColour = 'black'
     nodeColour = 'black'
     if (self.theKaosModel == 'task'):
       fontColour = 'blue'
       nodeColour = 'blue'
     self.theGraph.add_node(pydot.Node(objtName,shape='record',margin=0,fontname=self.fontName,fontsize=self.fontSize,fontcolor=fontColour,color=nodeColour,URL=objtUrl))
   else:
     raise UnknownNodeType(dimName)
Exemplo n.º 7
0
 def buildNode(self, dimName, objtName):
     objtUrl = dimName + "#" + objtName
     if dimName == "goal":
         self.theGraph.add_node(
             pydot.Node(objtName, shape="parallelogram", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
         )
     # soft-goal attributes      self.theGraph.add_node(pydot.Node(objtName,shape='polygon',style='rounded',sides='6',distortion='-0.537997',orientation='52',skew='-0.960726',fontname=self.fontName,fontsize=self.fontSize,URL=objtUrl))
     elif dimName == "obstacle":
         obsId = self.dbProxy.getDimensionId(objtName, "obstacle")
         envId = self.dbProxy.getDimensionId(self.theEnvironmentName, "environment")
         self.theGraph.add_node(
             pydot.Node(
                 objtName,
                 shape="polygon",
                 skew="-0.4",
                 style="filled",
                 pencolor="black",
                 colorscheme="ylorrd9",
                 fillcolor=obstacleColourCode(self.dbProxy.obstacleProbability(obsId, envId)),
                 fontname=self.fontName,
                 fontsize=self.fontSize,
                 URL=objtUrl,
             )
         )
     elif dimName == "domainproperty":
         self.theGraph.add_node(
             pydot.Node(objtName, shape="house", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
         )
     elif dimName == "requirement":
         self.theGraph.add_node(
             pydot.Node(objtName, shape="parallelogram", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
         )
     elif dimName == "countermeasure":
         self.theGraph.add_node(
             pydot.Node(objtName, shape="hexagon", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
         )
     elif (dimName == "role") and (self.theKaosModel != "task"):
         self.theGraph.add_node(
             pydot.Node(objtName, shape="hexagon", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
         )
     elif (dimName == "role") and (self.theKaosModel == "task"):
         self.theGraph.add_node(
             pydot.Node(objtName, shape="ellipse", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
         )
     elif dimName == "usecase":
         self.theGraph.add_node(
             pydot.Node(objtName, shape="ellipse", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
         )
     elif dimName == "task":
         objt = self.dbProxy.dimensionObject(objtName, "task")
         if objt.assumption() == True:
             objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName
         else:
             objtLabel = objtName
         taskScore = self.dbProxy.taskUsabilityScore(objtName, self.theEnvironmentName)
         self.theGraph.add_node(
             pydot.Node(
                 objtName,
                 label=objtLabel,
                 shape="ellipse",
                 style="filled",
                 color=usabilityColourCode(taskScore),
                 fontname=self.fontName,
                 fontsize=self.fontSize,
                 URL=objtUrl,
             )
         )
     elif dimName == "misusecase":
         ellipseColour = "black"
         if self.theKaosModel == "task":
             riskName = objtName[8:]
             riskObjt = self.dbProxy.dimensionObject(riskName, "risk")
             riskScores = self.dbProxy.riskScore(
                 riskObjt.threat(), riskObjt.vulnerability(), self.theEnvironmentName, riskName
             )
             highestScore = 0
             for riskScore in riskScores:
                 currentScore = riskScore[2]
                 if currentScore > highestScore:
                     highestScore = currentScore
             ellipseColour = threatColourCode(highestScore)
         self.theGraph.add_node(
             pydot.Node(
                 objtName,
                 shape="ellipse",
                 style="filled",
                 color=ellipseColour,
                 fontcolor="white",
                 fontname=self.fontName,
                 fontsize=self.fontSize,
                 URL=objtUrl,
             )
         )
     elif dimName == "persona":
         objt = self.dbProxy.dimensionObject(objtName, "persona")
         if objt.assumption() == True:
             objtLabel = "&lt;&lt;Assumption&gt;&gt;" + objtName
             self.theGraph.add_node(
                 pydot.Node(
                     objtName,
                     label=objtLabel,
                     shape="circle",
                     fontname=self.fontName,
                     fontsize=self.fontSize,
                     URL=objtUrl,
                 )
             )
         else:
             self.theGraph.add_node(
                 pydot.Node(objtName, shape="circle", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
             )
     elif dimName == "attacker":
         self.theGraph.add_node(
             pydot.Node(
                 objtName,
                 shape="circle",
                 style="filled",
                 color="black",
                 fontname=self.fontName,
                 fontsize=self.fontSize,
                 URL=objtUrl,
             )
         )
     elif dimName == "response":
         self.theGraph.add_node(
             pydot.Node(objtName, shape="note", fontname=self.fontName, fontsize=self.fontSize, URL=objtUrl)
         )
     elif dimName == "asset":
         fontColour = "black"
         nodeColour = "black"
         if self.theKaosModel == "task":
             fontColour = "blue"
             nodeColour = "blue"
         self.theGraph.add_node(
             pydot.Node(
                 objtName,
                 shape="record",
                 fontname=self.fontName,
                 fontsize=self.fontSize,
                 fontcolor=fontColour,
                 color=nodeColour,
                 URL=objtUrl,
             )
         )
     else:
         raise UnknownNodeType(dimName)