Ejemplo n.º 1
0
  private String getSourceCategory(ResultSourceInfo sourceInfo) {
    if (sourceInfo.getSource().containsInvokeExpr()) {
      InvokeExpr invExpr = sourceInfo.getSource().getInvokeExpr();

      for (SourceSinkDefinition meth : sources) {
        AndroidMethod am = (AndroidMethod) meth.getMethod();
        if (am.getSignature().equals(invExpr.getMethod().getSignature())) {
          return am.getCategory().toString();
        }
      }
    } else if (isSourceInfoParameter(sourceInfo)) {
      return unknownCategory;
    } else throw new RuntimeException("Currently not supported");

    return null;
  }
Ejemplo n.º 2
0
  /**
   * This method iterates over all sources from the FlowDroid-results and extracts the category of
   * the specific source. If there is no category found, it will return an empty set, otherwise the
   * correct categories will be added.
   *
   * @param sourcesInfo: all possible sources from which we try to identify the category
   * @return: set of categories for specific sink
   */
  private Set<String> getDataIdList(Set<ResultSourceInfo> sourcesInfo) {
    Set<String> dataIdList = new HashSet<String>();
    for (ResultSourceInfo sInfo : sourcesInfo) {
      if (sInfo.getSource().containsInvokeExpr()) {
        InvokeExpr invExpr = sInfo.getSource().getInvokeExpr();

        for (SourceSinkDefinition meth : sources) {
          AndroidMethod am = (AndroidMethod) meth.getMethod();
          if (am.getSignature().equals(invExpr.getMethod().getSignature())) {
            dataIdList.add(am.getCategory().toString());
          }
        }
      } else if (isSourceInfoParameter(sInfo)) {
        dataIdList.add(unknownCategory);
      } else throw new RuntimeException("Currently not supported");
    }

    return dataIdList;
  }