예제 #1
0
        private static IMcAfeeConfiguration Configuration(McAfeeSection section)
        {
            if (section == null)
            {
                throw new ConfigurationErrorsException("Could not find a 'mcafee' configuration section.");
            }

            if (!TimeSpan.TryParse(section.SessionDuration, out var sessionDuration))
            {
                sessionDuration = TimeSpan.FromHours(1);
            }

            if (!TimeSpan.TryParse(section.HeartbeatInterval, out var heartbeatInterval))
            {
                heartbeatInterval = TimeSpan.FromSeconds(5);
            }

            if (!TimeSpan.TryParse(section.PollScanInterval, out var pollScanInterval))
            {
                pollScanInterval = TimeSpan.FromSeconds(5);
            }

            var result = new McAfeeConfiguration(section.Url, section.Username, section.Password, sessionDuration, section.AnalyzerProfile,
                                                 section.AcceptableSeverity, heartbeatInterval, pollScanInterval);

            Log.Information($"[mcafee] : url = {result.Url}");
            Log.Information($"[mcafee] : username = {result.Username}");
            Log.Information($"[mcafee] : session duration = {result.SessionDuration}");
            Log.Information($"[mcafee] : analyzer profile = {result.AnalyzerProfile}");
            Log.Information($"[mcafee] : acceptable severity = {result.AcceptableSeverity}");
            Log.Information($"[mcafee] : heartbeat interval = {result.HeartbeatInterval}");
            Log.Information($"[mcafee] : poll scan interval = {result.PollScanInterval}");

            return(result);
        }
예제 #2
0
        public void Register(IComponentRegistry registry)
        {
            Guard.AgainstNull(registry, nameof(registry));

            if (!registry.IsRegistered <IMcAfeeConfiguration>())
            {
                registry.RegisterInstance(McAfeeSection.Configuration());
            }

            registry.AttemptRegister <IMcAfeeApi, McAfeeApi>();
            registry.AttemptRegister <IMalwareService, McAfeeMalwareService>();
        }