Ejemplo n.º 1
0
        public bool GenerateFakeReport()
        {
            return(StartTask("Generate fake reports",
                             () =>
            {
                var fakegenerator = new FakeHealthCheckDataGenerator();
                var hcconso = fakegenerator.GenerateData();

                foreach (var pingCastleReport in hcconso)
                {
                    var enduserReportGenerator = PingCastleFactory.GetEndUserReportGenerator <HealthcheckData>();
                    enduserReportGenerator.GenerateReportFile(pingCastleReport, License, pingCastleReport.GetHumanReadableFileName());
                    pingCastleReport.SetExportLevel(ExportLevel);
                    DataHelper <HealthcheckData> .SaveAsXml(pingCastleReport, pingCastleReport.GetMachineReadableFileName(), EncryptReport);
                }

                var reportConso = new ReportHealthCheckConsolidation();
                reportConso.GenerateReportFile(hcconso, License, "ad_hc_summary.html");
                ReportHealthCheckMapBuilder nodeAnalyzer = new ReportHealthCheckMapBuilder(hcconso, License);
                nodeAnalyzer.Log = Console.WriteLine;
                nodeAnalyzer.GenerateReportFile("ad_hc_summary_full_node_map.html");
                nodeAnalyzer.FullNodeMap = false;
                nodeAnalyzer.CenterDomainForSimpliedGraph = CenterDomainForSimpliedGraph;
                nodeAnalyzer.GenerateReportFile("ad_hc_summary_simple_node_map.html");
                var mapReport = new ReportNetworkMap();
                mapReport.GenerateReportFile(hcconso, License, "ad_hc_hilbert_map.html");
            }
                             ));
        }
Ejemplo n.º 2
0
 public bool ConsolidationTask <T>() where T : IPingCastleReport
 {
     return(StartTask("PingCastle report consolidation (" + typeof(T).Name + ")",
                      () =>
     {
         if (String.IsNullOrEmpty(FileOrDirectory))
         {
             FileOrDirectory = Directory.GetCurrentDirectory();
         }
         if (!Directory.Exists(FileOrDirectory))
         {
             WriteInRed("The directory " + FileOrDirectory + " doesn't exist");
             return;
         }
         var consolidation = PingCastleReportHelper <T> .LoadXmls(FileOrDirectory, FilterReportDate);
         if (consolidation.Count == 0)
         {
             WriteInRed("No report has been found. Please generate one with PingCastle and try again. The task will stop.");
             return;
         }
         if (typeof(T) == typeof(HealthcheckData))
         {
             var hcconso = consolidation as PingCastleReportCollection <HealthcheckData>;
             var report = new ReportHealthCheckConsolidation();
             report.GenerateReportFile(hcconso, License, "ad_hc_summary.html");
             ReportHealthCheckMapBuilder nodeAnalyzer = new ReportHealthCheckMapBuilder(hcconso);
             nodeAnalyzer.Log = Console.WriteLine;
             nodeAnalyzer.GenerateReportFile("ad_hc_summary_full_node_map.html");
             nodeAnalyzer.FullNodeMap = false;
             nodeAnalyzer.CenterDomainForSimpliedGraph = CenterDomainForSimpliedGraph;
             nodeAnalyzer.GenerateReportFile("ad_hc_summary_simple_node_map.html");
             var mapReport = new ReportNetworkMap();
             mapReport.GenerateReportFile(hcconso, License, "ad_hc_hilbert_map.html");
         }
         else if (typeof(T) == typeof(CompromiseGraphData))
         {
             var gcconso = consolidation as PingCastleReportCollection <CompromiseGraphData>;
             var report = new ReportCompromiseGraphConsolidation();
             report.GenerateReportFile(gcconso, License, "ad_cg_summary.html");
         }
     }
                      ));
 }