def existingGoalParameters(self): goalName = self.decorator.getText("goalNameCtrl") modifiedProperties = self.environmentProperties() goalEnvProperties = self.dbProxy.goalEnvironmentProperties(self.theGoalId) for idx,p in enumerate(goalEnvProperties): if (p.name() == self.theEnvironmentName): goalEnvProperties[idx] = modifiedProperties parameters = GoalParameters(goalName,'None',[],goalEnvProperties) parameters.setId(self.theGoalId) return parameters
def update_goal(self, goal, name): old_goal = self.get_goal_by_name(name, simplify=False) id = old_goal.theId params = GoalParameters(goalName=goal.theName, goalOrig=goal.theOriginator, tags=goal.theTags, properties=goal.theEnvironmentProperties) params.setId(id) try: self.db_proxy.updateGoal(params) except ARM.DatabaseProxyException as ex: self.close() raise ARMHTTPError(ex)
def add(self, idx=-1, goalName="", envName="", newDefinition="", newCategory="Maintain", newPriority="Low", newFitCriterion="None", newIssue="None", newOriginator=""): envName = self.envCombo.GetValue() parentGoalName = self.goalCombo.GetValue() ep = GoalEnvironmentProperties( envName, '', newDefinition, newCategory, newPriority, newFitCriterion, newIssue, [(parentGoalName, 'goal', 'and', 'No', 'None')]) g = Goal(-1, goalName, newOriginator, [], [ep]) gp = GoalParameters(goalName, newOriginator, [], [ep]) g.setId(self.dbProxy.addGoal(gp)) if (idx != -1): self.goals.insert(idx, g) else: self.goals.append(g) return g
def update_goal(self, goal, name): old_goal = self.get_goal_by_name(name, simplify=False) id = old_goal.theId params = GoalParameters( goalName=goal.theName, goalOrig=goal.theOriginator, tags=goal.theTags, properties=goal.theEnvironmentProperties ) params.setId(id) try: self.db_proxy.updateGoal(params) except ARM.DatabaseProxyException as ex: self.close() raise ARMHTTPError(ex)
def parameters(self): properties = GoalEnvironmentProperties( self.theEnvironmentName, '', self.theGoalDefinition, self.theGoalCategory, self.theGoalPriority, self.theGoalFitCriterion, self.theGoalIssues, self.theAssociations, self.theSubAssociations, self.theConcerns, self.theConcernAssociations) parameters = GoalParameters(self.theGoalName, self.theGoalOriginator, [], [properties]) return parameters
def add_goal(self, goal): goalParams = GoalParameters(goalName=goal.theName, goalOrig=goal.theOriginator, tags=goal.theTags, properties=goal.theEnvironmentProperties) if not self.check_existing_goal(goal.theName): goal_id = self.db_proxy.addGoal(goalParams) else: self.close() raise OverwriteNotAllowedHTTPError('The provided goal name') return goal_id
def build(response): goalCategory = response.responseType() goalOriginator = 'Response ' + response.name() if (goalCategory == 'Transfer'): goalName, goalDef = transferText(response) goalEnvProperties = [] for p in environmentProperties: envName = p.name() goalEnvProperties.append( GoalEnvironmentProperties(envName, '', goalDef, goalCategory, goalPriority, goalFitCriterion, goalIssue)) tParameters = GoalParameters(goalName, goalOriginator, [], goalEnvProperties) return [tParameters] else: mitText = mitigateText(response) riskText = mitText[0] riskGoalName = riskText[0] riskGoalDef = riskText[1] riskGoalCategory = riskText[2] thrText = mitText[1] vulText = mitText[2] goalPriority = 'Medium' goalFitCriterion = 'None' goalIssue = 'None' thrGoalName = thrText[0] thrGoalDef = thrText[1] thrGoalCategory = thrText[2] vulGoalName = vulText[0] vulGoalDef = vulText[1] vulGoalCategory = vulText[2] riskGoalEnvProperties = [] thrGoalEnvProperties = [] vulGoalEnvProperties = [] environmentProperties = response.environmentProperties() for p in environmentProperties: envName = p.name() riskGoalEnvProperties.append( GoalEnvironmentProperties(envName, '', riskGoalDef, riskGoalCategory, goalPriority, goalFitCriterion, goalIssue)) riskParameters = GoalParameters(riskGoalName, goalOriginator, [], riskGoalEnvProperties) for p in environmentProperties: envName = p.name() thrGoalRef = [(riskGoalName, 'goal', 'or', 'No', '')] thrGoalEnvProperties.append( GoalEnvironmentProperties(envName, '', thrGoalDef, thrGoalCategory, goalPriority, goalFitCriterion, goalIssue, thrGoalRef)) threatParameters = GoalParameters(thrGoalName, goalOriginator, [], thrGoalEnvProperties) for p in environmentProperties: envName = p.name() vulGoalRef = [(riskGoalName, 'goal', 'or', 'No', '')] vulGoalEnvProperties.append( GoalEnvironmentProperties(envName, '', vulGoalDef, vulGoalCategory, goalPriority, goalFitCriterion, goalIssue, vulGoalRef)) vulnerabilityParameters = GoalParameters(vulGoalName, goalOriginator, [], vulGoalEnvProperties) return [riskParameters, threatParameters, vulnerabilityParameters]
def parameters(self): parameters = GoalParameters(self.theGoalName,self.theGoalOriginator,[],self.theEnvironmentProperties) parameters.setId(self.theGoalId) return parameters
def parameters(self): parameters = GoalParameters(self.theGoalName, self.theGoalOriginator, self.theTags, self.theEnvironmentProperties) parameters.setId(self.theGoalId) return parameters
def newGoalParameters(self): goalName = self.decorator.getText("goalNameCtrl") envProperties = self.environmentProperties() parameters = GoalParameters(goalName,'None',[],[envProperties]) parameters.setId(self.theGoalId) return parameters
def endElement(self, name): if name == 'domainproperty': p = DomainPropertyParameters(self.theName, self.theDescription, self.theType, self.theOriginator, self.theTags) self.theDomainProperties.append(p) self.resetDomainPropertyAttributes() elif name == 'goal_environment': p = GoalEnvironmentProperties(self.theEnvironmentName, '', self.theDescription, self.theCategory, self.thePriority, self.theFitCriterion, self.theIssue, [], [], self.theConcerns, self.theConcernAssociations) self.theEnvironmentProperties.append(p) self.resetGoalEnvironmentAttributes() elif name == 'obstacle_environment': p = ObstacleEnvironmentProperties(self.theEnvironmentName, '', self.theDescription, self.theCategory, [], [], self.theConcerns) self.theEnvironmentProperties.append(p) self.resetObstacleEnvironmentAttributes() elif name == 'goal': p = GoalParameters(self.theName, self.theOriginator, self.theTags, self.theEnvironmentProperties) self.theGoals.append(p) self.resetGoalAttributes() elif name == 'obstacle': p = ObstacleParameters(self.theName, self.theOriginator, self.theTags, self.theEnvironmentProperties) self.theObstacles.append(p) self.resetObstacleAttributes() elif name == 'requirement': reqId = self.dbProxy.newId() r = RequirementFactory.build(reqId, self.theLabel, self.theName, self.theDescription, self.thePriority, self.theRationale, self.theFitCriterion, self.theOriginator, self.theType, self.theReference) self.theRequirements.append( (r, self.theReference, self.theReferenceType)) self.resetRequirementAttributes() elif name == 'countermeasure': p = CountermeasureParameters(self.theName, self.theDescription, self.theType, self.theTags, self.theEnvironmentProperties) self.theCountermeasures.append(p) self.resetCountermeasureAttributes() elif name == 'mitigating_property': self.theSpDict[self.thePropertyName] = (self.thePropertyValue, self.theDescription) self.resetMitigatingPropertyAttributes() elif name == 'countermeasure_environment': cProperty, cRationale = self.theSpDict['confidentiality'] iProperty, iRationale = self.theSpDict['integrity'] avProperty, avRationale = self.theSpDict['availability'] acProperty, acRationale = self.theSpDict['accountability'] anProperty, anRationale = self.theSpDict['anonymity'] panProperty, panRationale = self.theSpDict['pseudonymity'] unlProperty, unlRationale = self.theSpDict['unlinkability'] unoProperty, unoRationale = self.theSpDict['unobservability'] p = CountermeasureEnvironmentProperties( self.theEnvironmentName, self.theCmRequirements, self.theTargets, [ cProperty, iProperty, avProperty, acProperty, anProperty, panProperty, unlProperty, unoProperty ], [ cRationale, iRationale, avRationale, acRationale, anRationale, panRationale, unlRationale, unoRationale ], self.theCost, self.theCmRoles, self.theTaskPersonas) self.theEnvironmentProperties.append(p) self.resetCountermeasureEnvironmentAttributes() elif (name == 'target'): self.theTargets.append( Target(self.theTargetName, self.theTargetEffectiveness, self.theRationale)) self.theTargetResponses = [] elif (name == 'description'): self.inDescription = 0 elif (name == 'definition'): self.inDescription = 0 elif name == 'fit_criterion': self.inFitCriterion = 0 elif name == 'issue': self.inIssue = 0 elif name == 'rationale': self.inRationale = 0 elif name == 'originator': self.inOriginator = 0