Ejemplo n.º 1
0
        public static AnalysisSearch.SavedAssessmentSearch createSavedAssessmentSearchObjectFromNormalizedTraces(List <TreeNode> ltnNormalizedTraces)
        {
            //     if (tvTempTreeView.Nodes.Count > 0)
            //     {
            var sasSavedAssessmentSearch = new AnalysisSearch.SavedAssessmentSearch();

            //       foreach (TreeNode tnTreeNode in tvTempTreeView.Nodes)
            DI.log.debug("There are {0} Traces in ltnTraces to process", ltnNormalizedTraces.Count);
            foreach (TreeNode tnTreeNode in ltnNormalizedTraces)
            {
                FindingViewItem fviJoinedFindingViewItem =
                    creator.createJoinedUpFindingViewItemFromTreeNodeWithFindingViewItemAsTags(tnTreeNode);
                if (fviJoinedFindingViewItem != null && fviJoinedFindingViewItem.fFinding != null)
                {
                    var frFindingsResult =
                        new AnalysisSearch.FindingsResult(fviJoinedFindingViewItem.oadO2AssessmentDataOunceV6)
                    {
                        fFinding = fviJoinedFindingViewItem.fFinding,
                        fFile    =
                            fviJoinedFindingViewItem.oadO2AssessmentDataOunceV6.dFindings[
                                fviJoinedFindingViewItem.fFinding]
                    };
                    sasSavedAssessmentSearch.lfrFindingsResults.Add(frFindingsResult);
                    if (sasSavedAssessmentSearch.lfrFindingsResults.Count % 2500 == 0)
                    {
                        DI.log.debug("Create Trace # {0}/{1}", sasSavedAssessmentSearch.lfrFindingsResults.Count, ltnNormalizedTraces.Count);
                    }
                }
            }
            return(sasSavedAssessmentSearch);
        }
        public static AnalysisSearch.FindingsResult createFindingsResultForSourceAndSink(String sSourceSignature,
                                                                                         String sSinkSignature,
                                                                                         String sFakeActionObjectId,
                                                                                         String sVulnName,
                                                                                         String sVulnType,
                                                                                         String sCallerName,
                                                                                         String sFileName)
        {
            var nfNewFinding = new VirtualTraces.NewFinding();

            nfNewFinding.setFinding_FileName(sFileName);
            nfNewFinding.setFinding_VulnName(sVulnName);
            nfNewFinding.setFinding_VulnType(sVulnType);
            nfNewFinding.setFinding_fakeActionObjectId(sFakeActionObjectId);
            nfNewFinding.setFinding_CallerName(sCallerName);

            CallInvocation ciRootNode = nfNewFinding.setRootTrace(sVulnName);
            CallInvocation ciSource   = nfNewFinding.addCallToCall(sSourceSignature, ciRootNode, TraceType.Source);
            CallInvocation ciNode     = nfNewFinding.addCallToCall(sCallerName, ciSource, TraceType.Root_Call);
            CallInvocation ciSink     = nfNewFinding.addCallToCall(sSinkSignature, ciNode, TraceType.Known_Sink);


            var frFindingsResult = new AnalysisSearch.FindingsResult(nfNewFinding.oadNewO2AssessmentDataOunceV6);

            frFindingsResult.fFinding = nfNewFinding.fFinding;
            frFindingsResult.fFile    = nfNewFinding.fFile;
            return(frFindingsResult);
        }