mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-15 01:07:42 +00:00
3412: update the reports directory name from 'case timestamp' to 'case timestamp reportType'
This commit is contained in:
parent
cb9a967c4b
commit
f1e6d8ff72
@ -49,6 +49,7 @@ 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;
|
||||
@ -66,6 +67,7 @@ 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;
|
||||
@ -101,6 +103,13 @@ public class STIXReportModule implements GeneralReportModule {
|
||||
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
|
||||
}
|
||||
|
||||
reportPath = baseReportDir + getRelativeFilePath();
|
||||
File reportFile = new File(reportPath);
|
||||
// Check if the user wants to display all output or just hits
|
||||
@ -119,7 +128,7 @@ public class STIXReportModule implements GeneralReportModule {
|
||||
progressPanel.complete(ReportStatus.ERROR);
|
||||
progressPanel.updateStatusLabel(
|
||||
NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.noFildDirProvided"));
|
||||
new File(baseReportDir).delete();
|
||||
new File(stixReportDir).delete();
|
||||
return;
|
||||
}
|
||||
if (stixFileName.isEmpty()) {
|
||||
@ -129,7 +138,7 @@ public class STIXReportModule implements GeneralReportModule {
|
||||
progressPanel.complete(ReportStatus.ERROR);
|
||||
progressPanel.updateStatusLabel(
|
||||
NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.noFildDirProvided"));
|
||||
new File(baseReportDir).delete();
|
||||
new File(stixReportDir).delete();
|
||||
return;
|
||||
}
|
||||
File stixFile = new File(stixFileName);
|
||||
@ -142,7 +151,7 @@ public class STIXReportModule implements GeneralReportModule {
|
||||
progressPanel.complete(ReportStatus.ERROR);
|
||||
progressPanel.updateStatusLabel(
|
||||
NbBundle.getMessage(this.getClass(), "STIXReportModule.progress.couldNotOpenFileDir", stixFileName));
|
||||
new File(baseReportDir).delete();
|
||||
new File(stixReportDir).delete();
|
||||
return;
|
||||
}
|
||||
|
||||
@ -649,7 +658,7 @@ public class STIXReportModule implements GeneralReportModule {
|
||||
|
||||
@Override
|
||||
public String getRelativeFilePath() {
|
||||
return "stix.txt"; //NON-NLS
|
||||
return " " + STIX_REPORT + File.separator + "stix.txt"; //NON-NLS
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,6 +19,7 @@
|
||||
package org.sleuthkit.autopsy.report;
|
||||
|
||||
import java.io.BufferedWriter;
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStreamWriter;
|
||||
@ -27,6 +28,7 @@ import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.openide.filesystems.FileUtil;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
@ -45,6 +47,7 @@ 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;
|
||||
|
||||
@ -58,7 +61,14 @@ class FileReportText implements FileReportModule {
|
||||
|
||||
@Override
|
||||
public void startReport(String baseReportDir) {
|
||||
this.reportPath = baseReportDir + FILE_NAME;
|
||||
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();
|
||||
try {
|
||||
out = new BufferedWriter(new OutputStreamWriter(new FileOutputStream(this.reportPath)));
|
||||
} catch (IOException ex) {
|
||||
@ -138,6 +148,6 @@ class FileReportText implements FileReportModule {
|
||||
|
||||
@Override
|
||||
public String getRelativeFilePath() {
|
||||
return FILE_NAME;
|
||||
return " " + FILE_REPORT + File.separator + FILE_NAME;
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import javax.swing.JPanel;
|
||||
import org.openide.filesystems.FileUtil;
|
||||
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
@ -44,6 +45,7 @@ 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;
|
||||
@ -76,7 +78,12 @@ class ReportBodyFile implements GeneralReportModule {
|
||||
progressPanel.setIndeterminate(false);
|
||||
progressPanel.start();
|
||||
progressPanel.updateStatusLabel(NbBundle.getMessage(this.getClass(), "ReportBodyFile.progress.querying"));
|
||||
reportPath = baseReportDir + "BodyFile.txt"; //NON-NLS
|
||||
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();
|
||||
|
||||
@ -180,7 +187,7 @@ class ReportBodyFile implements GeneralReportModule {
|
||||
|
||||
@Override
|
||||
public String getRelativeFilePath() {
|
||||
return NbBundle.getMessage(this.getClass(), "ReportBodyFile.getFilePath.text");
|
||||
return " " + TSK_BODY_REPORT + java.io.File.separator + NbBundle.getMessage(this.getClass(), "ReportBodyFile.getFilePath.text");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,6 +18,7 @@
|
||||
*/
|
||||
package org.sleuthkit.autopsy.report;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.FileOutputStream;
|
||||
import java.io.IOException;
|
||||
import java.text.SimpleDateFormat;
|
||||
@ -25,6 +26,7 @@ import java.util.List;
|
||||
import java.util.logging.Level;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
||||
import org.openide.filesystems.FileUtil;
|
||||
import org.openide.util.NbBundle;
|
||||
import org.sleuthkit.autopsy.casemodule.Case;
|
||||
import org.sleuthkit.autopsy.coreutils.Logger;
|
||||
@ -33,6 +35,7 @@ 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;
|
||||
@ -65,8 +68,13 @@ class ReportExcel implements TableReportModule {
|
||||
@Override
|
||||
public void startReport(String baseReportDir) {
|
||||
// Set the path and save it for when the report is written to disk.
|
||||
this.reportPath = baseReportDir + getRelativeFilePath();
|
||||
|
||||
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();
|
||||
|
||||
// Make a workbook.
|
||||
wb = new XSSFWorkbook();
|
||||
|
||||
@ -269,7 +277,7 @@ class ReportExcel implements TableReportModule {
|
||||
|
||||
@Override
|
||||
public String getRelativeFilePath() {
|
||||
return "Excel.xlsx"; //NON-NLS
|
||||
return " " + EXCEL_REPORT + File.separator + "Excel.xlsx"; //NON-NLS
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -93,17 +93,9 @@ 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 + File.separator;
|
||||
this.reportPath = currentCase.getReportDirectory() + File.separator + currentCase.getDisplayName() + " " + dateNoTime + " ";
|
||||
|
||||
this.errorList = new ArrayList<>();
|
||||
|
||||
// Create the root reports directory.
|
||||
try {
|
||||
FileUtil.createFolder(new File(this.reportPath));
|
||||
} 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
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ class ReportHTML implements TableReportModule {
|
||||
private static ReportHTML instance;
|
||||
private static final int MAX_THUMBS_PER_PAGE = 1000;
|
||||
private static final String HTML_REPORT = "HTML Report";
|
||||
private static final String HTML_SUBDIR = "reports";
|
||||
private static final String HTML_SUBDIR = "content";
|
||||
private Case currentCase;
|
||||
private SleuthkitCase skCase;
|
||||
static Integer THUMBNAIL_COLUMNS = 5;
|
||||
@ -161,7 +161,7 @@ class ReportHTML implements TableReportModule {
|
||||
if (null != artifactType) {
|
||||
// set the icon file name
|
||||
iconFileName = dataTypeToFileName(artifactType.getDisplayName()) + ".png"; //NON-NLS
|
||||
iconFilePath = subPath + iconFileName;
|
||||
iconFilePath = subPath + File.separator + iconFileName;
|
||||
|
||||
// determine the source image to use
|
||||
switch (artifactType) {
|
||||
@ -272,7 +272,7 @@ class ReportHTML implements TableReportModule {
|
||||
logger.log(Level.WARNING, "useDataTypeIcon: unhandled artifact type = " + dataType); //NON-NLS
|
||||
in = getClass().getResourceAsStream("/org/sleuthkit/autopsy/report/images/star.png"); //NON-NLS
|
||||
iconFileName = "star.png"; //NON-NLS
|
||||
iconFilePath = subPath + iconFileName;
|
||||
iconFilePath = subPath + File.separator + iconFileName;
|
||||
break;
|
||||
}
|
||||
} else if (dataType.startsWith(ARTIFACT_TYPE.TSK_ACCOUNT.getDisplayName())) {
|
||||
@ -285,11 +285,11 @@ class ReportHTML implements TableReportModule {
|
||||
*/
|
||||
in = getClass().getResourceAsStream("/org/sleuthkit/autopsy/report/images/accounts.png"); //NON-NLS
|
||||
iconFileName = "accounts.png"; //NON-NLS
|
||||
iconFilePath = subPath + iconFileName;
|
||||
iconFilePath = subPath + File.separator + iconFileName;
|
||||
} else { // no defined artifact found for this dataType
|
||||
in = getClass().getResourceAsStream("/org/sleuthkit/autopsy/report/images/star.png"); //NON-NLS
|
||||
iconFileName = "star.png"; //NON-NLS
|
||||
iconFilePath = subPath + iconFileName;
|
||||
iconFilePath = subPath + File.separator + iconFileName;
|
||||
}
|
||||
|
||||
try {
|
||||
@ -329,7 +329,7 @@ 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 + " " + HTML_REPORT + File.separator; //NON-NLS
|
||||
this.subPath = this.path + HTML_SUBDIR + File.separator;
|
||||
this.thumbsPath = this.subPath + THUMBS_REL_PATH; //NON-NLS
|
||||
try {
|
||||
@ -801,7 +801,7 @@ class ReportHTML implements TableReportModule {
|
||||
|
||||
@Override
|
||||
public String getRelativeFilePath() {
|
||||
return HTML_REPORT + File.separator + "report.html"; //NON-NLS
|
||||
return " " + HTML_REPORT + File.separator + "report.html"; //NON-NLS
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -53,6 +53,7 @@ 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;
|
||||
@ -103,7 +104,14 @@ 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();
|
||||
|
||||
@ -832,7 +840,7 @@ class ReportKML implements GeneralReportModule {
|
||||
|
||||
@Override
|
||||
public String getRelativeFilePath() {
|
||||
return "ReportKML.kml"; //NON-NLS
|
||||
return " " + KML_REPORT + File.separator + "ReportKML.kml"; //NON-NLS
|
||||
}
|
||||
|
||||
@Override
|
||||
|
Loading…
x
Reference in New Issue
Block a user