Class InfoflowResults

java.lang.Object
soot.jimple.infoflow.results.InfoflowResults
Direct Known Subclasses:
BackwardsInfoflowResults

public class InfoflowResults extends Object
Class for collecting information flow results
Author:
Steven Arzt
  • Field Details

    • TERMINATION_SUCCESS

      public static final int TERMINATION_SUCCESS
      See Also:
    • TERMINATION_DATA_FLOW_TIMEOUT

      public static final int TERMINATION_DATA_FLOW_TIMEOUT
      See Also:
    • TERMINATION_DATA_FLOW_OOM

      public static final int TERMINATION_DATA_FLOW_OOM
      See Also:
    • TERMINATION_PATH_RECONSTRUCTION_TIMEOUT

      public static final int TERMINATION_PATH_RECONSTRUCTION_TIMEOUT
      See Also:
    • TERMINATION_PATH_RECONSTRUCTION_OOM

      public static final int TERMINATION_PATH_RECONSTRUCTION_OOM
      See Also:
    • results

      protected volatile soot.util.MultiMap<ResultSinkInfo,ResultSourceInfo> results
    • additionalResults

      protected volatile soot.util.MultiMap<ResultSinkInfo,ResultSourceInfo> additionalResults
    • performanceData

      protected volatile InfoflowPerformanceData performanceData
    • exceptions

      protected volatile List<String> exceptions
    • terminationState

      protected int terminationState
    • pathAgnosticResults

      protected volatile boolean pathAgnosticResults
  • Constructor Details

    • InfoflowResults

      public InfoflowResults()
    • InfoflowResults

      public InfoflowResults(boolean pathAgnosticResults)
  • Method Details

    • getExceptions

      public List<String> getExceptions()
      Gets the exceptions that have happened during the data flow analysis. This collection is immutable.
      Returns:
      exceptions that occurred during the data flow analysis
    • addException

      public void addException(String ex)
      Adds an exception that has occurred during the data flow analysis to this result object
      Parameters:
      ex - The exception to add
    • size

      public int size()
      Gets the number of entries in this result object
      Returns:
      The number of entries in this result object
    • numConnections

      public int numConnections()
      Gets the total number of source-to-sink connections. If there are two connections along different paths between the same source and sink, size() will return 1, but numConnections() will return 2.
      Returns:
      The number of source-to-sink connections in this result object
    • isEmpty

      public boolean isEmpty()
      Gets whether this result object is empty, i.e. contains no information flows
      Returns:
      True if this result object is empty, otherwise false.
    • containsSink

      public boolean containsSink(soot.jimple.Stmt sink)
      Checks whether this result object contains a sink that exactly matches the given value.
      Parameters:
      sink - The sink to check for
      Returns:
      True if this result contains the given value as a sink, otherwise false.
    • containsSinkMethod

      public boolean containsSinkMethod(String sinkSignature)
      Checks whether this result object contains a sink with the given method signature
      Parameters:
      sinkSignature - The method signature to check for
      Returns:
      True if there is a sink with the given method signature in this result object, otherwise false.
    • addResult

      public void addResult(Collection<ISourceSinkDefinition> sinkDefinitions, AccessPath sink, soot.jimple.Stmt sinkStmt, Collection<ISourceSinkDefinition> sourceDefinitions, AccessPath source, soot.jimple.Stmt sourceStmt)
    • addResult

      public Collection<heros.solver.Pair<ResultSourceInfo,ResultSinkInfo>> addResult(Collection<ISourceSinkDefinition> sinkDefinitions, AccessPath sink, soot.jimple.Stmt sinkStmt, Collection<ISourceSinkDefinition> sourceDefinitions, AccessPath source, soot.jimple.Stmt sourceStmt, Object userData, List<Abstraction> propagationPath, InfoflowManager manager)
    • addResult

      public Collection<heros.solver.Pair<ResultSourceInfo,ResultSinkInfo>> addResult(Collection<ISourceSinkDefinition> sinkDefinitions, AccessPath sink, soot.jimple.Stmt sinkStmt, Collection<ISourceSinkDefinition> sourceDefinitions, AccessPath source, soot.jimple.Stmt sourceStmt, Object userData, List<soot.jimple.Stmt> propagationPath, List<AccessPath> propagationAccessPath, List<soot.jimple.Stmt> propagationCallSites)
      Adds the given result to this data structure
      Parameters:
      sinkDefinitions - The definition of the sink
      sink - The access path that arrived at the sink statement
      sinkStmt - The sink statement
      sourceDefinitions - The definition of the source
      source - The access path that originated from the source statement
      sourceStmt - The source statement
      userData - Optional user data to associate with the source
      propagationPath - The statements over which the data flow was propagated
      propagationAccessPath - The access paths along the data flow propagation path
      Returns:
      The new data flow result
    • addResult

      public Collection<heros.solver.Pair<ResultSourceInfo,ResultSinkInfo>> addResult(Collection<ISourceSinkDefinition> sinkDefinitions, AccessPath sink, soot.jimple.Stmt sinkStmt, Collection<ISourceSinkDefinition> sourceDefinitions, AccessPath source, soot.jimple.Stmt sourceStmt, Object userData, List<soot.jimple.Stmt> propagationPath, List<AccessPath> propagationAccessPath, List<soot.jimple.Stmt> propagationCallSites, InfoflowManager manager)
    • addResult

      public void addResult(DataFlowResult res)
      Adds the given data flow result to this data structure
      Parameters:
      res - The data flow result to add
    • addResult

      public void addResult(ResultSinkInfo sink, ResultSourceInfo source)
      Adds the given result to this data structure
      Parameters:
      sink - The sink at which the taint arrived
      source - The source from which the taint originated
    • addAll

      public void addAll(InfoflowResults results)
      Adds all results from the given data structure to this one
      Parameters:
      results - The data structure from which to copy the results
    • addAll

      public void addAll(Set<DataFlowResult> results)
      Adds the given data flow results to this result object
      Parameters:
      results - The data flow results to add
    • getResults

      public soot.util.MultiMap<ResultSinkInfo,ResultSourceInfo> getResults()
      Gets all results in this object as a hash map from sinks to sets of sources.
      Returns:
      All results in this object as a hash map.
    • getAdditionalResults

      public soot.util.MultiMap<ResultSinkInfo,ResultSourceInfo> getAdditionalResults()
    • getResultSet

      public Set<DataFlowResult> getResultSet()
      Gets the data flow results in a flat set
      Returns:
      The data flow results in a flat set. If no data flows are available, the return value is null.
    • getAdditionalResultSet

      public Set<DataFlowResult> getAdditionalResultSet()
      Gets the additional data flow results in a flat set
      Returns:
      The additional data flow results in a flat set. If no data flows are available, the return value is null.
    • isPathBetween

      public boolean isPathBetween(soot.jimple.Stmt sink, soot.jimple.Stmt source)
      Checks whether there is a path between the given source and sink.
      Parameters:
      sink - The sink to which there may be a path
      source - The source from which there may be a path
      Returns:
      True if there is a path between the given source and sink, false otherwise
    • isPathBetween

      public boolean isPathBetween(String sink, String source)
      Checks whether there is a path between the given source and sink.
      Parameters:
      sink - The sink to which there may be a path
      source - The source from which there may be a path
      Returns:
      True if there is a path between the given source and sink, false otherwise
    • isPathBetweenMethods

      public boolean isPathBetweenMethods(String sinkSignature, String sourceSignature)
      Checks whether there is an information flow between the two given methods (specified by their respective Soot signatures).
      Parameters:
      sinkSignature - The sink to which there may be a path
      sourceSignature - The source from which there may be a path
      Returns:
      True if there is a path between the given source and sink, false otherwise
    • printResults

      public void printResults()
      Prints all results stored in this object to the standard output
    • printResults

      public void printResults(Writer wr) throws IOException
      Prints all results stored in this object to the given writer
      Parameters:
      wr - The writer to which to print the results
      Throws:
      IOException - Thrown when data writing fails
    • clear

      public void clear()
      Removes all results from the data structure
    • getTerminationState

      public int getTerminationState()
      Gets the termination state that describes whether the data flow analysis terminated normally or whether one or more phases terminated prematurely due to a timeout or an out-of-memory condition
      Returns:
      The termination state
    • setTerminationState

      public void setTerminationState(int terminationState)
      Sets the termination state that describes whether the data flow analysis terminated normally or whether one or more phases terminated prematurely due to a timeout or an out-of-memory condition
      Parameters:
      terminationState - The termination state
    • wasAbortedTimeout

      public boolean wasAbortedTimeout()
      Gets whether the analysis was aborted due to a timeout
      Returns:
      True if the analysis was aborted due to a timeout, otherwise false
    • wasTerminatedOutOfMemory

      public boolean wasTerminatedOutOfMemory()
      Gets whether the analysis was terminated because it ran out of memory
      Returns:
      True if the analysis was terminated because it ran out of memory, otherwise false
    • getPerformanceData

      public InfoflowPerformanceData getPerformanceData()
      Gets the performance data on this FlowDroid run
      Returns:
      The performance data on this FlowDroid run
    • setPerformanceData

      public void setPerformanceData(InfoflowPerformanceData performanceData)
      Sets the performance data on this FlowDroid run
      Parameters:
      performanceData - The performance data on this FlowDroid run
    • addPerformanceData

      public void addPerformanceData(InfoflowPerformanceData performanceData)
      Adds the given performance data to this result object
      Parameters:
      performanceData - The performance data to add
    • remove

      public void remove(DataFlowResult result)
      Removes the given data flow result from this result set
      Parameters:
      result - The result to remove
    • remove

      public void remove(ResultSourceInfo source, ResultSinkInfo sink)
      Removes the given data flow result from this result set
      Parameters:
      sink -
      source -
    • remove

      public void remove(ResultSinkInfo sink)
      Removes the given data flow result from this result set
      Parameters:
      sink -
    • removeAll

      public void removeAll(Collection<ResultSinkInfo> sinks)
      Removes the given data flow result from this result set
      Parameters:
      sinks -
    • toString

      public String toString()
      Overrides:
      toString in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object