Exemplo n.º 1
0
        private void AnalyzeRelationships([NotNull] ThreatSource threatSource, [NotNull] Attack_PatternType attack)
        {
            foreach (var relatedAttack in attack.Related_Attack_Patterns)
            {
                if (relatedAttack.Relationship_Target_Form == RelationshipTypeRelationship_Target_Form.AttackPattern &&
                    relatedAttack.Relationship_Nature != null && relatedAttack.Relationship_Nature.Count > 0)
                {
                    switch (relatedAttack.Relationship_Nature[0])
                    {
                    case RelationshipTypeRelationship_Nature.ChildOf:
                        foreach (var view in relatedAttack.Relationship_Views)
                        {
                            threatSource.AddParentChild(view.Value, relatedAttack.Relationship_Target_ID, Id);
                        }
                        break;

                    case RelationshipTypeRelationship_Nature.ParentOf:
                        foreach (var view in relatedAttack.Relationship_Views)
                        {
                            threatSource.AddParentChild(view.Value, Id, relatedAttack.Relationship_Target_ID);
                        }
                        break;
                    }
                }
            }
        }
Exemplo n.º 2
0
 private void AnalyzeRelationships([NotNull] ThreatSource threatSource, [NotNull] Category category)
 {
     foreach (var relationthip in category.Relationships)
     {
         if (relationthip.Relationship_Target_Form == RelationshipTypeRelationship_Target_Form.AttackPattern &&
             relationthip.Relationship_Nature != null && relationthip.Relationship_Nature.Count > 0)
         {
             switch (relationthip.Relationship_Nature[0])
             {
             case RelationshipTypeRelationship_Nature.HasMember:
                 foreach (var view in relationthip.Relationship_Views)
                 {
                     threatSource.AddParentChild(view.Value, Id, relationthip.Relationship_Target_ID);
                 }
                 break;
             }
         }
     }
 }