[Soot-list] soot modify jimple to instrument android app

Steven Arzt Steven.Arzt at cased.de
Mon Nov 30 09:28:45 EST 2015


Hi Conly Xia,

 

What exactly do you mean by "has no changes"? Did you decompile the APK file
written by Soot to check? Or did you read it back in using Soot?

 

In general, your added code is an unused assignment and may thus get removed
by optimizers as it does not change the behavior of the program.


Best regards,

  Steven

 

Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA]
Im Auftrag von conlyxia
Gesendet: Montag, 30. November 2015 15:06
An: soot-list at CS.McGill.CA
Betreff: [Soot-list] soot modify jimple to instrument android app

 

Hello all,

I have used soot to instrument android app,but countered one problem,the
instrumented app has no changes:

 

The following is my code:

</

try{

 
sr.app.calculateSourcesSinksEntrypoints("/home/xcl/soot-jar/SourcesAndSinks.
txt");

                        }catch(XmlPullParserException e){

                                               System.out.println("void main
XmlPullParserException: ");

                                               e.printStackTrace();

                                   }catch(IOException e){

                                               System.out.println("void main
IOException: ");

                                               e.printStackTrace();

                                   }

             soot.G.reset();                       

         //prefer Android APK files// -src-prec apk

         Options.v().set_src_prec(Options.src_prec_apk);

         Options.v().set_process_dir(Collections.singletonList(sr.apkPath));

 
Options.v().set_android_jars("/home/xcl/soot-jar/android-platform");

        

         //output as APK, too//-f dex 

         Options.v().set_allow_phantom_refs(true);

         Options.v().set_output_dir("/home/xcl/ic3/apk/sootOutput");

         Options.v().set_output_format(Options.output_format_dex);

 

         Scene.v().loadNecessaryClasses();

         PackManager.v().runPacks();

         

         SootClass
clazz=Scene.v().getSootClass("com.example.helloworld.Handle");

         SootMethod method=clazz.getMethod("void
onCreate(android.os.Bundle)");

         

         Body b=method.getActiveBody();

         PatchingChain<Unit> units=b.getUnits();

         

         Local tmpRef = Jimple.v().newLocal("tmpRef",
RefType.v("java.io.PrintStream"));

         b.getLocals().add(tmpRef);

         Stmt stmt=Jimple.v().newAssignStmt(

                        tmpRef, Jimple.v().newStaticFieldRef( 

                       Scene.v().getField("<java.lang.System:
java.io.PrintStream out>").makeRef()));

   

         units.insertBefore(stmt, units.getFirst());     //add one Stmt

         System.out.println(b);

         PackManager.v().writeOutput();

/>

So,could you tell me what's wrong with my code? Looking forward to your
reply.

 

Best Regards,

ConlyXia

 

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20151130/ee9722b1/attachment.html 


More information about the Soot-list mailing list