[Soot-list] How to make the instrumented apk contain the classfile I wrote?
Steven Arzt
Steven.Arzt at cased.de
Wed Jun 4 01:56:07 EDT 2014
Hi Jin,
Make sure that your Helper class is set as an application class using SootClass.setApplicationClass(true). Only application classes are written out into the target APK file.
Best regards,
Steven
Von: soot-list-bounces at CS.McGill.CA [mailto:soot-list-bounces at CS.McGill.CA] Im Auftrag von Jin Li
Gesendet: Mittwoch, 4. Juni 2014 04:58
An: soot-list at CS.McGill.CA
Betreff: [Soot-list] How to make the instrumented apk contain the classfile I wrote?
Hi All,
I wrote a Helper.java which is used to print the uid,pid,tid of the Instumented apk.
public class Helper {
private static int uid,pid,tid;
public static void getIDs(){
uid = Process.myUid();
pid = Process.myPid();
tid = Process.myTid();
}
public static void reportIds(){
System.out.println("uid is " + uid + "pid is " + pid + "tid is " + tid);
}
}
I modified the AndroidInstrument.java from Prof. Eric Bodden's blog to make it insert a InvokeExpr before a Unit. Relative code snipped like that:
getIdsClass = Scene.v().loadClassAndSupport("Helper");
getIds = getIdsClass.getMethod("void getIDs()");
reportIds = getIdsClass.getMethod("void reportIds()");
InvokeExpr getExpr = Jimple.v().newStaticInvokeExpr(getIds.makeRef());
Stmt getStmt = (Stmt) Jimple.v().newInvokeStmt(getExpr);
units.insertBefore((Unit)getStmt, u);
InvokeExpr reportExpr = Jimple.v().newStaticInvokeExpr(reportIds.makeRef());
Stmt reportStmt = (Stmt) Jimple.v().newInvokeStmt(reportExpr);
units.insertBefore((Unit)reportStmt, u);
When I run the Intrumented apk on my device, it crashed since the Helpler class can't be found.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.CS.McGill.CA/pipermail/soot-list/attachments/20140604/b4fe89b9/attachment.html
More information about the Soot-list
mailing list