public static bool createCirDump(String sApplicationToScan, String sScanResultsFolder,
                                         Callbacks.dMethod_Object dProcessCompletionCallback, Callbacks.dMethod_String _logCallback,
                                         bool bDeleteAllRulesFromDbBeforeScan,
                                         bool bStoreControlFlowBlockRawDataInsideCirDataFile)
        {
            var srScanResults = new O2scanresults
            {
                bDeleteAllRulesForCirCreation = bDeleteAllRulesFromDbBeforeScan,
                dProcessCompletionCallback    = dProcessCompletionCallback,
                logCallback        = _logCallback,
                bCreateCirDataFile = true,
                bStoreControlFlowBlockRawDataInsideCirDataFile =
                    bStoreControlFlowBlockRawDataInsideCirDataFile,
                bDeleteCreatedAssessmentFile = true
            };
            // srScanResults.sPathToCirDumpFiles = sScanResultsFolder; // o2.rules.scan.CalculateCirDataFileNameInResultsFolder(sApplicationToScan, sScanResultsFolder);

            bool bScanResult = srScanResults.scanApplication(sApplicationToScan);


            //o2.rules.scan.SaveCirDataFile(srScanResults, sScanResultsFolder);
            DebugMsg.saveLogIntoFile(Path.Combine(sScanResultsFolder,
                                                  Path.GetFileNameWithoutExtension(sApplicationToScan) +
                                                  " - CreateConsolidatedCirDump.txt"));

            return(bScanResult);
        }
예제 #2
0
        public static bool ScanWithNoRules(String sApplicationToScan, String sScanResultsFolder,
                                           Callbacks.dMethod_Object dProcessCompletionCallback)
        {
            var srScanResults = new O2scanresults();

            srScanResults.bScanWithNoRules = true;
            bool bScanResult = srScanResults.scanApplication(sApplicationToScan);

            DebugMsg.saveLogIntoFile(Path.Combine(sScanResultsFolder,
                                                  Path.GetFileNameWithoutExtension(sApplicationToScan) +
                                                  " - Scan_WithNoRules.txt"));
            return(bScanResult);
        }
예제 #3
0
        public static void ScanWithSelectedAutomaticRuleSets(String sApplicationToScan, String sScanResultsFolder,
                                                             bool bCallBacksOnControlFlowGraphs_And_ExternalSinks,
                                                             bool bCallBacksOnEdges_And_ExternalSinks,
                                                             bool bSourcesAndSinks, String sExtraLogNameText,
                                                             Callbacks.dMethod_Object dProcessCompletionCallback,
                                                             Callbacks.dMethod_String logCallback)
        {
            O2Thread.mtaThread(() =>
            {
                DebugMsg.bLogCache = true;                        // enable LogCache (so that we can save it at the end
                var srScanResults  = new O2scanresults();
                //if (File.Exists(CalculateCirDataFileNameInResultsFolder(sApplicationToScan, sScanResultsFolder)))
                //   srScanResults.sCirDataFile = CalculateCirDataFileNameInResultsFolder(sApplicationToScan, sScanResultsFolder);
                // load or create CirData file
                if (File.Exists(sApplicationToScan + ".CirData"))
                {
                    srScanResults.sCirDataFile = sApplicationToScan + ".CirData";
                }
                else
                {
                    srScanResults.bCreateCirDataFile = true;
                }
                // set scanning options (i.e. what to scan)
                srScanResults.bCallBacksOnControlFlowGraphs_And_ExternalSinks =
                    bCallBacksOnControlFlowGraphs_And_ExternalSinks;
                srScanResults.bCallBacksOnEdges_And_ExternalSinks =
                    bCallBacksOnEdges_And_ExternalSinks;
                srScanResults.bSourcesAndSinks = bSourcesAndSinks;

                srScanResults.dProcessCompletionCallback = dProcessCompletionCallback;
                srScanResults.logCallback = logCallback;

                // trigger scan
                bool bScanResult = srScanResults.scanApplication(sApplicationToScan);


                //  SaveCirDataFile(srScanResults, sScanResultsFolder);
                //SaveAssessmentFiles(srScanResults, sScanResultsFolder);
                DebugMsg.saveLogIntoFile(Path.Combine(sScanResultsFolder,
                                                      Path.GetFileNameWithoutExtension(
                                                          sApplicationToScan) + " - " +
                                                      sExtraLogNameText + ".txt"));
                DebugMsg.bLogCache = false;
            });
        }