[Soot-list] Problem about instrumentation for apk of API26
Manuel Benz
manuel.benz at uni-paderborn.de
Mon Jan 7 06:39:30 EST 2019
Hi Shikun.
From a first glimpse, your options seem to be reasonable. Have you tried using the `-process-multiple-dex` option? The app might contain multiple dex files which you skip without this option.
Soot should also print how many classes it found in a specific dex file at start-up.
Best,
Manuel
Am 01.01.2019 um 00:16 schrieb shikun zhang <shikun1102 at 163.com<mailto:shikun1102 at 163.com>>:
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
_______________________________________________
Soot-list mailing list
Soot-list at CS.McGill.CA<mailto:Soot-list at CS.McGill.CA>
https://mailman.CS.McGill.CA/mailman/listinfo/soot-list
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20190107/0d1438a3/attachment.html>
More information about the Soot-list
mailing list