Merge pull request #5399 from wschaeferB/5673-RemoveExcessFilters

5673 remove excess filters
This commit is contained in:
Richard Cordovano 2019-11-15 13:57:43 -05:00 committed by GitHub
commit 468a2d54c5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
17 changed files with 1211 additions and 437 deletions

View File

@ -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

View File

@ -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

View File

@ -71,5 +71,109 @@
</Container>
</SubComponents>
</Container>
<Container class="javax.swing.JPanel" name="toolBarPanel">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout" value="org.netbeans.modules.form.compat2.layouts.DesignBorderLayout$BorderConstraintsDescription">
<BorderConstraints direction="First"/>
</Constraint>
</Constraints>
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace pref="459" max="32767" attributes="0"/>
<Component id="toolBar" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="459" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="toolBar" max="32767" attributes="0"/>
<EmptySpace min="0" pref="0" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Container class="javax.swing.JToolBar" name="toolBar">
<Properties>
<Property name="floatable" type="boolean" value="false"/>
<Property name="rollover" type="boolean" value="true"/>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
<Layout class="org.netbeans.modules.form.compat2.layouts.DesignBoxLayout"/>
<SubComponents>
<Component class="javax.swing.JButton" name="imagesButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/pictures-icon.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DiscoveryTopComponent.imagesButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="disabledIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/pictures-icon.png"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[90, 43]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[90, 43]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[90, 43]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="imagesButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="videosButton">
<Properties>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/video-icon.png"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="DiscoveryTopComponent.videosButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="disabledIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/video-icon.png"/>
</Property>
<Property name="disabledSelectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/video-icon.png"/>
</Property>
<Property name="focusable" type="boolean" value="false"/>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[90, 43]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[90, 43]"/>
</Property>
<Property name="preferredSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[90, 43]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="videosButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
</SubComponents>
</Form>

View File

@ -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,11 +100,18 @@ 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);
}
@ -127,10 +124,25 @@ public final class DiscoveryTopComponent extends TopComponent {
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);
}// </editor-fold>//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
}

View File

@ -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<ResultFile> 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<String> hashesToLookUp = new HashSet<>();
List<ResultFile> 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<ResultFile> currentFiles = new ArrayList<>();
Set<String> 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<GroupingAttributeType> getOptionsForGrouping() {
return Arrays.asList(FILE_SIZE, FREQUENCY, PARENT_PATH, OBJECT_DETECTED, HASH_LIST_NAME, INTERESTING_ITEM_SET);
}
}
}

View File

@ -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<Frequency> getOptionsForFiltering() {
return Arrays.asList(UNIQUE, RARE, COUNT_10, COUNT_20, COUNT_50, COUNT_100, COMMON);
static List<Frequency> 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<Frequency> 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<FileSize> 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<FileSize> 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;
}
}

View File

