Java 类soot.jimple.infoflow.data.pathBuilders.DefaultPathBuilderFactory.PathBuilder 实例源码

项目:FuzzDroid    文件:SmartConstantDataExtractorFuzzyAnalysis.java   
private void runAnalysis(final Set<Unit> targetUnits) {
        try {
            Scene.v().getOrMakeFastHierarchy();

            InplaceInfoflow infoflow = new InplaceInfoflow();
//          InfoflowConfiguration.setAccessPathLength(2);
            infoflow.setPathBuilderFactory(new DefaultPathBuilderFactory(
                    PathBuilder.ContextSensitive, true));
            infoflow.setTaintWrapper(new EasyTaintWrapper(TAINT_WRAPPER_PATH));
            infoflow.getConfig().setEnableExceptionTracking(false);
            infoflow.getConfig().setEnableArraySizeTainting(false);
//          infoflow.getConfig().setCallgraphAlgorithm(CallgraphAlgorithm.CHA);

            System.out.println("Running data flow analysis...");
            PermissionMethodParser pmp = PermissionMethodParser.fromFile(SOURCES_SINKS_FILE);
            AccessPathBasedSourceSinkManager srcSinkManager =
                    new AccessPathBasedSourceSinkManager(pmp.getSources(), pmp.getSinks());

            infoflow.addResultsAvailableHandler(new FuzzerResultsAvailableHandler(pmp.getSources(),
                    targetUnits));
            infoflow.runAnalysis(srcSinkManager);
        }
        catch (IOException ex) {
            throw new RuntimeException("Could not read source/sink file", ex);
        }
    }
项目:FuzzDroid    文件:StringToPrimitiveTypeFuzzer.java   
private void runDataflowAnalysis() {
        try{
            Scene.v().getOrMakeFastHierarchy();

            InplaceInfoflow infoflow = new InplaceInfoflow();   
            infoflow.setPathBuilderFactory(new DefaultPathBuilderFactory(
                    PathBuilder.ContextSensitive, true));
            infoflow.setTaintWrapper(new EasyTaintWrapper(TAINT_WRAPPER_PATH));
            infoflow.getConfig().setEnableExceptionTracking(false);
            infoflow.getConfig().setEnableArraySizeTainting(false);
//          infoflow.getConfig().setCallgraphAlgorithm(CallgraphAlgorithm.CHA);

            System.out.println("Running data flow analysis...");
            PermissionMethodParser pmp = PermissionMethodParser.fromFile(SOURCES_SINKS_FILE);
            AccessPathBasedSourceSinkManager srcSinkManager =
                    new AccessPathBasedSourceSinkManager(pmp.getSources(), pmp.getSinks());

            infoflow.addResultsAvailableHandler(new StringToPrimitiveTypeExtractorDataflowHandler(valuesToFuzz));
            infoflow.runAnalysis(srcSinkManager);
        }catch(Exception ex) {
            ex.printStackTrace();
        }
    }
项目:FuzzDroid    文件:FileFuzzer.java   
private void runDataflowAnalysis() {
        try{
            Scene.v().getOrMakeFastHierarchy();

            InplaceInfoflow infoflow = new InplaceInfoflow();
//          InfoflowConfiguration.setAccessPathLength(2);
            infoflow.setPathBuilderFactory(new DefaultPathBuilderFactory(
                    PathBuilder.ContextSensitive, true));
            infoflow.setTaintWrapper(new EasyTaintWrapper(TAINT_WRAPPER_PATH));
            infoflow.getConfig().setEnableExceptionTracking(false);
            infoflow.getConfig().setEnableArraySizeTainting(false);
//          infoflow.getConfig().setCallgraphAlgorithm(CallgraphAlgorithm.CHA);

            System.out.println("Running data flow analysis...");
            PermissionMethodParser pmp = PermissionMethodParser.fromFile(SOURCES_SINKS_FILE);
            AccessPathBasedSourceSinkManager srcSinkManager =
                    new AccessPathBasedSourceSinkManager(pmp.getSources(), pmp.getSinks());

            infoflow.addResultsAvailableHandler(new FileFuzzerResultsAvailableHandler(fileFormatsFromDataflow));
            infoflow.runAnalysis(srcSinkManager);
        }catch(Exception ex) {
            ex.printStackTrace();
        }
    }
项目:JAADAS    文件:OtherTests.java   
@Test(timeout=300000)
public void multiSinkTest2() {
    boolean oldPathAgnosticResults = Infoflow.getPathAgnosticResults();
    try {
        Infoflow infoflow = initInfoflow();
        List<String> epoints = new ArrayList<String>();
        epoints.add("<soot.jimple.infoflow.test.OtherTestCode: void multiSinkTest2()>");
        Infoflow.setPathAgnosticResults(false);
        infoflow.setPathBuilderFactory(new DefaultPathBuilderFactory(PathBuilder.ContextSensitive,
                true));
        infoflow.computeInfoflow(appPath, libPath, epoints, sources, sinks);
        checkInfoflow(infoflow, 1);
        Assert.assertTrue(infoflow.getResults().isPathBetweenMethods(sink, sourceDeviceId));
        Assert.assertEquals(2, infoflow.getResults().numConnections());
    }
    finally {
        Infoflow.setPathAgnosticResults(oldPathAgnosticResults);
    }
}
项目:JAADAS    文件:Test.java   
private static String pathAlgorithmToString(PathBuilder pathBuilder) {
    switch (pathBuilder) {
        case ContextSensitive:
            return "CONTEXTSENSITIVE";
        case ContextInsensitive :
            return "CONTEXTINSENSITIVE";
        case ContextInsensitiveSourceFinder :
            return "SOURCESONLY";
        default :
            return "UNKNOWN";
    }
}
项目:soot-infoflow-android-iccta    文件:FlowDroidLauncher.java   
private static String pathAlgorithmToString(PathBuilder pathBuilder) {
    switch (pathBuilder) {
        case ContextSensitive:
            return "CONTEXTSENSITIVE";
        case ContextInsensitive :
            return "CONTEXTINSENSITIVE";
        case ContextInsensitiveSourceFinder :
            return "SOURCESONLY";
        default :
            return "UNKNOWN";
    }
}
项目:JAADAS    文件:SetupApplication.java   
/**
 * Sets the algorithm to be used for reconstructing the paths between sources and sinks
 * 
 * @param builder
 *            The path reconstruction algorithm to be used
 */
public void setPathBuilder(PathBuilder builder) {
    this.pathBuilder = builder;
}