예제 #1
0
        private void GenerateIndicatorPanelDetail(RiskModelCategory category, RuleBase <HealthcheckData> hcrule)
        {
            string safeRuleId = hcrule.RiskId.Replace("$", "dollar");

            object[] frameworks;
            string   prefix = string.Empty;

            frameworks = hcrule.GetType().GetCustomAttributes(typeof(RuleMitreAttackMitigationAttribute), true);
            if (frameworks != null && frameworks.Length > 0)
            {
                prefix += "[M]";
            }
            frameworks = hcrule.GetType().GetCustomAttributes(typeof(RuleMitreAttackTechniqueAttribute), true);
            if (frameworks != null && frameworks.Length > 0)
            {
                prefix += "[T]";
            }

            GenerateAccordionDetail("rules" + safeRuleId, "rules" + category.ToString(), prefix + hcrule.Title + " (" + hcrule.RiskId + ")", null,
                                    () =>
            {
                Add("<h3>");

                Add(hcrule.Title);
                Add("</h3>\r\n<strong>Rule ID:</strong><p class=\"text-justify\">");
                Add(hcrule.RiskId);
                Add("</p>\r\n<strong>Description:</strong><p class=\"text-justify\">");
                Add(NewLineToBR(hcrule.Description));
                Add("</p>\r\n<strong>Technical explanation:</strong><p class=\"text-justify\">");
                Add(NewLineToBR(hcrule.TechnicalExplanation));
                Add("</p>\r\n<strong>Advised solution:</strong><p class=\"text-justify\">");
                Add(NewLineToBR(hcrule.Solution));
                Add(@"</p>");
                object[] models = hcrule.GetType().GetCustomAttributes(typeof(RuleIntroducedInAttribute), true);
                if (models != null && models.Length != 0)
                {
                    var model = (PingCastle.Rules.RuleIntroducedInAttribute)models[0];
                    Add("<strong>Introduced in:</strong>");
                    Add("<p class=\"text-justify\">");
                    Add(model.Version.ToString());
                    Add(@"</p>");
                }
                Add("<strong>Points:</strong><p>");
                Add(NewLineToBR(hcrule.GetComputationModelString()));
                Add("</p>\r\n");
                if (!String.IsNullOrEmpty(hcrule.Documentation))
                {
                    Add("<strong>Documentation:</strong><p>");
                    Add(hcrule.Documentation);
                    Add("</p>");
                }
            });
        }