Class RiskCalculation

java.lang.Object
be.kuleuven.cs.distrinet.sparta.core.analysis.RiskCalculation

public class RiskCalculation extends Object
RiskAssessment class containing a number of static risk calculation methods to assist in performing a threat's risk calculation.
  • Method Details

    • calculateVulnerability

      public static double calculateVulnerability(double[] vulnerability)
      Calculate the vulnerability from a (binary) vector of attack success/failures
      Parameters:
      vulnerability - binary victor indicating an attacks success or failure
      Returns:
      Single vulnerability number
    • calculateVulnerabilityConfidenceInterval

      public static double[] calculateVulnerabilityConfidenceInterval(double[] vulnerability)
      Calculate the Clopper-Pearson vulnerability confidence interval
      Parameters:
      vulnerability - binary vector indicating an attacks success or failure
      Returns:
      double[] containing {lower, expected, upper}
    • calculateBoundaries

      public static double[] calculateBoundaries(double[] tef)
      Parameters:
      tef - frequency array
      Returns:
      double[] containing {min, average, max}
    • calculateTefArray

      public static double[] calculateTefArray(ThreatType tt, AttackerProfile attackerType, int samples)
      Calculate the threat event frequency. This depends on the contact frequency and the probability of action. The contact frequency depends on the AttackerType. The probability of action depends on the AttackerType These values could be scaled according to the ThreatType, for example an attacker may be more likely to attempt an denial of service. This is currently not implemented.
      Parameters:
      tt - - the threat type
      attackerType - - the attacker profile
      samples - - the number of samples to use
      Returns:
      the threat event frequency array
    • calculateVulnerabilityArray

      public static double[] calculateVulnerabilityArray(DFDElement threatenedElement, DataFlow flow, ThreatType tt, List<RoleBinding> countermeasureBindings, AttackerProfile attacker, int samples)
      Calculate the vulnerability for flow, threattype, countermeasures and attacker profile
      Parameters:
      threatenedElement - - the threatened DFDElement
      flow - - the data flow (for the context in which the threat applies)
      tt - - the threat type
      countermeasureBindings - - list of bound countermeasures
      attacker - - the attacker profile
      samples - - the number of samples to use
      Returns:
      binary vulnerability array double[SAMPLES]
    • calculateLefArray

      public static double[][] calculateLefArray(double[] tefSamples, double[] vulnerabilityConfidenceInterval, int samples)
      Calculate the loss event frequency array. This function returns a multi dimension double array; result[0] is a double[samples] array with the lower vulnerability value result[1] is a double[samples] array with the expected vulnerability value result[2] is a double[samples] array with the upper vulnerability value
      Parameters:
      tefSamples - - the array of threat event frequency samples
      vulnerabilityConfidenceInterval - - double[] of the vulnerability {lower, expected, upper}
      samples - - the number of samples to use
      Returns:
      the loss event frequency confidence interval {lower, expected, upper}
    • aggregateMatrix

      public static double[] aggregateMatrix(double[][][][] matrix)
      This method reduces an four dimensional matrix (with the fourth dimension containing [lower,expected,upper], to a three value array containing the sum of, respectively, the lower, expected, and upper values.
      Parameters:
      matrix -
      Returns:
    • aggregateAvgMatrix

      public static double[] aggregateAvgMatrix(double[][][][] matrix, double[][][] applicabilityMatrix)
      This method reduces an four dimensional matrix (with the fourth dimension containing [lower,expected,upper], to a three value array containing the average of, respectively, the lower, expected, and upper values. To prevent averaging with 0 values for entries for which there is actually NA, the applicabilityMatrix for the same index. This means that only entries matrix[i][j][k] are averaged for which applicabilityMatrix[i][j][k]!=0
      Parameters:
      matrix -
      applicabilityMatrix -
      Returns:
    • getSamplesFromNullableNeutral

      public static double[] getSamplesFromNullableNeutral(Estimate estimate, int n)
      Get n samples from an estimate distribution. In case of null, samples are all 1.
      Parameters:
      estimate - the estimate for which samples have to be calculated
      n - the number of samples
      Returns:
      the samples themselves
    • getSamplesFromNullableZero

      public static double[] getSamplesFromNullableZero(Estimate estimate, int n)
      Get n samples from an estimate distribution. In case of null, samples are all 0.
      Parameters:
      estimate - the estimate for which samples have to be calculated
      n - the number of samples
      Returns:
      the samples themselves
    • identity

      public static double[] identity(int n)
      Get n identity samples (all 1).
      Parameters:
      n - the number of samples
      Returns:
      the samples themselves