protected ReferenceVariable staticFieldImpl(String className, String fieldName) { SootClass c = RefType.v(className).getSootClass(); SootField f = c.getFieldByName(fieldName); return pag.makeGlobalVarNode(f, f.getType()); }
private static soot.SootMethod makeOuterThisAccessMethod(soot.SootClass classToInvoke) { String name = "access$" + soot.javaToJimple.InitialResolver.v().getNextPrivateAccessCounter() + "00"; ArrayList paramTypes = new ArrayList(); paramTypes.add(classToInvoke.getType()); soot.SootMethod meth = Scene.v().makeSootMethod(name, paramTypes, classToInvoke.getFieldByName("this$0").getType(), soot.Modifier.STATIC); classToInvoke.addMethod(meth); PrivateFieldAccMethodSource src = new PrivateFieldAccMethodSource(classToInvoke.getFieldByName("this$0").getType(), "this$0", classToInvoke.getFieldByName("this$0").isStatic(), classToInvoke); meth.setActiveBody(src.getBody(meth, null)); meth.addTag(new soot.tagkit.SyntheticTag()); return meth; }
soot.SootField outerThisField = classToInvoke.getFieldByName("this$0"); soot.Local t1 = lg.generateLocal(outerThisField.getType());
+ currentClass.getName() + "!" + " current class contains fields: " + currentClass.getFields()); soot.SootClass outerClass = ((soot.RefType) currentClass.getFieldByName("this$0").getType()).getSootClass();
globalLockObj[i] = Scene.v().getMainClass().getFieldByName("globalLockObj" + i); globalLockObj[i] = Scene.v().getMainClass().getFieldByName("globalLockObj" + i);
/** * @ast method * @aspect EmitJimple * @declaredat /Users/eric/Documents/workspaces/clara-soot/JastAddExtensions/JimpleBackend/EmitJimple.jrag:329 */ public void jimplify1phase2() { String name = name(); soot.Type type = type().getSootType(); int modifiers = sootTypeModifiers(); if (!hostType().getSootClassDecl().declaresFieldByName(name)) { SootField f = Scene.v().makeSootField(name, type, modifiers); hostType().getSootClassDecl().addField(f); if (isStatic() && isFinal() && isConstant() && (type().isPrimitive() || type().isString())) { if (type().isString()) f.addTag(new soot.tagkit.StringConstantValueTag(constant().stringValue())); else if (type().isLong()) f.addTag(new soot.tagkit.LongConstantValueTag(constant().longValue())); else if (type().isDouble()) f.addTag(new soot.tagkit.DoubleConstantValueTag(constant().doubleValue())); else if (type().isFloat()) f.addTag(new soot.tagkit.FloatConstantValueTag(constant().floatValue())); else if (type().isIntegralType()) f.addTag(new soot.tagkit.IntegerConstantValueTag(constant().intValue())); } sootField = f; } else { sootField = hostType().getSootClassDecl().getFieldByName(name); } addAttributes(); }
public SootField getExceptionGlobal() { SootClass assertionClass = Scene.v().getSootClass(SootRunner.assertionClassName); return assertionClass.getFieldByName(SootRunner.exceptionGlobalName); }
if (!rClass.declaresFieldByName(name)) return -1; SootField idField = rClass.getFieldByName(name); for (Tag t : idField.getTags()) if (t instanceof IntegerConstantValueTag) {
public SootField getMessageForIPCField() { SootClass sc = iccLink.fromSM.getDeclaringClass(); if (!sc.declaresField("message_for_ipc_static", RefType.v("android.os.Messenge"))) { fieldSendingMessage(iccLink.fromSM); } return sc.getFieldByName("message_for_ipc_static"); }
sc.removeField(sc.getFieldByName(s));
SootField whatField = messageCls.getFieldByName("what"); SootField arg1Field = messageCls.getFieldByName("arg1"); SootField arg2Field = messageCls.getFieldByName("arg2"); SootField objField = messageCls.getFieldByName("obj");
RefType rt = (RefType) iinv.getBase().getType(); AccessPath ap = manager.getAccessPathFactory().createAccessPath(iinv.getBase(), new SootField[] { rt.getSootClass().getFieldByName("b1") }, true); res.add(ap); RefType rt = (RefType) iinv.getBase().getType(); AccessPath ap = manager.getAccessPathFactory().createAccessPath(iinv.getBase(), new SootField[] { rt.getSootClass().getFieldByName("b2") }, true); res.add(ap); RefType rt = (RefType) iinv.getBase().getType(); AccessPath ap = manager.getAccessPathFactory().createAccessPath(iinv.getBase(), new SootField[] { rt.getSootClass().getFieldByName("b1") }, true); res.add(ap); } else if (taintedPath.getPlainValue() == iinv.getBase()) { AccessPath ap = manager.getAccessPathFactory() .createAccessPath(def.getLeftOp(), new SootField[] { Scene.v() .getSootClass("soot.jimple.infoflow.test.HeapTestCode$A").getFieldByName("b") }, true); res.add(ap);
SootClass scApplicationHolder = LibraryClassPatcher.createOrGetApplicationHolder(); body.getUnits().add(Jimple.v().newAssignStmt(applicationLocal, Jimple.v().newStaticFieldRef(scApplicationHolder.getFieldByName("application").makeRef()))); localVarsForClasses.put(applicationClass, applicationLocal);
RefType rt = (RefType) iinv.getBase().getType(); AccessPath ap = manager.getAccessPathFactory().createAccessPath(iinv.getBase(), new SootField[] { rt.getSootClass().getFieldByName( "b1") /* RefType rt = (RefType) iinv.getBase().getType(); AccessPath ap = manager.getAccessPathFactory().createAccessPath(iinv.getBase(), new SootField[] { rt.getSootClass().getFieldByName( "b2") /* RefType rt = (RefType) iinv.getBase().getType(); AccessPath ap = manager.getAccessPathFactory().createAccessPath(iinv.getBase(), new SootField[] { rt.getSootClass().getFieldByName( "b1") /* AccessPath ap = manager.getAccessPathFactory() .createAccessPath(def.getLeftOp(), new SootField[] { Scene.v() .getSootClass("soot.jimple.infoflow.test.HeapTestCode$A").getFieldByName("b") }, true); res.add(ap);
arrayClass = objArRepl.getSootClass(); SootField lenField = arrayClass.getFieldByName(SootTranslationHelpers.lengthFieldName); Value fieldRef = Jimple.v().newInstanceFieldRef(le.getOp(), lenField.makeRef());
.add(Jimple.v().newAssignStmt( Jimple.v() .newStaticFieldRef(scApplicationHolder.getFieldByName("application").makeRef()), applicationLocal));
SootField elemTypeField = objArReplacement.getSootClass().getFieldByName( SootTranslationHelpers.arrayElementTypeFieldName); String elementTypeName = ((RefType) elementType).getSootClass().getJavaStyleName();
/** * Patch android.app.Activity getApplication method in order to return the * singleton Application instance created in the dummyMainMethod. */ private void patchActivityImplementation() { SootClass scApplicationHolder = createOrGetApplicationHolder(); SootClass sc = Scene.v().getSootClassUnsafe("android.app.Activity"); if (sc == null || sc.resolvingLevel() < SootClass.SIGNATURES || scApplicationHolder == null) return; sc.setLibraryClass(); SootMethod smRun = sc.getMethodUnsafe("android.app.Application getApplication()"); if (smRun == null || (smRun.hasActiveBody() && !isStubImplementation(smRun.getActiveBody()))) return; smRun.setPhantom(false); smRun.addTag(new FlowDroidEssentialMethodTag()); Body b = Jimple.v().newBody(smRun); smRun.setActiveBody(b); // add "this" local Local thisLocal = Jimple.v().newLocal("this", sc.getType()); b.getLocals().add(thisLocal); b.getUnits().add(Jimple.v().newIdentityStmt(thisLocal, Jimple.v().newThisRef(sc.getType()))); SootFieldRef appStaticFieldRef = scApplicationHolder.getFieldByName("application").makeRef(); // creating local to store the mApplication field Local targetLocal = Jimple.v().newLocal("retApplication", appStaticFieldRef.type()); b.getLocals().add(targetLocal); b.getUnits().add(Jimple.v().newAssignStmt(targetLocal, Jimple.v().newStaticFieldRef(appStaticFieldRef))); Unit retStmt = Jimple.v().newReturnStmt(targetLocal); b.getUnits().add(retStmt); b.validate(); }