public static void createFindingsFromStrutsMappings(IStrutsMappings strutsMappings, ascx_FindingsViewer findingsViewer_ToLoadResults) { var createdFindings = StrutsMappingHelpers.createFindingsFromStrutsMappings(strutsMappings); findingsViewer_ToLoadResults.setTraceTreeViewVisibleStatus(true); findingsViewer_ToLoadResults.setFilter2Value("(no filter)"); findingsViewer_ToLoadResults.loadO2Findings(createdFindings, true); }
public void calculateFinalResults( string taintSources_SourceRegEx, string taintSources_SinkRegEx, string finalSinks_SourceRegEx, string finalSinks_SinkRegEx) { if (findingsWith_BaseO2Findings == null) { findingsWith_BaseO2Findings = XUtils_Findings_v0_1.loadFindingsFile(BaseO2Findings); } // calculate TaintSources findingsWith_FindingsFromTaintSources = O2FindingsHelpers.calculateFindings( findingsWith_BaseO2Findings, taintSources_SourceRegEx, taintSources_SinkRegEx, XUtils_Findings_v0_1.mapJoinPoints_HashTagsOn_Sinks); // calculate FinalSinks findingsWith_FindingsToFinalSinks = O2FindingsHelpers.calculateFindings( findingsWith_BaseO2Findings, FinalSinks_SourceRegEx, finalSinks_SinkRegEx, XUtils_Findings_v0_1.mapJoinPoints_HashTagsOn_Sources); // calculate strutsMapping object and findings if (StrutsMappings == null) { StrutsMappings = (IStrutsMappings)Serialize.getDeSerializedObjectFromBinaryFile(StrutsMappingsFile, typeof(KStrutsMappings)); } findingsWith_StrutsMappings = StrutsMappingHelpers.createFindingsFromStrutsMappings(StrutsMappings); calculateResults(); // results = xUtils_Findings_v0_1.mapJoinPoints_HashTagsOn_Sinks(results); /*runFilterFor_TaintSources( * taintSources_SourceRegEx, taintSources_SinkRegEx, findingsViewer_BaseFindings.currentO2Findings, * xUtils_Findings_v0_1.mapJoinPoints_HashTagsOn_Sinks, filteredFindings_TaintSources); * runFilterFor_FinalSinks( * finalSinks_SourceRegEx, finalSinks_SinkRegEx, findingsViewer_BaseFindings.currentO2Findings, * xUtils_Findings_v0_1.mapJoinPoints_HashTagsOn_Sources, filteredFindings_FinalSinks); * * * /* runFilterFor_TaintSources( * taintSources_SourceRegEx, taintSources_SinkRegEx, findingsViewer_BaseFindings.currentO2Findings, * xUtils_Findings_v0_1.mapJoinPoints_HashTagsOn_Sinks, filteredFindings_TaintSources); * runFilterFor_FinalSinks( * finalSinks_SourceRegEx, finalSinks_SinkRegEx, findingsViewer_BaseFindings.currentO2Findings, * xUtils_Findings_v0_1.mapJoinPoints_HashTagsOn_Sources, filteredFindings_FinalSinks); */ /* * createFindingsFromStrutsMappings(strutsMappingsControl, findingsViewer_FromStrutsMappings); * * calculateResults(strutsMappingsControl,filteredFindings_TaintSources, filteredFindings_FinalSinks, findingsViewer_FinalFindings); */ }
private List <IO2Finding> mapStrutsFindings(IStrutsMappings strutsMappingsObject, List <IO2Finding> o2Findings, bool createConsolidatedView) { // calculate findings from strutsMappings var strutsFindings = StrutsMappingHelpers.createFindingsFromStrutsMappings(strutsMappingsObject); // creates a dictionary with the O2JoinSinks as the key (containing a list of Findings that match that key (i.e. O2LostSink)) var joinSinksDictionary = OzasmtSearch.getDictionaryWithJoinSinks(strutsFindings); // creates a list of findings with the root node as the key (containing a list of Findings that match that key (i.e. root node)) var rootFunctions = new Dictionary <string, List <IO2Finding> >(); foreach (var o2Finding in o2Findings) { if (o2Finding.o2Traces.Count > 0) { var rootFunction = o2Finding.o2Traces[0].clazz; if (rootFunction.StartsWith("jsp_servlet")) { rootFunction = rootFunction.Replace("jsp_servlet", ""). Replace("_45_", "-"). Replace(".__", "/"). Replace("._", "/") + ".jsp"; } if (rootFunction != "") { if (false == rootFunctions.ContainsKey(rootFunction)) { rootFunctions.Add(rootFunction, new List <IO2Finding>()); } rootFunctions[rootFunction].Add(o2Finding); } } } // now map the JoinSinks with the Root Functions if (createConsolidatedView) { return(StrutsMappingHelpers.joinTracesUsingConsolidatedView(joinSinksDictionary, rootFunctions)); } return(joinTracesUsingExpandedView(o2Findings, joinSinksDictionary, rootFunctions)); /*foreach (var values in rootFunctions.Values) * foreach (var o2Finding in values) * { * var modifiedFinding = (O2Finding)OzasmtCopy.createCopy(o2Finding); * var currentSource = modifiedFinding.getSource(); * currentSource.traceType = TraceType.Type_4; * modifiedFinding.o2Traces[0].traceType = TraceType.Source; * mappedFindings.Add(modifiedFinding); * } */ }
private void btCreateFindingsFromStrutsMapings_Click(object sender, EventArgs e) { var strutsMappingObject = strutsMappings.getStrutsMappingObject(); if (strutsMappingObject != null) { var createdFindings = StrutsMappingHelpers.createFindingsFromStrutsMappings(strutsMappingObject); findingsViewer_FromStrutsMappings.setTraceTreeViewVisibleStatus(true); findingsViewer_FromStrutsMappings.setFilter2Value("(no filter)"); findingsViewer_FromStrutsMappings.loadO2Findings(createdFindings, true); } }