Java 类soot.jimple.infoflow.android.source.AccessPathBasedSourceSinkManager 实例源码

项目: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();
        }
    }
项目:cheetah    文件:SetupApplicationJIT.java   
public SetupApplicationJIT(String apkFileLocation, String sootCP,
        ISourceSinkDefinitionProvider sourceSinkProvider) {
    this.apkFileLocation = apkFileLocation;
    this.sootCP = sootCP;
    try {
        // Load Android callbacks
        this.androidCallbacks = Activator.getDefault().getAndroidCallbacks();

        // Process manifest
        ProcessManifest processMan = new ProcessManifest(apkFileLocation);
        this.appPackageName = processMan.getPackageName();
        this.entrypoints = processMan.getEntryPointClasses();

        // Parse the resource file
        ARSCFileParser resParser = new ARSCFileParser();
        resParser.parse(apkFileLocation);
        this.resourcePackages = resParser.getPackages();

        // LayoutFileParser
        LayoutFileParser lfp = new LayoutFileParser(this.appPackageName, resParser);
        lfp.parseLayoutFile(apkFileLocation, entrypoints);

        // Create the SourceSinkManager
        Set<SootMethodAndClass> callbacks = new HashSet<>();
        for (Set<SootMethodAndClass> methods : this.callbackMethods.values())
            callbacks.addAll(methods);
        sourceSinkManager = new AccessPathBasedSourceSinkManager(sourceSinkProvider.getSources(),
                sourceSinkProvider.getSinks(), callbacks, LayoutMatchingMode.MatchSensitiveOnly,
                lfp == null ? null : lfp.getUserControlsByID());
        sourceSinkManager.setAppPackageName(this.appPackageName);
        sourceSinkManager.setResourcePackages(this.resourcePackages);
        sourceSinkManager.setEnableCallbackSources(true);
    } catch (IOException | XmlPullParserException e) {
        LOGGER.error("Error initializing " + apkFileLocation);
    }
}
项目:cheetah    文件:SetupApplicationJIT.java   
public AccessPathBasedSourceSinkManager getSourceSinkManager() {
    return sourceSinkManager;
}
项目:JAADAS    文件:SetupApplication.java   
/**
 * Gets the source/sink manager constructed for FlowDroid. Make sure to call calculateSourcesSinksEntryPoints()
 * first, or you will get a null result.
 * 
 * @return FlowDroid's source/sink manager
 */
public AccessPathBasedSourceSinkManager getSourceSinkManager() {
    return sourceSinkManager;
}