[Soot-list] Problem about instrumentation for apk of API26

shikun zhang shikun1102 at 163.com
Mon Dec 31 18:16:57 EST 2018


Dear all,

I am using soot to instrument apks.  I followed the tutorial on https://github.com/Sable/soot/wiki/Instrumenting-Android-Apps-with-Soot and it works well for android API16. But I got one problem for apks of API 26.
The following is the code:
public static void main(String[] args) {
            Options.v().set_allow_phantom_refs(true);
            Options.v().set_src_prec(Options.src_prec_apk);
            Options.v().set_output_format(Options.output_format_dex);
            Options.v().set_debug(true);
            Options.v().set_verbose(true);
            Options.v().set_whole_program(true);
            Options.v().set_android_jars(“C:\\Users\\Mike58\\AppData\\Local\\Android\\Sdk\\platforms”);

             //apk of API 16
            Options.v().set_process_dir(Collections.singletonList("DroidBench-develop/DroidBench-  develop/apk/InterAppCommunication/SendSMS.apk”));

             //apk of API 26
           //Options.v().set_process_dir(Collections.singletonList("FeatureChecking\\API26\\benchmark\\apks\\ InterAppEnd1.apk”));

            Scene.v().addBasicClass("java.io.PrintStream",SootClass.SIGNATURES);
            Scene.v().addBasicClass("java.lang.System",SootClass.SIGNATURES);

            PackManager.v().getPack("wjtp").add(new Transform("jtp.myInstrumenter", new SceneTransformer() {

           @Override
           protected void internalTransform(String phaseName, Map<String, String> options) {
                       System.out.println(Scene.v().getApplicationClasses());
                 }
            }));

             soot.Main.main(new String[] { "-whole-program" });
}

This is a very simple example, when I run it on apks of API 16, the program can print all the application classes and one apk file is generated under sootOutput directory. But when I run the code for apk of API 26, there is no error but the result of Scene.v().getApplicationClasses() is empty. In addition, in sootOutput directory there is only one classes.dex file generated. The Android platform I am using is the latest one and soot does not complain about the platform, so I think the platform is not a problem. Now I am really confused, am I using soot in a wrong way?   Thanks a lot for any help!

Cheers,
Shikun Zhang
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20190101/fc368bbe/attachment.html>


More information about the Soot-list mailing list