예제 #1
0
 def onReferenceChange(self,evt):
   refValue = evt.GetString()
   descCtrl = self.FindWindowById(CHARACTERISTICREFERENCE_TEXTDESCRIPTION_ID)
   
   if (refValue == self.newArtifactString or refValue == self.newConceptString):
     if (refValue == self.newArtifactString):
       addParameters = DialogClassParameters(DOCUMENTREFERENCE_ID,'Add Artifact Reference',DocumentReferenceDialog,DOCUMENTREFERENCE_BUTTONCOMMIT_ID,self.dbProxy.addDocumentReference,True)
     else:
       addParameters = DialogClassParameters(CONCEPTREFERENCE_ID,'Add Concept Reference',ConceptReferenceDialog,CONCEPTREFERENCE_BUTTONCOMMIT_ID,self.dbProxy.addConceptReference,True)
     dialogClass = addParameters.dclass()
     addDialog = dialogClass(self,addParameters)
     if (addDialog.ShowModal() == addParameters.createButtonId()):
       dialogOutParameters = addDialog.parameters()
       addFn = addParameters.setter()
       objtId = addFn(dialogOutParameters)
       dimName = dialogOutParameters.name()
       refDesc = dialogOutParameters.description()
       refCtrl = self.FindWindowById(CHARACTERISTICREFERENCE_COMBOREFERENCE_ID)
       refCtrl.Append(dimName)
       refCtrl.SetValue(dimName)
       descCtrl.SetValue(refDesc)
     addDialog.Destroy()
   else:
     dimCtrl = self.FindWindowById(CHARACTERISTICREFERENCE_COMBODIMENSION_ID)
     dimName = dimCtrl.GetValue()
     refDesc = self.dbProxy.referenceDescription(dimName,refValue)
     descCtrl.SetValue(refDesc)
 def onReferenceChange(self,evt):
   refValue = evt.GetString()
   if (refValue == '[New reference]' or refValue == '[New concept]'):
     if (refValue == '[New reference]'):
       addParameters = DialogClassParameters(DOCUMENTREFERENCE_ID,'Add Document Reference',DocumentReferenceDialog,DOCUMENTREFERENCE_BUTTONCOMMIT_ID,self.dbProxy.addDocumentReference,True)
     else:
       addParameters = DialogClassParameters(CONCEPTREFERENCE_ID,'Add Concept Reference',ConceptReferenceDialog,CONCEPTREFERENCE_BUTTONCOMMIT_ID,self.dbProxy.addConceptReference,True)
     dialogClass = addParameters.dclass()
     addDialog = dialogClass(self,addParameters)
     if (addDialog.ShowModal() == addParameters.createButtonId()):
       dialogOutParameters = addDialog.parameters()
       addFn = addParameters.setter()
       objtId = addFn(dialogOutParameters)
       dimName = dialogOutParameters.name()
       refCtrl = self.FindWindowById(PERSONACHARACTERISTIC_COMBOREFERENCE_ID)
       refCtrl.Append(dimName)
       refCtrl.SetValue(dimName)
     addDialog.Destroy()
