5673 combine known and occurrences filter

This commit is contained in:
William Schaefer 2019-11-01 14:36:22 -04:00
parent 0500843c38
commit 043412804c
13 changed files with 282 additions and 217 deletions

View File

@ -61,5 +61,6 @@ FileSearchPanel.includeRadioButton.text=Include
FileSearchPanel.excludeRadioButton.text=Exclude FileSearchPanel.excludeRadioButton.text=Exclude
FileSearchPanel.knownFilesCheckbox.toolTipText= FileSearchPanel.knownFilesCheckbox.toolTipText=
FileSearchPanel.knownFilesCheckbox.text=Hide known files FileSearchPanel.knownFilesCheckbox.text=Hide known files
FileSearchPanel.imagesButton.text=Images GroupListPanel.groupKeyList.border.title=Groups
FileSearchPanel.videosButton.text=Videos DiscoveryTopComponent.imagesButton.text=Images
DiscoveryTopComponent.videosButton.text=Videos

View File

@ -181,8 +181,9 @@ FileSearchPanel.includeRadioButton.text=Include
FileSearchPanel.excludeRadioButton.text=Exclude FileSearchPanel.excludeRadioButton.text=Exclude
FileSearchPanel.knownFilesCheckbox.toolTipText= FileSearchPanel.knownFilesCheckbox.toolTipText=
FileSearchPanel.knownFilesCheckbox.text=Hide known files FileSearchPanel.knownFilesCheckbox.text=Hide known files
FileSearchPanel.imagesButton.text=Images GroupListPanel.groupKeyList.border.title=Groups
FileSearchPanel.videosButton.text=Videos DiscoveryTopComponent.imagesButton.text=Images
DiscoveryTopComponent.videosButton.text=Videos
ResultsPanel.viewFileInDir.name=View File in Directory ResultsPanel.viewFileInDir.name=View File in Directory
SearchNode.getName.text=Search Result SearchNode.getName.text=Search Result
# {0} - numberOfInstances # {0} - numberOfInstances

View File

