[Soot-list] Log-statement-insertion into apk file.

Steven Arzt Steven.Arzt at cased.de
Mon May 12 04:40:59 EDT 2014


Hi Sarah,

 

Your signature looks wrong. This might be a problem with the encoding in the
e-mail, but to me it looks like you are missing some blanks:

 

                <android.util.Log: int i(java.lang.String,java.lang.String)>

 

You should also make sure that your android.jar file from the Android SDK is
on the Soot classpath. Soot places it there automatically unless you
explicitly specify your own classpath. In the latter case you have to make
sure to add it on your own. Next, after getting your classpath right (and
optionally specifying previously unreferenced classes as basic classes), you
need to tell Soot to load the required classes. Please stick to the
tutorials as they have been tested and are known to work:

 

                http://sseblog.ec-spride.de/tutorials/

 

Best regards,

  Steven

 

Von: H S [mailto:aras_h1988 at yahoo.com] 
Gesendet: Montag, 12. Mai 2014 00:48
An: soot-list at CS.McGill.CA; Steven Arzt; 'Siegfried Rasthofer';
soot-list at sable.mcgill.ca
Betreff: Log-statement-insertion into apk file.

 

Hi :

 

I want to add Log statement into an apk file. 

 

Here is my code:

 

Scene.v().addBasicClass("android.util.Log",SootClass.SIGNATURES);

SootMethod
sm=Scene.v().getMethod(<android.util.Log:inti(java.lang.String,java.lang.Str
ing)>");

Value logType = StringConstant.v("INFO");

Value logMessage = StringConstant.v("Inserted Log after show()");

StaticInvokeExpr invokeExpr = Jimple.v().newStaticInvokeExpr(sm.makeRef(),
logType, logMessage);

Unit generated = Jimple.v().newInvokeStmt(invokeExpr);

 

Here is Run-result

Exception in thread "main" java.lang.RuntimeException: tried to get
nonexistent method <android.util.Log: int
i(java.lang.String,java.lang.String)>

     at soot.Scene.getMethod(Scene.java:613)

 

I also used instead of addBasicClass Method, this following lines:

 

SootClass logClass = Scene.v().loadClassAndSupport("android.util.Log");

        SootMethod sm = logClass.getMethod("<android.util.Log: int
i(java.lang.String,java.lang.String)>");

 

But I get:

Exception in thread "main" java.lang.RuntimeException: This operation
requires resolving level SIGNATURES but android.util.Log is at resolving
level HIERARCHY

If you are extending Soot, try to add the following call before calling
soot.Main.main(..):

Scene.v().addBasicClass(android.util.Log,SIGNATURES);

Otherwise, try whole-program mode (-w).

 

I have also added Options.v().set_whole_program(true);

But it wasn't helpful. 

 

Any suggestion would be appreciated.

 

Sarah

 

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140512/00ff20db/attachment-0002.html 


More information about the Soot-list mailing list