[Soot-list] How to make the instrumented apk contain the classfile I wrote?
Jin Li
lijin1988 at gmail.com
Tue Jun 3 22:57:42 EDT 2014
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/aa0cab09/attachment.html
More information about the Soot-list
mailing list