@ -185,7 +185,7 @@ public class FileSearchDialog extends javax.swing.JDialog implements ActionListe
} else {
int count = 0;
DefaultListModel<Frequency> frequencyListModel = (DefaultListModel<Frequency>)freqList.getModel();
for (Frequency freq : Frequency.getOptionsForFiltering()) {
for (Frequency freq : Frequency.getOptionsForFilteringWithCr()) {
frequencyListModel.add(count, freq);
}
}

View File

@ -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<ResultFile> applyAlternateFilter(List<ResultFile> 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()) {

View File

@ -3,6 +3,10 @@
<Form version="1.5" maxVersion="1.9" type="org.netbeans.modules.form.forminfo.JPanelFormInfo">
<NonVisualComponents>
<Component class="javax.swing.ButtonGroup" name="parentPathButtonGroup">
<AuxValues>
<AuxValue name="JavaCodeGenerator_VariableLocal" type="java.lang.Boolean" value="true"/>
<AuxValue name="JavaCodeGenerator_VariableModifier" type="java.lang.Integer" value="0"/>
</AuxValues>
</Component>
<Component class="javax.swing.ButtonGroup" name="orderGroupsByButtonGroup">
</Component>
@ -36,50 +40,45 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="fileTypeLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="fileTypeComboBox" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="errorLabel" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="errorLabel" pref="268" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="searchButton" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="sortingPanel" alignment="0" max="32767" attributes="0"/>
<Component id="filtersScrollPane" max="32767" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="filtersScrollPane" pref="0" max="32767" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="sortingPanel" max="32767" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/>
<EmptySpace min="6" pref="6" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="fileTypeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="fileTypeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Component id="filtersScrollPane" pref="326" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="sortingPanel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="filtersScrollPane" pref="290" max="32767" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="errorLabel" alignment="0" min="-2" pref="23" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<Component id="errorLabel" min="-2" pref="0" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -161,7 +160,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="3" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="12" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -176,7 +175,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="12" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -219,7 +218,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="14" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="9" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -235,7 +234,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="14" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
<GridBagConstraints gridX="2" gridY="9" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -245,7 +244,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="16" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="6" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="11" gridWidth="2" gridHeight="1" fill="2" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="6" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -270,7 +269,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="16" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="6" insetsRight="6" anchor="24" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="3" gridY="11" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="6" insetsRight="6" anchor="24" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -295,7 +294,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="3" gridY="15" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="4" insetsRight="6" anchor="24" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="3" gridY="10" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="10" insetsBottom="4" insetsRight="6" anchor="24" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -357,7 +356,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="3" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
<GridBagConstraints gridX="1" gridY="12" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
</Constraint>
</Constraints>
@ -385,7 +384,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="13" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.1"/>
<GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.1"/>
</Constraint>
</Constraints>
</Component>
@ -395,7 +394,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="12" gridWidth="3" gridHeight="2" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
<GridBagConstraints gridX="1" gridY="7" gridWidth="3" gridHeight="2" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
</Constraint>
</Constraints>
@ -429,7 +428,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -439,7 +438,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="4" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
<GridBagConstraints gridX="1" gridY="5" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
</Constraint>
</Constraints>
@ -470,7 +469,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="5" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="4" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -485,7 +484,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="13" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -500,7 +499,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="7" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="6" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -515,7 +514,7 @@
</Events>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="8" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="14" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -527,7 +526,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="9" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="3" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -539,7 +538,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="10" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="15" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -549,7 +548,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="5" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
<GridBagConstraints gridX="1" gridY="4" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
</Constraint>
</Constraints>
@ -575,7 +574,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="6" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
<GridBagConstraints gridX="1" gridY="13" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
</Constraint>
</Constraints>
@ -601,7 +600,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="7" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
<GridBagConstraints gridX="1" gridY="6" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.1"/>
</Constraint>
</Constraints>
@ -627,7 +626,7 @@
</AuxValues>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="8" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="14" gridWidth="3" gridHeight="1" fill="1" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.5" weightY="0.0"/>
</Constraint>
</Constraints>
@ -660,7 +659,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="1" gridY="15" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="1" gridY="10" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -676,7 +675,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="2" gridY="15" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
<GridBagConstraints gridX="2" gridY="10" gridWidth="1" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="4" insetsBottom="4" insetsRight="0" anchor="23" weightX="0.5" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -691,7 +690,7 @@
</Properties>
<Constraints>
<Constraint layoutClass="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout" value="org.netbeans.modules.form.compat2.layouts.DesignGridBagLayout$GridBagConstraintsDescription">
<GridBagConstraints gridX="0" gridY="11" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
<GridBagConstraints gridX="0" gridY="16" gridWidth="4" gridHeight="1" fill="0" ipadX="0" ipadY="0" insetsTop="0" insetsLeft="6" insetsBottom="4" insetsRight="6" anchor="23" weightX="0.0" weightY="0.0"/>
</Constraint>
</Constraints>
</Component>
@ -699,13 +698,6 @@
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JLabel" name="fileTypeLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.fileTypeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="searchButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -749,8 +741,8 @@
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="groupByCombobox" max="32767" attributes="0"/>
<Component id="orderByCombobox" max="32767" attributes="0"/>
<Component id="groupByCombobox" pref="280" max="32767" attributes="0"/>
<Component id="orderByCombobox" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
@ -860,16 +852,6 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JComboBox" name="fileTypeComboBox">
<Properties>
<Property name="model" type="javax.swing.ComboBoxModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new DefaultComboBoxModel&lt;FileType&gt;()" type="code"/>
</Property>
</Properties>
<AuxValues>
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="&lt;FileType&gt;"/>
</AuxValues>
</Component>
<Component class="javax.swing.JLabel" name="errorLabel">
<Properties>
<Property name="foreground" type="java.awt.Color" editor="org.netbeans.beaninfo.editors.ColorEditor">

File diff suppressed because it is too large Load Diff

View File

@ -20,9 +20,11 @@ package org.sleuthkit.autopsy.filequery;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.Comparator;
import java.util.List;
import org.openide.util.NbBundle;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Class used to sort ResultFiles using the supplied method.
@ -32,9 +34,9 @@ class FileSorter implements Comparator<ResultFile> {
private final List<Comparator<ResultFile>> comparators = new ArrayList<>();
/**
* Set up the sorter using the supplied sorting method.
* The sorting is defined by a list of ResultFile comparators. These
* comparators will be run in order until one returns a non-zero result.
* Set up the sorter using the supplied sorting method. The sorting is
* defined by a list of ResultFile comparators. These comparators will be
* run in order until one returns a non-zero result.
*
* @param method The method that should be used to sort the files
*/
@ -58,7 +60,7 @@ class FileSorter implements Comparator<ResultFile> {
case BY_KEYWORD_LIST_NAMES:
comparators.add(getKeywordListNameComparator());
break;
case BY_PARENT_PATH:
case BY_FULL_PATH:
comparators.add(getParentPathComparator());
break;
case BY_FILE_NAME:
@ -99,8 +101,8 @@ class FileSorter implements Comparator<ResultFile> {
}
/**
* Compare files using their FileType enum. Orders based on the ranking
* in the FileType enum.
* Compare files using their FileType enum. Orders based on the ranking in
* the FileType enum.
*
* @return -1 if file1 has the lower FileType value, 0 if equal, 1 otherwise
*/
@ -109,10 +111,12 @@ class FileSorter implements Comparator<ResultFile> {
}
/**
* Compare files using a concatenated version of keyword list names. Alphabetical by
* the list names with files with no keyword list hits going last.
* Compare files using a concatenated version of keyword list names.
* Alphabetical by the list names with files with no keyword list hits going
* last.
*
* @return -1 if file1 has the earliest combined keyword list name, 0 if equal, 1 otherwise
* @return -1 if file1 has the earliest combined keyword list name, 0 if
* equal, 1 otherwise
*/
private static Comparator<ResultFile> getKeywordListNameComparator() {
return (ResultFile file1, ResultFile file2) -> {
@ -135,10 +139,29 @@ class FileSorter implements Comparator<ResultFile> {
/**
* Compare files based on parent path. Order alphabetically.
*
* @return -1 if file1's path comes first alphabetically, 0 if equal, 1 otherwise
* @return -1 if file1's path comes first alphabetically, 0 if equal, 1
* otherwise
*/
private static Comparator<ResultFile> getParentPathComparator() {
return (ResultFile file1, ResultFile file2) -> compareStrings(file1.getFirstInstance().getParentPath(), file2.getFirstInstance().getParentPath());
return new Comparator<ResultFile>() {
@Override
public int compare(ResultFile file1, ResultFile file2) {
String file1ParentPath;
try {
file1ParentPath = file1.getFirstInstance().getParent().getUniquePath();
} catch (TskCoreException ingored) {
file1ParentPath = file1.getFirstInstance().getParentPath();
}
String file2ParentPath;
try {
file2ParentPath = file2.getFirstInstance().getParent().getUniquePath();
} catch (TskCoreException ingored) {
file2ParentPath = file2.getFirstInstance().getParentPath();
}
return compareStrings(file1ParentPath.toLowerCase(), file2ParentPath.toLowerCase());
}
};
}
/**
@ -154,7 +177,8 @@ class FileSorter implements Comparator<ResultFile> {
/**
* Compare files based on MIME type. Order is alphabetical.
*
* @return -1 if file1's MIME type comes before file2's, 0 if equal, 1 otherwise
* @return -1 if file1's MIME type comes before file2's, 0 if equal, 1
* otherwise
*/
private static Comparator<ResultFile> getMIMETypeComparator() {
return (ResultFile file1, ResultFile file2) -> compareStrings(file1.getFirstInstance().getMIMEType(), file2.getFirstInstance().getMIMEType());
@ -167,7 +191,7 @@ class FileSorter implements Comparator<ResultFile> {
*/
private static Comparator<ResultFile> getFileSizeComparator() {
return (ResultFile file1, ResultFile file2) -> -1 * Long.compare(file1.getFirstInstance().getSize(), file2.getFirstInstance().getSize()) // Sort large to small
;
;
}
/**
@ -176,14 +200,14 @@ class FileSorter implements Comparator<ResultFile> {
* @return -1 if file1 comes before file2, 0 if equal, 1 otherwise
*/
private static Comparator<ResultFile> getFileNameComparator() {
return (ResultFile file1, ResultFile file2) -> compareStrings(file1.getFirstInstance().getName(), file2.getFirstInstance().getName());
return (ResultFile file1, ResultFile file2) -> compareStrings(file1.getFirstInstance().getName().toLowerCase(), file2.getFirstInstance().getName().toLowerCase());
}
/**
* A final default comparison between two ResultFile objects.
* Currently this is on file name and then object ID. It can be changed but
* should always include something like the object ID to ensure a
* consistent sorting when the rest of the compared fields are the same.
* A final default comparison between two ResultFile objects. Currently this
* is on file name and then object ID. It can be changed but should always
* include something like the object ID to ensure a consistent sorting when
* the rest of the compared fields are the same.
*
* @return -1 if file1 comes before file2, 0 if equal, 1 otherwise
*/
@ -204,16 +228,12 @@ class FileSorter implements Comparator<ResultFile> {
* @param s1
* @param s2
*
* @return -1 if s1 comes before s2, 0 if equal, 1 otherwise
* @return -1 if s1 comes before s2, 0 if equal, 1 otherwise
*/
private static int compareStrings(String s1, String s2) {
if (s1 == null) {
s1 = "";
}
if (s2 == null) {
s2 = "";
}
return s1.compareTo(s2);
String string1 = s1 == null ? "" : s1;
String string2 = s2 == null ? "" : s2;
return string1.compareTo(string2);
}
/**
@ -226,22 +246,22 @@ class FileSorter implements Comparator<ResultFile> {
"FileSorter.SortingMethod.filetype.displayName=By file type",
"FileSorter.SortingMethod.frequency.displayName=By central repo frequency",
"FileSorter.SortingMethod.keywordlist.displayName=By keyword list names",
"FileSorter.SortingMethod.parent.displayName=By parent path"})
"FileSorter.SortingMethod.fullPath.displayName=By full path"})
enum SortingMethod {
BY_FILE_NAME(new ArrayList<>(),
Bundle.FileSorter_SortingMethod_filename_displayName()), // Sort alphabetically by file name
Bundle.FileSorter_SortingMethod_filename_displayName()), // Sort alphabetically by file name
BY_DATA_SOURCE(new ArrayList<>(),
Bundle.FileSorter_SortingMethod_datasource_displayName()), // Sort in increasing order of data source ID
Bundle.FileSorter_SortingMethod_datasource_displayName()), // Sort in increasing order of data source ID
BY_FILE_SIZE(new ArrayList<>(),
Bundle.FileSorter_SortingMethod_filesize_displayName()), // Sort in decreasing order of size
Bundle.FileSorter_SortingMethod_filesize_displayName()), // Sort in decreasing order of size
BY_FILE_TYPE(Arrays.asList(new FileSearch.FileTypeAttribute()),
Bundle.FileSorter_SortingMethod_filetype_displayName()), // Sort in order of file type (defined in FileType enum), with secondary sort on MIME type
Bundle.FileSorter_SortingMethod_filetype_displayName()), // Sort in order of file type (defined in FileType enum), with secondary sort on MIME type
BY_FREQUENCY(Arrays.asList(new FileSearch.FrequencyAttribute()),
Bundle.FileSorter_SortingMethod_frequency_displayName()), // Sort by decreasing rarity in the central repository
Bundle.FileSorter_SortingMethod_frequency_displayName()), // Sort by decreasing rarity in the central repository
BY_KEYWORD_LIST_NAMES(Arrays.asList(new FileSearch.KeywordListAttribute()),
Bundle.FileSorter_SortingMethod_keywordlist_displayName()), // Sort alphabetically by list of keyword list names found
BY_PARENT_PATH(new ArrayList<>(),
Bundle.FileSorter_SortingMethod_parent_displayName()); // Sort alphabetically by path
Bundle.FileSorter_SortingMethod_keywordlist_displayName()), // Sort alphabetically by list of keyword list names found
BY_FULL_PATH(new ArrayList<>(),
Bundle.FileSorter_SortingMethod_fullPath_displayName()); // Sort alphabetically by path
private final String displayName;
private final List<FileSearch.AttributeType> requiredAttributes;
@ -257,7 +277,16 @@ class FileSorter implements Comparator<ResultFile> {
}
List<FileSearch.AttributeType> getRequiredAttributes() {
return requiredAttributes;
return Collections.unmodifiableList(requiredAttributes);
}
/**
* Get the list of enums that are valid for ordering images.
*
* @return enums that can be used to ordering images.
*/
static List<SortingMethod> getOptionsForOrdering() {
return Arrays.asList(BY_FILE_SIZE, BY_FULL_PATH, BY_FILE_NAME, BY_DATA_SOURCE);
}
}
}

View File

@ -41,6 +41,13 @@
<SubComponents>
<Component class="javax.swing.JList" name="groupKeyList">
<Properties>
<Property name="border" type="javax.swing.border.Border" editor="org.netbeans.modules.form.editors2.BorderEditor">
<Border info="org.netbeans.modules.form.compat2.border.TitledBorderInfo">
<TitledBorder title="Groups">
<ResourceString PropertyName="titleX" bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="GroupListPanel.groupKeyList.border.title" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</TitledBorder>
</Border>
</Property>
<Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new DefaultListModel&lt;GroupKey&gt;()" type="code"/>
</Property>

View File

@ -90,6 +90,7 @@ class GroupListPanel extends javax.swing.JPanel {
groupListScrollPane = new javax.swing.JScrollPane();
groupKeyList = new javax.swing.JList<>();
groupKeyList.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(GroupListPanel.class, "GroupListPanel.groupKeyList.border.title"))); // NOI18N
groupKeyList.setModel(new DefaultListModel<GroupKey>());
groupKeyList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
groupKeyList.setCellRenderer(new GroupListRenderer());

View File

@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.logging.Level;
import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel;
import javax.swing.JList;
@ -40,7 +41,9 @@ import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.actions.AddContentTagAction;
import org.sleuthkit.autopsy.actions.DeleteFileContentTagAction;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.coreutils.ImageUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.FileNode;
import org.sleuthkit.autopsy.directorytree.ExternalViewerAction;
import org.sleuthkit.autopsy.directorytree.ViewContextAction;
@ -57,6 +60,7 @@ import org.sleuthkit.datamodel.TskCoreException;
public class ResultsPanel extends javax.swing.JPanel {
private static final long serialVersionUID = 1L;
private final static Logger logger = Logger.getLogger(ResultsPanel.class.getName());
private final VideoThumbnailViewer videoThumbnailViewer;
private final ImageThumbnailViewer imageThumbnailViewer;
private List<FileSearchFiltering.FileFilter> searchFilters;
@ -67,7 +71,6 @@ public class ResultsPanel extends javax.swing.JPanel {
private int currentPage = 0;
private int previousPageSize = 10;
private FileSearchData.FileType resultType;
private final EamDb centralRepo;
private int groupSize = 0;
private PageWorker pageWorker;
private final List<SwingWorker<Void, Void>> thumbnailWorkers = new ArrayList<>();
@ -78,9 +81,8 @@ public class ResultsPanel extends javax.swing.JPanel {
*/
@Messages({"ResultsPanel.viewFileInDir.name=View File in Directory",
"ResultsPanel.openInExternalViewer.name=Open in External Viewer"})
public ResultsPanel(EamDb centralRepo) {
public ResultsPanel() {
initComponents();
this.centralRepo = centralRepo;
imageThumbnailViewer = new ImageThumbnailViewer();
videoThumbnailViewer = new VideoThumbnailViewer();
videoThumbnailViewer.addListSelectionListener((e) -> {
@ -299,6 +301,15 @@ public class ResultsPanel extends javax.swing.JPanel {
if (pageWorker != null && !pageWorker.isDone()) {
pageWorker.cancel(true);
}
EamDb centralRepo = null;
if (EamDb.isEnabled()) {
try {
centralRepo = EamDb.getInstance();
} catch (EamDbException ex) {
centralRepo = null;
logger.log(Level.SEVERE, "Error loading central repository database, no central repository options will be available for File Discovery", ex);
}
}
pageWorker = new PageWorker(searchFilters, groupingAttribute, groupSort, fileSortMethod, selectedGroupKey, startingEntry, pageSize, resultType, centralRepo);
pageWorker.execute();
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.0 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 962 B

View File

@ -140,7 +140,6 @@
<rule ref="rulesets/java/design.xml/ReturnEmptyArrayRatherThanNull"/>
<rule ref="rulesets/java/design.xml/AbstractClassWithoutAnyMethod"/>
<rule ref="rulesets/java/design.xml/TooFewBranchesForASwitchStatement"/>
<rule ref="rulesets/java/design.xml/UseVarargs"/>
<!-- Commented out because it flagged many of the NetBeans created UI classes that place
fields at various places in the class
<rule ref="rulesets/java/design.xml/FieldDeclarationsShouldBeAtStartOfClass"/> -->