Examples of SootClass


Examples of soot.SootClass

    }
   
    ReflectionModel reflectionModel;
   
    private void getImplicitTargets( SootMethod source ) {
        final SootClass scl = source.getDeclaringClass();
        if( source.isNative() || source.isPhantom() ) return;
        if( source.getSubSignature().indexOf( "<init>" ) >= 0 ) {
            handleInit(source, scl);
        }
        Body b = source.retrieveActiveBody();
        for( Iterator sIt = b.getUnits().iterator(); sIt.hasNext(); ) {
            final Stmt s = (Stmt) sIt.next();
            if( s.containsInvokeExpr() ) {
                InvokeExpr ie = s.getInvokeExpr();
                if( ie.getMethodRef().getSignature().equals( "<java.lang.reflect.Method: java.lang.Object invoke(java.lang.Object,java.lang.Object[])>" ) ) {
                  reflectionModel.methodInvoke(source,s);
                }
                if( ie.getMethodRef().getSignature().equals( "<java.lang.Class: java.lang.Object newInstance()>" ) ) {
                  reflectionModel.classNewInstance(source,s);
                }
                if( ie.getMethodRef().getSignature().equals( "<java.lang.reflect.Constructor: java.lang.Object newInstance(java.lang.Object[])>" ) ) {
                  reflectionModel.contructorNewInstance(source, s);
                }
                if( ie.getMethodRef().getSubSignature() == sigForName ) {
                  reflectionModel.classForName(source,s);
                }
                if( ie instanceof StaticInvokeExpr ) {
                  SootClass cl = ie.getMethodRef().declaringClass();
                  for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
                    addEdge( source, s, clinit, Kind.CLINIT );
                  }
                }
            }
            if( s.containsFieldRef() ) {
                FieldRef fr = s.getFieldRef();
                if( fr instanceof StaticFieldRef ) {
                    SootClass cl = fr.getFieldRef().declaringClass();
                    for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
                        addEdge( source, s, clinit, Kind.CLINIT );
                    }
                }
            }
            if( s instanceof AssignStmt ) {
                Value rhs = ((AssignStmt)s).getRightOp();
                if( rhs instanceof NewExpr ) {
                    NewExpr r = (NewExpr) rhs;
                    SootClass cl = r.getBaseType().getSootClass();
                    for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
                        addEdge( source, s, clinit, Kind.CLINIT );
                    }
                } else if( rhs instanceof NewArrayExpr || rhs instanceof NewMultiArrayExpr ) {
                    Type t = rhs.getType();
                    if( t instanceof ArrayType ) t = ((ArrayType)t).baseType;
                    if( t instanceof RefType ) {
                        SootClass cl = ((RefType) t).getSootClass();
                        for (SootMethod clinit : EntryPoints.v().clinitsOf(cl)) {
                            addEdge( source, s, clinit, Kind.CLINIT );
                        }
                    }
                }
View Full Code Here

Examples of soot.SootClass

                    G.v().out.println( "Warning: Class "+cls+" is"+
                        " a dynamic class, and you did not specify"+
                        " it as such; graph will be incomplete!" );
                }
            } else {
                SootClass sootcls = Scene.v().getSootClass( cls );
                if( !sootcls.isApplicationClass() ) {
                    sootcls.setLibraryClass();
                }
                for (SootMethod clinit : EntryPoints.v().clinitsOf(sootcls)) {
                    addEdge( src, srcUnit, clinit, Kind.CLINIT );
                }
View Full Code Here

Examples of soot.SootClass

   
    protected void addTags( PAG pag ) {
        final Tag unknown = new StringTag( "Untagged Spark node" );
        final Map<Node, Tag> nodeToTag = pag.getNodeTags();
        for( Iterator cIt = Scene.v().getClasses().iterator(); cIt.hasNext(); ) {
            final SootClass c = (SootClass) cIt.next();
            for( Iterator mIt = c.methodIterator(); mIt.hasNext(); ) {
                SootMethod m = (SootMethod) mIt.next();
                if( !m.isConcrete() ) continue;
                if( !m.hasActiveBody() ) continue;
                for( Iterator sIt = m.getActiveBody().getUnits().iterator(); sIt.hasNext(); ) {
                    final Stmt s = (Stmt) sIt.next();
View Full Code Here

Examples of soot.SootClass

      Set<String> classNames = reflectionInfo.classNewInstanceClassNames(container);
      if(classNames==null || classNames.isEmpty()) {
        registerGuard(container, newInstanceInvokeStmt, "Class.newInstance() call site; Soot did not expect this site to be reached");
      } else {
        for (String clsName : classNames) {
          SootClass cls = Scene.v().getSootClass(clsName);
          if( cls.declaresMethod(sigInit) ) {
            SootMethod constructor = cls.getMethod(sigInit);
            addEdge( container, newInstanceInvokeStmt, constructor, Kind.REFL_CLASS_NEWINSTANCE );
          }
        }
      }
    }
View Full Code Here

Examples of soot.SootClass

                        G.v().out.println( "Warning: Class "+constant+" is"+
                            " a dynamic class, and you did not specify"+
                            " it as such; graph will be incomplete!" );
                    }
                } else {
                    SootClass sootcls = Scene.v().getSootClass( constant );
                    if( !sootcls.isApplicationClass() ) {
                        sootcls.setLibraryClass();
                    }
                    for (SootMethod clinit : EntryPoints.v().clinitsOf(sootcls)) {
                        cm.addStaticEdge(
                                MethodContext.v( site.container(), srcContext ),
                                site.stmt(),
View Full Code Here

Examples of soot.SootClass

      if(!Scene.v().containsClass(className)) {
        throw new RuntimeException("Trace file refers to unknown class: "+className);
      }
    }

    SootClass sootClass = Scene.v().getSootClass(className);
    Set<SootMethod> methodsWithRightName = new HashSet<SootMethod>();
    for (SootMethod m: sootClass.getMethods()) {
      if(m.getName().equals(methodName)) {
        methodsWithRightName.add(m);
      }
    }
View Full Code Here

Examples of soot.SootClass

 
  private  void setApplicationClasses(){
    Iterator classIt = classes.iterator();
    while(classIt.hasNext()){
      String className = classIt.next().toString();
      SootClass current = Scene.v().getSootClass(className);
      current.setApplicationClass();
    }
  }
View Full Code Here

Examples of soot.SootClass

    String name = (String)JOptionPane.showInputDialog(
                this, "Enter name of main class",
                "Customized Dialog",JOptionPane.PLAIN_MESSAGE,
                null,null,null);
    try{
      SootClass mainClass = Scene.v().getSootClass(name);
      Scene.v().setMainClass(mainClass);
    }
    catch(Exception e){
      e.printStackTrace();
      selectMainClass();
View Full Code Here

Examples of soot.SootClass

    String name = (String)JOptionPane.showInputDialog(
                this, "Enter name of main class",
                "Customized Dialog",JOptionPane.PLAIN_MESSAGE,
                null,null,null);
    try{
      SootClass mainClass = Scene.v().getSootClass(name);
      Scene.v().setMainClass(mainClass);
    }
    catch(Exception e){
      e.printStackTrace();
      selectMainClass();
View Full Code Here

Examples of soot.SootClass

 
  private  void setApplicationClasses(){
    Iterator classIt = classes.iterator();
    while(classIt.hasNext()){
      String className = classIt.next().toString();
      SootClass current = Scene.v().getSootClass(className);
      current.setApplicationClass();
    }
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.