[Soot-list] Why does rewriting an APK fail with no instrumentation?
prateeksaxena at gmail.com
prateeksaxena at gmail.com
Fri Jun 12 22:38:26 EDT 2015
Hi,
I am trying to instrument an APK using soot. As a simple test, I want to re-compile the APK with no / null instrumentation. I am using the VM released at http://sseblog.ec-spride.de/tutorials/
My instrumentation doesn’t modify any method bodies.
The code is:
public class MyBodyTransformer extends BodyTransformer{
@Override
protected void internalTransform(Body body, String arg0, Map arg1) {
}
}
When I try the RV2013.apk example (sample provided in the tutorial VM), it works fine. But, when I use a different apk it fails (e.g. the apk here). The original APK works fine on the Android emulator.
In the console I see:
…
Transforming com.vladium.util.IntObjectMap...
…
Exception in thread "main" java.lang.RuntimeException: (<com.vladium.util.IntObjectMap: java.lang.Object put(int,java.lang.Object)>) no defs for value: $r5!
…
at soot.Body.validateUses(Body.java:365)
at soot.Body.validate(Body.java:234)
at soot.jimple.JimpleBody.validate(JimpleBody.java:71)
at soot.PackManager.runBodyPacks(PackManager.java:903)
at soot.PackManager.runBodyPacks(PackManager.java:585)
at soot.PackManager.runBodyPacks(PackManager.java:487)
at soot.PackManager.runPacksNormally(PackManager.java:464)
at soot.PackManager.runPacks(PackManager.java:388)
at instrumentation.Main.main(Main.java:12)
The options I provide are the same as the one that work for the sample APK:
public class Settings {
private static boolean SOOT_INITIALIZED = false;
private final static String TOAST_CLASS = "android.widget.Toast";
private final static String androidJAR = "./lib/android.jar";
private final static String apk = "./apk/foo.apk";
public static void initialiseSoot(){
if (SOOT_INITIALIZED)
return;
G.reset();
Options.v().set_allow_phantom_refs(true);
Options.v().set_prepend_classpath(true);
Options.v().set_validate(true)
Options.v().set_output_format(Options.output_format_dex);
Options.v().set_process_dir(Collections.singletonList(apk));
Options.v().set_force_android_jar(androidJAR);
Options.v().set_src_prec(Options.src_prec_apk);
Options.v().set_soot_classpath(androidJAR);
Scene.v().loadNecessaryClasses();
Scene.v().forceResolve(TOAST_CLASS, SootClass.BODIES);
SOOT_INITIALIZED = true;
}
Could you please help?
Thanks,
-- Prateek.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20150613/c7da6e1e/attachment-0001.html
More information about the Soot-list
mailing list