public static SootMethod getAmbiguousMethodByName(String methodName) { SootClass sc = Scene.v().tryLoadClass(getClassName(methodName), SootClass.SIGNATURES); SootMethod sm = sc.getMethodByName(getMethodName(methodName)); return sm; }
= hierarchy.resolveConcreteDispatch(maySootClass, method.getDeclaringClass().getMethodByName("run"));
public void run() { SootMethod mainMethod = Scene.v().getMainClass().getMethodByName("main");
} else { RefType rt = (RefType) ops[0].getType(); SootMethod m = rt.getSootClass().getMethodByName("booleanValue"); Local B = Jimple.v().newLocal("addswitchesBOOL1", rt); locals.add(B); } else { RefType rt = (RefType) ops[1].getType(); SootMethod m = rt.getSootClass().getMethodByName("booleanValue"); Local B = Jimple.v().newLocal("addswitchesBOOL2", rt); locals.add(B);
MethodSource source = cl.getMethodByName("<clinit>").getSource(); if(source instanceof CoffiMethodSource) { Scene.v().removeClass(cl);
newInit = true; } else { SootMethod m = sc.getMethodByName(SootMethod.staticInitializerName); if (!m.hasActiveBody()) { b = Jimple.v().newBody(m);
SootMethod clinit = reflCallsClass.getMethodByName(SootMethod.staticInitializerName); Body body = clinit.retrieveActiveBody(); PatchingChain<Unit> units = body.getUnits(); Chain<Unit> newUnits = new HashChain<Unit>(); SootClass setClass = Scene.v().getSootClass("java.util.Set"); SootMethodRef addMethodRef = setClass.getMethodByName("add").makeRef(); for (SootMethod m : RTI.methodsContainingReflectiveCalls()) {
staticInitializerMethod.setActiveBody(body); } else { body = sootClass.getMethodByName(SootMethod.staticInitializerName).getActiveBody();
SootMethod m = reflCallsClass.getMethodByName(methodName); JimpleBody body = (JimpleBody) m.retrieveActiveBody(); LocalGenerator localGen = new LocalGenerator(body);
SootMethod toStrg = obj.getMethodByName("toString"); SootMethod eq = obj.getMethodByName("equals"); boolean change = false; PatchingChain<Unit> units = b.getUnits();
public SootMethod getAssertMethod() { SootClass assertionClass = Scene.v().getSootClass(SootRunner.assertionClassName); return assertionClass.getMethodByName(SootRunner.assertionProcedureName); }
/** * To extract the real binder type, Thus, a more precision way is to perform a * type analysis for IBinder reference * * @return */ public Type extractBinderType(SootClass sootClass) { SootMethod onBindMethod = null; try { onBindMethod = sootClass.getMethodByName("onBind"); } catch (RuntimeException ex) { } if (null == onBindMethod) { return null; } Body body = onBindMethod.retrieveActiveBody(); PatchingChain<Unit> units = body.getUnits(); for (Iterator<Unit> iter = units.snapshotIterator(); iter.hasNext();) { Stmt stmt = (Stmt) iter.next(); if (stmt instanceof ReturnStmt) { ReturnStmt rtStmt = (ReturnStmt) stmt; Value rtValue = rtStmt.getOp(); if (rtValue.toString().equals("null")) { return onBindMethod.getReturnType(); } return rtValue.getType(); } } return onBindMethod.getReturnType(); }
SootMethod clinit = declaringClass.getMethodByName("<clinit>");
/** * Get a method that returns an unknown value of type t. * * @param t * @return */ public SootMethod getHavocMethod(soot.Type t) { if (!Scene.v().containsClass(HavocClassName)) { SootClass sClass = new SootClass(HavocClassName, Modifier.PUBLIC | Modifier.PUBLIC); sClass.setSuperclass(Scene.v().getSootClass("java.lang.Object")); sClass.setResolvingLevel(SootClass.SIGNATURES); Scene.v().addClass(sClass); } SootClass cls = Scene.v().getSootClass(HavocClassName); final String havocMethodName = HavocMethodName + t.toString(); if (!cls.declaresMethodByName(havocMethodName)) { cls.addMethod(new SootMethod(havocMethodName, Arrays.asList(new Type[] {}), t, Modifier.PUBLIC | Modifier.STATIC)); } return cls.getMethodByName("havoc_" + t.toString()); }
injectedStmts.add(newU); SootMethod initMethod = handler.getMethodByName("<init>"); Unit initU = Jimple.v().newInvokeStmt( Jimple.v().newVirtualInvokeExpr(handlerLocal, initMethod.makeRef())); injectedStmts.add(initU); SootMethod hmMethod = handler.getMethodByName("handleMessage"); Unit callHMU = Jimple.v().newInvokeStmt(Jimple.v().newVirtualInvokeExpr( handlerLocal, hmMethod.makeRef(), stmt.getInvokeExpr().getArg(0)));
method = destProvider.getMethodByName(iccMethod.getName()); InvokeExpr invoke = Jimple.v().newVirtualInvokeExpr(al, method.makeRef(), locals); b.getUnits().add(Jimple.v().newAssignStmt(rtLocal, invoke));
refType = objArRepl; SootMethod am = refType.getSootClass().getMethodByName(arraySetName); Stmt ivk = Jimple.v().newInvokeStmt(Jimple.v().newVirtualInvokeExpr((Local) aref.getBase(), am.makeRef(), refType = objArRepl; SootMethod am = refType.getSootClass().getMethodByName(arrayGetName);