public bool RegenerateHtmlTask() { return(StartTask("Regenerate html report", () => { if (!File.Exists(FileOrDirectory)) { WriteInRed("The file " + FileOrDirectory + " doesn't exist"); return; } if (FileOrDirectory.StartsWith("ad_cg_")) { CompromiseGraphData data = DataHelper <CompromiseGraphData> .LoadXml(FileOrDirectory); HealthCheckReportCompromiseGraph report = new HealthCheckReportCompromiseGraph(data, License); report.GenerateReportFile("ad_cg_" + data.DomainFQDN + ".html"); } else { HealthcheckData healthcheckData = DataHelper <HealthcheckData> .LoadXml(FileOrDirectory); HealthCheckReportSingle report = new HealthCheckReportSingle(healthcheckData, License); report.GenerateReportFile("ad_hc_" + healthcheckData.DomainFQDN + ".html"); } } )); }
public bool AdvancedLiveAnalysisTask() { return(StartTask("Compromission Graph analysis", () => { DisplayAdvancement("Doing the data collection"); ExportDataFromActiveDirectoryLive export = new ExportDataFromActiveDirectoryLive(Server, ADWSPort, Credential); export.ExportData(NodesToInvestigate); DisplayAdvancement("Doing the analysis"); ReportGenerator reporting = new ReportGenerator(export.Storage, MaxDepth, MaxNodes); var data = reporting.GenerateReport(NodesToInvestigate); DisplayAdvancement("Generating the report"); var reportGenerator = new HealthCheckReportCompromiseGraph(data, License); reportGenerator.GenerateReportFile("ad_cg_" + data.DomainFQDN + ".html"); string xml = DataHelper <CompromiseGraphData> .SaveAsXml(data, "ad_cg_" + data.DomainFQDN + ".xml", EncryptReport); if (!String.IsNullOrEmpty(apiKey) && !String.IsNullOrEmpty(apiEndpoint)) { SendViaAPI(new Dictionary <string, string>() { { FileOrDirectory, xml } }); } if (!String.IsNullOrEmpty(sharepointdirectory)) { UploadToWebsite("ad_cg_" + data.DomainFQDN + ".xml", xml); } if (!String.IsNullOrEmpty(sendXmlTo)) { SendEmail(sendXmlTo, new List <string> { data.DomainFQDN }, new List <Attachment> { Attachment.CreateAttachmentFromString(xml, "ad_cg_" + data.DomainFQDN + ".xml") }); } if (!String.IsNullOrEmpty(sendHtmlTo)) { WriteInRed("Html report ignored when xml file used as input"); } if (!String.IsNullOrEmpty(sendAllTo)) { WriteInRed("Html report ignored when xml file used as input"); SendEmail(sendAllTo, new List <string> { data.DomainFQDN }, new List <Attachment> { Attachment.CreateAttachmentFromString(xml, "ad_cg_" + data.DomainFQDN + ".xml") }); } DisplayAdvancement("Done"); } )); }