diff --git a/Core/src/org/sleuthkit/autopsy/modules/stix/STIXReportModule.java b/Core/src/org/sleuthkit/autopsy/modules/stix/STIXReportModule.java index c4e15656c1..24c1dae6dc 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/stix/STIXReportModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/stix/STIXReportModule.java @@ -49,7 +49,6 @@ import org.mitre.cybox.objects.WindowsRegistryKey; import org.mitre.stix.common_1.IndicatorBaseType; import org.mitre.stix.indicator_2.Indicator; import org.mitre.stix.stix_1.STIXPackage; -import org.openide.filesystems.FileUtil; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; @@ -67,7 +66,6 @@ import org.sleuthkit.datamodel.TskCoreException; public class STIXReportModule implements GeneralReportModule { private static final Logger logger = Logger.getLogger(STIXReportModule.class.getName()); - private static final String STIX_REPORT = "STIX Report"; private STIXReportModuleConfigPanel configPanel; private static STIXReportModule instance = null; private String reportPath; @@ -102,14 +100,7 @@ public class STIXReportModule implements GeneralReportModule { // Start the progress bar and setup the report progressPanel.setIndeterminate(false); progressPanel.start(); - progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.readSTIX")); - String stixReportDir = baseReportDir + " " + STIX_REPORT; - try { - FileUtil.createFolder(new File(stixReportDir)); - } catch (IOException ex) { - logger.log(Level.SEVERE, "Unable to make STIX report folder."); //NON-NLS - } - + progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.readSTIX")); reportPath = baseReportDir + getRelativeFilePath(); File reportFile = new File(reportPath); // Check if the user wants to display all output or just hits @@ -128,7 +119,7 @@ public class STIXReportModule implements GeneralReportModule { progressPanel.complete(ReportStatus.ERROR); progressPanel.updateStatusLabel( NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.noFildDirProvided")); - new File(stixReportDir).delete(); + new File(baseReportDir).delete(); return; } if (stixFileName.isEmpty()) { @@ -138,7 +129,7 @@ public class STIXReportModule implements GeneralReportModule { progressPanel.complete(ReportStatus.ERROR); progressPanel.updateStatusLabel( NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.noFildDirProvided")); - new File(stixReportDir).delete(); + new File(baseReportDir).delete(); return; } File stixFile = new File(stixFileName); @@ -151,7 +142,7 @@ public class STIXReportModule implements GeneralReportModule { progressPanel.complete(ReportStatus.ERROR); progressPanel.updateStatusLabel( NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.couldNotOpenFileDir", stixFileName)); - new File(stixReportDir).delete(); + new File(baseReportDir).delete(); return; } @@ -658,7 +649,7 @@ public class STIXReportModule implements GeneralReportModule { @Override public String getRelativeFilePath() { - return " " + STIX_REPORT + File.separator + "stix.txt"; //NON-NLS + return "stix.txt"; //NON-NLS } @Override diff --git a/Core/src/org/sleuthkit/autopsy/report/Bundle.properties b/Core/src/org/sleuthkit/autopsy/report/Bundle.properties index 49eb13d806..2da0862826 100755 --- a/Core/src/org/sleuthkit/autopsy/report/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/report/Bundle.properties @@ -47,13 +47,13 @@ ReportBodyFile.getDesc.text=Body file format report with MAC times for every fil ReportBodyFile.getFilePath.text=BodyFile.txt ReportKML.progress.querying=Querying files... ReportKML.progress.loading=Loading files... -ReportKML.getName.text=Google Earth/KML +ReportKML.getName.text=Google Earth KML ReportKML.getDesc.text=KML format report with coordinates for relevant files. This format can be used for google earth views. ReportKML.getFilePath.text=ReportKML.kml ReportBranding.defaultReportTitle.text=Autopsy Forensic Report ReportBranding.defaultReportFooter.text=Powered by Autopsy Open Source Digital Forensics Platform - www.sleuthkit.org ReportExcel.numAartifacts.text=Number of artifacts\: -ReportExcel.getName.text=Results - Excel +ReportExcel.getName.text=Excel Report ReportExcel.getDesc.text=A report about results and tagged items in Excel (XLS) format. ReportExcel.sheetName.text=Summary ReportExcel.cellVal.summary=Summary @@ -177,12 +177,12 @@ ReportGenerator.errors.reportErrorText=Error generating report: ReportHTML.addThumbRows.dataType.title=Tagged Images - {0} ReportHTML.addThumbRows.dataType.msg=Tagged Results and Contents that contain images. ReportHTML.thumbLink.tags=Tags\: -ReportHTML.getName.text=Results - HTML +ReportHTML.getName.text=HTML Report ReportHTML.getDesc.text=A report about results and tagged items in HTML format. ReportHTML.writeIndex.title=for case {0} ReportHTML.writeIndex.noFrames.msg=Your browser is not compatible with our frame setup. -ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, -ReportHTML.writeIndex.seeSum=and the summary page for a case summary. +ReportHTML.writeIndex.noFrames.seeNav=Please see the navigation page for artifact links, +ReportHTML.writeIndex.seeSum=and the summary page for a case summary. ReportHTML.writeNav.title=Report Navigation ReportHTML.writeNav.h1=Report Navigation ReportHTML.writeNav.summary=Case Summary diff --git a/Core/src/org/sleuthkit/autopsy/report/FileReportText.java b/Core/src/org/sleuthkit/autopsy/report/FileReportText.java index 94e3aa9b0a..426f0dd2a7 100755 --- a/Core/src/org/sleuthkit/autopsy/report/FileReportText.java +++ b/Core/src/org/sleuthkit/autopsy/report/FileReportText.java @@ -47,7 +47,6 @@ class FileReportText implements FileReportModule { private String reportPath; private Writer out; private static final String FILE_NAME = "file-report.txt"; //NON-NLS - private static final String FILE_REPORT = "Text Report"; private static FileReportText instance; @@ -61,14 +60,7 @@ class FileReportText implements FileReportModule { @Override public void startReport(String baseReportDir) { - String fileReportDir = baseReportDir + " " + FILE_REPORT; - try { - FileUtil.createFolder(new File(fileReportDir)); - } catch (IOException ex) { - logger.log(Level.SEVERE, "Unable to make File report folder."); //NON-NLS - } - - this.reportPath = baseReportDir + getRelativeFilePath(); + this.reportPath = baseReportDir + FILE_NAME; try { out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.reportPath))); } catch (IOException ex) { @@ -148,6 +140,6 @@ class FileReportText implements FileReportModule { @Override public String getRelativeFilePath() { - return " " + FILE_REPORT + File.separator + FILE_NAME; + return FILE_NAME; } } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportBodyFile.java b/Core/src/org/sleuthkit/autopsy/report/ReportBodyFile.java index 378948f73c..bddbcd4778 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ReportBodyFile.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportBodyFile.java @@ -45,7 +45,6 @@ import org.sleuthkit.datamodel.*; class ReportBodyFile implements GeneralReportModule { private static final Logger logger = Logger.getLogger(ReportBodyFile.class.getName()); - private static final String TSK_BODY_REPORT = "TSK Body File Report"; private static ReportBodyFile instance = null; private Case currentCase; @@ -78,11 +77,6 @@ class ReportBodyFile implements GeneralReportModule { progressPanel.setIndeterminate(false); progressPanel.start(); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportBodyFile.progress.querying")); - try { - FileUtil.createFolder(new java.io.File(baseReportDir + " " + TSK_BODY_REPORT)); - } catch (IOException ex) { - logger.log(Level.SEVERE, "Unable to make TSK Body File report folder."); //NON-NLS - } reportPath = baseReportDir + getRelativeFilePath(); //NON-NLS currentCase = Case.getCurrentCase(); skCase = currentCase.getSleuthkitCase(); @@ -187,7 +181,7 @@ class ReportBodyFile implements GeneralReportModule { @Override public String getRelativeFilePath() { - return " " + TSK_BODY_REPORT + java.io.File.separator + NbBundle.getMessage(this.getClass(), "ReportBodyFile.getFilePath.text"); + return NbBundle.getMessage(this.getClass(), "ReportBodyFile.getFilePath.text"); } @Override diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportExcel.java b/Core/src/org/sleuthkit/autopsy/report/ReportExcel.java index a4c8d36ce1..07c02c81c7 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ReportExcel.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportExcel.java @@ -35,7 +35,6 @@ import org.sleuthkit.datamodel.TskCoreException; class ReportExcel implements TableReportModule { private static final Logger logger = Logger.getLogger(ReportExcel.class.getName()); - private static final String EXCEL_REPORT = "Excel Report"; private static ReportExcel instance; private Workbook wb; @@ -68,12 +67,7 @@ class ReportExcel implements TableReportModule { @Override public void startReport(String baseReportDir) { // Set the path and save it for when the report is written to disk. - try { - FileUtil.createFolder(new File(baseReportDir + " " + EXCEL_REPORT)); - } catch (IOException ex) { - logger.log(Level.SEVERE, "Unable to make Excel report folder."); //NON-NLS - } - this.reportPath = baseReportDir + getRelativeFilePath(); + this.reportPath = baseReportDir + getRelativeFilePath(); // Make a workbook. wb = new XSSFWorkbook(); @@ -277,7 +271,7 @@ class ReportExcel implements TableReportModule { @Override public String getRelativeFilePath() { - return " " + EXCEL_REPORT + File.separator + "Excel.xlsx"; //NON-NLS + return "Excel.xlsx"; //NON-NLS } /** diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java b/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java index 9713215d99..7fcc124fab 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportGenerator.java @@ -63,7 +63,7 @@ class ReportGenerator { */ private ReportProgressPanel progressPanel; - private final String reportPath; + private String reportPathFormatString; private final ReportGenerationPanel reportGenerationPanel = new ReportGenerationPanel(); static final String REPORTS_DIR = "Reports"; //NON-NLS @@ -93,11 +93,12 @@ class ReportGenerator { DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy-HH-mm-ss"); Date date = new Date(); String dateNoTime = dateFormat.format(date); - this.reportPath = currentCase.getReportDirectory() + File.separator + currentCase.getDisplayName() + " " + dateNoTime + " "; + this.reportPathFormatString = currentCase.getReportDirectory() + File.separator + currentCase.getDisplayName() + " %s " + dateNoTime + File.separator; this.errorList = new ArrayList<>(); } + /** * Display the progress panels to the user, and add actions to close the * parent dialog. @@ -137,9 +138,17 @@ class ReportGenerator { */ void generateGeneralReport(GeneralReportModule generalReportModule) { if (generalReportModule != null) { + reportPathFormatString = String.format(reportPathFormatString, generalReportModule.getName()); + // Create the root reports directory. + try { + FileUtil.createFolder(new File(reportPathFormatString)); + } catch (IOException ex) { + errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedMakeRptFolder")); + logger.log(Level.SEVERE, "Failed to make report folder, may be unable to generate reports.", ex); //NON-NLS + } setupProgressPanel(generalReportModule); ReportWorker worker = new ReportWorker(() -> { - generalReportModule.generateReport(reportPath, progressPanel); + generalReportModule.generateReport(reportPathFormatString, progressPanel); }); worker.execute(); displayProgressPanel(); @@ -156,9 +165,17 @@ class ReportGenerator { */ void generateTableReport(TableReportModule tableReport, Map artifactTypeSelections, Map tagNameSelections) { if (tableReport != null && null != artifactTypeSelections) { + reportPathFormatString = String.format(reportPathFormatString, tableReport.getName()); + // Create the root reports directory. + try { + FileUtil.createFolder(new File(reportPathFormatString)); + } catch (IOException ex) { + errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedMakeRptFolder")); + logger.log(Level.SEVERE, "Failed to make report folder, may be unable to generate reports.", ex); //NON-NLS + } setupProgressPanel(tableReport); ReportWorker worker = new ReportWorker(() -> { - tableReport.startReport(reportPath); + tableReport.startReport(reportPathFormatString); TableReportGenerator generator = new TableReportGenerator(artifactTypeSelections, tagNameSelections, progressPanel, tableReport); generator.execute(); tableReport.endReport(); @@ -179,6 +196,14 @@ class ReportGenerator { */ void generateFileListReport(FileReportModule fileReportModule, Map enabledInfo) { if (fileReportModule != null && null != enabledInfo) { + reportPathFormatString = String.format(reportPathFormatString, fileReportModule.getName()); + // Create the root reports directory. + try { + FileUtil.createFolder(new File(reportPathFormatString)); + } catch (IOException ex) { + errorList.add(NbBundle.getMessage(this.getClass(), "ReportGenerator.errList.failedMakeRptFolder")); + logger.log(Level.SEVERE, "Failed to make report folder, may be unable to generate reports.", ex); //NON-NLS + } List enabled = new ArrayList<>(); for (Entry e : enabledInfo.entrySet()) { if (e.getValue()) { @@ -196,7 +221,7 @@ class ReportGenerator { List files = getFiles(); int numFiles = files.size(); if (progressPanel.getStatus() != ReportStatus.CANCELED) { - fileReportModule.startReport(reportPath); + fileReportModule.startReport(reportPathFormatString); fileReportModule.startTable(enabled); } progressPanel.setIndeterminate(false); @@ -254,7 +279,7 @@ class ReportGenerator { private void setupProgressPanel(ReportModule module) { String reportFilePath = module.getRelativeFilePath(); if (!reportFilePath.isEmpty()) { - this.progressPanel = reportGenerationPanel.addReport(module.getName(), reportPath + reportFilePath); + this.progressPanel = reportGenerationPanel.addReport(module.getName(), String.format(reportPathFormatString, module.getName()) + reportFilePath); } else { this.progressPanel = reportGenerationPanel.addReport(module.getName(), null); } diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java index a1c9914a2c..4f6f2f4671 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportHTML.java @@ -329,11 +329,10 @@ class ReportHTML implements TableReportModule { // Refresh the HTML report refresh(); // Setup the path for the HTML report - this.path = baseReportDir + " " + HTML_REPORT + File.separator; //NON-NLS + this.path = baseReportDir; //NON-NLS this.subPath = this.path + HTML_SUBDIR + File.separator; this.thumbsPath = this.subPath + THUMBS_REL_PATH; //NON-NLS try { - FileUtil.createFolder(new File(this.path)); FileUtil.createFolder(new File(this.subPath)); FileUtil.createFolder(new File(this.thumbsPath)); } catch (IOException ex) { @@ -801,7 +800,7 @@ class ReportHTML implements TableReportModule { @Override public String getRelativeFilePath() { - return " " + HTML_REPORT + File.separator + "report.html"; //NON-NLS + return "report.html"; //NON-NLS } @Override diff --git a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java index f0cfff46e6..b55a25ef84 100755 --- a/Core/src/org/sleuthkit/autopsy/report/ReportKML.java +++ b/Core/src/org/sleuthkit/autopsy/report/ReportKML.java @@ -53,7 +53,6 @@ class ReportKML implements GeneralReportModule { private static final String KML_STYLE_FILE = "style.kml"; private static final String REPORT_KML = "ReportKML.kml"; private static final String STYLESHEETS_PATH = "/org/sleuthkit/autopsy/report/stylesheets/"; - private static final String KML_REPORT = "Google Earth KML Report"; private static ReportKML instance = null; private Case currentCase; private SleuthkitCase skCase; @@ -104,14 +103,8 @@ class ReportKML implements GeneralReportModule { progressPanel.setIndeterminate(true); progressPanel.start(); progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportKML.progress.querying")); - baseReportDir += " " + KML_REPORT + File.separator; String kmlFileFullPath = baseReportDir + REPORT_KML; //NON-NLS - try { - FileUtil.createFolder(new File(baseReportDir)); - } catch (IOException ex) { - logger.log(Level.SEVERE, "Unable to make KML report folder."); //NON-NLS - } - + currentCase = Case.getCurrentCase(); skCase = currentCase.getSleuthkitCase(); @@ -840,7 +833,7 @@ class ReportKML implements GeneralReportModule { @Override public String getRelativeFilePath() { - return " " + KML_REPORT + File.separator + "ReportKML.kml"; //NON-NLS + return "ReportKML.kml"; //NON-NLS } @Override