Skip to content

How to import additional jar files #789

Open
@lzl-l

Description

@lzl-l

Dear developers @StevenArzt @t1mlange

I used the Options.v().set_soot_classpath() and config.getAnalysisFileConfig().setAdditionalClasspath() to import the jar files of apps except the apk package into the framework. However, when FlowDroid builds CallGraph and does taint analysis, he analysis results appear to be the same as when only the apk was imported. The jar files I imported seems to be useless, may I ask why? How can I fix it?

My code:

public static void main(String[] args){
        InfoflowAndroidConfiguration conf = new InfoflowAndroidConfiguration();
        conf.getAnalysisFileConfig().setAndroidPlatformDir(new File(androidPlatformPath));
        conf.getAnalysisFileConfig().setTargetAPKFile(new File(appPath));
        conf.getCallbackConfig().setCallbacksFile(AndroidCallbacks.txt");
        String additionalClasspath = jarFile + ";" + jdkRtJarPath + ";" + "android.jar";
        conf.getAnalysisFileConfig().setAdditionalClasspath(additionalClasspath);
        conf.setMergeDexFiles(true);
        conf.getAnalysisFileConfig().setOutputFile(outputFile);
        conf.setEnableLineNumbers(true);
        conf.setLogSourcesAndSinks(true);
        conf.getAnalysisFileConfig().setSourceSinkFile(new File(sourceSinkPath));
        conf.setMergeDexFiles(true);
        conf.getAccessPathConfiguration().setAccessPathLength(-1);
        conf.getSolverConfiguration().setMaxAbstractionPathLength(-1);
        SetupApplication app = new SetupApplication(conf);
        soot.G.reset();

        Options.v().set_soot_classpath(androidPlatformPath+ ";" + appPath + ";" + jdkRtJarPath + ";" + "android.jar"+ ";" + jarFile + ";" + libFile);
        Options.v().set_process_dir(Collections.singletonList("jar/"));
        Options.v().set_process_multiple_dex(true);

        Options.v().set_whole_program(true);
        Options.v().set_allow_phantom_refs(false);

        Scene.v().loadNecessaryClasses();

        app.setCallbackFile(CGGenerator_test2.class.getResource("/AndroidCallbacks.txt").getFile());
        app.constructCallgraph();
        System.out.println(cg.toString());

        Scene.v().setCallGraph(cg);
        InfoflowAndroidConfiguration config = app.getConfig();
        config.setTaintAnalysisEnabled(true);
        config.setSootIntegrationMode(InfoflowAndroidConfiguration.SootIntegrationMode.UseExistingCallgraph);
         app.setTaintWrapper(new EasyTaintWrapper(taintWrapperFilePath));
         app.runInfoflow();
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions