diff --git a/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties b/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties
index 3d0207ef87..c67ff8aa08 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties
@@ -19,7 +19,6 @@ ResultsDialog.exitButton.text=Exit
ResultsDialog.searchButton.text=Run another search
FileSearchPanel.sortingPanel.border.title=Sorting
FileSearchPanel.searchButton.text=Show
-FileSearchPanel.fileTypeLabel.text=File Type:
FileSearchPanel.addButton.text=Add
FileSearchPanel.substringRadioButton.text=Substring
FileSearchPanel.fullRadioButton.text=Full
@@ -62,3 +61,6 @@ FileSearchPanel.includeRadioButton.text=Include
FileSearchPanel.excludeRadioButton.text=Exclude
FileSearchPanel.knownFilesCheckbox.toolTipText=
FileSearchPanel.knownFilesCheckbox.text=Hide known files
+GroupListPanel.groupKeyList.border.title=Groups
+DiscoveryTopComponent.imagesButton.text=Images
+DiscoveryTopComponent.videosButton.text=Videos
diff --git a/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties-MERGED b/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties-MERGED
index 3cd2698d6b..b947682e5b 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties-MERGED
+++ b/Core/src/org/sleuthkit/autopsy/filequery/Bundle.properties-MERGED
@@ -25,11 +25,15 @@ FileSearch.KeywordListGroupKey.noKeywords=None
FileSearch.NoGroupingGroupKey.allFiles=All Files
FileSearch.ObjectDetectedGroupKey.noSets=None
FileSearchData.FileSize.OVER_100KB.displayName=100 KB - 1 MB
+FileSearchData.FileSize.OVER_10GB.displayName=10 GB+
FileSearchData.FileSize.OVER_16KB.displayName=16 KB - 100 KB
-FileSearchData.FileSize.OVER_1GB.displayName=1 GB+
+FileSearchData.FileSize.OVER_1GB_IMAGE.displayName=1 GB+
+FileSearchData.FileSize.OVER_1GB_VIDEO.displayName=1 - 5 GB
FileSearchData.FileSize.OVER_1MB.displayName=1 - 50 MB
FileSearchData.FileSize.OVER_200MB.displayName=200 MB - 1 GB
FileSearchData.FileSize.OVER_50MB.displayName=50 - 200 MB
+FileSearchData.FileSize.OVER_5GB.displayName=5 - 10 GB
+FileSearchData.FileSize.UNDER_100KB.displayName=Under 100 KB
FileSearchData.FileSize.UNDER_16KB.displayName=Under 16 KB
FileSearchData.FileType.Audio.displayName=Audio
FileSearchData.FileType.Documents.displayName=Documents
@@ -116,8 +120,8 @@ FileSorter.SortingMethod.filename.displayName=By file name
FileSorter.SortingMethod.filesize.displayName=By file size
FileSorter.SortingMethod.filetype.displayName=By file type
FileSorter.SortingMethod.frequency.displayName=By central repo frequency
+FileSorter.SortingMethod.fullPath.displayName=By full path
FileSorter.SortingMethod.keywordlist.displayName=By keyword list names
-FileSorter.SortingMethod.parent.displayName=By parent path
# {0} - numberOfInstances
ImageThumbnailPanel.countLabel.text=Number of Instances: {0}
ImageThumbnailPanel.isDeleted.text=All instances of file are deleted.
@@ -132,7 +136,6 @@ ResultsDialog.exitButton.text=Exit
ResultsDialog.searchButton.text=Run another search
FileSearchPanel.sortingPanel.border.title=Sorting
FileSearchPanel.searchButton.text=Show
-FileSearchPanel.fileTypeLabel.text=File Type:
FileSearchPanel.addButton.text=Add
FileSearchPanel.substringRadioButton.text=Substring
FileSearchPanel.fullRadioButton.text=Full
@@ -183,6 +186,9 @@ FileSearchPanel.includeRadioButton.text=Include
FileSearchPanel.excludeRadioButton.text=Exclude
FileSearchPanel.knownFilesCheckbox.toolTipText=
FileSearchPanel.knownFilesCheckbox.text=Hide known files
+GroupListPanel.groupKeyList.border.title=Groups
+DiscoveryTopComponent.imagesButton.text=Images
+DiscoveryTopComponent.videosButton.text=Videos
ResultsPanel.viewFileInDir.name=View File in Directory
SearchNode.getName.text=Search Result
# {0} - numberOfInstances
diff --git a/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryTopComponent.form b/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryTopComponent.form
index 3e1b796825..c3ad04da7d 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryTopComponent.form
+++ b/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryTopComponent.form
@@ -71,5 +71,109 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryTopComponent.java b/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryTopComponent.java
index 40c7793498..4a4060410a 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryTopComponent.java
+++ b/Core/src/org/sleuthkit/autopsy/filequery/DiscoveryTopComponent.java
@@ -18,7 +18,8 @@
*/
package org.sleuthkit.autopsy.filequery;
-import java.util.logging.Level;
+import com.google.common.eventbus.Subscribe;
+import java.awt.Color;
import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener;
@@ -27,14 +28,11 @@ import org.openide.windows.Mode;
import org.openide.windows.RetainLocation;
import org.openide.windows.TopComponent;
import org.openide.windows.WindowManager;
-import org.sleuthkit.autopsy.casemodule.Case;
-import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
-import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.corecomponents.DataContentPanel;
import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
-import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.datamodel.FileNode;
+import org.sleuthkit.autopsy.filequery.FileSearchData.FileType;
import org.sleuthkit.datamodel.AbstractFile;
/**
@@ -48,7 +46,8 @@ public final class DiscoveryTopComponent extends TopComponent {
private static final long serialVersionUID = 1L;
private static final String PREFERRED_ID = "DiscoveryTopComponent"; // NON-NLS
- private final static Logger logger = Logger.getLogger(DiscoveryTopComponent.class.getName());
+ private static final Color SELECTED_COLOR = new Color(216, 230, 242);
+ private static final Color UNSELECTED_COLOR = new Color(240, 240, 240);
private final FileSearchPanel fileSearchPanel;
private final GroupListPanel groupListPanel;
private final DataContentPanel dataContentPanel;
@@ -60,19 +59,10 @@ public final class DiscoveryTopComponent extends TopComponent {
@ThreadConfined(type = ThreadConfined.ThreadType.AWT)
DiscoveryTopComponent() {
initComponents();
- // Load the central repository database.
- EamDb centralRepoDb = null;
- if (EamDb.isEnabled()) {
- try {
- centralRepoDb = EamDb.getInstance();
- } catch (EamDbException ex) {
- logger.log(Level.SEVERE, "Error loading central repository database, no central repository options will be available for File Discovery", ex);
- }
- }
setName(Bundle.DiscoveryTopComponent_name());
- fileSearchPanel = new FileSearchPanel(Case.getCurrentCase().getSleuthkitCase(), centralRepoDb);
+ fileSearchPanel = new FileSearchPanel();
dataContentPanel = DataContentPanel.createInstance();
- resultsPanel = new ResultsPanel(centralRepoDb);
+ resultsPanel = new ResultsPanel();
groupListPanel = new GroupListPanel();
leftSplitPane.setLeftComponent(fileSearchPanel);
leftSplitPane.setRightComponent(groupListPanel);
@@ -110,27 +100,49 @@ public final class DiscoveryTopComponent extends TopComponent {
mode.dockInto(tc);
}
tc.open();
+ tc.updateSearchSettings();
}
tc.toFront();
+
}
}
+ /**
+ * Get the current DiscoveryTopComponent if it is open.
+ *
+ * @return The open DiscoveryTopComponent or null if it has not been opened.
+ */
public static DiscoveryTopComponent getTopComponent() {
return (DiscoveryTopComponent) WindowManager.getDefault().findTopComponent(PREFERRED_ID);
}
/**
- * Reset the top component so it isn't displaying any results.
+ * Reset the top component so it isn't displaying any results.
*/
public void resetTopComponent() {
resultsPanel.resetResultViewer();
groupListPanel.resetGroupList();
}
+ /**
+ * Update the search settings to a default state.
+ */
+ private void updateSearchSettings() {
+ fileSearchPanel.resetPanel();
+ imagesButton.setSelected(true);
+ imagesButton.setEnabled(false);
+ imagesButton.setBackground(SELECTED_COLOR);
+ videosButton.setSelected(false);
+ videosButton.setEnabled(true);
+ videosButton.setBackground(UNSELECTED_COLOR);
+ fileSearchPanel.setSelectedType(FileSearchData.FileType.IMAGE);
+ }
+
@Override
public void componentOpened() {
super.componentOpened();
WindowManager.getDefault().setTopComponentFloating(this, true);
+ DiscoveryEvents.getDiscoveryEventBus().register(this);
DiscoveryEvents.getDiscoveryEventBus().register(resultsPanel);
DiscoveryEvents.getDiscoveryEventBus().register(groupListPanel);
DiscoveryEvents.getDiscoveryEventBus().register(fileSearchPanel);
@@ -139,6 +151,7 @@ public final class DiscoveryTopComponent extends TopComponent {
@Override
protected void componentClosed() {
fileSearchPanel.cancelSearch();
+ DiscoveryEvents.getDiscoveryEventBus().unregister(this);
DiscoveryEvents.getDiscoveryEventBus().unregister(fileSearchPanel);
DiscoveryEvents.getDiscoveryEventBus().unregister(groupListPanel);
DiscoveryEvents.getDiscoveryEventBus().unregister(resultsPanel);
@@ -157,6 +170,10 @@ public final class DiscoveryTopComponent extends TopComponent {
javax.swing.JSplitPane mainSplitPane = new javax.swing.JSplitPane();
leftSplitPane = new javax.swing.JSplitPane();
rightSplitPane = new javax.swing.JSplitPane();
+ javax.swing.JPanel toolBarPanel = new javax.swing.JPanel();
+ javax.swing.JToolBar toolBar = new javax.swing.JToolBar();
+ imagesButton = new javax.swing.JButton();
+ videosButton = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(1100, 700));
setLayout(new java.awt.BorderLayout());
@@ -176,12 +193,132 @@ public final class DiscoveryTopComponent extends TopComponent {
mainSplitPane.setRightComponent(rightSplitPane);
add(mainSplitPane, java.awt.BorderLayout.CENTER);
+
+ toolBar.setFloatable(false);
+ toolBar.setRollover(true);
+
+ imagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/pictures-icon.png"))); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(imagesButton, org.openide.util.NbBundle.getMessage(DiscoveryTopComponent.class, "DiscoveryTopComponent.imagesButton.text")); // NOI18N
+ imagesButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/pictures-icon.png"))); // NOI18N
+ imagesButton.setFocusable(false);
+ imagesButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
+ imagesButton.setMaximumSize(new java.awt.Dimension(90, 43));
+ imagesButton.setMinimumSize(new java.awt.Dimension(90, 43));
+ imagesButton.setPreferredSize(new java.awt.Dimension(90, 43));
+ imagesButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ imagesButtonActionPerformed(evt);
+ }
+ });
+ toolBar.add(imagesButton);
+
+ videosButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/video-icon.png"))); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(videosButton, org.openide.util.NbBundle.getMessage(DiscoveryTopComponent.class, "DiscoveryTopComponent.videosButton.text")); // NOI18N
+ videosButton.setDisabledIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/video-icon.png"))); // NOI18N
+ videosButton.setDisabledSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/video-icon.png"))); // NOI18N
+ videosButton.setFocusable(false);
+ videosButton.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
+ videosButton.setMaximumSize(new java.awt.Dimension(90, 43));
+ videosButton.setMinimumSize(new java.awt.Dimension(90, 43));
+ videosButton.setPreferredSize(new java.awt.Dimension(90, 43));
+ videosButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ videosButtonActionPerformed(evt);
+ }
+ });
+ toolBar.add(videosButton);
+
+ javax.swing.GroupLayout toolBarPanelLayout = new javax.swing.GroupLayout(toolBarPanel);
+ toolBarPanel.setLayout(toolBarPanelLayout);
+ toolBarPanelLayout.setHorizontalGroup(
+ toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(toolBarPanelLayout.createSequentialGroup()
+ .addContainerGap(459, Short.MAX_VALUE)
+ .addComponent(toolBar, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addContainerGap(459, Short.MAX_VALUE))
+ );
+ toolBarPanelLayout.setVerticalGroup(
+ toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, toolBarPanelLayout.createSequentialGroup()
+ .addComponent(toolBar, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(0, 0, 0))
+ );
+
+ add(toolBarPanel, java.awt.BorderLayout.PAGE_START);
}// //GEN-END:initComponents
+ private void imagesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imagesButtonActionPerformed
+ resetTopComponent();
+ imagesButton.setSelected(true);
+ imagesButton.setEnabled(false);
+ imagesButton.setBackground(SELECTED_COLOR);
+ videosButton.setSelected(false);
+ videosButton.setEnabled(true);
+ videosButton.setBackground(UNSELECTED_COLOR);
+ fileSearchPanel.setSelectedType(FileSearchData.FileType.IMAGE);
+ }//GEN-LAST:event_imagesButtonActionPerformed
+
+ private void videosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_videosButtonActionPerformed
+ resetTopComponent();
+ imagesButton.setSelected(false);
+ imagesButton.setEnabled(true);
+ imagesButton.setBackground(UNSELECTED_COLOR);
+ videosButton.setSelected(true);
+ videosButton.setEnabled(false);
+ videosButton.setBackground(SELECTED_COLOR);
+ fileSearchPanel.setSelectedType(FileSearchData.FileType.VIDEO);
+ }//GEN-LAST:event_videosButtonActionPerformed
+
+ /**
+ * Update the user interface in response to a search being cancelled.
+ *
+ * @param searchCancelledEvent The SearchCancelledEvent received.
+ */
+ @Subscribe
+ void handleSearchCancelledEvent(DiscoveryEvents.SearchCancelledEvent searchCancelledEvent) {
+ SwingUtilities.invokeLater(() -> {
+ if (fileSearchPanel.getSelectedType() == FileType.VIDEO) {
+ imagesButton.setEnabled(true);
+ } else if (fileSearchPanel.getSelectedType() == FileType.IMAGE) {
+ videosButton.setEnabled(true);
+ }
+ });
+ }
+
+ /**
+ * Update the user interface in response to a search being completed.
+ *
+ * @param searchCompletedEvent The SearchCompletedEvent received.
+ */
+ @Subscribe
+ void handleSearchCompletedEvent(DiscoveryEvents.SearchCompleteEvent searchCompletedEvent) {
+ SwingUtilities.invokeLater(() -> {
+ if (fileSearchPanel.getSelectedType() == FileType.VIDEO) {
+ imagesButton.setEnabled(true);
+ } else if (fileSearchPanel.getSelectedType() == FileType.IMAGE) {
+ videosButton.setEnabled(true);
+ }
+ });
+ }
+
+ /**
+ * Update the user interface in response to a search being started.
+ *
+ * @param searchStartedEvent The SearchStartedEvent received.
+ */
+ @Subscribe
+ void handleSearchStartedEvent(DiscoveryEvents.SearchStartedEvent searchStartedEvent) {
+ SwingUtilities.invokeLater(() -> {
+ imagesButton.setEnabled(false);
+ videosButton.setEnabled(false);
+ });
+ }
// Variables declaration - do not modify//GEN-BEGIN:variables
+ private javax.swing.JButton imagesButton;
private javax.swing.JSplitPane leftSplitPane;
private javax.swing.JSplitPane rightSplitPane;
+ private javax.swing.JButton videosButton;
// End of variables declaration//GEN-END:variables
}
diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearch.java b/Core/src/org/sleuthkit/autopsy/filequery/FileSearch.java
index dd5f62b8c3..aad5d901ce 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearch.java
+++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearch.java
@@ -27,6 +27,7 @@ import java.io.IOException;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
@@ -62,6 +63,7 @@ import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
+import org.sleuthkit.datamodel.TskData;
/**
* Main class to perform the file search.
@@ -619,7 +621,12 @@ class FileSearch {
private final FileSize fileSize;
FileSizeGroupKey(ResultFile file) {
- fileSize = FileSize.fromSize(file.getFirstInstance().getSize());
+ if (file.getFileType() == FileType.VIDEO) {
+ fileSize = FileSize.fromVideoSize(file.getFirstInstance().getSize());
+ }
+ else {
+ fileSize = FileSize.fromImageSize(file.getFirstInstance().getSize());
+ }
}
@Override
@@ -1028,30 +1035,35 @@ class FileSearch {
@Override
void addAttributeToResultFiles(List files, SleuthkitCase caseDb,
EamDb centralRepoDb) throws FileSearchException {
-
if (centralRepoDb == null) {
- throw new FileSearchException("Central Repository is not enabled - can not add frequency data"); // NON-NLS
- }
-
- // Set frequency in batches
- Set hashesToLookUp = new HashSet<>();
- List currentFiles = new ArrayList<>();
- for (ResultFile file : files) {
- if (file.getFrequency() == Frequency.UNKNOWN
- && file.getFirstInstance().getMd5Hash() != null
- && !file.getFirstInstance().getMd5Hash().isEmpty()) {
- hashesToLookUp.add(file.getFirstInstance().getMd5Hash());
- currentFiles.add(file);
+ for (ResultFile file : files) {
+ if (file.getFrequency() == Frequency.UNKNOWN && file.getFirstInstance().getKnown() == TskData.FileKnown.KNOWN) {
+ file.setFrequency(Frequency.KNOWN);
+ }
}
+ } else {
+ // Set frequency in batches
+ List currentFiles = new ArrayList<>();
+ Set hashesToLookUp = new HashSet<>();
+ for (ResultFile file : files) {
+ if (file.getFirstInstance().getKnown() == TskData.FileKnown.KNOWN) {
+ file.setFrequency(Frequency.KNOWN);
+ }
+ if (file.getFrequency() == Frequency.UNKNOWN
+ && file.getFirstInstance().getMd5Hash() != null
+ && !file.getFirstInstance().getMd5Hash().isEmpty()) {
+ hashesToLookUp.add(file.getFirstInstance().getMd5Hash());
+ currentFiles.add(file);
+ }
+ if (hashesToLookUp.size() >= BATCH_SIZE) {
+ computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
- if (hashesToLookUp.size() >= BATCH_SIZE) {
- computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
-
- hashesToLookUp.clear();
- currentFiles.clear();
+ hashesToLookUp.clear();
+ currentFiles.clear();
+ }
}
+ computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
}
- computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
}
}
@@ -1815,5 +1827,14 @@ class FileSearch {
AttributeType getAttributeType() {
return attributeType;
}
+
+ /**
+ * Get the list of enums that are valid for grouping images.
+ *
+ * @return enums that can be used to group images
+ */
+ static List getOptionsForGrouping() {
+ return Arrays.asList(FILE_SIZE, FREQUENCY, PARENT_PATH, OBJECT_DETECTED, HASH_LIST_NAME, INTERESTING_ITEM_SET);
+ }
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java
index b0cc38fc52..1859a45126 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java
+++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchData.java
@@ -53,7 +53,8 @@ class FileSearchData {
COUNT_50(4, 50, Bundle.FileSearchData_Frequency_count_50_displayName()),
COUNT_100(5, 100, Bundle.FileSearchData_Frequency_count_100_displayName()),
COMMON(6, 0, Bundle.FileSearchData_Frequency_common_displayName()),
- UNKNOWN(7, 0, Bundle.FileSearchData_Frequency_unknown_displayName());
+ KNOWN(7, 0, "Known (NSRL)"),
+ UNKNOWN(8, 0, Bundle.FileSearchData_Frequency_unknown_displayName());
private final int ranking;
private final String displayName;
@@ -82,56 +83,82 @@ class FileSearchData {
* @return the corresponding enum
*/
static Frequency fromCount(long count) {
- if (count <= UNIQUE.maxOccur) {
+ if (count <= UNIQUE.getMaxOccur()) {
return UNIQUE;
- } else if (count <= RARE.maxOccur) {
+ } else if (count <= RARE.getMaxOccur()) {
return RARE;
- } else if (count <= COUNT_10.maxOccur) {
+ } else if (count <= COUNT_10.getMaxOccur()) {
return COUNT_10;
- } else if (count <= COUNT_20.maxOccur) {
+ } else if (count <= COUNT_20.getMaxOccur()) {
return COUNT_20;
- } else if (count <= COUNT_50.maxOccur) {
+ } else if (count <= COUNT_50.getMaxOccur()) {
return COUNT_50;
- } else if (count <= COUNT_100.maxOccur) {
+ } else if (count <= COUNT_100.getMaxOccur()) {
return COUNT_100;
}
return COMMON;
}
/**
- * Get the list of enums that are valid for filtering.
+ * Get the list of enums that are valid for filtering when a CR is
+ * enabled.
*
- * @return enums that can be used to filter
+ * @return enums that can be used to filter with a CR.
*/
- static List getOptionsForFiltering() {
- return Arrays.asList(UNIQUE, RARE, COUNT_10, COUNT_20, COUNT_50, COUNT_100, COMMON);
+ static List getOptionsForFilteringWithCr() {
+ return Arrays.asList(UNIQUE, RARE, COUNT_10, COUNT_20, COUNT_50, COUNT_100, COMMON, KNOWN);
+ }
+
+ /**
+ * Get the list of enums that are valid for filtering when no CR is
+ * enabled.
+ *
+ * @return enums that can be used to filter without a CR.
+ */
+ static List getOptionsForFilteringWithoutCr() {
+ return Arrays.asList(KNOWN, UNKNOWN);
}
@Override
public String toString() {
return displayName;
}
+
+ /**
+ * @return the maxOccur
+ */
+ int getMaxOccur() {
+ return maxOccur;
+ }
}
/**
* Enum representing the file size
*/
@NbBundle.Messages({
- "FileSearchData.FileSize.OVER_1GB.displayName=1 GB+",
+ "FileSearchData.FileSize.OVER_10GB.displayName=10 GB+",
+ "FileSearchData.FileSize.OVER_5GB.displayName=5 - 10 GB",
+ "FileSearchData.FileSize.OVER_1GB_VIDEO.displayName=1 - 5 GB",
+ "FileSearchData.FileSize.OVER_1GB_IMAGE.displayName=1 GB+",
"FileSearchData.FileSize.OVER_200MB.displayName=200 MB - 1 GB",
"FileSearchData.FileSize.OVER_50MB.displayName=50 - 200 MB",
"FileSearchData.FileSize.OVER_1MB.displayName=1 - 50 MB",
"FileSearchData.FileSize.OVER_100KB.displayName=100 KB - 1 MB",
+ "FileSearchData.FileSize.UNDER_100KB.displayName=Under 100 KB",
"FileSearchData.FileSize.OVER_16KB.displayName=16 KB - 100 KB",
"FileSearchData.FileSize.UNDER_16KB.displayName=Under 16 KB",})
enum FileSize {
- OVER_1GB(0, 1000 * BYTES_PER_MB, -1, Bundle.FileSearchData_FileSize_OVER_1GB_displayName()),
- OVER_200MB(1, 200 * BYTES_PER_MB, 1000 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_200MB_displayName()),
- OVER_50MB(2, 50 * BYTES_PER_MB, 200 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_50MB_displayName()),
- OVER_1MB(3, 1 * BYTES_PER_MB, 50 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_1MB_displayName()),
- OVER_100KB(4, 100000, 1 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_100KB_displayName()),
- OVER_16KB(5, 16000, 100000, Bundle.FileSearchData_FileSize_OVER_16KB_displayName()),
- UNDER_16KB(6, 0, 16000, Bundle.FileSearchData_FileSize_UNDER_16KB_displayName());
+ OVER_10GB(0, 10000 * BYTES_PER_MB, -1, Bundle.FileSearchData_FileSize_OVER_10GB_displayName()),
+ OVER_5GB(1, 5000 * BYTES_PER_MB, 10000 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_5GB_displayName()),
+ OVER_1GB_VIDEO(2, 1000 * BYTES_PER_MB, -1, Bundle.FileSearchData_FileSize_OVER_1GB_VIDEO_displayName()),
+ OVER_1GB_IMAGE(3, 1000 * BYTES_PER_MB, -1, Bundle.FileSearchData_FileSize_OVER_1GB_IMAGE_displayName()),
+ OVER_200MB(4, 200 * BYTES_PER_MB, 1000 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_200MB_displayName()),
+ OVER_50MB(5, 50 * BYTES_PER_MB, 200 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_50MB_displayName()),
+ OVER_1MB(6, 1 * BYTES_PER_MB, 50 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_1MB_displayName()),
+ OVER_100KB(7, 100000, 1 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_OVER_100KB_displayName()),
+ UNDER_100KB(8, 0, 1 * BYTES_PER_MB, Bundle.FileSearchData_FileSize_UNDER_100KB_displayName()),
+ OVER_16KB(9, 16000, 100000, Bundle.FileSearchData_FileSize_OVER_16KB_displayName()),
+ UNDER_16KB(10, 0, 16000, Bundle.FileSearchData_FileSize_UNDER_16KB_displayName());
private final int ranking; // Must be unique for each value
private final long minBytes; // Note that the size must be strictly greater than this to match
@@ -151,31 +178,59 @@ class FileSearchData {
}
/**
- * Get the enum corresponding to the given file size. The file size must
- * be strictly greater than minBytes.
+ * Get the enum corresponding to the given file size for image files.
+ * The file size must be strictly greater than minBytes.
*
* @param size the file size
*
* @return the enum whose range contains the file size
*/
- static FileSize fromSize(long size) {
- if (size > OVER_1GB.minBytes) {
- return OVER_1GB;
- } else if (size > OVER_200MB.minBytes) {
+ static FileSize fromImageSize(long size) {
+ if (size > OVER_1GB_IMAGE.getMinBytes()) {
+ return OVER_1GB_IMAGE;
+ } else if (size > OVER_200MB.getMinBytes()) {
return OVER_200MB;
- } else if (size > OVER_50MB.minBytes) {
+ } else if (size > OVER_50MB.getMinBytes()) {
return OVER_50MB;
- } else if (size > OVER_1MB.minBytes) {
+ } else if (size > OVER_1MB.getMinBytes()) {
return OVER_1MB;
- } else if (size > OVER_100KB.minBytes) {
+ } else if (size > OVER_100KB.getMinBytes()) {
return OVER_100KB;
- } else if (size > OVER_16KB.minBytes) {
+ } else if (size > OVER_16KB.getMinBytes()) {
return OVER_16KB;
} else {
return UNDER_16KB;
}
}
+ /**
+ * Get the enum corresponding to the given file size for video files.
+ * The file size must be strictly greater than minBytes.
+ *
+ * @param size the file size
+ *
+ * @return the enum whose range contains the file size
+ */
+ static FileSize fromVideoSize(long size) {
+ if (size > OVER_10GB.getMinBytes()) {
+ return OVER_10GB;
+ } else if (size > OVER_5GB.getMinBytes()) {
+ return OVER_5GB;
+ } else if (size > OVER_1GB_VIDEO.getMinBytes()) {
+ return OVER_1GB_VIDEO;
+ } else if (size > OVER_200MB.getMinBytes()) {
+ return OVER_200MB;
+ } else if (size > OVER_50MB.getMinBytes()) {
+ return OVER_50MB;
+ } else if (size > OVER_1MB.getMinBytes()) {
+ return OVER_1MB;
+ } else if (size > OVER_100KB.getMinBytes()) {
+ return OVER_100KB;
+ } else {
+ return UNDER_100KB;
+ }
+ }
+
/**
* Get the upper limit of the range.
*
@@ -207,6 +262,24 @@ class FileSearchData {
public String toString() {
return displayName;
}
+
+ /**
+ * Get the list of enums that are valid for image sizes.
+ *
+ * @return enums that can be used to filter images by size.
+ */
+ static List getOptionsForImages() {
+ return Arrays.asList(OVER_1GB_IMAGE, OVER_200MB, OVER_50MB, OVER_1MB, OVER_100KB, OVER_16KB, UNDER_16KB);
+ }
+
+ /**
+ * Get the list of enums that are valid for video sizes.
+ *
+ * @return enums that can be used to filter videos by size.
+ */
+ static List getOptionsForVideos() {
+ return Arrays.asList(OVER_10GB, OVER_5GB, OVER_1GB_VIDEO, OVER_200MB, OVER_50MB, OVER_1MB, OVER_100KB, UNDER_100KB);
+ }
}
/**
@@ -273,7 +346,7 @@ class FileSearchData {
*/
static FileType fromMIMEtype(String mimeType) {
for (FileType type : FileType.values()) {
- if (type.mediaTypes.contains(mimeType)) {
+ if (type.getMediaTypes().contains(mimeType)) {
return type;
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.java b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.java
index 37e7912c4f..186111cef0 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchDialog.java
@@ -185,7 +185,7 @@ public class FileSearchDialog extends javax.swing.JDialog implements ActionListe
} else {
int count = 0;
DefaultListModel frequencyListModel = (DefaultListModel)freqList.getModel();
- for (Frequency freq : Frequency.getOptionsForFiltering()) {
+ for (Frequency freq : Frequency.getOptionsForFilteringWithCr()) {
frequencyListModel.add(count, freq);
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchFiltering.java b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchFiltering.java
index 66676aa669..920f7983c1 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchFiltering.java
+++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchFiltering.java
@@ -262,15 +262,15 @@ class FileSearchFiltering {
// TODO - these should really be prepared statements
if (isIncluded()) {
if (isFullPath()) {
- return "parent_path=\'" + searchStr + "\'"; // NON-NLS
+ return "parent_path=\'" + getSearchStr() + "\'"; // NON-NLS
} else {
- return "parent_path LIKE \'%" + searchStr + "%\'"; // NON-NLS
+ return "parent_path LIKE \'%" + getSearchStr() + "%\'"; // NON-NLS
}
} else {
if (isFullPath()) {
- return "parent_path!=\'" + searchStr + "\'"; // NON-NLS
+ return "parent_path!=\'" + getSearchStr() + "\'"; // NON-NLS
} else {
- return "parent_path NOT LIKE \'%" + searchStr + "%\'"; // NON-NLS
+ return "parent_path NOT LIKE \'%" + getSearchStr() + "%\'"; // NON-NLS
}
}
}
@@ -282,7 +282,7 @@ class FileSearchFiltering {
"FileSearchFiltering.ParentSearchTerm.excludeString= (exclude)",})
@Override
public String toString() {
- String returnString = searchStr;
+ String returnString = getSearchStr();
if (isFullPath()) {
returnString += Bundle.FileSearchFiltering_ParentSearchTerm_fullString();
} else {
@@ -309,6 +309,13 @@ class FileSearchFiltering {
boolean isIncluded() {
return included;
}
+
+ /**
+ * @return the searchStr
+ */
+ String getSearchStr() {
+ return searchStr;
+ }
}
/**
@@ -371,9 +378,9 @@ class FileSearchFiltering {
desc += Bundle.FileSearchFiltering_ParentFilter_or();
}
if (searchTerm.isFullPath()) {
- desc += searchTerm.searchStr + Bundle.FileSearchFiltering_ParentFilter_exact();
+ desc += searchTerm.getSearchStr() + Bundle.FileSearchFiltering_ParentFilter_exact();
} else {
- desc += searchTerm.searchStr + Bundle.FileSearchFiltering_ParentFilter_substring();
+ desc += searchTerm.getSearchStr() + Bundle.FileSearchFiltering_ParentFilter_substring();
}
}
desc = Bundle.FileSearchFiltering_ParentFilter_desc(desc);
@@ -559,10 +566,6 @@ class FileSearchFiltering {
List applyAlternateFilter(List currentResults, SleuthkitCase caseDb,
EamDb centralRepoDb) throws FileSearchException {
- if (centralRepoDb == null) {
- throw new FileSearchException("Can not run Frequency filter with null Central Repository DB"); // NON-NLS
- }
-
// We have to have run some kind of SQL filter before getting to this point,
// and should have checked afterward to see if the results were empty.
if (currentResults.isEmpty()) {
diff --git a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.form b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.form
index 5f148e7227..ccfb608cd6 100644
--- a/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.form
+++ b/Core/src/org/sleuthkit/autopsy/filequery/FileSearchPanel.form
@@ -3,6 +3,10 @@