本文整理汇总了Java中soot.jimple.Stmt类的典型用法代码示例。如果您正苦于以下问题:Java Stmt类的具体用法?Java Stmt怎么用?Java Stmt使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
Stmt类属于soot.jimple包,在下文中一共展示了Stmt类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: findDataFlowPathForSink
import soot.jimple.Stmt; //导入依赖的package包/类
private ResultSourceInfo findDataFlowPathForSink(Stmt sinkStmt, Local sinkLokal, List<ResultSourceInfo> allDataFlows) {
for(ResultSourceInfo singleFlow : allDataFlows){
Stmt[] statements = singleFlow.getPath();
AccessPath[] accessPath = singleFlow.getPathAccessPaths();
for(int i = 0; i < statements.length; i++) {
Stmt currentStmt = statements[i];
if(currentStmt == sinkStmt) {
if(accessPath[i].getPlainValue() == sinkLokal)
return singleFlow;
}
else if(currentStmt instanceof AssignStmt) {
AssignStmt assignStmt = (AssignStmt)currentStmt;
Value lhs = assignStmt.getLeftOp();
if(lhs == sinkLokal)
return singleFlow;
}
}
}
return null;
}
示例2: hasConstantIndexAtArrayForSplitDataFlow
import soot.jimple.Stmt; //导入依赖的package包/类
private boolean hasConstantIndexAtArrayForSplitDataFlow(Stmt[] dataflow) {
Stmt firstAssign = dataflow[0];
if(firstAssign instanceof AssignStmt) {
AssignStmt ass = (AssignStmt)firstAssign;
Value value = ass.getRightOp();
if(value instanceof ArrayRef) {
ArrayRef aRef = (ArrayRef)value;
Value index = aRef.getIndex();
if(index instanceof IntConstant)
return true;
}
}
else
throw new RuntimeException("this should not happen - wrong assumption");
return false;
}
示例3: getConstantArrayIndexForSplitDataFlow
import soot.jimple.Stmt; //导入依赖的package包/类
private int getConstantArrayIndexForSplitDataFlow(Stmt[] dataflow) {
Stmt firstAssign = dataflow[0];
if(firstAssign instanceof AssignStmt) {
AssignStmt ass = (AssignStmt)firstAssign;
Value value = ass.getRightOp();
if(value instanceof ArrayRef) {
ArrayRef aRef = (ArrayRef)value;
Value index = aRef.getIndex();
if(index instanceof IntConstant)
return ((IntConstant) index).value;
}
}
else
throw new RuntimeException("this should not happen - wrong assumption");
return -1;
}
示例4: 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;
}
示例5: 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;
}
示例6: 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();
}
}
示例7: generate
import soot.jimple.Stmt; //导入依赖的package包/类
@Override
public Collection<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> generate(Unit unit,
Collection<SootMethod> calledMethod) {
boolean matches = false;
for (SootMethod method : calledMethod) {
if (initialTrans.matches(method)) {
matches = true;
}
}
if (!matches)
return Collections.emptySet();
if (unit instanceof Stmt && ((Stmt) unit).getInvokeExpr() instanceof InstanceInvokeExpr) {
InstanceInvokeExpr iie = (InstanceInvokeExpr) ((Stmt) unit).getInvokeExpr();
Set<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> out = new HashSet<>();
out.add(new Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>(
new AccessGraph((Local) iie.getBase(), iie.getBase().getType()),
new TransitionFunction(initialTrans)));
return out;
}
return Collections.emptySet();
}
示例8: 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();
}
示例9: generateThisAtAnyCallSitesOf
import soot.jimple.Stmt; //导入依赖的package包/类
protected Collection<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> generateThisAtAnyCallSitesOf(Unit unit,
Collection<SootMethod> calledMethod, Set<SootMethod> hasToCall, MatcherTransition initialTrans) {
for (SootMethod callee : calledMethod) {
if (hasToCall.contains(callee)) {
if (unit instanceof Stmt) {
if (((Stmt) unit).getInvokeExpr() instanceof InstanceInvokeExpr) {
InstanceInvokeExpr iie = (InstanceInvokeExpr) ((Stmt) unit).getInvokeExpr();
Local thisLocal = (Local) iie.getBase();
Set<Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>> out = new HashSet<>();
out.add(new Pair<AccessGraph, EdgeFunction<TypestateDomainValue>>(
new AccessGraph(thisLocal, thisLocal.getType()), new TransitionFunction(initialTrans)));
return out;
}
}
}
}
return Collections.emptySet();
}
示例10: 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);
}
}
示例11: 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;
}
示例12: 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);
}
示例13: 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;
}
示例14: 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;
}
示例15: hasCallToService
import soot.jimple.Stmt; //导入依赖的package包/类
/**
* To get a service (not to be confused with getSystemService)
*
* @param b
* @return
*/
public List<Unit> hasCallToService(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();
String cName = ie.getMethodRef().declaringClass().getName();
// System.out.println("m : "+ ie.getMethodRef());
// System.out.println("mName: "+ mName);
if (mName.equals("getService")
&& cName.equals("android.os.ServiceManager")) {
calls.add(u);
}
} catch (Throwable t) {
continue;
}
}
}
return calls;
}