merge from FilterBugFix Branch resolution

This commit is contained in:
William Schaefer 2017-02-01 15:35:26 -05:00
commit eae04f4474
9 changed files with 64 additions and 38 deletions

View File

@ -1,15 +1,15 @@
/*
* Autopsy Forensic Browser
*
*
* Copyright 2011-2016 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
*
* http://www.apache.org/licenses/LICENSE-2.0
*
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@ -46,6 +46,7 @@ import org.sleuthkit.datamodel.Directory;
import org.sleuthkit.datamodel.File;
import org.sleuthkit.datamodel.LayoutFile;
import org.sleuthkit.datamodel.LocalFile;
import org.sleuthkit.datamodel.SlackFile;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
@ -75,8 +76,8 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
}
/*
* The pcl is in the class because it has the easiest mechanisms to add
* and remove itself during its life cycles.
* The pcl is in the class because it has the easiest mechanisms to add and
* remove itself during its life cycles.
*/
private final PropertyChangeListener pcl = (PropertyChangeEvent evt) -> {
String eventType = evt.getPropertyName();
@ -108,7 +109,7 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
* Retrieve the media types by retrieving the keyset from the hashmap.
*
* @return mediaTypes - a list of strings representing all distinct media
* types of files for this case
* types of files for this case
*/
private List<String> getMediaTypeList() {
synchronized (existingMimeTypes) {
@ -129,6 +130,9 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
allDistinctMimeTypesQuery.append(" AND (type IN (").append(TskData.TSK_DB_FILES_TYPE_ENUM.FS.ordinal()).append(","); //NON-NLS
allDistinctMimeTypesQuery.append(TskData.TSK_DB_FILES_TYPE_ENUM.CARVED.ordinal()).append(",");
allDistinctMimeTypesQuery.append(TskData.TSK_DB_FILES_TYPE_ENUM.DERIVED.ordinal()).append(",");
if (!UserPreferences.hideSlackFilesInViewsTree()) {
allDistinctMimeTypesQuery.append(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.ordinal()).append(",");
}
allDistinctMimeTypesQuery.append(TskData.TSK_DB_FILES_TYPE_ENUM.LOCAL.ordinal()).append("))");
synchronized (existingMimeTypes) {
existingMimeTypes.clear();
@ -178,8 +182,9 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
* empty.
*
* @param node the Node which you wish to check.
*
* @return True if originNode is an instance of ByMimeTypeNode and is empty,
* false otherwise.
* false otherwise.
*/
public static boolean isEmptyMimeTypeNode(Node node) {
boolean isEmptyMimeNode = false;
@ -346,7 +351,7 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
* of files which it represents.
*
* @param mimeType - the complete MimeType, needed for accurate query
* results
* results
*/
private void updateDisplayName(String mimeType) {
@ -401,7 +406,7 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
* Get children count without actually loading all nodes
*
* @return count(*) - the number of items that will be shown in this
* items Directory Listing
* items Directory Listing
*/
private long calculateItems(SleuthkitCase sleuthkitCase, String mime_type) {
try {
@ -418,7 +423,8 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
* which match this mime type and their information.
*
* @param list - will contain all files and their attributes from the
* tsk_files table where mime_type matches the one specified
* tsk_files table where mime_type matches the one specified
*
* @return true
*/
@Override
@ -439,8 +445,9 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
* tsk_files.
*
* @param mimeType - the complete mimetype of the file mediatype/subtype
*
* @return query.toString - portion of SQL query which will follow a
* WHERE clause.
* WHERE clause.
*/
private String createQuery(String mime_type) {
StringBuilder query = new StringBuilder();
@ -448,6 +455,9 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
query.append(" AND (type IN (").append(TskData.TSK_DB_FILES_TYPE_ENUM.FS.ordinal()).append(","); //NON-NLS
query.append(TskData.TSK_DB_FILES_TYPE_ENUM.CARVED.ordinal()).append(",");
query.append(TskData.TSK_DB_FILES_TYPE_ENUM.DERIVED.ordinal()).append(",");
if (!UserPreferences.hideSlackFilesInViewsTree()) {
query.append(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK.ordinal()).append(",");
}
query.append(TskData.TSK_DB_FILES_TYPE_ENUM.LOCAL.ordinal()).append("))");
if (UserPreferences.hideKnownFilesInViewsTree()) {
query.append(" AND (known IS NULL OR known != ").append(TskData.FileKnown.KNOWN.getFileKnownValue()).append(")"); //NON-NLS
@ -466,6 +476,7 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
* each file
*
* @param key
*
* @return
*/
@Override
@ -496,6 +507,11 @@ public final class FileTypesByMimeType extends Observable implements AutopsyVisi
return new LocalFileNode(lf);
}
@Override
public SlackFileNode visit(SlackFile sf) {
return new SlackFileNode(sf, false);
}
@Override
protected AbstractNode defaultVisit(Content di) {
throw new UnsupportedOperationException(NbBundle.getMessage(this.getClass(), "FileTypeChildren.exception.notSupported.msg", di.toString()));

View File

@ -400,6 +400,7 @@ final class IngestTasksScheduler {
// Skip the task if the file is actually the pseudo-file for the parent
// or current directory.
String fileName = file.getName();
if (fileName.equals(".") || fileName.equals("..")) {
return false;
}
@ -409,7 +410,7 @@ final class IngestTasksScheduler {
* applied to the current run of ingest, checks if unallocated space
* should be processed inside call to fileIsMemberOf
*/
if ((task.getIngestJob().getFileIngestFilter().fileIsMemberOf(file)) == null) {
if (file.isFile() && task.getIngestJob().getFileIngestFilter().fileIsMemberOf(file) == null) {
return false;
}

View File

@ -65,7 +65,6 @@ FilesSetDefsPanel.jLabel1.text=Rule Details
FilesSetDefsPanel.dirsRadioButton.text=Directories
FilesSetDefsPanel.jLabel2.text=File Type:
FilesSetDefsPanel.deleteRuleButton.text=Delete Rule
FilesSetDefsPanel.bothRadioButton.text=Files and Directories
FilesSetDefsPanel.fileNameRegexCheckbox.text=Regex
FilesSetDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files
FilesSetDefsPanel.rulePathConditionTextField.text=
@ -81,3 +80,4 @@ FilesSetRulePanel.allRadioButton.text=All
FilesSetDefsPanel.ingoreUnallocCheckbox.text=Ignore Unallocated Space
FilesSetDefsPanel.ingoreUnallocCheckbox.toolTipText=Ignores unallocated space, such as deleted files. May run faster but produce less complete results.
FilesSetDefsPanel.ingestWarningLabel.text=Ingest is ongoing, some settings will be unavailable until it finishes.
FilesSetDefsPanel.allRadioButton.text=All

View File

@ -39,7 +39,6 @@ FilesSetDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30
FilesSetDefsPanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea
FilesSetDefsPanel.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a
FilesSetDefsPanel.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664
FilesSetDefsPanel.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea
FilesSetDefsPanel.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe
FilesSetDefsPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996
FilesSetDefsPanel.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d

View File

@ -535,7 +535,7 @@ public final class FilesSet implements Serializable {
public boolean passes(AbstractFile file) {
switch (this.type) {
case FILES:
return file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG;
return file.isFile();
case DIRECTORIES:
return file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR;
case FILES_AND_DIRECTORIES:

View File

@ -88,7 +88,7 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="dirsRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="bothRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="allRadioButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="105" max="-2" attributes="0"/>
@ -236,7 +236,7 @@
<Component id="jLabel2" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="filesRadioButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="dirsRadioButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="bothRadioButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="allRadioButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="16" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
@ -603,18 +603,18 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="bothRadioButton">
<Component class="javax.swing.JRadioButton" name="allRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="typeButtonGroup"/>
</Property>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="bothRadioButton" property="font" relativeSize="false" size="11"/>
<Font bold="false" component="allRadioButton" property="font" relativeSize="false" size="11"/>
</FontInfo>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetDefsPanel.bothRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties" key="FilesSetDefsPanel.allRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>

View File

@ -98,6 +98,10 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
this.jLabel8.setVisible(false);
this.equalitySignComboBox.setVisible(false);
this.ignoreKnownFilesCheckbox.setVisible(false);
this.jLabel2.setVisible(false);
this.filesRadioButton.setVisible(false);
this.dirsRadioButton.setVisible(false);
this.allRadioButton.setVisible(false);
this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.jTextArea1.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.setsListLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.editSetButton.text")); // NOI18N
@ -343,7 +347,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
FilesSetDefsPanel.this.dirsRadioButton.setSelected(true);
break;
case FILES_AND_DIRECTORIES:
FilesSetDefsPanel.this.bothRadioButton.setSelected(true);
FilesSetDefsPanel.this.allRadioButton.setSelected(true);
break;
}
if (pathCondition != null) {
@ -556,7 +560,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
fileNameRegexCheckbox = new javax.swing.JCheckBox();
separator = new javax.swing.JSeparator();
setsListLabel = new javax.swing.JLabel();
bothRadioButton = new javax.swing.JRadioButton();
allRadioButton = new javax.swing.JRadioButton();
deleteSetButton = new javax.swing.JButton();
deleteRuleButton = new javax.swing.JButton();
newSetButton = new javax.swing.JButton();
@ -686,10 +690,10 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
setsListLabel.setFont(setsListLabel.getFont().deriveFont(setsListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.setsListLabel.text")); // NOI18N
typeButtonGroup.add(bothRadioButton);
bothRadioButton.setFont(bothRadioButton.getFont().deriveFont(bothRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(bothRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.bothRadioButton.text")); // NOI18N
bothRadioButton.setEnabled(false);
typeButtonGroup.add(allRadioButton);
allRadioButton.setFont(allRadioButton.getFont().deriveFont(allRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(allRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.allRadioButton.text")); // NOI18N
allRadioButton.setEnabled(false);
deleteSetButton.setFont(deleteSetButton.getFont().deriveFont(deleteSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
deleteSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N
@ -802,7 +806,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(dirsRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(bothRadioButton))
.addComponent(allRadioButton))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(105, 105, 105)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -921,7 +925,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
.addComponent(jLabel2)
.addComponent(filesRadioButton)
.addComponent(dirsRadioButton)
.addComponent(bothRadioButton))
.addComponent(allRadioButton))
.addGap(16, 16, 16)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
@ -1023,7 +1027,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp
}//GEN-LAST:event_newRuleButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JRadioButton bothRadioButton;
private javax.swing.JRadioButton allRadioButton;
private javax.swing.JButton deleteRuleButton;
private javax.swing.JButton deleteSetButton;
private javax.swing.JRadioButton dirsRadioButton;

View File

@ -28,8 +28,9 @@ import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel.PANEL_TY
* definitions.
*/
public class FilesSetPanel extends javax.swing.JPanel {
@NbBundle.Messages({"FilesSetPanel.ingest.title=File Ingest Filter", "FilesSetPanel.ingest.createNewFilter=Create new file ingest filter..."})
@NbBundle.Messages({"FilesSetPanel.ingest.title=File Ingest Filter", "FilesSetPanel.ingest.createNewFilter=Create/edit file ingest filter(s)..."})
private static final String CREATE_NEW_FILE_INGEST_FILTER = Bundle.FilesSetPanel_ingest_createNewFilter();
/**
@ -39,7 +40,6 @@ public class FilesSetPanel extends javax.swing.JPanel {
return CREATE_NEW_FILE_INGEST_FILTER;
}
/**
* Construct a files set panel in create mode.
*/

View File

@ -39,8 +39,7 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel.PANEL_TYPE;
/**
* A panel that allows a user to create and edit files set
* membership rules.
* A panel that allows a user to create and edit files set membership rules.
*/
final class FilesSetRulePanel extends javax.swing.JPanel {
@ -75,6 +74,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
fileSizeCheck.setVisible(false);
equalitySymbolComboBox.setVisible(false);
fileSizeSpinner.setVisible(false);
jLabel1.setVisible(false);
filesRadioButton.setVisible(false);
dirsRadioButton.setVisible(false);
allRadioButton.setVisible(false);
org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ingest.jLabel5.text")); // NOI18N
} else {
@ -98,6 +101,10 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
fileSizeCheck.setVisible(false);
equalitySymbolComboBox.setVisible(false);
fileSizeSpinner.setVisible(false);
jLabel1.setVisible(false);
filesRadioButton.setVisible(false);
dirsRadioButton.setVisible(false);
allRadioButton.setVisible(false);
} else {
populateMimeTypesComboBox();
populateMimeConditionComponents(rule);
@ -295,8 +302,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
/**
* Returns whether or not the data entered in the panel constitutes a valid
* files set membership rule definition, displaying a dialog
* explaining the deficiency if the definition is invalid.
* files set membership rule definition, displaying a dialog explaining the
* deficiency if the definition is invalid.
*
* @return True if the definition is valid, false otherwise.
*/
@ -559,7 +566,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel {
this.fileSizeCheck.setSelected(false);
this.mimeCheck.setEnabled(false);
this.mimeCheck.setSelected(false);
} else {
if (this.nameCheck.isSelected()) {
this.extensionRadioButton.setEnabled(true);