Search in sources :

Example 1 with CyberReq

use of com.ge.verdict.attackdefensecollector.model.CyberReq in project VERDICT by ge-high-assurance.

the class AttackDefenseCollector method perform.

/**
 * Trace all cyber requirements, build attack-defense tree, and calculate probabilities for the
 * loaded model.
 *
 * <p>The bulk of the work is actually done in SystemModel::trace and ConnectionModel::trace.
 */
public List<Result> perform() {
    List<Result> output = new ArrayList<>();
    // We are also ignoring whether or not the cyber requirement is in a mission
    for (SystemModel system : sysNameToSystemModelMap.values()) {
        for (CyberReq cyberReq : system.getCyberReqs()) {
            Optional<ADTree> treeOpt = system.trace(cyberReq.getCondition());
            // Crush the tree to remove redundant nodes
            ADTree crushed = treeOpt.isPresent() ? treeOpt.get().crush() : new ADOr(Collections.emptyList(), true);
            // not enabling this for now because it is potentially inefficient
            // ADTree adtree = CutSetGenerator.generate(crushed);
            ADTree adtree = crushed;
            // Compute probability of attack
            Prob computed = adtree.compute();
            output.add(new Result(system, cyberReq, adtree, computed));
        }
    }
    return output;
}
Also used : ADTree(com.ge.verdict.attackdefensecollector.adtree.ADTree) SystemModel(com.ge.verdict.attackdefensecollector.model.SystemModel) CyberReq(com.ge.verdict.attackdefensecollector.model.CyberReq) ArrayList(java.util.ArrayList) ADOr(com.ge.verdict.attackdefensecollector.adtree.ADOr)

Example 2 with CyberReq

use of com.ge.verdict.attackdefensecollector.model.CyberReq in project VERDICT by ge-high-assurance.

the class DTreeConstructorTest method multipleRequirementsTest.

@Test
public void multipleRequirementsTest() {
    DLeaf.Factory factory = new DLeaf.Factory();
    CostModel dummyCosts = new CostModel(new File(getClass().getResource("dummyCosts.xml").getPath()));
    SystemModel system = new SystemModel("S1");
    Attack attack1 = new Attack(system.getAttackable(), "A1", "An attack", Prob.certain(), CIA.I);
    Defense defense1 = new Defense(attack1);
    defense1.addDefenseClause(Collections.singletonList(new Defense.DefenseLeaf("D1", Optional.empty())));
    List<AttackDefenseCollector.Result> results = Arrays.asList(new AttackDefenseCollector.Result(system, new CyberReq("req1", "mission1", 5, "port1", CIA.I), new ADAnd(new ADNot(defense1), attack1), Prob.certain()), new AttackDefenseCollector.Result(system, new CyberReq("req1", "mission1", 7, "port1", CIA.I), new ADAnd(new ADNot(defense1), attack1), Prob.certain()));
    DTree dtree = new DAnd(new DOr(new DOr(new DAnd(new DLeaf("S1", "D1", "A1", 0, 5, dummyCosts, factory, false, false)))), new DOr(new DOr(new DAnd(new DLeaf("S1", "D1", "A1", 0, 7, dummyCosts, factory, false, false)))));
    Assertions.assertThat(DTreeConstructor.construct(results, dummyCosts, false, false, factory).prepare().get().prettyPrint()).isEqualTo(dtree.prettyPrint());
}
Also used : DLeaf(com.ge.verdict.synthesis.dtree.DLeaf) ADNot(com.ge.verdict.attackdefensecollector.adtree.ADNot) DTree(com.ge.verdict.synthesis.dtree.DTree) ADTree(com.ge.verdict.attackdefensecollector.adtree.ADTree) CyberReq(com.ge.verdict.attackdefensecollector.model.CyberReq) ADOr(com.ge.verdict.attackdefensecollector.adtree.ADOr) DOr(com.ge.verdict.synthesis.dtree.DOr) AttackDefenseCollector(com.ge.verdict.attackdefensecollector.AttackDefenseCollector) ADAnd(com.ge.verdict.attackdefensecollector.adtree.ADAnd) Attack(com.ge.verdict.attackdefensecollector.adtree.Attack) ADAnd(com.ge.verdict.attackdefensecollector.adtree.ADAnd) DAnd(com.ge.verdict.synthesis.dtree.DAnd) Defense(com.ge.verdict.attackdefensecollector.adtree.Defense) SystemModel(com.ge.verdict.attackdefensecollector.model.SystemModel) File(java.io.File) Test(org.junit.Test)

Example 3 with CyberReq

use of com.ge.verdict.attackdefensecollector.model.CyberReq in project VERDICT by ge-high-assurance.

