diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/audio-file.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/audio-file.png new file mode 100644 index 0000000000..516ac7f233 Binary files /dev/null and b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/audio-file.png differ diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/doc-file.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/doc-file.png new file mode 100644 index 0000000000..2d364e1cf3 Binary files /dev/null and b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/doc-file.png differ diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/exe-file.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/exe-file.png new file mode 100644 index 0000000000..a886401df0 Binary files /dev/null and b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/exe-file.png differ diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/image-file.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/image-file.png new file mode 100644 index 0000000000..e2e79d0324 Binary files /dev/null and b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/image-file.png differ diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/pdf-file.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/pdf-file.png new file mode 100644 index 0000000000..7a6dcb42d0 Binary files /dev/null and b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/pdf-file.png differ diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/text-file.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/text-file.png new file mode 100644 index 0000000000..43ec054ac2 Binary files /dev/null and b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/text-file.png differ diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/video-file.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/video-file.png new file mode 100644 index 0000000000..c290609f59 Binary files /dev/null and b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/video-file.png differ diff --git a/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/web-file.png b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/web-file.png new file mode 100644 index 0000000000..ac5957ad62 Binary files /dev/null and b/CoreComponentInterfaces/src/org/sleuthkit/autopsy/images/web-file.png differ diff --git a/DataModel/src/org/sleuthkit/autopsy/datamodel/FileNode.java b/DataModel/src/org/sleuthkit/autopsy/datamodel/FileNode.java index d444317e65..2a6e32087d 100644 --- a/DataModel/src/org/sleuthkit/autopsy/datamodel/FileNode.java +++ b/DataModel/src/org/sleuthkit/autopsy/datamodel/FileNode.java @@ -18,8 +18,9 @@ */ package org.sleuthkit.autopsy.datamodel; +import java.util.Arrays; +import java.util.List; import javax.swing.Action; -import org.openide.nodes.Sheet; import org.sleuthkit.datamodel.File; import org.sleuthkit.datamodel.TskData; @@ -29,7 +30,18 @@ import org.sleuthkit.datamodel.TskData; * */ public class FileNode extends AbstractFsContentNode { - + + private final static List IMAGE_EXTENSIONS = Arrays.asList(".jpg", ".jpeg", ".png", ".psd", ".nef", ".tiff"); + private final static List VIDEO_EXTENSIONS = Arrays.asList(".aaf", ".3gp", ".asf", ".avi", ".m1v", ".m2v", + ".m4v", ".mp4", ".mov", ".mpeg", ".mpg", ".mpe", ".mp4", ".rm", ".wmv", ".mpv", ".flv", ".swf"); + private final static List AUDIO_EXTENSIONS = Arrays.asList(".aiff", ".aif", ".flac", ".wav", ".m4a", ".ape", + ".wma", ".mp2", ".mp1", ".mp3", ".aac", ".mp4", ".m4p", ".m1a", ".m2a", ".m4r", ".mpa", ".m3u", ".mid", ".midi", ".ogg"); + private final static List DOCUMENT_EXTENSIONS = Arrays.asList(".doc", ".docx", ".odt", ".xls", ".xlsx", ".ppt", ".pptx"); + private final static List EXECUTABLE_EXTENSIONS = Arrays.asList(".exe", ".msi", ".cmd", ".com", ".bat", ".reg", ".scr", ".dll", ".ini"); + private final static List TEXT_EXTENSIONS = Arrays.asList(".txt", ".rtf", ".log", ".text"); + private final static List WEB_EXTENSIONS = Arrays.asList(".html", ".htm", ".css", ".js", ".php", ".aspx", ".xml"); + private final static List PDF_EXTENSIONS = Arrays.asList(".pdf"); + /** * * @param file underlying Content @@ -45,7 +57,7 @@ public class FileNode extends AbstractFsContentNode { if (File.dirFlagToValue(file.getDir_flags()).equals(TskData.TSK_FS_NAME_FLAG_ENUM.TSK_FS_NAME_FLAG_UNALLOC.toString())) { this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-icon-deleted.png"); } else { - this.setIconBaseWithExtension("org/sleuthkit/autopsy/images/file-icon.png"); + this.setIconBaseWithExtension(getIconForFileType(file)); } } @@ -69,4 +81,49 @@ public class FileNode extends AbstractFsContentNode { public T accept(DisplayableItemNodeVisitor v) { return v.visit(this); } + + // Given a file, returns the correct icon for said + // file based off it's extension + static String getIconForFileType(File file) { + // Get the name, extension + String name = file.getName(); + int i = name.lastIndexOf("."); + String ext = name.substring(i).toLowerCase(); + + // Images + for(String s:IMAGE_EXTENSIONS) { + if(ext.equals(s)) { return "org/sleuthkit/autopsy/images/image-file.png"; } + } + // Videos + for(String s:VIDEO_EXTENSIONS) { + if(ext.equals(s)) { return "org/sleuthkit/autopsy/images/video-file.png"; } + } + // Audio Files + for(String s:AUDIO_EXTENSIONS) { + if(ext.equals(s)) { return "org/sleuthkit/autopsy/images/audio-file.png"; } + } + // Documents + for(String s:DOCUMENT_EXTENSIONS) { + if(ext.equals(s)) { return "org/sleuthkit/autopsy/images/doc-file.png"; } + } + // Executables / System Files + for(String s:EXECUTABLE_EXTENSIONS) { + if(ext.equals(s)) { return "org/sleuthkit/autopsy/images/exe-file.png"; } + } + // Text Files + for(String s:TEXT_EXTENSIONS) { + if(ext.equals(s)) { return "org/sleuthkit/autopsy/images/text-file.png"; } + } + // Web Files + for(String s:WEB_EXTENSIONS) { + if(ext.equals(s)) { return "org/sleuthkit/autopsy/images/web-file.png"; } + } + // PDFs + for(String s:PDF_EXTENSIONS) { + if(ext.equals(s)) { return "org/sleuthkit/autopsy/images/pdf-file.png"; } + } + // Else return the default + return "org/sleuthkit/autopsy/images/file-icon.png"; + + } } diff --git a/Report/src/org/sleuthkit/autopsy/report/ReportBodyFile.java b/Report/src/org/sleuthkit/autopsy/report/ReportBodyFile.java index a11bb5b817..e35df54013 100644 --- a/Report/src/org/sleuthkit/autopsy/report/ReportBodyFile.java +++ b/Report/src/org/sleuthkit/autopsy/report/ReportBodyFile.java @@ -36,13 +36,14 @@ import java.util.HashMap; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import org.openide.util.Exceptions; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.datamodel.*; /** - * - * @author Alex/Devin + * ReportBodyFile generates a report in the body file format specified on + * The Sleuth Kit wiki as MD5|name|inode|mode_as_string|UID|GID|size|atime|mtime|ctime|crtime. */ public class ReportBodyFile implements ReportModule { //Declare our publically accessible formatted Report, this will change everytime they run a Report @@ -50,8 +51,9 @@ public class ReportBodyFile implements ReportModule { private static String bodyFilePath = ""; private ReportConfiguration config; private static ReportBodyFile instance = null; - private Case currentCase = Case.getCurrentCase(); // get the most updated case + private Case currentCase = Case.getCurrentCase(); // get the current case private SleuthkitCase skCase = currentCase.getSleuthkitCase(); + private final Logger logger = Logger.getLogger(ReportBodyFile.class.getName()); ReportBodyFile() { } @@ -80,8 +82,9 @@ public class ReportBodyFile implements ReportModule { String datenotime = dateFormat.format(date); // Run query to get all files + ResultSet rs = null; try { - ResultSet rs = skCase.runQuery("SELECT * FROM tsk_files"); + rs = skCase.runQuery("SELECT * FROM tsk_files"); List fs = skCase.resultSetToFsContents(rs); // Check if ingest finished if (IngestManager.getDefault().isIngestRunning()) { @@ -95,7 +98,7 @@ public class ReportBodyFile implements ReportModule { } // MD5|name|inode|mode_as_string|UID|GID|size|atime|mtime|ctime|crtime formatted_Report.append(file.getMd5Hash()).append("|"); - formatted_Report.append(file.getName()).append("|"); + formatted_Report.append(file.getUniquePath()).append("|"); formatted_Report.append(file.getMeta_addr()).append("|"); // Use instead of inode formatted_Report.append(file.getModeAsString()).append("|"); formatted_Report.append(file.getUid()).append("|"); @@ -107,18 +110,24 @@ public class ReportBodyFile implements ReportModule { formatted_Report.append(file.getCrtime()).append("|"); formatted_Report.append("\n"); } - // Close the query - skCase.closeRunQuery(rs); } catch(SQLException ex) { - Logger.getLogger(ReportBodyFile.class.getName()).log(Level.WARNING, "Failed to get all file information.", ex); + logger.log(Level.WARNING, "Failed to get all file information.", ex); + } catch(TskCoreException ex) { + logger.log(Level.WARNING, "Failed to get the unique path.", ex); + } finally { + try {// Close the query + if(rs!=null) { skCase.closeRunQuery(rs); } + } catch (SQLException ex) { + logger.log(Level.WARNING, "Failed to close the query.", ex); + } } try { bodyFilePath = currentCase.getCaseDirectory() + File.separator + "Reports" + File.separator + currentCase.getName() + "-" + datenotime + ".txt"; this.save(bodyFilePath); - } catch (Exception e) { - Logger.getLogger(ReportHTML.class.getName()).log(Level.WARNING, "Could not write out body file report! ", e); + } catch (Exception ex) { + logger.log(Level.WARNING, "Could not write out body file report! ", ex); } return bodyFilePath; } @@ -136,8 +145,8 @@ public class ReportBodyFile implements ReportModule { out.write(formatted_Report.toString()); out.flush(); out.close(); - } catch (IOException e) { - Logger.getLogger(ReportBodyFile.class.getName()).log(Level.WARNING, "Could not write out body file report!", e); + } catch (IOException ex) { + logger.log(Level.WARNING, "Could not write out body file report!", ex); } } @@ -169,4 +178,4 @@ public class ReportBodyFile implements ReportModule { public void getPreview(String path) { BrowserControl.openUrl(path); } -} \ No newline at end of file +} diff --git a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java index 61c4ddb7f8..c9378c0034 100644 --- a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java +++ b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java @@ -254,7 +254,7 @@ public class RegressionTest extends JellyTestCase{ jcbo2.doClick(); JButtonOperator jbo0 = new JButtonOperator(reportDialogOperator, "Generate Report"); jbo0.pushNoBlock(); - new Timeout("pausing", 10000).sleep(); // Give it a few seconds to generate + new Timeout("pausing", 3000).sleep(); // Give it a few seconds to generate JDialog previewDialog = JDialogOperator.waitJDialog("Report Preview", false, false); JDialogOperator previewDialogOperator = new JDialogOperator(previewDialog);