Skip to content

Commit 81bfd2b

Browse files
authored
Merge pull request #1 from secure-software-engineering/develop
Develop Into Master
2 parents 2d9adec + e9061a4 commit 81bfd2b

File tree

6 files changed

+355
-252
lines changed

6 files changed

+355
-252
lines changed

de.fraunhofer.iem.secucheck.analysis.sample/src/main/java/de/fraunhofer/iem/secucheck/analysis/sample/Main.java

+11-12
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,9 @@ private static void runSecucheckAnalysis(SecucheckAnalysis secucheckAnalysis)
4747
secucheckAnalysis.setApplicationClassPath(getAppClassPath());
4848
secucheckAnalysis.setSootClassPathJars(getSootClassPath());
4949

50-
//runDemoSet1(secucheckAnalysis, resultListener);
50+
runDemoSet1(secucheckAnalysis, resultListener);
5151
runDemoSet2(secucheckAnalysis, resultListener);
52-
//runDemoSet3(secucheckAnalysis, resultListener);
53-
//runDemoSet4(secucheckAnalysis, resultListener);
52+
runDemoSet3(secucheckAnalysis, resultListener);
5453

5554
}
5655

@@ -121,16 +120,10 @@ private static void runDemoSet2(SecucheckAnalysis secucheckAnalysis,
121120
runAnalysisQuery(secucheckAnalysis, compositeOfTenth, 10, null);
122121
}
123122

124-
private static void runDemoSet3(SecucheckAnalysis secucheckAnalysis,
125-
AnalysisResultListener resultListener) throws Exception {
126-
127-
}
128-
129-
/** Demo-set X: TODO: Fix the number.
123+
/** Demo-set 3:
130124
* - Demonstrates multiple composites
131-
* - Demonstrates the result listener
132125
*/
133-
private static void runDemoSet4(SecucheckAnalysis secucheckAnalysis,
126+
private static void runDemoSet3(SecucheckAnalysis secucheckAnalysis,
134127
AnalysisResultListener resultListener) throws Exception {
135128

136129
List<CompositeTaintFlowQueryImpl> compositeOfFirst = Utility.getInList(
@@ -290,11 +283,17 @@ private static String getSootClassPath() {
290283

291284
private static List<EntryPoint> getEntryPoints(){
292285
List<EntryPoint> entryPoints = new ArrayList<EntryPoint>();
286+
293287
EntryPoint entryPoint = new EntryPoint();
294288
entryPoint.setCanonicalClassName("AnalyzeMeLevel1");
295289
entryPoint.setAllMethods(true);
296290
entryPoints.add(entryPoint);
291+
292+
entryPoint = new EntryPoint();
293+
entryPoint.setCanonicalClassName("AnalyzeMeLevel2");
294+
entryPoint.setAllMethods(true);
295+
entryPoints.add(entryPoint);
296+
297297
return entryPoints;
298298
}
299-
300299
}

de.fraunhofer.iem.secucheck.analysis.sample/src/main/java/de/fraunhofer/iem/secucheck/analysis/sample/Utility.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ private static MethodImpl getSanitizerMethod(String canonicalClassName) {
5757
List<InputParameter> inputs = new ArrayList<InputParameter>();
5858
inputs.add(input);
5959

60-
List<OutputParameter> outputs = null;
60+
List<OutputParameter> outputs = new ArrayList<OutputParameter>();
6161
ReturnValue returnValue = null;
6262

6363
MethodImpl method = new MethodImpl();
@@ -76,8 +76,8 @@ private static MethodImpl getPropogatorMethod(String canonicalClassName) {
7676
List<InputParameter> inputs = new ArrayList<InputParameter>();
7777
inputs.add(input);
7878

79-
List<OutputParameter> outputs = null;
80-
ReturnValue returnValue = null;
79+
List<OutputParameter> outputs = new ArrayList<OutputParameter>();
80+
ReturnValue returnValue = new ReturnValue();
8181

8282
MethodImpl method = new MethodImpl();
8383
method.setName("propogator");
@@ -95,7 +95,7 @@ private static MethodImpl getSinkMethod(String canonicalClassName) {
9595
List<InputParameter> inputs = new ArrayList<InputParameter>();
9696
inputs.add(input);
9797

98-
List<OutputParameter> outputs = null;
98+
List<OutputParameter> outputs = new ArrayList<OutputParameter>();
9999
ReturnValue returnValue = null;
100100

101101
MethodImpl method = new MethodImpl();
@@ -115,9 +115,9 @@ public static MethodImpl getUsageSourceParameMethod(String canonicalClassName,
115115
ReturnValue returnValue = null;
116116

117117
// For the first input parameter.
118-
InputParameter inputParam = new InputParameter();
119-
inputParam.setNumber(0);
120-
inputs.add(inputParam);
118+
OutputParameter outputParam = new OutputParameter();
119+
outputParam.setNumber(0);
120+
outputs.add(outputParam);
121121

122122
MethodImpl method = new MethodImpl();
123123
method.setName("getSecret");

de.fraunhofer.iem.secucheck.analysis/src/main/java/de/fraunhofer/iem/secucheck/analysis/SecucheckTaintAnalysisBase.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -194,31 +194,31 @@ protected void internalTransform(String phaseName, Map options) {
194194
icfg = new JimpleBasedInterproceduralCFG(true);
195195
try {
196196
executeAnalysis();
197-
} catch (Exception e) { }
197+
} catch (Exception ex) {
198+
ex.printStackTrace();
199+
}
198200
}
199201
};
200202
}
201-
203+
204+
202205
private static void drawCallGraph(CallGraph callGraph){
203206
DotGraph dot = new DotGraph("callgraph");
204207
Iterator<Edge> iteratorEdges = callGraph.iterator();
205208

206-
int i = 0;
207209
System.out.println("Call Graph size : "+ callGraph.size());
208210
while (iteratorEdges.hasNext()) {
209211
Edge edge = iteratorEdges.next();
210212
String node_src = edge.getSrc().toString();
211213
String node_tgt = edge.getTgt().toString();
212-
213214
dot.drawEdge(node_src, node_tgt);
214-
System.out.println(i++);
215215
}
216-
217-
dot.plot("/home/arkt/Desktop/cgs/callgraph.dot");
216+
dot.plot("<file-path>");
218217
}
219218

220219
private void executeAnalysis() throws Exception {
221-
220+
221+
// For dumping the call graph for debugging purposes.
222222
//drawCallGraph(Scene.v().getCallGraph());
223223

224224
for (CompositeTaintFlowQueryImpl flowQuery : this.flowQueries) {

0 commit comments

Comments
 (0)