Skip to content

Commit 681137b

Browse files
committed
If post process is enabled, now it prints the path in order
1 parent ad68237 commit 681137b

File tree

1 file changed

+20
-6
lines changed

1 file changed

+20
-6
lines changed

de.fraunhofer.iem.secucheck.analysis.implementation/src/main/java/de/fraunhofer/iem/secucheck/analysis/implementation/SingleFlowTaintAnalysis/BoomerangSolver/guided/SecucheckBoomerangDemandDrivenAnalysis.java

Lines changed: 20 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import boomerang.scene.jimple.JimpleStatement;
99
import de.fraunhofer.iem.secucheck.analysis.configuration.SecucheckAnalysisConfiguration;
1010
import de.fraunhofer.iem.secucheck.analysis.datastructures.SameTypedPair;
11+
import de.fraunhofer.iem.secucheck.analysis.datastructures.TaintFlowPath;
1112
import de.fraunhofer.iem.secucheck.analysis.implementation.SingleFlowTaintAnalysis.BoomerangSolver.Utility;
1213
import de.fraunhofer.iem.secucheck.analysis.datastructures.DifferentTypedPair;
1314
import de.fraunhofer.iem.secucheck.analysis.implementation.SingleFlowTaintAnalysis.datastructure.BoomerangTaintFlowPath;
@@ -36,6 +37,19 @@ public SecucheckBoomerangDemandDrivenAnalysis(SecucheckAnalysisConfiguration sec
3637
this.secucheckAnalysisConfiguration = secucheckAnalysisConfiguration;
3738
}
3839

40+
public void printPath(BoomerangTaintFlowPath node) {
41+
if (node == null)
42+
return;
43+
44+
if (node.getNodeValue() == null)
45+
System.out.println("--> null");
46+
else
47+
System.out.println("--> " + (Query) node.getNodeValue());
48+
49+
for (TaintFlowPath child : node.getChildrenNodes())
50+
printPath((BoomerangTaintFlowPath) child);
51+
}
52+
3953
/**
4054
* Runs the DemandDrivenAnalysis
4155
*
@@ -61,12 +75,6 @@ public List<DifferentTypedPair<TaintFlowImpl, SingleTaintFlowAnalysisResult>> ru
6175

6276
QueryGraph<Weight.NoWeight> queryGraph = demandDrivenGuidedAnalysis.run(source);
6377

64-
if (secucheckAnalysisConfiguration.isPostProcessResult()) {
65-
for (Query query : queryGraph.getNodes()) {
66-
System.out.println("---> " + query.cfgEdge());
67-
}
68-
}
69-
7078
for (DifferentTypedPair<BackwardQuery, BoomerangTaintFlowPath> sinkNode : boomerangGPHandler.getFoundSinks()) {
7179
BackwardQuery sink = sinkNode.getFirst();
7280

@@ -76,6 +84,12 @@ public List<DifferentTypedPair<TaintFlowImpl, SingleTaintFlowAnalysisResult>> ru
7684
secucheckAnalysisConfiguration.isPostProcessResult()
7785
);
7886
reachMap.add(new DifferentTypedPair<>(singleFlow, res));
87+
88+
if (secucheckAnalysisConfiguration.isPostProcessResult()) {
89+
System.out.println("***** TaintFlow *****");
90+
printPath((BoomerangTaintFlowPath) res.getPath());
91+
System.out.println("*********************");
92+
}
7993
}
8094
}
8195

0 commit comments

Comments
 (0)