public Program()
        {
            AnalyzerFactory analyzerFactory = new AnalyzerFactory
            {
                VulnerabilityDiscovered = OnVulnerabilityDiscovered
            };

            ScannerFactory = new ScannerFactory
            {
                CsAnalyzers = analyzerFactory.GetCsAnalyzers(),
                AndroidManifestAnalyzers = analyzerFactory.GetAndroidManifestAnalyzers(),
                TextAnalyzers            = analyzerFactory.GetTextAnalyzers()
            };

            EnvironmentWrapper = new EnvironmentWrapper();
        }
        public void OnExecute()
        {
            if (EnableLogging)
            {
                XamarinSecurityScannerLogger.LogEvent = Console.WriteLine;
            }

            if (IgnoreFile != null)
            {
                SetIgnoreObject();
            }

            IScanner scanner = ScannerFactory.Create();

            Task task = scanner.Start(Path);

            task.Wait();

            Console.WriteLine("Total vulnerabilities: {0}", _vulnerabilityCount);
            EnvironmentWrapper.Exit(_vulnerabilityCount < Threshold ? 0 : 1);
        }
示例#3
0
        public void OnExecute()
        {
            if (EnableLogging)
            {
                XamarinSecurityScannerLogger.LogEvent = (m) => File.AppendAllText(LogFile, m);
            }

            if (IgnoreFile != null)
            {
                SetIgnoreObject();
            }

            Reporter = ReporterFactory.Create(Output);
            IScanner scanner = ScannerFactory.Create();

            Reporter.Start();
            Task task = scanner.Start(Path);

            task.Wait();

            Reporter.Finish();
            EnvironmentWrapper.Exit(Reporter.VulnerabilityCount < Threshold ? 0 : 1);
        }