From 0a31d56a5d991b149c878a4bc688e5a9c3145dd7 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Tue, 12 May 2015 12:02:34 -0400 Subject: [PATCH 01/21] Media player NPE fixed --- .../autopsy/corecomponents/FXVideoPanel.java | 82 ++++++++++--------- 1 file changed, 45 insertions(+), 37 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java index 809be1da89..d7fa6d4027 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java @@ -478,26 +478,28 @@ public class FXVideoPanel extends MediaViewVideoPanel { pauseButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { - Status status = mediaPlayer.getStatus(); + if (mediaPlayer != null) { + Status status = mediaPlayer.getStatus(); - switch (status) { - // If playing, pause - case PLAYING: - mediaPlayer.pause(); - break; - // If ready, paused or stopped, continue playing - case READY: - case PAUSED: - case STOPPED: - mediaPlayer.play(); - break; - default: - logger.log(Level.INFO, "MediaPlayer in unexpected state: " + status.toString()); //NON-NLS - // If the MediaPlayer is in an unexpected state, stop playback. - mediaPlayer.stop(); - setInfoLabelText(NbBundle.getMessage(this.getClass(), - "FXVideoPanel.pauseButton.infoLabel.playbackErr")); - break; + switch (status) { + // If playing, pause + case PLAYING: + mediaPlayer.pause(); + break; + // If ready, paused or stopped, continue playing + case READY: + case PAUSED: + case STOPPED: + mediaPlayer.play(); + break; + default: + logger.log(Level.INFO, "MediaPlayer in unexpected state: " + status.toString()); //NON-NLS + // If the MediaPlayer is in an unexpected state, stop playback. + mediaPlayer.stop(); + setInfoLabelText(NbBundle.getMessage(this.getClass(), + "FXVideoPanel.pauseButton.infoLabel.playbackErr")); + break; + } } } }); @@ -505,14 +507,16 @@ public class FXVideoPanel extends MediaViewVideoPanel { stopButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { - mediaPlayer.stop(); + if (mediaPlayer != null) { + mediaPlayer.stop(); + } } }); progressSlider.valueProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable o) { - if (progressSlider.isValueChanging()) { + if (progressSlider.isValueChanging() && mediaPlayer != null) { mediaPlayer.seek(duration.multiply(progressSlider.getValue() / 100.0)); } } @@ -634,17 +638,19 @@ public class FXVideoPanel extends MediaViewVideoPanel { @Override public void run() { - duration = mediaPlayer.getMedia().getDuration(); - long durationInMillis = (long) mediaPlayer.getMedia().getDuration().toMillis(); + if (mediaPlayer != null) { + duration = mediaPlayer.getMedia().getDuration(); + long durationInMillis = (long) mediaPlayer.getMedia().getDuration().toMillis(); - // pick out the total hours, minutes, seconds - long durationSeconds = (int) durationInMillis / 1000; - totalHours = (int) durationSeconds / 3600; - durationSeconds -= totalHours * 3600; - totalMinutes = (int) durationSeconds / 60; - durationSeconds -= totalMinutes * 60; - totalSeconds = (int) durationSeconds; - updateProgress(); + // pick out the total hours, minutes, seconds + long durationSeconds = (int) durationInMillis / 1000; + totalHours = (int) durationSeconds / 3600; + durationSeconds -= totalHours * 3600; + totalMinutes = (int) durationSeconds / 60; + durationSeconds -= totalMinutes * 60; + totalSeconds = (int) durationSeconds; + updateProgress(); + } } } @@ -657,12 +663,14 @@ public class FXVideoPanel extends MediaViewVideoPanel { @Override public void run() { - Duration beginning = mediaPlayer.getStartTime(); - mediaPlayer.stop(); - mediaPlayer.pause(); - pauseButton.setText(PLAY_TEXT); - updateSlider(beginning); - updateTime(beginning); + if (mediaPlayer != null) { + Duration beginning = mediaPlayer.getStartTime(); + mediaPlayer.stop(); + mediaPlayer.pause(); + pauseButton.setText(PLAY_TEXT); + updateSlider(beginning); + updateTime(beginning); + } } } From 0901b8b852c960e447b543308f61030b2dc5c8d3 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Wed, 13 May 2015 11:42:41 -0400 Subject: [PATCH 02/21] OOB on selecting no nodes is handled --- .../autopsy/directorytree/CollapseAction.java | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/CollapseAction.java b/Core/src/org/sleuthkit/autopsy/directorytree/CollapseAction.java index d554f63e04..5ed8778618 100644 --- a/Core/src/org/sleuthkit/autopsy/directorytree/CollapseAction.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/CollapseAction.java @@ -44,7 +44,14 @@ class CollapseAction extends AbstractAction { // Collapse all BeanTreeView tree = DirectoryTreeTopComponent.findInstance().getTree(); - collapseAll(tree, selectedNode[0]); + if(selectedNode.length != 0) { + collapseSelectedNode(tree, selectedNode[0]); + } else { + // If no node is selected, all the level-2 nodes (children of the + // root node) are collapsed. + for(Node childOfRoot: em.getRootContext().getChildren().getNodes()) + collapseSelectedNode(tree, childOfRoot); + } } /** @@ -53,13 +60,13 @@ class CollapseAction extends AbstractAction { * @param tree the given tree * @param currentNode the current selectedNode */ - private void collapseAll(BeanTreeView tree, Node currentNode) { + private void collapseSelectedNode(BeanTreeView tree, Node currentNode) { Children c = currentNode.getChildren(); for (Node next : c.getNodes()) { if (tree.isExpanded(next)) { - this.collapseAll(tree, next); + this.collapseSelectedNode(tree, next); } } From fc3fd857f28cca77d7edc9e8527da85da32f1102 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Wed, 13 May 2015 16:53:40 -0400 Subject: [PATCH 03/21] supported extensions revised --- Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java index 809be1da89..1353430ef0 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java @@ -79,7 +79,7 @@ import org.sleuthkit.datamodel.TskData; }) public class FXVideoPanel extends MediaViewVideoPanel { - private static final String[] EXTENSIONS = new String[]{".mov", ".m4v", ".flv", ".mp4", ".mpg", ".mpeg"}; //NON-NLS + private static final String[] EXTENSIONS = new String[]{".m4v", ".fxm", ".flv", ".m3u8", ".mp4", ".aif", ".aiff", ".mp3", "m4a", ".wav"}; //NON-NLS private static final List MIMETYPES = Arrays.asList("audio/x-aiff", "video/x-javafx", "video/x-flv", "application/vnd.apple.mpegurl", " audio/mpegurl", "audio/mpeg", "video/mp4", "audio/x-m4a", "video/x-m4v", "audio/x-wav"); //NON-NLS private static final Logger logger = Logger.getLogger(MediaViewVideoPanel.class.getName()); From 384bcd297f279c46c78f13b19c1539a8c9af27dc Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Thu, 14 May 2015 16:54:52 -0400 Subject: [PATCH 04/21] NPE in case of removed photorec carver job handled --- .../modules/photoreccarver/PhotoRecCarverFileIngestModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index 1bcd4791c7..ec4beae595 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -239,7 +239,7 @@ final class PhotoRecCarverFileIngestModule implements FileIngestModule { */ @Override public void shutDown() { - if (refCounter.decrementAndGet(this.context.getJobId()) == 0) { + if (this.context != null && refCounter.decrementAndGet(this.context.getJobId()) == 0) { try { // The last instance of this module for an ingest job cleans out // the working paths map entry for the job and deletes the temp dir. From e1a9084e7adfac3e9a4615067a1d3c3e5f6f0a0d Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 15 May 2015 10:52:40 -0400 Subject: [PATCH 05/21] Run ingest option provided at appropriate directory tree nodes --- .../DirectoryTreeFilterNode.java | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index 15da98c0b7..50417a1ec3 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -39,6 +39,7 @@ import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.Directory; import org.sleuthkit.datamodel.Image; import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.datamodel.VirtualDirectory; /** * This class sets the actions for the nodes in the directory tree and creates @@ -113,8 +114,22 @@ class DirectoryTreeFilterNode extends FilterNode { NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text"))); } - //ingest action - actions.add(new AbstractAction( + + VirtualDirectory virtualDirectory = this.getLookup().lookup(VirtualDirectory.class); + // determine if the virtualDireory is at root-level (Logical File Set). + boolean isRootVD = false; + if(virtualDirectory != null) { + try { + if(virtualDirectory.getParent() == null) + isRootVD = true; + } catch (TskCoreException ex) { + logger.log(Level.WARNING, "Error determining the parent of the virtual directory", ex); // NON-NLS + } + } + + //ingest action only if the selected node is img node or a root level virtual directory. + if(img != null || isRootVD) { + actions.add(new AbstractAction( NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { @Override public void actionPerformed(ActionEvent e) { @@ -122,6 +137,7 @@ class DirectoryTreeFilterNode extends FilterNode { ingestDialog.display(); } }); + } } //check if delete actions should be added From aa8bd589394fe1d1a54b27ac66d3c94e2eb96fce Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 15 May 2015 10:59:21 -0400 Subject: [PATCH 06/21] Open file search by attribs option available for logical FS --- .../directorytree/DirectoryTreeFilterNode.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index 50417a1ec3..9de9257ce3 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -107,13 +107,7 @@ class DirectoryTreeFilterNode extends FilterNode { actions.add(ExtractAction.getInstance()); } - // file search action final Image img = this.getLookup().lookup(Image.class); - if (img != null) { - actions.add(new FileSearchAction( - NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text"))); - } - VirtualDirectory virtualDirectory = this.getLookup().lookup(VirtualDirectory.class); // determine if the virtualDireory is at root-level (Logical File Set). @@ -127,6 +121,12 @@ class DirectoryTreeFilterNode extends FilterNode { } } + // file search action only if the selected node is img node or a root level virtual directory. + if (img != null || isRootVD) { + actions.add(new FileSearchAction( + NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text"))); + } + //ingest action only if the selected node is img node or a root level virtual directory. if(img != null || isRootVD) { actions.add(new AbstractAction( From 019d77f3750a472b9a95c5cc7f5125525d460e6f Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Fri, 15 May 2015 12:23:14 -0400 Subject: [PATCH 07/21] bail for thumbnail detection if non-supported mime type. --- .../autopsy/coreutils/ImageUtils.java | 55 ++++++++++++------- .../autopsy/imagegallery/ThumbnailCache.java | 1 + 2 files changed, 35 insertions(+), 21 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java index b5944cd2b4..b631602dc3 100755 --- a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java @@ -33,11 +33,9 @@ import java.util.List; import java.util.logging.Level; import javax.imageio.ImageIO; import javax.swing.ImageIcon; -import org.openide.util.Exceptions; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.corelibs.ScalrWrapper; import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.BlackboardArtifact; import org.sleuthkit.datamodel.BlackboardAttribute; import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE; import org.sleuthkit.datamodel.Content; @@ -55,7 +53,13 @@ public class ImageUtils { private static final Logger logger = Logger.getLogger(ImageUtils.class.getName()); private static final Image DEFAULT_ICON = new ImageIcon("/org/sleuthkit/autopsy/images/file-icon.png").getImage(); //NON-NLS private static final List SUPP_EXTENSIONS = Arrays.asList(ImageIO.getReaderFileSuffixes()); - private static final List SUPP_MIME_TYPES = Arrays.asList(ImageIO.getReaderMIMETypes()); + private static final List SUPP_MIME_TYPES; + + static { + SUPP_MIME_TYPES = Arrays.asList(ImageIO.getReaderMIMETypes()); + //SUPP_MIME_TYPES.add("image/x-ms-bmp"); + } + /** * Get the default Icon, which is the icon for a file. * @return @@ -88,14 +92,17 @@ public class ImageUtils { return true; } } + // if the file type is known and we don't support it, bail + if (attributes.size() > 0) { + return false; + } } catch (TskCoreException ex) { logger.log(Level.WARNING, "Error while getting file signature from blackboard.", ex); //NON-NLS } - final String extension = f.getNameExtension(); - // if we have an extension, check it + final String extension = f.getNameExtension(); if (extension.equals("") == false) { // Note: thumbnail generator only supports JPG, GIF, and PNG for now if (SUPP_EXTENSIONS.contains(extension)) { @@ -109,7 +116,8 @@ public class ImageUtils { /** - * Get an icon of a specified size. + * Get a thumbnail of a specified size. Generates the image if it is + * not already cached. * * @param content * @param iconSize @@ -118,6 +126,7 @@ public class ImageUtils { public static Image getIcon(Content content, int iconSize) { Image icon; // If a thumbnail file is already saved locally + // @@@ Bug here in that we do not refer to size in the cache. File file = getFile(content.getId()); if (file.exists()) { try { @@ -125,7 +134,7 @@ public class ImageUtils { if (bicon == null) { icon = DEFAULT_ICON; } else if (bicon.getWidth() != iconSize) { - icon = generateAndSaveIcon(content, iconSize); + icon = generateAndSaveIcon(content, iconSize, file); } else { icon = bicon; } @@ -134,18 +143,17 @@ public class ImageUtils { icon = DEFAULT_ICON; } } else { // Make a new icon - icon = generateAndSaveIcon(content, iconSize); + icon = generateAndSaveIcon(content, iconSize, file); } return icon; } /** - * Get the cached file of the icon. Generates the icon and its file if it - * doesn't already exist, so this method guarantees to return a file that - * exists. + * Get a thumbnail of a specified size. Generates the image if it is + * not already cached. * @param content * @param iconSize - * @return + * @return File object for cached image. Is guaranteed to exist. */ public static File getIconFile(Content content, int iconSize) { if (getIcon(content, iconSize) != null) { @@ -155,13 +163,12 @@ public class ImageUtils { } /** - * Get the cached file of the content object with the given id. - * - * The returned file may not exist. + * Get a file object for where the cached icon should exist. The returned file may not exist. * * @param id * @return */ + // TODO: This should be private and be renamed to something like getCachedThumbnailLocation(). public static File getFile(long id) { return new File(Case.getCurrentCase().getCacheDirectory() + File.separator + id + ".png"); } @@ -223,18 +230,24 @@ public class ImageUtils { } - private static Image generateAndSaveIcon(Content content, int iconSize) { + /** + * Generate an icon and save it to specified location. + * @param content File to generate icon for + * @param iconSize + * @param saveFile Location to save thumbnail to + * @return Generated icon or null on error + */ + private static Image generateAndSaveIcon(Content content, int iconSize, File saveFile) { Image icon = null; try { icon = generateIcon(content, iconSize); if (icon == null) { return DEFAULT_ICON; } else { - File f = getFile(content.getId()); - if (f.exists()) { - f.delete(); + if (saveFile.exists()) { + saveFile.delete(); } - ImageIO.write((BufferedImage) icon, "png", getFile(content.getId())); //NON-NLS + ImageIO.write((BufferedImage) icon, "png", saveFile); //NON-NLS } } catch (IOException ex) { logger.log(Level.WARNING, "Could not write cache thumbnail: " + content, ex); //NON-NLS @@ -243,7 +256,7 @@ public class ImageUtils { } /* - * Generate a scaled image + * Generate and return a scaled image */ private static BufferedImage generateIcon(Content content, int iconSize) { diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ThumbnailCache.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ThumbnailCache.java index ee7c74e981..e22eb75488 100644 --- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ThumbnailCache.java +++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/ThumbnailCache.java @@ -153,6 +153,7 @@ public enum ThumbnailCache { } private static File getCacheFile(long id) { + // @@@ should use ImageUtils.getFile(); return new File(Case.getCurrentCase().getCacheDirectory() + File.separator + id + ".png"); } From f63725d64f30e12ed41aed491722cb45beaf2398 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 15 May 2015 13:10:47 -0400 Subject: [PATCH 08/21] the x-ms-bmp formt added --- Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java index b631602dc3..919c4dfc1d 100755 --- a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java @@ -56,8 +56,11 @@ public class ImageUtils { private static final List SUPP_MIME_TYPES; static { - SUPP_MIME_TYPES = Arrays.asList(ImageIO.getReaderMIMETypes()); - //SUPP_MIME_TYPES.add("image/x-ms-bmp"); + SUPP_MIME_TYPES = new ArrayList(); + for (String mimeType : Arrays.asList(ImageIO.getReaderMIMETypes())) { + SUPP_MIME_TYPES.add(mimeType); + } + SUPP_MIME_TYPES.add("image/x-ms-bmp"); } /** From 1174a7798e8cab9f0ed20ce4a0b9fa6d5ccd1f63 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 15 May 2015 13:44:13 -0400 Subject: [PATCH 09/21] minor directorytreefilternode.getActions() refactoring --- .../DirectoryTreeFilterNode.java | 26 +++++++++---------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java index 9de9257ce3..dbbb906a4e 100755 --- a/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java +++ b/Core/src/org/sleuthkit/autopsy/directorytree/DirectoryTreeFilterNode.java @@ -112,31 +112,29 @@ class DirectoryTreeFilterNode extends FilterNode { VirtualDirectory virtualDirectory = this.getLookup().lookup(VirtualDirectory.class); // determine if the virtualDireory is at root-level (Logical File Set). boolean isRootVD = false; - if(virtualDirectory != null) { + if (virtualDirectory != null) { try { - if(virtualDirectory.getParent() == null) + if (virtualDirectory.getParent() == null) { isRootVD = true; + } } catch (TskCoreException ex) { logger.log(Level.WARNING, "Error determining the parent of the virtual directory", ex); // NON-NLS } } - // file search action only if the selected node is img node or a root level virtual directory. + // 'run ingest' action and 'file search' action are added only if the + // selected node is img node or a root level virtual directory. if (img != null || isRootVD) { actions.add(new FileSearchAction( NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.openFileSrcByAttr.text"))); - } - - //ingest action only if the selected node is img node or a root level virtual directory. - if(img != null || isRootVD) { actions.add(new AbstractAction( - NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { - @Override - public void actionPerformed(ActionEvent e) { - final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(content)); - ingestDialog.display(); - } - }); + NbBundle.getMessage(this.getClass(), "DirectoryTreeFilterNode.action.runIngestMods.text")) { + @Override + public void actionPerformed(ActionEvent e) { + final RunIngestModulesDialog ingestDialog = new RunIngestModulesDialog(Collections.singletonList(content)); + ingestDialog.display(); + } + }); } } From 1950f45425ce120c2c5acb64bc018e0be03d4e4b Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Fri, 15 May 2015 15:20:21 -0400 Subject: [PATCH 10/21] fxvideopanel code refactored --- .../autopsy/corecomponents/FXVideoPanel.java | 99 ++++++++++--------- 1 file changed, 54 insertions(+), 45 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java index d7fa6d4027..4dcc9a2ab3 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java @@ -478,28 +478,29 @@ public class FXVideoPanel extends MediaViewVideoPanel { pauseButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { - if (mediaPlayer != null) { - Status status = mediaPlayer.getStatus(); + if (mediaPlayer == null) + return; - switch (status) { - // If playing, pause - case PLAYING: - mediaPlayer.pause(); - break; - // If ready, paused or stopped, continue playing - case READY: - case PAUSED: - case STOPPED: - mediaPlayer.play(); - break; - default: - logger.log(Level.INFO, "MediaPlayer in unexpected state: " + status.toString()); //NON-NLS - // If the MediaPlayer is in an unexpected state, stop playback. - mediaPlayer.stop(); - setInfoLabelText(NbBundle.getMessage(this.getClass(), - "FXVideoPanel.pauseButton.infoLabel.playbackErr")); - break; - } + Status status = mediaPlayer.getStatus(); + + switch (status) { + // If playing, pause + case PLAYING: + mediaPlayer.pause(); + break; + // If ready, paused or stopped, continue playing + case READY: + case PAUSED: + case STOPPED: + mediaPlayer.play(); + break; + default: + logger.log(Level.INFO, "MediaPlayer in unexpected state: " + status.toString()); //NON-NLS + // If the MediaPlayer is in an unexpected state, stop playback. + mediaPlayer.stop(); + setInfoLabelText(NbBundle.getMessage(this.getClass(), + "FXVideoPanel.pauseButton.infoLabel.playbackErr")); + break; } } }); @@ -507,16 +508,20 @@ public class FXVideoPanel extends MediaViewVideoPanel { stopButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { - if (mediaPlayer != null) { - mediaPlayer.stop(); - } + if (mediaPlayer == null) + return; + + mediaPlayer.stop(); } }); progressSlider.valueProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable o) { - if (progressSlider.isValueChanging() && mediaPlayer != null) { + if(mediaPlayer == null) + return; + + if (progressSlider.isValueChanging()) { mediaPlayer.seek(duration.multiply(progressSlider.getValue() / 100.0)); } } @@ -563,6 +568,8 @@ public class FXVideoPanel extends MediaViewVideoPanel { * media. */ private void updateProgress() { + if(mediaPlayer == null) + return; Duration currentTime = mediaPlayer.getCurrentTime(); updateSlider(currentTime); updateTime(currentTime); @@ -638,19 +645,20 @@ public class FXVideoPanel extends MediaViewVideoPanel { @Override public void run() { - if (mediaPlayer != null) { - duration = mediaPlayer.getMedia().getDuration(); - long durationInMillis = (long) mediaPlayer.getMedia().getDuration().toMillis(); + if (mediaPlayer == null) + return; + + duration = mediaPlayer.getMedia().getDuration(); + long durationInMillis = (long) mediaPlayer.getMedia().getDuration().toMillis(); - // pick out the total hours, minutes, seconds - long durationSeconds = (int) durationInMillis / 1000; - totalHours = (int) durationSeconds / 3600; - durationSeconds -= totalHours * 3600; - totalMinutes = (int) durationSeconds / 60; - durationSeconds -= totalMinutes * 60; - totalSeconds = (int) durationSeconds; - updateProgress(); - } + // pick out the total hours, minutes, seconds + long durationSeconds = (int) durationInMillis / 1000; + totalHours = (int) durationSeconds / 3600; + durationSeconds -= totalHours * 3600; + totalMinutes = (int) durationSeconds / 60; + durationSeconds -= totalMinutes * 60; + totalSeconds = (int) durationSeconds; + updateProgress(); } } @@ -663,14 +671,15 @@ public class FXVideoPanel extends MediaViewVideoPanel { @Override public void run() { - if (mediaPlayer != null) { - Duration beginning = mediaPlayer.getStartTime(); - mediaPlayer.stop(); - mediaPlayer.pause(); - pauseButton.setText(PLAY_TEXT); - updateSlider(beginning); - updateTime(beginning); - } + if (mediaPlayer == null) + return; + + Duration beginning = mediaPlayer.getStartTime(); + mediaPlayer.stop(); + mediaPlayer.pause(); + pauseButton.setText(PLAY_TEXT); + updateSlider(beginning); + updateTime(beginning); } } From c6b262391e43b3a29d07f391c2150368874a1e61 Mon Sep 17 00:00:00 2001 From: Sidhesh Mhatre Date: Fri, 15 May 2015 16:42:19 -0400 Subject: [PATCH 11/21] Added supported format reference --- .../org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java index 1353430ef0..4fd40c1693 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java @@ -78,7 +78,9 @@ import org.sleuthkit.datamodel.TskData; @ServiceProvider(service = FrameCapture.class) }) public class FXVideoPanel extends MediaViewVideoPanel { - + + // Refer to https://docs.oracle.com/javafx/2/api/javafx/scene/media/package-summary.html + // for Javafx supported formats private static final String[] EXTENSIONS = new String[]{".m4v", ".fxm", ".flv", ".m3u8", ".mp4", ".aif", ".aiff", ".mp3", "m4a", ".wav"}; //NON-NLS private static final List MIMETYPES = Arrays.asList("audio/x-aiff", "video/x-javafx", "video/x-flv", "application/vnd.apple.mpegurl", " audio/mpegurl", "audio/mpeg", "video/mp4", "audio/x-m4a", "video/x-m4v", "audio/x-wav"); //NON-NLS private static final Logger logger = Logger.getLogger(MediaViewVideoPanel.class.getName()); From 765be69f6c4cffaea527d19a87bef5545c957d0d Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Mon, 18 May 2015 09:41:41 -0400 Subject: [PATCH 12/21] code formatted --- .../autopsy/corecomponents/FXVideoPanel.java | 20 ++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java index 4dcc9a2ab3..4a9ab863bf 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponents/FXVideoPanel.java @@ -478,8 +478,9 @@ public class FXVideoPanel extends MediaViewVideoPanel { pauseButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { - if (mediaPlayer == null) + if (mediaPlayer == null) { return; + } Status status = mediaPlayer.getStatus(); @@ -508,8 +509,9 @@ public class FXVideoPanel extends MediaViewVideoPanel { stopButton.setOnAction(new EventHandler() { @Override public void handle(ActionEvent e) { - if (mediaPlayer == null) + if (mediaPlayer == null) { return; + } mediaPlayer.stop(); } @@ -518,8 +520,9 @@ public class FXVideoPanel extends MediaViewVideoPanel { progressSlider.valueProperty().addListener(new InvalidationListener() { @Override public void invalidated(Observable o) { - if(mediaPlayer == null) + if (mediaPlayer == null) { return; + } if (progressSlider.isValueChanging()) { mediaPlayer.seek(duration.multiply(progressSlider.getValue() / 100.0)); @@ -568,8 +571,9 @@ public class FXVideoPanel extends MediaViewVideoPanel { * media. */ private void updateProgress() { - if(mediaPlayer == null) - return; + if (mediaPlayer == null) { + return; + } Duration currentTime = mediaPlayer.getCurrentTime(); updateSlider(currentTime); updateTime(currentTime); @@ -645,8 +649,9 @@ public class FXVideoPanel extends MediaViewVideoPanel { @Override public void run() { - if (mediaPlayer == null) + if (mediaPlayer == null) { return; + } duration = mediaPlayer.getMedia().getDuration(); long durationInMillis = (long) mediaPlayer.getMedia().getDuration().toMillis(); @@ -671,8 +676,9 @@ public class FXVideoPanel extends MediaViewVideoPanel { @Override public void run() { - if (mediaPlayer == null) + if (mediaPlayer == null) { return; + } Duration beginning = mediaPlayer.getStartTime(); mediaPlayer.stop(); From 0df6a09f4357c9d2c2a92f34c5bdebd9b352aa61 Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Mon, 18 May 2015 10:49:27 -0400 Subject: [PATCH 13/21] Added comments to DataSourceProcessor interfaces --- .../DataSourceProcessor.java | 47 ++++++------- .../DataSourceProcessorCallback.java | 69 +++++++++++-------- .../DataSourceProcessorProgressMonitor.java | 4 +- 3 files changed, 65 insertions(+), 55 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessor.java b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessor.java index e150e871ac..20a004c516 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessor.java @@ -21,28 +21,25 @@ package org.sleuthkit.autopsy.corecomponentinterfaces; import javax.swing.JPanel; -/* - * Defines an interface used by the Add DataSource wizard to discover different - * Data SourceProcessors. +/** + * Interface used by the Add DataSource wizard to allow different + * types of data sources to be added to a case. Examples of data + * sources include disk images, local files, etc. * - * Each data source may have its unique attributes and may need to be processed - * differently. - * - * The DataSourceProcessor interface defines a uniform mechanism for the Autopsy UI + * The interface provides a uniform mechanism for the Autopsy UI * to: - * - collect details for the data source to be processed. - * - Process the data source in the background - * - Be notified when the processing is complete + * - Collect details from the user about the data source to be processed. + * - Process the data source in the background and add data to the database + * - Provides progress feedback to the user / UI. */ public interface DataSourceProcessor { - /* + /** * The DSP Panel may fire Property change events * The caller must enure to add itself as a listener and * then react appropriately to the events */ enum DSP_PANEL_EVENT { - UPDATE_UI, // the content of JPanel has changed that MAY warrant updates to the caller UI FOCUS_NEXT // the caller UI may move focus the the next UI element, following the panel. }; @@ -51,39 +48,43 @@ public interface DataSourceProcessor { /** * Returns the type of Data Source it handles. * This name gets displayed in the drop-down listbox - **/ + */ String getDataSourceType(); /** * Returns the picker panel to be displayed along with any other - * runtime options supported by the data source handler. - **/ + * runtime options supported by the data source handler. The + * DSP is responsible for storing the settings so that a later + * call to run() will have the user-specified settings. + * + * Should be less than 544 pixels wide and 173 pixels high. + */ JPanel getPanel(); /** * Called to validate the input data in the panel. * Returns true if no errors, or * Returns false if there is an error. - **/ + */ boolean isPanelValid(); /** - * Called to invoke the handling of Data source in the background. - * Returns after starting the background thread - * @param settings wizard settings to read/store properties - * @param progressPanel progress panel to be updated while processing + * Called to invoke the handling of data source in the background. + * Returns after starting the background thread. * - **/ + * @param progressPanel progress panel to be updated while processing + * @param dspCallback Contains the callback method DataSourceProcessorCallback.done() that the DSP must call when the background thread finishes with errors and status. + */ void run(DataSourceProcessorProgressMonitor progressPanel, DataSourceProcessorCallback dspCallback); /** * Called to cancel the background processing. - **/ + */ void cancel(); /** * Called to reset/reinitialize the DSP. - **/ + */ void reset(); } diff --git a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorCallback.java b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorCallback.java index 1b69c03c17..6fca9d08a6 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorCallback.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorCallback.java @@ -16,7 +16,6 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - package org.sleuthkit.autopsy.corecomponentinterfaces; import java.awt.EventQueue; @@ -25,42 +24,52 @@ import org.sleuthkit.datamodel.Content; /** * Abstract class for a callback for a DataSourceProcessor. - * - * Ensures that DSP invokes the caller overridden method, doneEDT(), - * in the EDT thread. - * + * + * Ensures that DSP invokes the caller overridden method, doneEDT(), in the EDT + * thread. + * */ public abstract class DataSourceProcessorCallback { - - public enum DataSourceProcessorResult - { - NO_ERRORS, - CRITICAL_ERRORS, - NONCRITICAL_ERRORS, + + public enum DataSourceProcessorResult { + NO_ERRORS, + CRITICAL_ERRORS, + NONCRITICAL_ERRORS, }; + - /* - * Invoke the caller supplied callback function on the EDT thread + /** + * Called by a DSP implementation when it is done adding a data source + * to the database. Users of the DSP can override this method if they do + * not want to be notified on the EDT. Otherwise, this method will call + * doneEDT() with the same arguments. + * @param result Code for status + * @param errList List of error strings + * @param newContents List of root Content objects that were added to database. Typically only one is given. */ - public void done(DataSourceProcessorResult result, List errList, List newContents) - { - + public void done(DataSourceProcessorResult result, List errList, List newContents) { + final DataSourceProcessorResult resultf = result; final List errListf = errList; final List newContentsf = newContents; - - // Invoke doneEDT() that runs on the EDT . - EventQueue.invokeLater(new Runnable() { - @Override - public void run() { - doneEDT(resultf, errListf, newContentsf ); - - } - }); + + // Invoke doneEDT() that runs on the EDT . + EventQueue.invokeLater(new Runnable() { + @Override + public void run() { + doneEDT(resultf, errListf, newContentsf); + } + }); } - - /* - * calling code overrides to provide its own calllback - */ - public abstract void doneEDT(DataSourceProcessorResult result, List errList, List newContents); + + /** + * Called by done() if the default implementation is used. Users of DSPs + * that have UI updates to do after the DSP is finished adding the DS can + * implement this method to receive the updates on the EDT. + * + * @param result Code for status + * @param errList List of error strings + * @param newContents List of root Content objects that were added to database. Typically only one is given. + */ + public abstract void doneEDT(DataSourceProcessorResult result, List errList, List newContents); }; diff --git a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorProgressMonitor.java b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorProgressMonitor.java index 7495979d71..28001a9d62 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorProgressMonitor.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorProgressMonitor.java @@ -18,10 +18,10 @@ */ package org.sleuthkit.autopsy.corecomponentinterfaces; -/* +/** * An GUI agnostic DataSourceProcessorProgressMonitor interface for DataSourceProcesssors to * indicate progress. - * It models after a JProgressbar though it could use any underlying implementation + * It models after a JProgressbar though it could use any underlying implementation (or NoOps) */ public interface DataSourceProcessorProgressMonitor { From cc88d8a77e5d54b4f7b6bedbfc89af075000b416 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Mon, 18 May 2015 10:52:07 -0400 Subject: [PATCH 14/21] removed unnecessary sorts --- .../src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java | 4 ---- .../src/org/sleuthkit/autopsy/keywordsearch/Server.java | 3 +-- 2 files changed, 1 insertion(+), 6 deletions(-) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java index 72e564c11b..aef452b7d5 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/LuceneQuery.java @@ -340,7 +340,6 @@ class LuceneQuery implements KeywordSearchQuery { List snippetList = highlightResponse.get(docId).get(Server.Schema.TEXT.toString()); // list is null if there wasn't a snippet if (snippetList != null) { - snippetList.sort(null); snippet = EscapeUtil.unEscapeHtml(snippetList.get(0)).trim(); } } @@ -440,7 +439,6 @@ class LuceneQuery implements KeywordSearchQuery { //docs says makes sense for the original Highlighter only, but not really //analyze all content SLOW! consider lowering q.setParam("hl.maxAnalyzedChars", Server.HL_ANALYZE_CHARS_UNLIMITED); //NON-NLS - q.setParam("hl.preserveMulti", true); //NON-NLS try { QueryResponse response = solrServer.query(q, METHOD.POST); @@ -453,8 +451,6 @@ class LuceneQuery implements KeywordSearchQuery { if (contentHighlights == null) { return ""; } else { - // Sort contentHighlights in order to get consistently same snippet. - contentHighlights.sort(null); // extracted content is HTML-escaped, but snippet goes in a plain text field return EscapeUtil.unEscapeHtml(contentHighlights.get(0)).trim(); } diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java index 370d7b1ab6..003c8e437d 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/Server.java @@ -1037,8 +1037,7 @@ public class Server { filterQuery = filterQuery + Server.ID_CHUNK_SEP + chunkID; } q.addFilterQuery(filterQuery); - // sort the TEXT field - q.setSortField(Schema.TEXT.toString(), SolrQuery.ORDER.asc); + q.setFields(Schema.TEXT.toString()); try { // Get the first result. SolrDocument solrDocument = solrCore.query(q).getResults().get(0); From 5e997614a5d94592aec4bd7685a0f9a4c8cf823c Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Mon, 18 May 2015 10:55:31 -0400 Subject: [PATCH 15/21] Added comments to DataSourceProcessor interfaces --- .../corecomponentinterfaces/DataSourceProcessor.java | 4 ++-- .../DataSourceProcessorCallback.java | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessor.java b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessor.java index 20a004c516..f76f6b29a1 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessor.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessor.java @@ -40,8 +40,8 @@ public interface DataSourceProcessor { * then react appropriately to the events */ enum DSP_PANEL_EVENT { - UPDATE_UI, // the content of JPanel has changed that MAY warrant updates to the caller UI - FOCUS_NEXT // the caller UI may move focus the the next UI element, following the panel. + UPDATE_UI, ///< the content of JPanel has changed that MAY warrant updates to the caller UI + FOCUS_NEXT ///< the caller UI may move focus the the next UI element, following the panel. }; diff --git a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorCallback.java b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorCallback.java index 6fca9d08a6..76acfd2efc 100644 --- a/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorCallback.java +++ b/Core/src/org/sleuthkit/autopsy/corecomponentinterfaces/DataSourceProcessorCallback.java @@ -32,9 +32,9 @@ import org.sleuthkit.datamodel.Content; public abstract class DataSourceProcessorCallback { public enum DataSourceProcessorResult { - NO_ERRORS, - CRITICAL_ERRORS, - NONCRITICAL_ERRORS, + NO_ERRORS, ///< No errors were encountered while ading the data source + CRITICAL_ERRORS, ///< No data was added to the database. There were fundamental errors processing the data (such as no data or system failure). + NONCRITICAL_ERRORS, ///< There was data added to the database, but there were errors from data corruption or a small number of minor issues. }; From e38474ab1a86afee3c45be2ac4731e88fc4948c5 Mon Sep 17 00:00:00 2001 From: Eamonn Saunders Date: Mon, 18 May 2015 10:51:52 -0400 Subject: [PATCH 16/21] Return immediately after indexing unallocated space, otherwise it gets processed twice. --- .../autopsy/keywordsearch/KeywordSearchIngestModule.java | 1 + 1 file changed, 1 insertion(+) diff --git a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java index 12fb92e5c0..66fb3cd6ad 100644 --- a/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java +++ b/KeywordSearch/src/org/sleuthkit/autopsy/keywordsearch/KeywordSearchIngestModule.java @@ -454,6 +454,7 @@ public final class KeywordSearchIngestModule implements FileIngestModule { // unallocated and unused blocks can only have strings extracted from them. if ((aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || aType.equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) { extractStringsAndIndex(aFile); + return; } final long size = aFile.getSize(); From 48c67a6b40a10048ac580f464305d557f5d0c360 Mon Sep 17 00:00:00 2001 From: sidheshenator Date: Tue, 19 May 2015 16:26:07 -0400 Subject: [PATCH 17/21] refactored the SUPP_MIME_TYPES assignment in ImageUtils.java --- Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java index 919c4dfc1d..2bbb74d823 100755 --- a/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java +++ b/Core/src/org/sleuthkit/autopsy/coreutils/ImageUtils.java @@ -53,13 +53,8 @@ public class ImageUtils { private static final Logger logger = Logger.getLogger(ImageUtils.class.getName()); private static final Image DEFAULT_ICON = new ImageIcon("/org/sleuthkit/autopsy/images/file-icon.png").getImage(); //NON-NLS private static final List SUPP_EXTENSIONS = Arrays.asList(ImageIO.getReaderFileSuffixes()); - private static final List SUPP_MIME_TYPES; - + private static final List SUPP_MIME_TYPES = new ArrayList(Arrays.asList(ImageIO.getReaderMIMETypes())); static { - SUPP_MIME_TYPES = new ArrayList(); - for (String mimeType : Arrays.asList(ImageIO.getReaderMIMETypes())) { - SUPP_MIME_TYPES.add(mimeType); - } SUPP_MIME_TYPES.add("image/x-ms-bmp"); } From e98d821ae456601b55b6f81fd8a3ff944b98a0b9 Mon Sep 17 00:00:00 2001 From: harvv Date: Tue, 19 May 2015 20:40:03 -0700 Subject: [PATCH 18/21] fix small error (inverted logic) obvious error that prevents process() from running in the normal case; could be confusing to newcomers (which is who examples are really aimed toward) --- .../org/sleuthkit/autopsy/examples/SampleFileIngestModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/examples/SampleFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/examples/SampleFileIngestModule.java index a6dc6af76b..e3420e0468 100755 --- a/Core/src/org/sleuthkit/autopsy/examples/SampleFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/examples/SampleFileIngestModule.java @@ -98,7 +98,7 @@ class SampleFileIngestModule implements FileIngestModule { @Override public IngestModule.ProcessResult process(AbstractFile file) { - if (attrId != -1) { + if (attrId == -1) { return IngestModule.ProcessResult.ERROR; } From 08160fc52f23325d98c809f32021625d6314d3c9 Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Wed, 20 May 2015 00:04:04 -0400 Subject: [PATCH 19/21] update to ingest job settings --- docs/doxygen/modIngest.dox | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/docs/doxygen/modIngest.dox b/docs/doxygen/modIngest.dox index 8bbcbd043b..ffea77385d 100755 --- a/docs/doxygen/modIngest.dox +++ b/docs/doxygen/modIngest.dox @@ -271,17 +271,22 @@ that the samples do not do anything particularly useful. Autopsy allows you to provide a graphical panel that will be displayed when the user decides to enable the ingest module. This panel is supposed to be for settings that the user may turn on or off for different data sources. + To provide options for each ingest job: - Update org.sleuthkit.autopsy.ingest.IngestModuleFactory.hasIngestJobSettingsPanel() in your factory class to return true. -- Update org.sleuthkit.autopsy.ingest.IngestModuleFactory.getIngestJobSettingsPanel() in your factory class to return a IngestModuleIngestJobSettingsPanel that displays the needed configuration options and returns a IngestModuleIngestJobSettings object based on the settings. This will get passed in the last configuration setting that was used, so that you can populate the panel accordlingly and the user doesn't have to choose new settings. -- Create a class based on org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings to store the settings. +- Update org.sleuthkit.autopsy.ingest.IngestModuleFactory.getIngestJobSettingsPanel() in your factory class to return a IngestModuleIngestJobSettingsPanel that displays the needed configuration options. The org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel.getSettings() method should return an instance of a org.sleutkit.autopsy.ingest.IngestModuleIngestJobSettings object based on the user-specified settings (see next bullet). +- Create a class that implements org.sleutkit.autopsy.ingest.IngestModuleIngestJobSettings. Your IngestModuleIngestJobSettingsPanel should store settings in here. This class needs to be Serializable, so keep all data types simple or mark them as transient with some custom deserialization code. You should also set the serialVersionUID (see http://stackoverflow.com/questions/285793/what-is-a-serialversionuid-and-why-should-i-use-it). +- If you decide to store settings internal to the module (NOT RECOMMENDED), the getSettings() method can return an instance of NoIngestModuleIngestJobSettings. +- Your instance of IngestModuleIngestJobSettings will be saved and passed to your panel the next time so that you can pre-populate it accordingly. + +Your panel should create the IngestModuleIngestJobSettings class to store the settings and that will be passed back into your factory with each call to createDataSourceIngestModule() or createFileIngestModule(). The way that we have implemented this in Autopsy modules is that the factory casts the IngestModuleINgestJobSettings object to the module-specific implementation and then passes it into the constructor of the ingest module. The ingest module can then call whatever getter methods that were defined based on the panel settings. -Your panel should create the IngestModuleIngestJobSettings class to store the settings and that will be passed back into your factory with each call to createDataSourceIngestModule() or createFileIngestModule(). The factory should cast it to its internal class that implements IngestModuleIngestJobSettings and pass that object into the constructor of its ingest module so that it can use the settings when it runs. You can also implement the getDefaultIngestJobSettings() method to return an instance of your IngestModuleIngestJobSettings class with default settings. Autopsy will call this when the module has not been run before. NOTE: We recommend storing simple data in the IngestModuleIngestJobSettings-based class. In the case of our hash lookup module, we store the string names of the hash databases to do lookups in. We then get the hash database handles in the call to startUp() using the global module settings. + NOTE: The main benefit of using the IngestModuleIngestJobSettings-based class to store settings (versus some static variables in your package) are: - When multiple jobs are running at the same time, each can have their own settings. - Autopsy persists them so that the last used settings get passed into the call to getIngestJobSettingsPanel() and you don't need to save them yoursevles to provide the user the benefit of re-using the last settings. From 615b6dc53b403a5c15c006d325fa61c40aada343 Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Wed, 20 May 2015 00:05:51 -0400 Subject: [PATCH 20/21] updated docs footer --- docs/doxygen/footer.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/doxygen/footer.html b/docs/doxygen/footer.html index 983a55f487..08c9a6d5fb 100755 --- a/docs/doxygen/footer.html +++ b/docs/doxygen/footer.html @@ -1,5 +1,5 @@
-

Copyright © 2012-2014 Basis Technology. Generated on: $date
+

Copyright © 2012-2015 Basis Technology. Generated on: $date
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.

From 91648425fb17a23e03378978b47ae28fd91f229d Mon Sep 17 00:00:00 2001 From: Brian Carrier Date: Wed, 20 May 2015 08:33:43 -0400 Subject: [PATCH 21/21] updated link to JNI blackboard page --- docs/doxygen/platformConcepts.dox | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docs/doxygen/platformConcepts.dox b/docs/doxygen/platformConcepts.dox index 7884fc6bfd..f76ea35f66 100755 --- a/docs/doxygen/platformConcepts.dox +++ b/docs/doxygen/platformConcepts.dox @@ -44,12 +44,10 @@ The blackboard allows modules to communicate with each other and the UI. It has The blackboard is not unique to Autopsy. It is part of The Sleuth Kit datamodel and The Sleuth Kit Framework. In the name of reducing the amount of documentation that we need to maintain, we provide links here to those documentation sources. -- Details on the blackboard concepts (artifacts versus attributes) can be found at http://sleuthkit.org/sleuthkit/docs/framework-docs/mod_bbpage.html. These documents are about the C++ implementation of the blackboard, but it is the same concepts. -- Details of the Java classes can be found in \ref jni_blackboard section of the The Sleuth Kit JNI documents (http://sleuthkit.org/sleuthkit/docs/jni-docs/). +- \ref mod_bbpage (http://sleuthkit.org/sleuthkit/docs/jni-docs/mod_bbpage.html) - -\subsection mod_dev_other_services Framework Services and Utilities +\section mod_dev_other_services Framework Services and Utilities The following are basic services that are available to any module. They are provided here to be used as a reference. When you are developing your module and feel like something should be provided by the framework, then refer to this list to find out where it could be. If you don't find it, let us know and we'll talk about adding it for other writers to benefit.