当前位置: 首页>>代码示例>>Java>>正文


Java Stmt.getInvokeExpr方法代码示例

本文整理汇总了Java中soot.jimple.Stmt.getInvokeExpr方法的典型用法代码示例。如果您正苦于以下问题:Java Stmt.getInvokeExpr方法的具体用法?Java Stmt.getInvokeExpr怎么用?Java Stmt.getInvokeExpr使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在soot.jimple.Stmt的用法示例。


在下文中一共展示了Stmt.getInvokeExpr方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: fixSMTSolverIntegerOutput

import soot.jimple.Stmt; //导入方法依赖的package包/类
private String fixSMTSolverIntegerOutput(String loggingPoint, Stmt stmt) {
	if(stmt.containsInvokeExpr()) {
		InvokeExpr inv = stmt.getInvokeExpr();
		String metSig = inv.getMethod().getSignature();
		if(metSig.equals("<android.telephony.TelephonyManager: java.lang.String getSimOperator()>") 
				|| metSig.equals("<android.telephony.TelephonyManager: java.lang.String getNetworkOperator()>")
			) {
			String newLoggingPoint = "";
			for(char c : loggingPoint.toCharArray()) {
				if(c < '0' || c > '9') {
					Random rand = new Random();
					int num = rand.nextInt(10);
					newLoggingPoint += num;
				}
				else
					newLoggingPoint += c;
			}
			return newLoggingPoint;				
		}
	}
	return loggingPoint;
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:23,代码来源:SmartConstantDataExtractorFuzzyAnalysis.java

示例2: isSemanticallyCorrect

import soot.jimple.Stmt; //导入方法依赖的package包/类
private boolean isSemanticallyCorrect(String loggingPoint, Stmt stmt) {
	if(loggingPoint == null)
		return false;
	if(stmt.containsInvokeExpr()) {
		InvokeExpr inv = stmt.getInvokeExpr();
		String metSig = inv.getMethod().getSignature();
		if(metSig.equals("<android.telephony.TelephonyManager: java.lang.String getSimOperator()>") 
				|| metSig.equals("<android.telephony.TelephonyManager: java.lang.String getNetworkOperator()>")
			) {
			for(char c : loggingPoint.toCharArray()) {
				if(c < '0' || c > '9') 
					return false;
			}
		}
	}
	return true;
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:18,代码来源:SmartConstantDataExtractorFuzzyAnalysis.java

示例3: getFileFormatFromDataflow

import soot.jimple.Stmt; //导入方法依赖的package包/类
private AnalysisDecision getFileFormatFromDataflow(int codePosID ) {
	Unit unit = codePositionManager.getUnitForCodePosition(codePosID);
	if(unit instanceof Stmt) {		
		Stmt stmt = (Stmt)unit;
		if(stmt.containsInvokeExpr()) {
			InvokeExpr inv = stmt.getInvokeExpr();
			SootMethod sm = inv.getMethod();
			Pair<Integer, Object> paramValue = retrieveCorrectFileInformation(sm);
							
			ServerResponse response = new ServerResponse();
			response.setAnalysisName(getAnalysisName());
	        response.setResponseExist(true);      
	        response.setParamValues(Collections.singleton(paramValue));
			AnalysisDecision finalDecision = new AnalysisDecision();
			finalDecision.setAnalysisName(getAnalysisName());
			finalDecision.setDecisionWeight(8);
		    finalDecision.setServerResponse(response);		    
		    return finalDecision;
		}
		else
			return noResults();
	}
	else {
		return noResults();
	}
}
 
开发者ID:srasthofer,项目名称:FuzzDroid,代码行数:27,代码来源:FileFuzzer.java

示例4: generateAtConstructor

import soot.jimple.Stmt; //导入方法依赖的package包/类
protected Collection<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> generateAtConstructor(Unit unit,
		Collection<SootMethod> calledMethod, MatcherTransition initialTrans) {
	boolean matches = false;
	for (SootMethod method : calledMethod) {
		if (initialTrans.matches(method)) {
			matches = true;
		}
	}
	if (!matches)
		return Collections.emptySet();
	if (unit instanceof Stmt) {
		Stmt stmt = (Stmt) unit;
		if (stmt.containsInvokeExpr())
			if (stmt.getInvokeExpr() instanceof InstanceInvokeExpr) {
				InstanceInvokeExpr iie = (InstanceInvokeExpr) stmt.getInvokeExpr();
				if (iie.getBase() instanceof Local) {
					Local l = (Local) iie.getBase();
					Set<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> out = new HashSet<>();
					out.add(new Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>(
							new AccessGraph(l, l.getType()), new TransitionFunction(initialTrans)));
					return out;
				}
			}
	}
	return Collections.emptySet();
}
 
开发者ID:themaplelab,项目名称:ideal,代码行数:27,代码来源:MatcherStateMachine.java

示例5: getUnitInBetween

import soot.jimple.Stmt; //导入方法依赖的package包/类
private static void getUnitInBetween(UnitGraph ug, List<Unit>inBetween, Unit u) {

    for (Unit succ: ug.getSuccsOf(u)) {
      Stmt s = (Stmt)succ;
      if (inBetween.contains(succ)) {
        continue;
      }
      if (s.containsInvokeExpr()) {
        InvokeExpr ie = s.getInvokeExpr();
        if (ie.getMethodRef().name().contains("restoreCallingIdentity")) {
          return;
        } 
      }
      inBetween.add(succ);
      getUnitInBetween(ug, inBetween, succ);
    }
  }
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:18,代码来源:ClearRestoreCallingIdentity.java

示例6: hasGetInstanceMethod

import soot.jimple.Stmt; //导入方法依赖的package包/类
private SootMethod hasGetInstanceMethod(SootClass sc) {
    String cname = sc.getName();
    if (!(cname.startsWith("android") || cname.startsWith("com.android")))
        return null;
    for (SootMethod sm: sc.getMethods()) {
        if (sm.isConcrete() && sm.getName().equals(("getInstance"))) {
            Body b = sm.retrieveActiveBody();
            for (Unit u: b.getUnits()){
                Stmt s = (Stmt)u;
                if (s.containsInvokeExpr()) {
                    InvokeExpr ie = (InvokeExpr)s.getInvokeExpr();
                    String name = ie.getMethodRef().name();
                    if (name.equals("getService"))
                        return sm;
                    if (name.equals("getSystemService"))
                        return sm;
                }
            }
        }
    }
    return null;
}
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:23,代码来源:GenerateServiceInit.java

示例7: getNameFromGetInstance

import soot.jimple.Stmt; //导入方法依赖的package包/类
private String getNameFromGetInstance(SootMethod sm) {

        Body b = sm.retrieveActiveBody();
        for (Unit u: b.getUnits()){
            Stmt s = (Stmt)u;
            if (s.containsInvokeExpr()) {
                InvokeExpr ie = (InvokeExpr)s.getInvokeExpr();
                String name = ie.getMethodRef().name();
                if (name.equals("getService")|| name.equals("getSystemService")) {
                    List<Value> args = ie.getArgs();
                    int size = args.size();
                    Value v = args.get(size-1);
                    if (v instanceof StringConstant) {
                        StringConstant c = (StringConstant)v;
                        return c.value;
                    } else {
                        throw new RuntimeException("error: expected constant string: "+ b);
                    }

                }
            }
        }
        throw new RuntimeException("error: nothing found, expected constant string: "+ b);
    }
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:25,代码来源:GenerateServiceInit.java

示例8: hasCallToGetSystem

import soot.jimple.Stmt; //导入方法依赖的package包/类
/**
 * To get a service (not to be confused with getSystemService)
 * @param b
 * @return
 */
public List<Unit> hasCallToGetSystem(Body b) {
  List<Unit> calls = new ArrayList<Unit>();
  for (Unit u: b.getUnits()) {
    Stmt s = (Stmt)u;
    if (s.containsInvokeExpr()) {
      try {
      InvokeExpr ie = s.getInvokeExpr();
      String mName = ie.getMethodRef().name();
      //System.out.println("m    : "+ ie.getMethodRef());
      //System.out.println("mName: "+ mName);
                  if (mName.equals("getService") && ie.getArgs().size() > 0) {
        calls.add(u);
      }
      } catch (Throwable t) {
        continue;
      }
    }
  }
  return calls;
}
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:26,代码来源:RedirectService.java

示例9: hasCallToSystemServices

import soot.jimple.Stmt; //导入方法依赖的package包/类
/**
 * To get a manager (not to be confused with getSystem)
 * 
 * @param b
 * @return
 */
public List<Unit> hasCallToSystemServices(Body b) {
    List<Unit> calls = new ArrayList<Unit>();
    for (Unit u : b.getUnits()) {
        Stmt s = (Stmt) u;
        if (s.containsInvokeExpr()) {
            try {
                InvokeExpr ie = s.getInvokeExpr();
                String mName = ie.getMethodRef().name();
                // System.out.println("m    : "+ ie.getMethodRef());
                // System.out.println("mName: "+ mName);
                if (mName.equals("getSystemService")) {
                    calls.add(u);
                }
            } catch (Throwable t) {
                continue;
            }
        }
    }
    return calls;
}
 
开发者ID:Alexandre-Bartel,项目名称:permission-map,代码行数:27,代码来源:RedirectServiceManager.java

示例10: taintApiDefault

import soot.jimple.Stmt; //导入方法依赖的package包/类
private Set<FlowAbstraction> taintApiDefault(Unit call, FlowAbstraction source, Stmt stmt,
		Set<FlowAbstraction> outSet) {
	final List<Value> args = stmt.getInvokeExpr().getArgs();
	final Local baseLocal = stmt.getInvokeExpr() instanceof InstanceInvokeExpr
			? (Local) ((InstanceInvokeExpr) stmt.getInvokeExpr()).getBase() : null;
	Local receiver = null;
	if (stmt instanceof AssignStmt)
		receiver = (Local) ((AssignStmt) stmt).getLeftOp();

	Set<FlowAbstraction> ret = new HashSet<FlowAbstraction>();

	// If a parameter is tainted, we taint the base local and the receiver
	if (source.getLocal() != null && args.contains(source.getLocal())) {
		if (baseLocal != null && !baseLocal.toString().equals("this"))
			ret.add(FlowAbstraction.v(source.getSource(), baseLocal, call, icfg.getMethodOf(call), source));
		if (receiver != null)
			ret.add(FlowAbstraction.v(source.getSource(), receiver, call, icfg.getMethodOf(call), source));
	}

	// If the base local is tainted, we taint the receiver
	if (baseLocal != null && source.getLocal() == baseLocal && receiver != null)
		ret.add(FlowAbstraction.v(source.getSource(), receiver, call, icfg.getMethodOf(call), source));

	return ret;
}
 
开发者ID:secure-software-engineering,项目名称:cheetah,代码行数:26,代码来源:AnalysisTask.java

示例11: isExclusiveInternal

import soot.jimple.Stmt; //导入方法依赖的package包/类
@Override
public boolean isExclusiveInternal(Stmt stmt, AccessPath taintedPath) {
	SootMethod method = stmt.getInvokeExpr().getMethod();
	
	// Do we have an entry for at least one entry in the given class?
	if (hasWrappedMethodsForClass(method.getDeclaringClass(), true, true, true))
		return true;

	// In aggressive mode, we always taint the return value if the base
	// object is tainted.
	if (aggressiveMode && stmt.getInvokeExpr() instanceof InstanceInvokeExpr) {
		InstanceInvokeExpr iiExpr = (InstanceInvokeExpr) stmt.getInvokeExpr();			
		if (iiExpr.getBase().equals(taintedPath.getPlainValue()))
			return true;
	}
	
	final MethodWrapType wrapType = methodWrapCache.getUnchecked(method);
	return wrapType != MethodWrapType.NotRegistered;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:20,代码来源:EasyTaintWrapper.java

示例12: supportsCallee

import soot.jimple.Stmt; //导入方法依赖的package包/类
@Override
public boolean supportsCallee(Stmt callSite) {
	// We need an invocation expression
	if (!callSite.containsInvokeExpr())
		return false;

	SootMethod method = callSite.getInvokeExpr().getMethod();
	if (!supportsCallee(method))
		return false;
			
	// We need a method that can create a taint
	if (!aggressiveMode) {
		// Check for a cached wrap type
		final MethodWrapType wrapType = methodWrapCache.getUnchecked(method);
		if (wrapType != MethodWrapType.CreateTaint)
			return false;
	}
	
	// We need at least one non-constant argument or a tainted base
	if (callSite.getInvokeExpr() instanceof InstanceInvokeExpr)
		return true;
	for (Value val : callSite.getInvokeExpr().getArgs())
		if (!(val instanceof Constant))
			return true;
	return false;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:27,代码来源:EasyTaintWrapper.java

示例13: getCallTargets

import soot.jimple.Stmt; //导入方法依赖的package包/类
/**
 * Obtain the set of possible call targets at given @param callsite.
 */
private void getCallTargets(IVarAbstraction pn, SootMethod src,
		Stmt callsite, ChunkedQueue<SootMethod> targetsQueue)
{
	InstanceInvokeExpr iie = (InstanceInvokeExpr)callsite.getInvokeExpr();
	Local receiver = (Local)iie.getBase();
	NumberedString subSig = iie.getMethodRef().getSubSignature();
	
	// We first build the set of possible call targets
	for (AllocNode an : pn.get_all_points_to_objects()) {
		Type type = an.getType();
		if (type == null) continue;

		VirtualCalls.v().resolve(type, 
				receiver.getType(), subSig, src,
				targetsQueue);
	}
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:21,代码来源:GeomPointsTo.java

示例14: getOutWordCount

import soot.jimple.Stmt; //导入方法依赖的package包/类
public static int getOutWordCount(Collection<Unit> units) {
	int outWords = 0;
	for (Unit u : units) {
		Stmt stmt = (Stmt) u;
		if (stmt.containsInvokeExpr()) {
			int wordsForParameters = 0;
			InvokeExpr invocation = stmt.getInvokeExpr();
			List<Value> args = invocation.getArgs();
			for (Value arg : args) {
				wordsForParameters += getDexWords(arg.getType());
			}
			if (!invocation.getMethod().isStatic()) {
				wordsForParameters++; // extra word for "this"
			}
			if (wordsForParameters > outWords) {
				outWords = wordsForParameters;
			}
		}
	}
	return outWords;
}
 
开发者ID:flankerhqd,项目名称:JAADAS,代码行数:22,代码来源:SootToDexUtils.java

示例15: computeArgumentValues

import soot.jimple.Stmt; //导入方法依赖的package包/类
@Override
public Set<Object> computeArgumentValues(Argument argument, Unit callSite) {
  ArgumentValueAnalysis stringAnalysis =
      ArgumentValueManager.v().getArgumentValueAnalysis(
          Constants.DefaultArgumentTypes.Scalar.STRING);

  Stmt stmt = (Stmt) callSite;
  if (!stmt.containsInvokeExpr()) {
    throw new RuntimeException("Statement " + stmt + " does not contain an invoke expression");
  }
  InvokeExpr invokeExpr = stmt.getInvokeExpr();

  Set<Object> hosts =
      stringAnalysis.computeVariableValues(invokeExpr.getArg(argument.getArgnum()[0]), stmt);
  Set<Object> ports =
      stringAnalysis.computeVariableValues(invokeExpr.getArg(argument.getArgnum()[1]), stmt);

  Set<Object> result = new HashSet<>();
  for (Object host : hosts) {
    for (Object port : ports) {
      result.add(new DataAuthority((String) host, (String) port));
    }
  }

  return result;
}
 
开发者ID:dialdroid-android,项目名称:ic3-dialdroid,代码行数:27,代码来源:AuthorityValueAnalysis.java


注:本文中的soot.jimple.Stmt.getInvokeExpr方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。