/// <summary> /// This is the output method. /// It is used to output the file from given path and also given Record. /// </summary> /// <param name="path">the file path for output</param> /// <param name="record">the Record for output</param> public override void output(string path, ref Record.Record record) { this.record = record; bool isRawRecordOuput = record.getIsOutputRecord(); Record.DataEntry.EntryType outputEntryType = record.getOutputEntryType(); // Create a Wordprocessing document. using (SpreadsheetDocument package = SpreadsheetDocument.Create(path, SpreadsheetDocumentType.Workbook)) { #region // print HIGH/MEDIUM/LOW/NONE Findings // Add a new workbook part WorkbookPart wbPart = package.AddWorkbookPart(); wbPart.Workbook = new Workbook(); // Add a new worksheet part WorksheetPart wsPart = package.WorkbookPart.AddNewPart <WorksheetPart>(); //Create the Spreadsheet DOM Worksheet worksheet = new Worksheet(); SheetData sheetData = new SheetData(); if (!isRawRecordOuput) { String[] stringArray = { "Plugin Name", "Hosts Affected", "Description", "Impact", "Risk Level", "Recommendations", "Reference (CVE)", "Reference (BID)", "Reference (OSVDB)", "Reference Link" }; sheetData.Append(buildRow(stringArray)); } else { if (outputEntryType == DataEntry.EntryType.Acunetix) { String[] stringArray = { "Plugin Name", "Hosts Affected", "Description", "Impact", "Risk Level", "Recommendations", "File Name", "SubDomain", "SubDirectory", "Department", "Affected Item ", "Affected Item Link", "Affected Item Detail", "Affected Item Request", "Affected Item Response", "ModuleName", "IsFalsePositive", "AOP_SourceFile", "AOP_SourceLine", "AOP_Additional", "DetailedInformation", "AcunetixType", "Reference" }; sheetData.Append(buildRow(stringArray)); } else if (outputEntryType == DataEntry.EntryType.NMAP) { String[] stringArray = { "Plugin Name", "Hosts Affected", "Description", "Risk Level", "File Name", "entryType", "OS", "OSDetail", "openPortList", "closedPortList", "filteredPortList", "unknownPortList" }; sheetData.Append(buildRow(stringArray)); } else if (outputEntryType == DataEntry.EntryType.MBSA) { String[] stringArray = { "Plugin Name", "Hosts Affected", "Description", "Impact", "Risk Level", "Recommendations", "bidlist", "cvelist", "osvdblist", "referenceLink", "fileName", "entryType", "checkID", "checkGrade", "checkType", "checkCat", "checkRank", "checkName", "checkURL1", "checkURL2", "checkGroupID", "checkGroupName", "detailText", "updateDataIsInstalled", "updateDataRestartRequired", "updateDataID", "updateDataGUID", "updateDataBulletinID", "updateDataKBID", "updateDataType", "UpdateDataInformationURL", "UpdateDataDownloadURL", "severity", "tableHeader", "tableRowData" }; sheetData.Append(buildRow(stringArray)); } else if (outputEntryType == DataEntry.EntryType.NESSUS) { String[] stringArray = { "Plugin Name", "Hosts Affected", "Description", "Impact", "Risk Level", "Recommendations", "bidlist", "cvelist", "osvdblist", "referenceLink", "fileName", "entryType", "port", "protocol", "svc_name", "pluginFamily", "plugin_publication_date", "plugin_modification_date", "cvss_vector", "cvss_base_score ", "plugin_output", "plugin_version ", "see_alsoList", "pluginID", "microSoftID", "severity" }; sheetData.Append(buildRow(stringArray)); } } worksheet.Append(sheetData); if (!isRawRecordOuput) { printHighRisk(sheetData); printMediumRisk(sheetData); printLowRisk(sheetData); printNoneRisk(sheetData); #endregion #region // print Missing Hotfix Findings if (Program.state.panelOutputSelect_isOutputHotfix) { printHotfix(sheetData); } #endregion #region // print Open Port Findings if (Program.state.panelOutputSelect_isOutputOpenPort) { printOpenPort(sheetData); } #endregion } else { if (outputEntryType == DataEntry.EntryType.Acunetix) { printAcunetixExcel(sheetData); } else if (outputEntryType == DataEntry.EntryType.NMAP) { printNmapExcel(sheetData); } else if (outputEntryType == DataEntry.EntryType.NESSUS) { printNessusExcel(sheetData); } else if (outputEntryType == DataEntry.EntryType.MBSA) { printMbsaExcel(sheetData); } } wsPart.Worksheet = worksheet; // Save changes to the spreadsheet part wsPart.Worksheet.Save(); // create the worksheet to workbook relation wbPart.Workbook.AppendChild(new Sheets()); wbPart.Workbook.GetFirstChild <Sheets>().AppendChild(new Sheet() { Id = wbPart.GetIdOfPart(wsPart), SheetId = 1, Name = "Findings" }); wbPart.Workbook.Save(); } }