예제 #3
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     assetId = selectedObjt.id()
     try:
         updateParameters = DialogClassParameters(
             TEMPLATEASSET_ID, 'Edit template asset', TemplateAssetDialog,
             TEMPLATEASSET_BUTTONCOMMIT_ID,
             self.dbProxy.updateTemplateAsset, False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Edit template asset',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #4
0
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(PERSONA_ID, 'Add persona',
                                               PersonaDialog,
                                               PERSONA_BUTTONCOMMIT_ID,
                                               self.dbProxy.addPersona,
                                               True)
         self.addObject(addParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Add persona',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(
             armid.GOALASSOCIATION_ID, 'Add goal association',
             GoalAssociationDialog, armid.GOALASSOCIATION_BUTTONCOMMIT_ID,
             self.dbProxy.addGoalAssociation, True)
         self.addObject(addParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Add goal association',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #6
0
 def onUpdate(self, evt):
     try:
         selectedObjt = self.objts[self.selectedLabel]
         updateParameters = DialogClassParameters(
             armid.VULNERABILITY_ID, 'Edit vulnerability',
             VulnerabilityDialog.VulnerabilityDialog,
             armid.VULNERABILITY_BUTTONCOMMIT_ID,
             self.dbProxy.updateVulnerability, False)
         self.updateObject(selectedObjt, updateParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Edit vulnerability',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #7
0
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(
             TEMPLATEREQUIREMENT_ID, 'Add template requirement',
             TemplateRequirementDialog, TEMPLATEREQUIREMENT_BUTTONCOMMIT_ID,
             self.dbProxy.addTemplateRequirement, True)
         self.addObject(addParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Add template requirement',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #8
0
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(ASSET_ID, 'Add asset',
                                               AssetDialog,
                                               ASSET_BUTTONCOMMIT_ID,
                                               self.dbProxy.addAsset, True)
         self.addObject(addParameters)
         self.rmFrame.updateObjectSelection(self.selectedLabel)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Add asset',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #9
0
 def onUpdate(self, evt):
     try:
         selectedObjt = self.objts[self.selectedLabel]
         updateParameters = DialogClassParameters(VULNERABILITY_ID,
                                                  'Edit risk', RiskDialog,
                                                  RISK_BUTTONCOMMIT_ID,
                                                  self.dbProxy.updateRisk,
                                                  False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Edit risk',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #10
0
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(armid.DOMAIN_ID,
                                               'Add Domain', DomainDialog,
                                               armid.DOMAIN_BUTTONCOMMIT_ID,
                                               self.dbProxy.addDomain, True)
         self.addObject(addParameters)
         self.rmFrame.updateDomainSelection(self.selectedLabel)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Add Domain',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(
             armid.EXTERNALDOCUMENT_ID, 'Add External Document',
             ExternalDocumentDialog, armid.EXTERNALDOCUMENT_BUTTONCOMMIT_ID,
             self.dbProxy.addExternalDocument, True)
         self.addObject(addParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Add external document',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     assetId = selectedObjt.id()
     try:
         updateParameters = DialogClassParameters(
             armid.CLASSASSOCIATION_ID, 'Edit class association',
             ClassAssociationDialog, armid.CLASSASSOCIATION_BUTTONCOMMIT_ID,
             self.dbProxy.updateClassAssociation, False)
         self.updateObject(selectedObjt, updateParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Edit class association',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(
             armid.DOCUMENTREFERENCE_ID, 'Add Document Reference',
             DocumentReferenceDialog,
             armid.DOCUMENTREFERENCE_BUTTONCOMMIT_ID,
             self.dbProxy.addDocumentReference, True)
         self.addObject(addParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Add document reference',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #14
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     try:
         updateParameters = DialogClassParameters(ROLE_ID, 'Edit role',
                                                  RoleDialog,
                                                  ROLE_BUTTONCOMMIT_ID,
                                                  self.dbProxy.updateRole,
                                                  False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Edit role',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #15
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     objtId = selectedObjt.id()
     try:
         updateParameters = DialogClassParameters(CODE_ID, 'Edit Code',
                                                  CodeDialog,
                                                  CODE_BUTTONCOMMIT_ID,
                                                  self.dbProxy.updateCode,
                                                  False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Edit code',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #16
0
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(ATTACKER_ID,
                                               'Add attacker',
                                               AttackerDialog,
                                               ATTACKER_BUTTONCOMMIT_ID,
                                               self.dbProxy.addAttacker,
                                               creationFlag=True)
         self.addObject(addParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Add attacker',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #17
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     assetId = selectedObjt.id()
     try:
         updateParameters = DialogClassParameters(
             SECURITYPATTERN_ID, 'Edit Security Pattern',
             SecurityPatternDialog, SECURITYPATTERN_BUTTONCOMMIT_ID,
             self.dbProxy.updateSecurityPattern, False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Edit security pattern',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #18
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     objtId = selectedObjt.id()
     try:
         updateParameters = DialogClassParameters(
             DOCUMENTREFERENCE_ID, 'Edit Document Reference',
             DocumentReferenceDialog, DOCUMENTREFERENCE_BUTTONCOMMIT_ID,
             self.dbProxy.updateDocumentReference, False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Edit document reference',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #19
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     try:
         updateParameters = DialogClassParameters(
             IMPLIEDPROCESS_ID, 'Edit implied process',
             ImpliedProcessDialog, IMPLIEDPROCESS_BUTTONCOMMIT_ID,
             self.dbProxy.updateImpliedProcess, False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Edit implied process',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #20
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     objtId = selectedObjt.id()
     try:
         updateParameters = DialogClassParameters(
             armid.INTERNALDOCUMENT_ID, 'Edit Internal Document',
             InternalDocumentDialog, armid.INTERNALDOCUMENT_BUTTONCOMMIT_ID,
             self.dbProxy.updateInternalDocument, False)
         self.updateObject(selectedObjt, updateParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Edit internal document',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #21
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.listCtrl.theSelectedLabel]
     updateLabel = 'Edit Use Case'
     try:
         updateParameters = DialogClassParameters(
             armid.USECASE_ID, updateLabel, UseCaseDialog,
             armid.USECASE_BUTTONCOMMIT_ID, self.dbProxy.updateUseCase,
             False)
         self.updateObject(selectedObjt, updateParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), updateLabel,
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #22
0
 def onAdd(self, evt):
     try:
         addLabel = 'Add Use Case'
         addParameters = DialogClassParameters(USECASE_ID, addLabel,
                                               UseCaseDialog,
                                               USECASE_BUTTONCOMMIT_ID,
                                               self.dbProxy.addUseCase,
                                               True)
         self.addObject(addParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Add Use Case',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #23
0
 def onAdd(self,evt):
   try:
     assets = self.dbProxy.getDimensions('asset')
     if (len(assets) == 0):
       dlg = wx.MessageDialog(self,'Cannot add a vulnerability as no assets have been defined','Add vulnerability',wx.OK)
       dlg.ShowModal()
       dlg.Destroy()
       return
     addParameters = DialogClassParameters(VULNERABILITY_ID,'Add vulnerability',VulnerabilityDialog.VulnerabilityDialog,VULNERABILITY_BUTTONCOMMIT_ID,self.dbProxy.addVulnerability,True)
     self.addObject(addParameters)
   except ARMException,errorText:
     dlg = wx.MessageDialog(self,str(errorText),'Add vulnerability',wx.OK | wx.ICON_ERROR)
     dlg.ShowModal()
     dlg.Destroy()
     return
예제 #24
0
 def onAdd(self, evt):
     try:
         addParameters = DialogClassParameters(
             armid.PERSONACHARACTERISTIC_ID, 'Add Persona Characteristic',
             PersonaCharacteristicDialog,
             armid.PERSONACHARACTERISTIC_BUTTONCOMMIT_ID,
             self.dbProxy.addPersonaCharacteristic, True)
         self.addObject(addParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Add persona characteristic',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #25
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     assetId = selectedObjt.id()
     try:
         updateParameters = DialogClassParameters(DOMAIN_ID, 'Edit Domain',
                                                  DomainDialog,
                                                  DOMAIN_BUTTONCOMMIT_ID,
                                                  self.dbProxy.updateDomain,
                                                  False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Edit Domain',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #26
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.deprecatedLabel()]
     objtId = selectedObjt.id()
     try:
         updateParameters = DialogClassParameters(
             armid.PERSONACHARACTERISTIC_ID, 'Edit Persona Characteristic',
             PersonaCharacteristicDialog,
             armid.PERSONACHARACTERISTIC_BUTTONCOMMIT_ID,
             self.dbProxy.updatePersonaCharacteristic, False)
         self.updateObject(selectedObjt, updateParameters)
     except ARM.ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText),
                                'Edit persona characteristic',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy
예제 #27
0
 def onUpdate(self, evt):
     selectedObjt = self.objts[self.selectedLabel]
     try:
         updateParameters = DialogClassParameters(
             ATTACKER_ID,
             'Edit attacker',
             AttackerDialog,
             ATTACKER_BUTTONCOMMIT_ID,
             self.dbProxy.updateAttacker,
             creationFlag=False)
         self.updateObject(selectedObjt, updateParameters)
     except ARMException, errorText:
         dlg = wx.MessageDialog(self, str(errorText), 'Edit attacker',
                                wx.OK | wx.ICON_ERROR)
         dlg.ShowModal()
         dlg.Destroy()
         return
예제 #28
0
 def onImport(self,evt):
   try:
     assets = self.dbProxy.getDimensions('asset')
     if (len(assets) == 0):
       dlg = wx.MessageDialog(self,'Cannot import a vulnerability as no assets have been defined','Add vulnerability',wx.OK)
       dlg.ShowModal()
       dlg.Destroy()
       return
     dirDlg = DirectoryDialog(self,'vulnerability')
     if (dirDlg.ShowModal() == DIRECTORYDIALOG_BUTTONIMPORT_ID):
       objt = dirDlg.object()
       importParameters = DialogClassParameters(VULNERABILITY_ID,'Import vulnerability',VulnerabilityDialog.VulnerabilityDialog,VULNERABILITY_BUTTONCOMMIT_ID,self.dbProxy.addVulnerability,False)
       self.importObject(objt,importParameters)
   except ARMException,errorText:
     dlg = wx.MessageDialog(self,str(errorText),'Import vulnerability',wx.OK | wx.ICON_ERROR)
     dlg.ShowModal()
     dlg.Destroy()
     return
예제 #29
0
 def onImport(self,evt):
   try:
     assets = self.dbProxy.getDimensions('asset')
     if (len(assets) == 0):
       dlg = wx.MessageDialog(self,'Cannot import a threat as no assets have been defined','Add threat',wx.OK)
       dlg.ShowModal()
       dlg.Destroy()
       return
     dirDlg = DirectoryDialog(self,'threat')
     if (dirDlg.ShowModal() == armid.DIRECTORYDIALOG_BUTTONIMPORT_ID):
       objt = dirDlg.object()
       importParameters = DialogClassParameters(armid.THREAT_ID,'Import threat',ThreatDialog,armid.THREAT_BUTTONCOMMIT_ID,self.dbProxy.addThreat,False)
       self.importObject(objt,importParameters)
   except ARM.ARMException,errorText:
     dlg = wx.MessageDialog(self,str(errorText),'Import threat',wx.OK | wx.ICON_ERROR)
     dlg.ShowModal()
     dlg.Destroy()
     return
예제 #30
0
 def displayMemo(self,fromIdx,toIdx):
   try:
     cmValue = self.theMemos[(fromIdx,toIdx)]
     b = Borg() 
     cmObjt = b.dbProxy.dimensionObject(cmValue[0],'memo') 
     dlg = MemoDialog(self,DialogClassParameters(MEMO_ID,'View Memo'))
     dlg.load(cmObjt)
     if (dlg.ShowModal() == MEMO_BUTTONCOMMIT_ID):
       memoName = dlg.name()
       memoTxt = dlg.memo()
       self.theMemos[(fromIdx,toIdx)] = (memoName,memoTxt)
       b = Borg()
       p = MemoParameters(memoName,memoTxt)
       p.setId(cmObjt.id())
       b.dbProxy.updateMemo(p)
     dlg.Destroy()
   except KeyError:
     return
예제 #31
0
 def onReferenceChange(self,evt):
   refValue = evt.GetString()
   if (refValue == '[New reference]' or refValue == '[New concept]'):
     if (refValue == '[New reference]'):
       addParameters = DialogClassParameters(DOCUMENTREFERENCE_ID,'Add Document Reference',DocumentReferenceDialog,DOCUMENTREFERENCE_BUTTONCOMMIT_ID,self.dbProxy.addDocumentReference,True)
     else:
       addParameters = DialogClassParameters(CONCEPTREFERENCE_ID,'Add Concept Reference',ConceptReferenceDialog,CONCEPTREFERENCE_BUTTONCOMMIT_ID,self.dbProxy.addConceptReference,True)
     dialogClass = addParameters.dclass()
     addDialog = dialogClass(self,addParameters)
     if (addDialog.ShowModal() == addParameters.createButtonId()):
       dialogOutParameters = addDialog.parameters()
       addFn = addParameters.setter()
       objtId = addFn(dialogOutParameters)
       dimName = dialogOutParameters.name()
       refCtrl = self.FindWindowById(PERSONACHARACTERISTIC_COMBOREFERENCE_ID)
       refCtrl.Append(dimName)
       refCtrl.SetValue(dimName)
     addDialog.Destroy()
예제 #32
0
 def onAdd(self,evt):
   try:
     threats = self.dbProxy.getDimensions('threat')
     vulnerabilities = self.dbProxy.getDimensions('vulnerability')
     if (len(threats) == 0):
       dlg = wx.MessageDialog(self,'Cannot add a risk as no threats have been defined','Add risk',wx.OK)
       dlg.ShowModal()
       dlg.Destroy()
       return
     elif (len(vulnerabilities) == 0):
       dlg = wx.MessageDialog(self,'Cannot add a risk as no vulnerabilities have been defined','Add risk',wx.OK)
       dlg.ShowModal()
       dlg.Destroy()
       return
     addParameters = DialogClassParameters(armid.RISK_ID,'Add risk',RiskDialog,armid.RISK_BUTTONCOMMIT_ID,self.dbProxy.addRisk,True)
     self.addObject(addParameters)
   except ARM.ARMException,errorText:
     dlg = wx.MessageDialog(self,str(errorText),'Add risk',wx.OK | wx.ICON_ERROR)
     dlg.ShowModal()
     dlg.Destroy()