the class VerdictSynthesisTest method biggerMeritAssignmentTest.

@Test
public void biggerMeritAssignmentTest() {
    CostModel costModel = new CostModel(new File(getClass().getResource("meritCosts.xml").getPath()));
    SystemModel system = new SystemModel("C1");
    Attack attack1 = new Attack(system.getAttackable(), "A1", "An attack", Prob.certain(), CIA.I);
    Defense defense1 = new Defense(attack1);
    defense1.addDefenseClause(Collections.singletonList(new Defense.DefenseLeaf("D1", Optional.of(new com.ge.verdict.attackdefensecollector.Pair<>("D1", 1)))));
    Attack attack2 = new Attack(system.getAttackable(), "A2", "An attack", Prob.certain(), CIA.I);
    Defense defense2 = new Defense(attack2);
    defense2.addDefenseClause(Collections.singletonList(new Defense.DefenseLeaf("D2", Optional.of(new com.ge.verdict.attackdefensecollector.Pair<>("D2", 1)))));
    ADTree adtree = new ADAnd(new ADOr(new ADAnd(new ADNot(defense1), attack1)), new ADOr(new ADAnd(new ADNot(defense2), attack2)));
    DLeaf.Factory factory = new DLeaf.Factory();
    List<AttackDefenseCollector.Result> results = Arrays.asList(new AttackDefenseCollector.Result(system, new CyberReq("req1", "mission1", 1, "port1", CIA.I), adtree, Prob.certain()));
    Optional<ResultsInstance> result = VerdictSynthesis.performSynthesisMultiple(DTreeConstructor.construct(results, costModel, true, true, factory), factory, costModel, true, true, true, false);
    Assertions.assertThat(result.isPresent());
    Assertions.assertThat(result.get().items.size()).isEqualTo(2);
    Assertions.assertThat(result.get().outputCost).isEqualTo(new Fraction(1));
}
Also used : DLeaf(com.ge.verdict.synthesis.dtree.DLeaf) ADNot(com.ge.verdict.attackdefensecollector.adtree.ADNot) CyberReq(com.ge.verdict.attackdefensecollector.model.CyberReq) ADAnd(com.ge.verdict.attackdefensecollector.adtree.ADAnd) AttackDefenseCollector(com.ge.verdict.attackdefensecollector.AttackDefenseCollector) Fraction(org.apache.commons.math3.fraction.Fraction) Attack(com.ge.verdict.attackdefensecollector.adtree.Attack) ResultsInstance(com.ge.verdict.vdm.synthesis.ResultsInstance) Defense(com.ge.verdict.attackdefensecollector.adtree.Defense) ComponentDefense(com.ge.verdict.synthesis.dtree.DLeaf.ComponentDefense) ADTree(com.ge.verdict.attackdefensecollector.adtree.ADTree) SystemModel(com.ge.verdict.attackdefensecollector.model.SystemModel) ADOr(com.ge.verdict.attackdefensecollector.adtree.ADOr) File(java.io.File) Pair(com.ge.verdict.synthesis.util.Pair) Test(org.junit.Test)

Aggregations

ADOr (com.ge.verdict.attackdefensecollector.adtree.ADOr)3 ADTree (com.ge.verdict.attackdefensecollector.adtree.ADTree)3 CyberReq (com.ge.verdict.attackdefensecollector.model.CyberReq)3 SystemModel (com.ge.verdict.attackdefensecollector.model.SystemModel)3 AttackDefenseCollector (com.ge.verdict.attackdefensecollector.AttackDefenseCollector)2 ADAnd (com.ge.verdict.attackdefensecollector.adtree.ADAnd)2 ADNot (com.ge.verdict.attackdefensecollector.adtree.ADNot)2 Attack (com.ge.verdict.attackdefensecollector.adtree.Attack)2 Defense (com.ge.verdict.attackdefensecollector.adtree.Defense)2 DLeaf (com.ge.verdict.synthesis.dtree.DLeaf)2 File (java.io.File)2 Test (org.junit.Test)2 DAnd (com.ge.verdict.synthesis.dtree.DAnd)1 ComponentDefense (com.ge.verdict.synthesis.dtree.DLeaf.ComponentDefense)1 DOr (com.ge.verdict.synthesis.dtree.DOr)1 DTree (com.ge.verdict.synthesis.dtree.DTree)1 Pair (com.ge.verdict.synthesis.util.Pair)1 ResultsInstance (com.ge.verdict.vdm.synthesis.ResultsInstance)1 ArrayList (java.util.ArrayList)1 Fraction (org.apache.commons.math3.fraction.Fraction)1