public HealthcheckData GenerateSingleReport(FakeHealthCheckDataGeneratorDomainModel model) { var healthcheckData = new HealthcheckData(); Trace.WriteLine("Gathering general data"); GenerateGeneralData(model, healthcheckData); Trace.WriteLine("Gathering user data"); GenerateUserData(model, healthcheckData); Trace.WriteLine("Gathering computer data"); GenerateComputerData(model, healthcheckData); Trace.WriteLine("Gathering trust data"); GenerateTrust(model, healthcheckData); Trace.WriteLine("Gathering privileged group and permissions data"); GeneratePrivilegedData(model, healthcheckData); Trace.WriteLine("Gathering delegation data"); GenerateDelegation(model, healthcheckData); Trace.WriteLine("Gathering gpo data"); GenerateGPOData(model, healthcheckData); Trace.WriteLine("Gathering anomaly data"); GenerateAnomalyData(model, healthcheckData); Trace.WriteLine("Gathering domain controller data"); Trace.WriteLine("Gathering network data"); GenerateNetworkData(model, healthcheckData); Trace.WriteLine("Computing risks"); var rules = new RuleSet <HealthcheckData>(); healthcheckData.RiskRules = new List <HealthcheckRiskRule>(); foreach (var rule in rules.ComputeRiskRules(healthcheckData)) { HealthcheckRiskRule risk = new HealthcheckRiskRule(); risk.Points = rule.Points; risk.Category = rule.Category; risk.Model = rule.Model; risk.RiskId = rule.RiskId; risk.Rationale = rule.Rationale; risk.Details = rule.Details; healthcheckData.RiskRules.Add(risk); } Trace.WriteLine("Done"); return(healthcheckData); }
public void ComputeRiskRules(HealthcheckData healthcheckData) { healthcheckData.RiskRules = new List <HealthcheckRiskRule>(); Trace.WriteLine("Begining to run risk rule"); foreach (HeatlcheckRuleBase rule in Rules) { Trace.WriteLine("Rule: " + rule.GetType().ToString()); ReInitRule(rule); if (rule.Analyze(healthcheckData)) { Trace.WriteLine(" matched"); HealthcheckRiskRule risk = new HealthcheckRiskRule(); risk.Points = rule.Points; risk.Category = rule.Category; risk.Model = rule.Model; risk.RiskId = rule.Id; risk.Rationale = rule.Rationale; risk.Details = rule.Details; healthcheckData.RiskRules.Add(risk); } } Trace.WriteLine("Risk rule run stopped"); ReComputeTotals(healthcheckData); }