2016-06-23 1 views
0

Comment utiliser SOOT pour construire au graphe d'appel? Ou y a-t-il de meilleurs programmes pour cela? J'ai été envoyé autour des mêmes cinq pages à la recherche de réponses et je ne trouve pas ce que je cherche. Il y a aussi un problème avec la version du plugin pour Eclipse. Il est installé correctement mais je ne peux pas le choisir quand je veux exécuter le code.Graphiques d'appel dans Soot

Répondre

0

Voici quelques exemples de graphique d'appel pour Java. http://www.brics.dk/SootGuide/

Et appelez le graphique pour apk. https://github.com/secure-software-engineering/soot-infoflow/issues/38

Si vous voulez obtenir le fichier de points, vous pouvez parcourir le tableau de bord et écrire le contenu au format de point comme ceci.

private static void visit(CallGraph cg, SootMethod method) { 
    String identifier = method.getSignature(); 
    visited.put(method.getSignature(), true); 
    dot.drawNode(identifier); 
    // iterate over unvisited parents 
    Iterator<MethodOrMethodContext> ptargets = new Targets(cg.edgesInto(method)); 
    if (ptargets != null) { 
    while (ptargets.hasNext()) { 
     SootMethod parent = (SootMethod) ptargets.next(); 
     if (!visited.containsKey(parent.getSignature())) visit(cg, parent); 
    } 
    } 
    // iterate over unvisited children 
    Iterator<MethodOrMethodContext> ctargets = new Targets(cg.edgesOutOf(method)); 
    if (ctargets != null) { 
    while (ctargets.hasNext()) { 
     SootMethod child = (SootMethod) ctargets.next(); 
     dot.drawEdge(identifier, child.getSignature()); 
     System.out.println(method + " may call " + child); 
     if (!visited.containsKey(child.getSignature())) visit(cg, child); 
    } 
    } 
} 
0

Petite modification de la réponse précédente

private static void visit(CallGraph cg, SootMethod method) { 
 
    String identifier = method.getSignature(); 
 
    visited.put(method.getSignature(), true); 
 
    dot.drawNode(identifier); 
 
    // iterate over unvisited parents 
 
    Iterator<MethodOrMethodContext> ptargets = new Sources(cg.edgesInto(method)); 
 
    if (ptargets != null) { 
 
    while (ptargets.hasNext()) { 
 
     SootMethod parent = (SootMethod) ptargets.next(); 
 
     if (!visited.containsKey(parent.getSignature())) visit(cg, parent); 
 
    } 
 
}