@ -71,5 +71,60 @@
</Container> </Container>
</SubComponents> </SubComponents>
</Container> </Container>
<Container class="javax.swing.JPanel" name="toolBarPanel">
<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 max="-2" attributes="0"/>
<Component id="imagesButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="videosButton" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="954" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="5" pref="5" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="imagesButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="videosButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JButton" name="imagesButton">
<Properties>
<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>
</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="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>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="videosButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>
</Container>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -61,18 +61,11 @@ public final class DiscoveryTopComponent extends TopComponent {
DiscoveryTopComponent() { DiscoveryTopComponent() {
initComponents(); initComponents();
// Load the central repository database. // 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()); setName(Bundle.DiscoveryTopComponent_name());
fileSearchPanel = new FileSearchPanel(Case.getCurrentCase().getSleuthkitCase(), centralRepoDb); fileSearchPanel = new FileSearchPanel();
dataContentPanel = DataContentPanel.createInstance(); dataContentPanel = DataContentPanel.createInstance();
resultsPanel = new ResultsPanel(centralRepoDb); resultsPanel = new ResultsPanel();
groupListPanel = new GroupListPanel(); groupListPanel = new GroupListPanel();
leftSplitPane.setLeftComponent(fileSearchPanel); leftSplitPane.setLeftComponent(fileSearchPanel);
leftSplitPane.setRightComponent(groupListPanel); leftSplitPane.setRightComponent(groupListPanel);
@ -110,8 +103,10 @@ public final class DiscoveryTopComponent extends TopComponent {
mode.dockInto(tc); mode.dockInto(tc);
} }
tc.open(); tc.open();
tc.updateSearchSettings();
} }
tc.toFront(); tc.toFront();
} }
} }
@ -120,13 +115,17 @@ public final class DiscoveryTopComponent extends TopComponent {
} }
/** /**
* 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() { public void resetTopComponent() {
resultsPanel.resetResultViewer(); resultsPanel.resetResultViewer();
groupListPanel.resetGroupList(); groupListPanel.resetGroupList();
} }
void updateSearchSettings() {
fileSearchPanel.resetPanel();
}
@Override @Override
public void componentOpened() { public void componentOpened() {
super.componentOpened(); super.componentOpened();
@ -157,6 +156,9 @@ public final class DiscoveryTopComponent extends TopComponent {
javax.swing.JSplitPane mainSplitPane = new javax.swing.JSplitPane(); javax.swing.JSplitPane mainSplitPane = new javax.swing.JSplitPane();
leftSplitPane = new javax.swing.JSplitPane(); leftSplitPane = new javax.swing.JSplitPane();
rightSplitPane = new javax.swing.JSplitPane(); rightSplitPane = new javax.swing.JSplitPane();
toolBarPanel = new javax.swing.JPanel();
imagesButton = new javax.swing.JButton();
videosButton = new javax.swing.JButton();
setPreferredSize(new java.awt.Dimension(1100, 700)); setPreferredSize(new java.awt.Dimension(1100, 700));
setLayout(new java.awt.BorderLayout()); setLayout(new java.awt.BorderLayout());
@ -176,12 +178,60 @@ public final class DiscoveryTopComponent extends TopComponent {
mainSplitPane.setRightComponent(rightSplitPane); mainSplitPane.setRightComponent(rightSplitPane);
add(mainSplitPane, java.awt.BorderLayout.CENTER); add(mainSplitPane, java.awt.BorderLayout.CENTER);
org.openide.awt.Mnemonics.setLocalizedText(imagesButton, org.openide.util.NbBundle.getMessage(DiscoveryTopComponent.class, "DiscoveryTopComponent.imagesButton.text")); // NOI18N
imagesButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
imagesButtonActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(videosButton, org.openide.util.NbBundle.getMessage(DiscoveryTopComponent.class, "DiscoveryTopComponent.videosButton.text")); // NOI18N
videosButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
videosButtonActionPerformed(evt);
}
});
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()
.addComponent(imagesButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(videosButton)
.addContainerGap(954, Short.MAX_VALUE))
);
toolBarPanelLayout.setVerticalGroup(
toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(toolBarPanelLayout.createSequentialGroup()
.addGap(5, 5, 5)
.addGroup(toolBarPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(imagesButton)
.addComponent(videosButton))
.addGap(6, 6, 6))
);
add(toolBarPanel, java.awt.BorderLayout.PAGE_START);
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
private void imagesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imagesButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_imagesButtonActionPerformed
private void videosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_videosButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_videosButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton imagesButton;
private javax.swing.JSplitPane leftSplitPane; private javax.swing.JSplitPane leftSplitPane;
private javax.swing.JSplitPane rightSplitPane; private javax.swing.JSplitPane rightSplitPane;
private javax.swing.JPanel toolBarPanel;
private javax.swing.JButton videosButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -63,6 +63,7 @@ import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ContentTag; import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException; import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
/** /**
* Main class to perform the file search. * Main class to perform the file search.
@ -1029,30 +1030,37 @@ class FileSearch {
@Override @Override
void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb, void addAttributeToResultFiles(List<ResultFile> files, SleuthkitCase caseDb,
EamDb centralRepoDb) throws FileSearchException { EamDb centralRepoDb) throws FileSearchException {
if (centralRepoDb == null) { if (centralRepoDb == null) {
throw new FileSearchException("Central Repository is not enabled - can not add frequency data"); // NON-NLS for (ResultFile file : files) {
} if (file.getFrequency() == Frequency.UNKNOWN) {
if (file.getFirstInstance().getKnown() == TskData.FileKnown.KNOWN) {
// Set frequency in batches file.setFrequency(Frequency.KNOWN);
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);
} }
} 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) { hashesToLookUp.clear();
computeFrequency(hashesToLookUp, currentFiles, centralRepoDb); currentFiles.clear();
}
hashesToLookUp.clear();
currentFiles.clear();
} }
computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
} }
computeFrequency(hashesToLookUp, currentFiles, centralRepoDb);
} }
} }
@ -1816,7 +1824,7 @@ class FileSearch {
AttributeType getAttributeType() { AttributeType getAttributeType() {
return attributeType; return attributeType;
} }
/** /**
* Get the list of enums that are valid for grouping images. * Get the list of enums that are valid for grouping images.
* *

View File

@ -53,7 +53,8 @@ class FileSearchData {
COUNT_50(4, 50, Bundle.FileSearchData_Frequency_count_50_displayName()), COUNT_50(4, 50, Bundle.FileSearchData_Frequency_count_50_displayName()),
COUNT_100(5, 100, Bundle.FileSearchData_Frequency_count_100_displayName()), COUNT_100(5, 100, Bundle.FileSearchData_Frequency_count_100_displayName()),
COMMON(6, 0, Bundle.FileSearchData_Frequency_common_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 int ranking;
private final String displayName; private final String displayName;
@ -99,12 +100,23 @@ class FileSearchData {
} }
/** /**
* 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() { static List<Frequency> getOptionsForFilteringWithCr() {
return Arrays.asList(UNIQUE, RARE, COUNT_10, COUNT_20, COUNT_50, COUNT_100, COMMON); 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 @Override

View File

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

View File

@ -279,7 +279,8 @@ class FileSearchFiltering {
"FileSearchFiltering.ParentSearchTerm.fullString= (exact)", "FileSearchFiltering.ParentSearchTerm.fullString= (exact)",
"FileSearchFiltering.ParentSearchTerm.subString= (substring)", "FileSearchFiltering.ParentSearchTerm.subString= (substring)",
"FileSearchFiltering.ParentSearchTerm.includeString= (include)", "FileSearchFiltering.ParentSearchTerm.includeString= (include)",
"FileSearchFiltering.ParentSearchTerm.excludeString= (exclude)",}) "FileSearchFiltering.ParentSearchTerm.excludeString= (exclude)",}
)
@Override @Override
public String toString() { public String toString() {
String returnString = searchStr; String returnString = searchStr;
@ -308,6 +309,7 @@ class FileSearchFiltering {
*/ */
boolean isIncluded() { boolean isIncluded() {
return isIncluded; return isIncluded;
} }
} }
@ -559,10 +561,6 @@ class FileSearchFiltering {
List<ResultFile> applyAlternateFilter(List<ResultFile> currentResults, SleuthkitCase caseDb, List<ResultFile> applyAlternateFilter(List<ResultFile> currentResults, SleuthkitCase caseDb,
EamDb centralRepoDb) throws FileSearchException { 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, // 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. // and should have checked afterward to see if the results were empty.
if (currentResults.isEmpty()) { if (currentResults.isEmpty()) {

View File

@ -34,18 +34,11 @@
<Layout> <Layout>
<DimensionLayout dim="0"> <DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Component id="imagesButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="videosButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0"> <Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0"> <Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="4" max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="errorLabel" max="32767" attributes="0"/> <Component id="errorLabel" pref="268" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="cancelButton" linkSize="1" min="-2" max="-2" attributes="0"/> <Component id="cancelButton" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
@ -67,21 +60,18 @@
<DimensionLayout dim="1"> <DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0"> <Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0"> <Group type="102" alignment="1" attributes="0">
<EmptySpace min="-2" pref="8" max="-2" attributes="0"/> <EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Component id="filtersScrollPane" pref="326" max="32767" attributes="0"/>
<Component id="imagesButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="videosButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="filtersScrollPane" pref="307" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/> <EmptySpace max="-2" attributes="0"/>
<Component id="sortingPanel" min="-2" max="-2" attributes="0"/> <Component id="sortingPanel" min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0"> <EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0"> <Group type="103" groupAlignment="3" attributes="0">
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/> <Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<Component id="errorLabel" min="-2" pref="23" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
</Group> </Group>
<Component id="errorLabel" alignment="0" min="-2" pref="0" max="-2" attributes="0"/>
</Group> </Group>
</Group> </Group>
</Group> </Group>
@ -874,44 +864,5 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/> <EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="cancelButtonActionPerformed"/>
</Events> </Events>
</Component> </Component>
<Component class="javax.swing.JButton" name="imagesButton">
<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.imagesButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="typeButtonGroup"/>
</Property>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[2, 8, 2, 8]"/>
</Property>
<Property name="selectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/tick.png"/>
</Property>
<Property name="verifyInputWhenFocusTarget" type="boolean" value="false"/>
</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="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/filequery/Bundle.properties" key="FileSearchPanel.videosButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="typeButtonGroup"/>
</Property>
<Property name="margin" type="java.awt.Insets" editor="org.netbeans.beaninfo.editors.InsetsEditor">
<Insets value="[2, 8, 2, 8]"/>
</Property>
<Property name="selectedIcon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/images/tick.png"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="videosButtonActionPerformed"/>
</Events>
</Component>
</SubComponents> </SubComponents>
</Form> </Form>

View File

@ -36,7 +36,9 @@ import javax.swing.SwingUtilities;
import javax.swing.event.ListSelectionEvent; import javax.swing.event.ListSelectionEvent;
import javax.swing.event.ListSelectionListener; import javax.swing.event.ListSelectionListener;
import org.openide.util.NbBundle; import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.filequery.FileSearch.GroupingAttributeType; import org.sleuthkit.autopsy.filequery.FileSearch.GroupingAttributeType;
import org.sleuthkit.autopsy.filequery.FileSearchData.FileType; import org.sleuthkit.autopsy.filequery.FileSearchData.FileType;
@ -61,30 +63,23 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private final static Logger logger = Logger.getLogger(FileSearchPanel.class.getName()); private final static Logger logger = Logger.getLogger(FileSearchPanel.class.getName());
private DefaultListModel<FileSearchFiltering.ParentSearchTerm> parentListModel; private DefaultListModel<FileSearchFiltering.ParentSearchTerm> parentListModel;
private final SleuthkitCase caseDb;
private final EamDb centralRepoDb;
private SearchWorker searchWorker = null; private SearchWorker searchWorker = null;
/** /**
* Creates new form FileSearchDialog * Creates new form FileSearchDialog
*/ */
@NbBundle.Messages({"FileSearchPanel.dialogTitle.text=Test file search"}) @NbBundle.Messages({"FileSearchPanel.dialogTitle.text=Test file search"})
FileSearchPanel(SleuthkitCase caseDb, EamDb centralRepoDb) { FileSearchPanel() {
this.caseDb = caseDb;
this.centralRepoDb = centralRepoDb;
initComponents(); initComponents();
customizeComponents();
imagesSelected();
} }
private void imagesSelected() { private void imagesSelected() {
imagesButton.setSelected(true); // imagesButton.setSelected(true);
imagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/tick.png"))); // imagesButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/tick.png")));
imagesButton.setBackground(Color.blue); // imagesButton.setBackground(Color.blue);
videosButton.setIcon(null); // videosButton.setIcon(null);
videosButton.setSelected(false); // videosButton.setSelected(false);
videosButton.setBackground(new Color(240, 240, 240)); // videosButton.setBackground(new Color(240, 240, 240));
dataSourceCheckbox.setVisible(true); dataSourceCheckbox.setVisible(true);
dataSourceScrollPane.setVisible(true); dataSourceScrollPane.setVisible(true);
dataSourceList.setVisible(true); dataSourceList.setVisible(true);
@ -127,12 +122,12 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
} }
private void videosSelected() { private void videosSelected() {
imagesButton.setSelected(false); // imagesButton.setSelected(false);
imagesButton.setIcon(null); // imagesButton.setIcon(null);
imagesButton.setBackground(new Color(240, 240, 240)); // imagesButton.setBackground(new Color(240, 240, 240));
videosButton.setSelected(true); // videosButton.setSelected(true);
videosButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/tick.png"))); // videosButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/tick.png")));
videosButton.setBackground(Color.blue); // videosButton.setBackground(Color.blue);
dataSourceCheckbox.setVisible(true); dataSourceCheckbox.setVisible(true);
dataSourceScrollPane.setVisible(true); dataSourceScrollPane.setVisible(true);
dataSourceList.setVisible(true); dataSourceList.setVisible(true);
@ -177,6 +172,10 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
notableCheckbox.setVisible(false); notableCheckbox.setVisible(false);
} }
void resetPanel(){
customizeComponents();
}
/** /**
* Set up all the UI components * Set up all the UI components
*/ */
@ -196,19 +195,21 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
setUpObjectFilter(); setUpObjectFilter();
setUpScoreFilter(); setUpScoreFilter();
groupByCombobox.removeAllItems();
// Set up the grouping attributes // Set up the grouping attributes
for (FileSearch.GroupingAttributeType type : FileSearch.GroupingAttributeType.getOptionsForGroupingImages()) { for (FileSearch.GroupingAttributeType type : FileSearch.GroupingAttributeType.getOptionsForGroupingImages()) {
if (type != GroupingAttributeType.FREQUENCY || EamDb.isEnabled()) { if (type != GroupingAttributeType.FREQUENCY || EamDb.isEnabled()) {
groupByCombobox.addItem(type); groupByCombobox.addItem(type);
} }
} }
orderByCombobox.removeAllItems();
// Set up the file order list // Set up the file order list
for (FileSorter.SortingMethod method : FileSorter.SortingMethod.getOptionsForOrderingImages()) { for (FileSorter.SortingMethod method : FileSorter.SortingMethod.getOptionsForOrderingImages()) {
if (method != SortingMethod.BY_FREQUENCY || EamDb.isEnabled()) { if (method != SortingMethod.BY_FREQUENCY || EamDb.isEnabled()) {
orderByCombobox.addItem(method); orderByCombobox.addItem(method);
} }
} }
imagesSelected();
validateFields(); validateFields();
} }
@ -226,7 +227,9 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
list.addListSelectionListener(new ListSelectionListener() { list.addListSelectionListener(new ListSelectionListener() {
@Override @Override
public void valueChanged(ListSelectionEvent evt) { public void valueChanged(ListSelectionEvent evt) {
validateFields(); if (!evt.getValueIsAdjusting()) {
validateFields();
}
} }
}); });
} }
@ -239,7 +242,8 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
int count = 0; int count = 0;
try { try {
DefaultListModel<DataSourceItem> dsListModel = (DefaultListModel<DataSourceItem>) dataSourceList.getModel(); DefaultListModel<DataSourceItem> dsListModel = (DefaultListModel<DataSourceItem>) dataSourceList.getModel();
for (DataSource ds : caseDb.getDataSources()) { dsListModel.removeAllElements();
for (DataSource ds : Case.getCurrentCase().getSleuthkitCase().getDataSources()) {
dsListModel.add(count, new DataSourceItem(ds)); dsListModel.add(count, new DataSourceItem(ds));
} }
} catch (TskCoreException ex) { } catch (TskCoreException ex) {
@ -254,13 +258,15 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
* Initialize the frequency filter * Initialize the frequency filter
*/ */
private void setUpFrequencyFilter() { private void setUpFrequencyFilter() {
if (centralRepoDb == null) { int count = 0;
crFrequencyList.setEnabled(false); DefaultListModel<FileSearchData.Frequency> frequencyListModel = (DefaultListModel<FileSearchData.Frequency>) crFrequencyList.getModel();
crFrequencyCheckbox.setEnabled(false); frequencyListModel.removeAllElements();
if (!EamDb.isEnabled()) {
for (FileSearchData.Frequency freq : FileSearchData.Frequency.getOptionsForFilteringWithoutCr()) {
frequencyListModel.add(count, freq);
}
} else { } else {
int count = 0; for (FileSearchData.Frequency freq : FileSearchData.Frequency.getOptionsForFilteringWithCr()) {
DefaultListModel<FileSearchData.Frequency> frequencyListModel = (DefaultListModel<FileSearchData.Frequency>) crFrequencyList.getModel();
for (FileSearchData.Frequency freq : FileSearchData.Frequency.getOptionsForFiltering()) {
frequencyListModel.add(count, freq); frequencyListModel.add(count, freq);
} }
} }
@ -273,6 +279,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private void setUpSizeFilter() { private void setUpSizeFilter() {
int count = 0; int count = 0;
DefaultListModel<FileSearchData.FileSize> sizeListModel = (DefaultListModel<FileSearchData.FileSize>) sizeList.getModel(); DefaultListModel<FileSearchData.FileSize> sizeListModel = (DefaultListModel<FileSearchData.FileSize>) sizeList.getModel();
sizeListModel.removeAllElements();
for (FileSearchData.FileSize size : FileSearchData.FileSize.values()) { for (FileSearchData.FileSize size : FileSearchData.FileSize.values()) {
sizeListModel.add(count, size); sizeListModel.add(count, size);
} }
@ -286,7 +293,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
int count = 0; int count = 0;
try { try {
DefaultListModel<String> kwListModel = (DefaultListModel<String>) keywordList.getModel(); DefaultListModel<String> kwListModel = (DefaultListModel<String>) keywordList.getModel();
kwListModel.removeAllElements();
List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT, List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_KEYWORD_HIT,
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME); BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME);
for (String name : setNames) { for (String name : setNames) {
@ -307,7 +314,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
int count = 0; int count = 0;
try { try {
DefaultListModel<String> hashListModel = (DefaultListModel<String>) hashSetList.getModel(); DefaultListModel<String> hashListModel = (DefaultListModel<String>) hashSetList.getModel();
hashListModel.removeAllElements();
List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT, List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_HASHSET_HIT,
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME); BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME);
for (String name : setNames) { for (String name : setNames) {
@ -329,7 +336,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
int count = 0; int count = 0;
try { try {
DefaultListModel<String> intListModel = (DefaultListModel<String>) interestingItemsList.getModel(); DefaultListModel<String> intListModel = (DefaultListModel<String>) interestingItemsList.getModel();
intListModel.removeAllElements();
List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT, List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT,
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME); BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME);
for (String name : setNames) { for (String name : setNames) {
@ -351,8 +358,8 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
int count = 0; int count = 0;
try { try {
DefaultListModel<TagName> tagsListModel = (DefaultListModel<TagName>) tagsList.getModel(); DefaultListModel<TagName> tagsListModel = (DefaultListModel<TagName>) tagsList.getModel();
tagsListModel.removeAllElements();
List<TagName> tagNames = caseDb.getTagNamesInUse(); List<TagName> tagNames = Case.getCurrentCase().getSleuthkitCase().getTagNamesInUse();
for (TagName name : tagNames) { for (TagName name : tagNames) {
tagsListModel.add(count, name); tagsListModel.add(count, name);
count++; count++;
@ -396,7 +403,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
int count = 0; int count = 0;
try { try {
DefaultListModel<String> objListModel = (DefaultListModel<String>) objectsList.getModel(); DefaultListModel<String> objListModel = (DefaultListModel<String>) objectsList.getModel();
objListModel.removeAllElements();
List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_OBJECT_DETECTED, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DESCRIPTION); List<String> setNames = getSetNames(BlackboardArtifact.ARTIFACT_TYPE.TSK_OBJECT_DETECTED, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DESCRIPTION);
for (String name : setNames) { for (String name : setNames) {
objListModel.add(count, name); objListModel.add(count, name);
@ -417,6 +424,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
int count = 0; int count = 0;
DefaultListModel<Score> scoreListModel = (DefaultListModel<Score>) scoreList.getModel(); DefaultListModel<Score> scoreListModel = (DefaultListModel<Score>) scoreList.getModel();
scoreListModel.removeAllElements();
for (Score score : Score.getOptionsForFiltering()) { for (Score score : Score.getOptionsForFiltering()) {
scoreListModel.add(count, score); scoreListModel.add(count, score);
} }
@ -436,7 +444,7 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
* @throws TskCoreException * @throws TskCoreException
*/ */
private List<String> getSetNames(BlackboardArtifact.ARTIFACT_TYPE artifactType, BlackboardAttribute.ATTRIBUTE_TYPE setNameAttribute) throws TskCoreException { private List<String> getSetNames(BlackboardArtifact.ARTIFACT_TYPE artifactType, BlackboardAttribute.ATTRIBUTE_TYPE setNameAttribute) throws TskCoreException {
List<BlackboardArtifact> arts = caseDb.getBlackboardArtifacts(artifactType); List<BlackboardArtifact> arts = Case.getCurrentCase().getSleuthkitCase().getBlackboardArtifacts(artifactType);
List<String> setNames = new ArrayList<>(); List<String> setNames = new ArrayList<>();
for (BlackboardArtifact art : arts) { for (BlackboardArtifact art : arts) {
for (BlackboardAttribute attr : art.getAttributes()) { for (BlackboardAttribute attr : art.getAttributes()) {
@ -456,8 +464,6 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
* Initialize the parent path filter * Initialize the parent path filter
*/ */
private void setUpParentPathFilter() { private void setUpParentPathFilter() {
parentPathButtonGroup.add(fullRadioButton);
parentPathButtonGroup.add(substringRadioButton);
fullRadioButton.setSelected(true); fullRadioButton.setSelected(true);
includeRadioButton.setSelected(true); includeRadioButton.setSelected(true);
parentListModel = (DefaultListModel<FileSearchFiltering.ParentSearchTerm>) parentList.getModel(); parentListModel = (DefaultListModel<FileSearchFiltering.ParentSearchTerm>) parentList.getModel();
@ -472,12 +478,12 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
List<FileSearchFiltering.FileFilter> getFilters() { List<FileSearchFiltering.FileFilter> getFilters() {
List<FileSearchFiltering.FileFilter> filters = new ArrayList<>(); List<FileSearchFiltering.FileFilter> filters = new ArrayList<>();
// There will always be a file type selected // // There will always be a file type selected
if (imagesButton.isSelected()) { // if (imagesButton.isSelected()) {
filters.add(new FileSearchFiltering.FileTypeFilter(FileType.IMAGE)); filters.add(new FileSearchFiltering.FileTypeFilter(FileType.IMAGE));
} else if (videosButton.isSelected()) { // } else if (videosButton.isSelected()) {
filters.add(new FileSearchFiltering.FileTypeFilter(FileType.VIDEO)); // filters.add(new FileSearchFiltering.FileTypeFilter(FileType.VIDEO));
} // }
if (parentCheckbox.isSelected()) { if (parentCheckbox.isSelected()) {
// For the parent paths, everything in the box is used (not just the selected entries) // For the parent paths, everything in the box is used (not just the selected entries)
@ -612,11 +618,11 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
* use bundle messages. * use bundle messages.
*/ */
private void validateFields() { private void validateFields() {
// There must be at least one file type selected // // There must be at least one file type selected
if (imagesButton.isSelected() || videosButton.isSelected()) { // if (imagesButton.isSelected() || videosButton.isSelected()) {
setInvalid("At least one file type must be selected"); // setInvalid("At least one file type must be selected");
return; // return;
} // }
// For most enabled filters, there should be something selected // For most enabled filters, there should be something selected
if (dataSourceCheckbox.isSelected() && dataSourceList.getSelectedValuesList().isEmpty()) { if (dataSourceCheckbox.isSelected() && dataSourceList.getSelectedValuesList().isEmpty()) {
setInvalid("At least one data source must be selected"); setInvalid("At least one data source must be selected");
@ -755,8 +761,6 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
groupByLabel = new javax.swing.JLabel(); groupByLabel = new javax.swing.JLabel();
errorLabel = new javax.swing.JLabel(); errorLabel = new javax.swing.JLabel();
cancelButton = new javax.swing.JButton(); cancelButton = new javax.swing.JButton();
imagesButton = new javax.swing.JButton();
videosButton = new javax.swing.JButton();
setMinimumSize(new java.awt.Dimension(424, 0)); setMinimumSize(new java.awt.Dimension(424, 0));
setPreferredSize(new java.awt.Dimension(424, 533)); setPreferredSize(new java.awt.Dimension(424, 533));
@ -1271,42 +1275,15 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
} }
}); });
org.openide.awt.Mnemonics.setLocalizedText(imagesButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.imagesButton.text")); // NOI18N
typeButtonGroup.add(imagesButton);
imagesButton.setMargin(new java.awt.Insets(2, 8, 2, 8));
imagesButton.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/tick.png"))); // NOI18N
imagesButton.setVerifyInputWhenFocusTarget(false);
imagesButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
imagesButtonActionPerformed(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(videosButton, org.openide.util.NbBundle.getMessage(FileSearchPanel.class, "FileSearchPanel.videosButton.text")); // NOI18N
typeButtonGroup.add(videosButton);
videosButton.setMargin(new java.awt.Insets(2, 8, 2, 8));
videosButton.setSelectedIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/tick.png"))); // NOI18N
videosButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
videosButtonActionPerformed(evt);
}
});
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout); this.setLayout(layout);
layout.setHorizontalGroup( layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addComponent(imagesButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(videosButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup() .addGroup(layout.createSequentialGroup()
.addGap(4, 4, 4) .addContainerGap()
.addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(errorLabel, javax.swing.GroupLayout.DEFAULT_SIZE, 268, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton) .addComponent(cancelButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
@ -1325,19 +1302,17 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
layout.setVerticalGroup( layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addGap(8, 8, 8) .addGap(6, 6, 6)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(filtersScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE)
.addComponent(imagesButton)
.addComponent(videosButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(filtersScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 307, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(sortingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(sortingPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelButton) .addComponent(cancelButton)
.addComponent(searchButton)) .addComponent(searchButton)
.addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGroup(layout.createSequentialGroup()
.addComponent(errorLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(6, 6, 6))))
); );
}// </editor-fold>//GEN-END:initComponents }// </editor-fold>//GEN-END:initComponents
@ -1346,9 +1321,9 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
FileType searchType = FileType.IMAGE; //default to images FileType searchType = FileType.IMAGE; //default to images
// There will always be a file type selected // There will always be a file type selected
if (videosButton.isSelected()) { // if (videosButton.isSelected()) {
searchType = FileType.VIDEO; // searchType = FileType.VIDEO;
} // }
DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchStartedEvent(searchType)); DiscoveryEvents.getDiscoveryEventBus().post(new DiscoveryEvents.SearchStartedEvent(searchType));
// For testing, allow the user to run different searches in loop // For testing, allow the user to run different searches in loop
@ -1361,6 +1336,15 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
// Get the file sorting method // Get the file sorting method
FileSorter.SortingMethod fileSort = getFileSortingMethod(); FileSorter.SortingMethod fileSort = getFileSortingMethod();
EamDb centralRepoDb = null;
if (EamDb.isEnabled()) {
try {
centralRepoDb = EamDb.getInstance();
} catch (EamDbException ex) {
centralRepoDb = null;
logger.log(Level.SEVERE, "Error loading central repository database, no central repository options will be available for File Discovery", ex);
}
}
searchWorker = new SearchWorker(centralRepoDb, filters, groupingAttr, groupSortAlgorithm, fileSort); searchWorker = new SearchWorker(centralRepoDb, filters, groupingAttr, groupSortAlgorithm, fileSort);
searchWorker.execute(); searchWorker.execute();
}//GEN-LAST:event_searchButtonActionPerformed }//GEN-LAST:event_searchButtonActionPerformed
@ -1380,8 +1364,6 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
} }
searchButton.setEnabled(enabled); searchButton.setEnabled(enabled);
cancelButton.setEnabled(!enabled); cancelButton.setEnabled(!enabled);
imagesButton.setEnabled(enabled);
videosButton.setEnabled(enabled);
orderByCombobox.setEnabled(enabled); orderByCombobox.setEnabled(enabled);
groupByCombobox.setEnabled(enabled); groupByCombobox.setEnabled(enabled);
attributeRadioButton.setEnabled(enabled); attributeRadioButton.setEnabled(enabled);
@ -1538,16 +1520,6 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
scoreList.setEnabled(scoreCheckbox.isSelected()); scoreList.setEnabled(scoreCheckbox.isSelected());
}//GEN-LAST:event_scoreCheckboxActionPerformed }//GEN-LAST:event_scoreCheckboxActionPerformed
private void imagesButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_imagesButtonActionPerformed
imagesSelected();
validateFields();
}//GEN-LAST:event_imagesButtonActionPerformed
private void videosButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_videosButtonActionPerformed
videosSelected();
validateFields();
}//GEN-LAST:event_videosButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables // Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton addButton; private javax.swing.JButton addButton;
@ -1572,7 +1544,6 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private javax.swing.JCheckBox hashSetCheckbox; private javax.swing.JCheckBox hashSetCheckbox;
private javax.swing.JList<String> hashSetList; private javax.swing.JList<String> hashSetList;
private javax.swing.JScrollPane hashSetScrollPane; private javax.swing.JScrollPane hashSetScrollPane;
private javax.swing.JButton imagesButton;
private javax.swing.JRadioButton includeRadioButton; private javax.swing.JRadioButton includeRadioButton;
private javax.swing.JCheckBox interestingItemsCheckbox; private javax.swing.JCheckBox interestingItemsCheckbox;
private javax.swing.JList<String> interestingItemsList; private javax.swing.JList<String> interestingItemsList;
@ -1609,7 +1580,6 @@ final class FileSearchPanel extends javax.swing.JPanel implements ActionListener
private javax.swing.JList<TagName> tagsList; private javax.swing.JList<TagName> tagsList;
private javax.swing.JScrollPane tagsScrollPane; private javax.swing.JScrollPane tagsScrollPane;
private javax.swing.ButtonGroup typeButtonGroup; private javax.swing.ButtonGroup typeButtonGroup;
private javax.swing.JButton videosButton;
// End of variables declaration//GEN-END:variables // End of variables declaration//GEN-END:variables
} }

View File

@ -41,6 +41,13 @@
<SubComponents> <SubComponents>
<Component class="javax.swing.JList" name="groupKeyList"> <Component class="javax.swing.JList" name="groupKeyList">
<Properties> <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"> <Property name="model" type="javax.swing.ListModel" editor="org.netbeans.modules.form.RADConnectionPropertyEditor">
<Connection code="new DefaultListModel&lt;GroupKey&gt;()" type="code"/> <Connection code="new DefaultListModel&lt;GroupKey&gt;()" type="code"/>
</Property> </Property>

View File

@ -90,6 +90,7 @@ class GroupListPanel extends javax.swing.JPanel {
groupListScrollPane = new javax.swing.JScrollPane(); groupListScrollPane = new javax.swing.JScrollPane();
groupKeyList = new javax.swing.JList<>(); 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.setModel(new DefaultListModel<GroupKey>());
groupKeyList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION); groupKeyList.setSelectionMode(javax.swing.ListSelectionModel.SINGLE_SELECTION);
groupKeyList.setCellRenderer(new GroupListRenderer()); groupKeyList.setCellRenderer(new GroupListRenderer());

View File

@ -27,6 +27,7 @@ import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
import java.util.logging.Level;
import javax.swing.DefaultListCellRenderer; import javax.swing.DefaultListCellRenderer;
import javax.swing.DefaultListModel; import javax.swing.DefaultListModel;
import javax.swing.JList; 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.AddContentTagAction;
import org.sleuthkit.autopsy.actions.DeleteFileContentTagAction; import org.sleuthkit.autopsy.actions.DeleteFileContentTagAction;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb; 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.ImageUtils;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.FileNode; import org.sleuthkit.autopsy.datamodel.FileNode;
import org.sleuthkit.autopsy.directorytree.ExternalViewerAction; import org.sleuthkit.autopsy.directorytree.ExternalViewerAction;
import org.sleuthkit.autopsy.directorytree.ViewContextAction; import org.sleuthkit.autopsy.directorytree.ViewContextAction;
@ -57,6 +60,7 @@ import org.sleuthkit.datamodel.TskCoreException;
public class ResultsPanel extends javax.swing.JPanel { public class ResultsPanel extends javax.swing.JPanel {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
private final static Logger logger = Logger.getLogger(ResultsPanel.class.getName());
private final VideoThumbnailViewer videoThumbnailViewer; private final VideoThumbnailViewer videoThumbnailViewer;
private final ImageThumbnailViewer imageThumbnailViewer; private final ImageThumbnailViewer imageThumbnailViewer;
private List<FileSearchFiltering.FileFilter> searchFilters; private List<FileSearchFiltering.FileFilter> searchFilters;
@ -67,7 +71,6 @@ public class ResultsPanel extends javax.swing.JPanel {
private int currentPage = 0; private int currentPage = 0;
private int previousPageSize = 10; private int previousPageSize = 10;
private FileSearchData.FileType resultType; private FileSearchData.FileType resultType;
private final EamDb centralRepo;
private int groupSize = 0; private int groupSize = 0;
private PageWorker pageWorker; private PageWorker pageWorker;
private final List<SwingWorker<Void, Void>> thumbnailWorkers = new ArrayList<>(); 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", @Messages({"ResultsPanel.viewFileInDir.name=View File in Directory",
"ResultsPanel.openInExternalViewer.name=Open in External Viewer"}) "ResultsPanel.openInExternalViewer.name=Open in External Viewer"})
public ResultsPanel(EamDb centralRepo) { public ResultsPanel() {
initComponents(); initComponents();
this.centralRepo = centralRepo;
imageThumbnailViewer = new ImageThumbnailViewer(); imageThumbnailViewer = new ImageThumbnailViewer();
videoThumbnailViewer = new VideoThumbnailViewer(); videoThumbnailViewer = new VideoThumbnailViewer();
videoThumbnailViewer.addListSelectionListener((e) -> { videoThumbnailViewer.addListSelectionListener((e) -> {
@ -299,6 +301,15 @@ public class ResultsPanel extends javax.swing.JPanel {
if (pageWorker != null && !pageWorker.isDone()) { if (pageWorker != null && !pageWorker.isDone()) {
pageWorker.cancel(true); 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 = new PageWorker(searchFilters, groupingAttribute, groupSort, fileSortMethod, selectedGroupKey, startingEntry, pageSize, resultType, centralRepo);
pageWorker.execute(); pageWorker.execute();
} }