mirror of
https://github.com/overcuriousity/autopsy-flatpak.git
synced 2025-07-13 08:26:15 +00:00
Update UI element variable names. Add filtering by mime_type based on check box selection. Needs Brian's changes to use executeQuery instead.
This commit is contained in:
parent
45a06bad41
commit
7754011b69
@ -26,14 +26,16 @@ import java.util.Map;
|
|||||||
*/
|
*/
|
||||||
class AllDataSources extends CommonFilesMetaDataBuilder {
|
class AllDataSources extends CommonFilesMetaDataBuilder {
|
||||||
|
|
||||||
private static final String WHERE_CLAUSE = "md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL) GROUP BY md5 HAVING COUNT(*) > 1) order by md5";
|
private static final String WHERE_CLAUSE = "md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL)%s GROUP BY md5 HAVING COUNT(*) > 1) order by md5";
|
||||||
|
|
||||||
public AllDataSources(Map<Long, String> dataSourceIdMap) {
|
public AllDataSources(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
||||||
super(dataSourceIdMap);
|
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String buildSqlWhereClause() {
|
protected String buildSqlWhereClause() {
|
||||||
return AllDataSources.WHERE_CLAUSE;
|
|
||||||
|
Object[] args = new String[]{determineMimeTypeFilter()};
|
||||||
|
return String.format(AllDataSources.WHERE_CLAUSE, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,12 +1,12 @@
|
|||||||
CommonFilesPanel.searchButton.text=Search
|
CommonFilesPanel.searchButton.text=Search
|
||||||
CommonFilesPanel.withinDataSourceRadioButton.text=Files must be in data source:
|
CommonFilesPanel.withinDataSourceRadioButton.text=Files must be in data source:
|
||||||
CommonFilesPanel.allDataSourcesRadioButton.text=Files can be in any data source
|
CommonFilesPanel.allDataSourcesRadioButton.text=Files can be in any data source
|
||||||
CommonFilesPanel.jLabel1.text=<html>Search for files that exist in multiple data sources:</html>
|
|
||||||
CommonFilesPanel.cancelButton.text=Cancel
|
CommonFilesPanel.cancelButton.text=Cancel
|
||||||
CommonFilesPanel.cancelButton.actionCommand=Cancel
|
CommonFilesPanel.cancelButton.actionCommand=Cancel
|
||||||
CommonFilesPanel.allRadioButton.text=Match on all file types
|
CommonFilesPanel.allRadioButton.text=Match on all file types
|
||||||
CommonFilesPanel.selectedFileCategoriesButton.text=Match on the following file categories:
|
CommonFilesPanel.selectedFileCategoriesButton.text=Match on the following file categories:
|
||||||
CommonFilesPanel.jCheckBox1.text=Pictures and Videos
|
|
||||||
CommonFilesPanel.jCheckBox2.text=Documents
|
|
||||||
CommonFilesPanel.selectedFileCategoriesButton.toolTipText=Select from the options below...
|
CommonFilesPanel.selectedFileCategoriesButton.toolTipText=Select from the options below...
|
||||||
CommonFilesPanel.allRadioButton.toolTipText=No filtering applied to results...
|
CommonFilesPanel.allRadioButton.toolTipText=No filtering applied to results...
|
||||||
|
CommonFilesPanel.pictureVideoCheckbox.text=Pictures and Videos
|
||||||
|
CommonFilesPanel.documentsCheckbox.text=Documents
|
||||||
|
CommonFilesPanel.commonFilesSearchLabel.text=<html>Search for files that exist in multiple data sources:</html>
|
||||||
|
@ -21,14 +21,18 @@ package org.sleuthkit.autopsy.commonfilesearch;
|
|||||||
|
|
||||||
import java.sql.SQLException;
|
import java.sql.SQLException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.stream.Collectors;
|
||||||
|
import java.util.stream.Stream;
|
||||||
import org.openide.util.Exceptions;
|
import org.openide.util.Exceptions;
|
||||||
import org.sleuthkit.autopsy.casemodule.Case;
|
import org.sleuthkit.autopsy.casemodule.Case;
|
||||||
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
|
||||||
|
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
|
||||||
import org.sleuthkit.datamodel.AbstractFile;
|
import org.sleuthkit.datamodel.AbstractFile;
|
||||||
import org.sleuthkit.datamodel.HashUtility;
|
import org.sleuthkit.datamodel.HashUtility;
|
||||||
import org.sleuthkit.datamodel.SleuthkitCase;
|
import org.sleuthkit.datamodel.SleuthkitCase;
|
||||||
@ -44,9 +48,57 @@ import org.sleuthkit.datamodel.TskCoreException;
|
|||||||
abstract class CommonFilesMetaDataBuilder {
|
abstract class CommonFilesMetaDataBuilder {
|
||||||
|
|
||||||
private final Map<Long, String> dataSourceIdToNameMap;
|
private final Map<Long, String> dataSourceIdToNameMap;
|
||||||
|
private final boolean filterByMedia;
|
||||||
|
private final boolean filterByDoc;
|
||||||
|
private final String filterByMimeTypesWhereClause = " and mime_type in (%s)"; // where %s is csv list of mime_types to filter on
|
||||||
|
|
||||||
CommonFilesMetaDataBuilder(Map<Long, String> dataSourceIdMap) {
|
/*
|
||||||
|
* The set of the MIME types that will be checked for extension mismatches
|
||||||
|
* when checkType is ONLY_MEDIA.
|
||||||
|
*/
|
||||||
|
private static final Set<String> MEDIA_PICS_VIDEO_MIME_TYPES = Stream.of(
|
||||||
|
"image/bmp",
|
||||||
|
"image/gif",
|
||||||
|
"image/jpeg",
|
||||||
|
"image/png",
|
||||||
|
"image/tiff",
|
||||||
|
"image/x-ms-bmp",
|
||||||
|
"image/x-icon",
|
||||||
|
"video/webm",
|
||||||
|
"video/3gpp",
|
||||||
|
"video/3gpp2",
|
||||||
|
"video/ogg",
|
||||||
|
"video/mpeg",
|
||||||
|
"video/x-msvideo"
|
||||||
|
).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The set of the MIME types that will be checked for extension mismatches
|
||||||
|
* when checkType is ONLY_TEXT_FILES.
|
||||||
|
*/
|
||||||
|
private static final Set<String> TEXT_FILES_MIME_TYPES = Stream.of(
|
||||||
|
"text/plain",
|
||||||
|
"application/rtf",
|
||||||
|
"application/pdf",
|
||||||
|
"text/css",
|
||||||
|
"text/html",
|
||||||
|
"text/csv",
|
||||||
|
"application/json",
|
||||||
|
"application/javascript",
|
||||||
|
"application/xml",
|
||||||
|
"text/calendar",
|
||||||
|
"application/msword", //NON-NLS
|
||||||
|
"application/vnd.openxmlformats-officedocument.wordprocessingml.document", //NON-NLS
|
||||||
|
"application/vnd.ms-powerpoint", //NON-NLS
|
||||||
|
"application/vnd.openxmlformats-officedocument.presentationml.presentation", //NON-NLS
|
||||||
|
"application/vnd.ms-excel", //NON-NLS
|
||||||
|
"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" //NON-NLS
|
||||||
|
).collect(Collectors.toSet());
|
||||||
|
|
||||||
|
CommonFilesMetaDataBuilder(Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
||||||
dataSourceIdToNameMap = dataSourceIdMap;
|
dataSourceIdToNameMap = dataSourceIdMap;
|
||||||
|
filterByMedia = filterByMediaMimeType;
|
||||||
|
filterByDoc = filterByDocMimeType;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addDataSource(Set<String> dataSources, AbstractFile file, Map<Long, String> dataSourceIdToNameMap) {
|
private void addDataSource(Set<String> dataSources, AbstractFile file, Map<Long, String> dataSourceIdToNameMap) {
|
||||||
@ -95,8 +147,8 @@ abstract class CommonFilesMetaDataBuilder {
|
|||||||
for (AbstractFile file : files) {
|
for (AbstractFile file : files) {
|
||||||
|
|
||||||
String currentMd5 = file.getMd5Hash();
|
String currentMd5 = file.getMd5Hash();
|
||||||
if((currentMd5 == null) || (HashUtility.isNoDataMd5(currentMd5))) {
|
if ((currentMd5 == null) || (HashUtility.isNoDataMd5(currentMd5))) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
if (parentNodes.containsKey(currentMd5)) {
|
if (parentNodes.containsKey(currentMd5)) {
|
||||||
parentNodes.get(currentMd5).add(file);
|
parentNodes.get(currentMd5).add(file);
|
||||||
@ -122,4 +174,23 @@ abstract class CommonFilesMetaDataBuilder {
|
|||||||
List<AbstractFile> files = sleuthkitCase.findAllFilesWhere(whereClause);
|
List<AbstractFile> files = sleuthkitCase.findAllFilesWhere(whereClause);
|
||||||
return files;
|
return files;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String determineMimeTypeFilter() {
|
||||||
|
StringBuilder mimeTypeFilter = new StringBuilder();
|
||||||
|
Set<String> mimeTypesToFilterOn = new HashSet<>();
|
||||||
|
String mimeTypeString = "";
|
||||||
|
if(filterByMedia) {
|
||||||
|
mimeTypesToFilterOn.addAll(MEDIA_PICS_VIDEO_MIME_TYPES);
|
||||||
|
}
|
||||||
|
if(filterByDoc) {
|
||||||
|
mimeTypesToFilterOn.addAll(TEXT_FILES_MIME_TYPES);
|
||||||
|
}
|
||||||
|
if(mimeTypesToFilterOn.size() > 0) {
|
||||||
|
for (String mimeType : mimeTypesToFilterOn) {
|
||||||
|
mimeTypeFilter.append("\"" + mimeType + "\",");
|
||||||
|
}
|
||||||
|
mimeTypeString = mimeTypeFilter.toString().substring(0, mimeTypeFilter.length() - 1);
|
||||||
|
}
|
||||||
|
return String.format(filterByMimeTypesWhereClause, new Object[]{mimeTypeString});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -27,35 +27,46 @@
|
|||||||
<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" attributes="0">
|
<Group type="102" alignment="0" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="selectDataSourceComboBox" alignment="1" max="32767" attributes="0"/>
|
<Group type="102" attributes="0">
|
||||||
<Group type="102" alignment="0" attributes="0">
|
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
|
||||||
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
<Component id="pictureVideoCheckbox" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="searchButton" min="-2" max="-2" attributes="0"/>
|
<EmptySpace max="32767" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</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">
|
||||||
<Component id="withinDataSourceRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
<Group type="102" attributes="0">
|
||||||
<Component id="allDataSourcesRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="jLabel1" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="allRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Component id="selectedFileCategoriesButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
|
||||||
<Group type="102" alignment="0" attributes="0">
|
|
||||||
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
|
|
||||||
<Group type="103" groupAlignment="0" attributes="0">
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
|
<Component id="withinDataSourceRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
|
<Component id="allDataSourcesRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="commonFilesSearchLabel" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="allRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Component id="selectedFileCategoriesButton" alignment="0" min="-2" max="-2" attributes="0"/>
|
||||||
|
<Group type="102" alignment="0" attributes="0">
|
||||||
|
<EmptySpace min="21" pref="21" max="-2" attributes="0"/>
|
||||||
|
<Component id="documentsCheckbox" min="-2" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
</Group>
|
||||||
|
<EmptySpace min="0" pref="3" max="32767" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
|
||||||
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<Component id="searchButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
<Component id="cancelButton" min="-2" max="-2" attributes="0"/>
|
||||||
|
<EmptySpace min="-2" pref="12" max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
|
<Component id="selectDataSourceComboBox" alignment="1" min="-2" pref="261" max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace min="0" pref="54" max="32767" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</DimensionLayout>
|
</DimensionLayout>
|
||||||
@ -63,25 +74,33 @@
|
|||||||
<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 max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jLabel1" min="-2" max="-2" attributes="0"/>
|
<Component id="commonFilesSearchLabel" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="allDataSourcesRadioButton" min="-2" max="-2" attributes="0"/>
|
<Component id="allDataSourcesRadioButton" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
<EmptySpace type="unrelated" max="-2" attributes="0"/>
|
||||||
<Component id="withinDataSourceRadioButton" min="-2" max="-2" attributes="0"/>
|
<Component id="withinDataSourceRadioButton" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="selectDataSourceComboBox" min="-2" max="-2" attributes="0"/>
|
<Component id="selectDataSourceComboBox" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace type="separate" max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="selectedFileCategoriesButton" min="-2" max="-2" attributes="0"/>
|
<Component id="selectedFileCategoriesButton" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<Group type="103" groupAlignment="0" attributes="0">
|
||||||
<Component id="jCheckBox1" min="-2" max="-2" attributes="0"/>
|
<Group type="102" attributes="0">
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="jCheckBox2" min="-2" max="-2" attributes="0"/>
|
<Component id="pictureVideoCheckbox" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="-2" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Component id="allRadioButton" min="-2" max="-2" attributes="0"/>
|
<Component id="documentsCheckbox" min="-2" max="-2" attributes="0"/>
|
||||||
<EmptySpace max="32767" attributes="0"/>
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
<Group type="103" groupAlignment="3" attributes="0">
|
<Component id="allRadioButton" min="-2" max="-2" attributes="0"/>
|
||||||
<Component id="cancelButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
<EmptySpace min="0" pref="55" max="32767" attributes="0"/>
|
||||||
<Component id="searchButton" alignment="3" min="-2" max="-2" attributes="0"/>
|
</Group>
|
||||||
|
<Group type="102" alignment="1" attributes="0">
|
||||||
|
<EmptySpace max="32767" 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>
|
||||||
|
<EmptySpace max="-2" attributes="0"/>
|
||||||
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
</Group>
|
</Group>
|
||||||
@ -143,10 +162,10 @@
|
|||||||
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
<AuxValue name="JavaCodeGenerator_TypeParameters" type="java.lang.String" value="<String>"/>
|
||||||
</AuxValues>
|
</AuxValues>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JLabel" name="jLabel1">
|
<Component class="javax.swing.JLabel" name="commonFilesSearchLabel">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.jLabel1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.commonFilesSearchLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
</Property>
|
</Property>
|
||||||
<Property name="focusable" type="boolean" value="false"/>
|
<Property name="focusable" type="boolean" value="false"/>
|
||||||
</Properties>
|
</Properties>
|
||||||
@ -192,19 +211,19 @@
|
|||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JCheckBox" name="jCheckBox1">
|
<Component class="javax.swing.JCheckBox" name="pictureVideoCheckbox">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="selected" type="boolean" value="true"/>
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.jCheckBox1.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.pictureVideoCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
<Component class="javax.swing.JCheckBox" name="jCheckBox2">
|
<Component class="javax.swing.JCheckBox" name="documentsCheckbox">
|
||||||
<Properties>
|
<Properties>
|
||||||
<Property name="selected" type="boolean" value="true"/>
|
<Property name="selected" type="boolean" value="true"/>
|
||||||
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
|
||||||
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.jCheckBox2.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
<ResourceString bundle="org/sleuthkit/autopsy/commonfilesearch/Bundle.properties" key="CommonFilesPanel.documentsCheckbox.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, "{key}")"/>
|
||||||
</Property>
|
</Property>
|
||||||
</Properties>
|
</Properties>
|
||||||
</Component>
|
</Component>
|
||||||
|
@ -246,13 +246,22 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
|||||||
Long dataSourceId = determineDataSourceId();
|
Long dataSourceId = determineDataSourceId();
|
||||||
|
|
||||||
CommonFilesMetaDataBuilder builder;
|
CommonFilesMetaDataBuilder builder;
|
||||||
|
boolean filterByMedia = false;
|
||||||
|
boolean filterByDocuments = false;
|
||||||
|
if(selectedFileCategoriesButton.isSelected()) {
|
||||||
|
if(pictureVideoCheckbox.isSelected()) {
|
||||||
|
filterByMedia = true;
|
||||||
|
}
|
||||||
|
if(documentsCheckbox.isSelected()) {
|
||||||
|
filterByDocuments = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (dataSourceId == CommonFilesPanel.NO_DATA_SOURCE_SELECTED) {
|
if (dataSourceId == CommonFilesPanel.NO_DATA_SOURCE_SELECTED) {
|
||||||
builder = new AllDataSources(dataSourceMap);
|
builder = new AllDataSources(dataSourceMap, filterByMedia, filterByDocuments);
|
||||||
|
|
||||||
setTitleForAllDataSources();
|
setTitleForAllDataSources();
|
||||||
} else {
|
} else {
|
||||||
builder = new SingleDataSource(dataSourceId, dataSourceMap);
|
builder = new SingleDataSource(dataSourceId, dataSourceMap, filterByMedia, filterByDocuments);
|
||||||
|
|
||||||
setTitleForSingleSource(dataSourceId);
|
setTitleForSingleSource(dataSourceId);
|
||||||
}
|
}
|
||||||
@ -377,12 +386,12 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
|||||||
allDataSourcesRadioButton = new javax.swing.JRadioButton();
|
allDataSourcesRadioButton = new javax.swing.JRadioButton();
|
||||||
withinDataSourceRadioButton = new javax.swing.JRadioButton();
|
withinDataSourceRadioButton = new javax.swing.JRadioButton();
|
||||||
selectDataSourceComboBox = new javax.swing.JComboBox<>();
|
selectDataSourceComboBox = new javax.swing.JComboBox<>();
|
||||||
jLabel1 = new javax.swing.JLabel();
|
commonFilesSearchLabel = new javax.swing.JLabel();
|
||||||
cancelButton = new javax.swing.JButton();
|
cancelButton = new javax.swing.JButton();
|
||||||
allRadioButton = new javax.swing.JRadioButton();
|
allRadioButton = new javax.swing.JRadioButton();
|
||||||
selectedFileCategoriesButton = new javax.swing.JRadioButton();
|
selectedFileCategoriesButton = new javax.swing.JRadioButton();
|
||||||
jCheckBox1 = new javax.swing.JCheckBox();
|
pictureVideoCheckbox = new javax.swing.JCheckBox();
|
||||||
jCheckBox2 = new javax.swing.JCheckBox();
|
documentsCheckbox = new javax.swing.JCheckBox();
|
||||||
|
|
||||||
setPreferredSize(new java.awt.Dimension(300, 200));
|
setPreferredSize(new java.awt.Dimension(300, 200));
|
||||||
|
|
||||||
@ -422,8 +431,8 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.jLabel1.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(commonFilesSearchLabel, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.commonFilesSearchLabel.text")); // NOI18N
|
||||||
jLabel1.setFocusable(false);
|
commonFilesSearchLabel.setFocusable(false);
|
||||||
|
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.cancelButton.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.cancelButton.text")); // NOI18N
|
||||||
cancelButton.setActionCommand(org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.cancelButton.actionCommand")); // NOI18N
|
cancelButton.setActionCommand(org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.cancelButton.actionCommand")); // NOI18N
|
||||||
@ -443,11 +452,11 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
|||||||
org.openide.awt.Mnemonics.setLocalizedText(selectedFileCategoriesButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.selectedFileCategoriesButton.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(selectedFileCategoriesButton, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.selectedFileCategoriesButton.text")); // NOI18N
|
||||||
selectedFileCategoriesButton.setToolTipText(org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.selectedFileCategoriesButton.toolTipText")); // NOI18N
|
selectedFileCategoriesButton.setToolTipText(org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.selectedFileCategoriesButton.toolTipText")); // NOI18N
|
||||||
|
|
||||||
jCheckBox1.setSelected(true);
|
pictureVideoCheckbox.setSelected(true);
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(jCheckBox1, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.jCheckBox1.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(pictureVideoCheckbox, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.pictureVideoCheckbox.text")); // NOI18N
|
||||||
|
|
||||||
jCheckBox2.setSelected(true);
|
documentsCheckbox.setSelected(true);
|
||||||
org.openide.awt.Mnemonics.setLocalizedText(jCheckBox2, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.jCheckBox2.text")); // NOI18N
|
org.openide.awt.Mnemonics.setLocalizedText(documentsCheckbox, org.openide.util.NbBundle.getMessage(CommonFilesPanel.class, "CommonFilesPanel.documentsCheckbox.text")); // NOI18N
|
||||||
|
|
||||||
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
|
||||||
this.setLayout(layout);
|
this.setLayout(layout);
|
||||||
@ -456,50 +465,62 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
|||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.Alignment.TRAILING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(0, 0, Short.MAX_VALUE)
|
.addGap(21, 21, 21)
|
||||||
.addComponent(searchButton)
|
.addComponent(pictureVideoCheckbox)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
|
||||||
.addComponent(cancelButton))
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(withinDataSourceRadioButton)
|
|
||||||
.addComponent(allDataSourcesRadioButton)
|
|
||||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
|
||||||
.addComponent(allRadioButton)
|
|
||||||
.addComponent(selectedFileCategoriesButton)
|
|
||||||
.addGroup(layout.createSequentialGroup()
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addGap(21, 21, 21)
|
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jCheckBox2)
|
.addComponent(withinDataSourceRadioButton)
|
||||||
.addComponent(jCheckBox1))))
|
.addComponent(allDataSourcesRadioButton)
|
||||||
.addGap(0, 54, Short.MAX_VALUE)))
|
.addComponent(commonFilesSearchLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addContainerGap())
|
.addComponent(allRadioButton)
|
||||||
|
.addComponent(selectedFileCategoriesButton)
|
||||||
|
.addGroup(layout.createSequentialGroup()
|
||||||
|
.addGap(21, 21, 21)
|
||||||
|
.addComponent(documentsCheckbox)))
|
||||||
|
.addGap(0, 3, Short.MAX_VALUE))
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addGap(0, 0, Short.MAX_VALUE)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addComponent(searchButton)
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
|
.addComponent(cancelButton)
|
||||||
|
.addGap(12, 12, 12))
|
||||||
|
.addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 261, javax.swing.GroupLayout.PREFERRED_SIZE))))
|
||||||
|
.addContainerGap())))
|
||||||
);
|
);
|
||||||
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()
|
||||||
.addContainerGap()
|
.addContainerGap()
|
||||||
.addComponent(jLabel1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(commonFilesSearchLabel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(allDataSourcesRadioButton)
|
.addComponent(allDataSourcesRadioButton)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
|
||||||
.addComponent(withinDataSourceRadioButton)
|
.addComponent(withinDataSourceRadioButton)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
.addComponent(selectDataSourceComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
|
||||||
.addGap(18, 18, 18)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(selectedFileCategoriesButton)
|
.addComponent(selectedFileCategoriesButton)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
|
||||||
.addComponent(jCheckBox1)
|
.addGroup(layout.createSequentialGroup()
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(jCheckBox2)
|
.addComponent(pictureVideoCheckbox)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addComponent(allRadioButton)
|
.addComponent(documentsCheckbox)
|
||||||
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
|
||||||
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
.addComponent(allRadioButton)
|
||||||
.addComponent(cancelButton)
|
.addGap(0, 55, Short.MAX_VALUE))
|
||||||
.addComponent(searchButton)))
|
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
|
||||||
|
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
|
||||||
|
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
|
||||||
|
.addComponent(cancelButton)
|
||||||
|
.addComponent(searchButton))
|
||||||
|
.addContainerGap())))
|
||||||
);
|
);
|
||||||
}// </editor-fold>//GEN-END:initComponents
|
}// </editor-fold>//GEN-END:initComponents
|
||||||
|
|
||||||
@ -542,11 +563,11 @@ public final class CommonFilesPanel extends javax.swing.JPanel {
|
|||||||
private javax.swing.JRadioButton allDataSourcesRadioButton;
|
private javax.swing.JRadioButton allDataSourcesRadioButton;
|
||||||
private javax.swing.JRadioButton allRadioButton;
|
private javax.swing.JRadioButton allRadioButton;
|
||||||
private javax.swing.JButton cancelButton;
|
private javax.swing.JButton cancelButton;
|
||||||
|
private javax.swing.JLabel commonFilesSearchLabel;
|
||||||
private javax.swing.ButtonGroup dataSourcesButtonGroup;
|
private javax.swing.ButtonGroup dataSourcesButtonGroup;
|
||||||
|
private javax.swing.JCheckBox documentsCheckbox;
|
||||||
private javax.swing.ButtonGroup fileTypeFilterButtonGroup;
|
private javax.swing.ButtonGroup fileTypeFilterButtonGroup;
|
||||||
private javax.swing.JCheckBox jCheckBox1;
|
private javax.swing.JCheckBox pictureVideoCheckbox;
|
||||||
private javax.swing.JCheckBox jCheckBox2;
|
|
||||||
private javax.swing.JLabel jLabel1;
|
|
||||||
private javax.swing.JButton searchButton;
|
private javax.swing.JButton searchButton;
|
||||||
private javax.swing.JComboBox<String> selectDataSourceComboBox;
|
private javax.swing.JComboBox<String> selectDataSourceComboBox;
|
||||||
private javax.swing.JRadioButton selectedFileCategoriesButton;
|
private javax.swing.JRadioButton selectedFileCategoriesButton;
|
||||||
|
@ -19,24 +19,26 @@
|
|||||||
*/
|
*/
|
||||||
package org.sleuthkit.autopsy.commonfilesearch;
|
package org.sleuthkit.autopsy.commonfilesearch;
|
||||||
|
|
||||||
|
import java.util.HashSet;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import java.util.Set;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides logic for selecting common files from a single data source.
|
* Provides logic for selecting common files from a single data source.
|
||||||
*/
|
*/
|
||||||
class SingleDataSource extends CommonFilesMetaDataBuilder {
|
class SingleDataSource extends CommonFilesMetaDataBuilder {
|
||||||
|
|
||||||
private static final String WHERE_CLAUSE = "md5 in (select md5 from tsk_files where md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL) and data_source_obj_id=%s) GROUP BY md5 HAVING COUNT(*) > 1) order by md5";
|
private static final String WHERE_CLAUSE = "md5 in (select md5 from tsk_files where md5 in (select md5 from tsk_files where (known != 1 OR known IS NULL) and data_source_obj_id=%s%s) GROUP BY md5 HAVING COUNT(*) > 1) order by md5";
|
||||||
private final Long selectedDataSourceId;
|
private final Long selectedDataSourceId;
|
||||||
|
|
||||||
public SingleDataSource(Long dataSourceId, Map<Long, String> dataSourceIdMap) {
|
public SingleDataSource(Long dataSourceId, Map<Long, String> dataSourceIdMap, boolean filterByMediaMimeType, boolean filterByDocMimeType) {
|
||||||
super(dataSourceIdMap);
|
super(dataSourceIdMap, filterByMediaMimeType, filterByDocMimeType);
|
||||||
this.selectedDataSourceId = dataSourceId;
|
this.selectedDataSourceId = dataSourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected String buildSqlWhereClause() {
|
protected String buildSqlWhereClause() {
|
||||||
Object[] args = new String[]{Long.toString(this.selectedDataSourceId)};
|
Object[] args = new String[]{Long.toString(this.selectedDataSourceId), determineMimeTypeFilter()};
|
||||||
return String.format(SingleDataSource.WHERE_CLAUSE, args);
|
return String.format(SingleDataSource.WHERE_CLAUSE, args);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user