From 8f762cc1735361671409598f4d77ed72a815a776 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 18 Nov 2016 10:55:01 -0500 Subject: [PATCH 01/50] 1903 InterestingItemDefsManager modified to support new File Filter --- .../autopsy/ingest/IngestTasksScheduler.java | 10 ++- .../modules/interestingitems/FilesFilter.java | 73 +++++++++++++++++ ...FilesIdentifierIngestJobSettingsPanel.java | 4 +- .../FilesIdentifierIngestModule.java | 2 +- .../InterestingItemDefsManager.java | 80 ++++++++++--------- .../InterestingItemDefsPanel.java | 4 +- .../InterestingItemsIngestModuleFactory.java | 2 +- 7 files changed, 130 insertions(+), 45 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index 2a56c71c85..ee73af38ed 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -33,6 +33,7 @@ import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.modules.interestingitems.FilesFilter; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.FileSystem; @@ -410,7 +411,14 @@ final class IngestTasksScheduler { if (fileName.equals(".") || fileName.equals("..")) { return false; } - + + if (file.isFile()){ //is this the criteria we want to be using(will unallocated space files show return true?) + FilesFilter fileFilter; + fileFilter = new FilesFilter(); + if (!fileFilter.match(file)){ + return false; + } + } // Skip the task if the file is one of a select group of special, large // NTFS or FAT file system files. if (file instanceof org.sleuthkit.datamodel.File) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java new file mode 100644 index 0000000000..eb72dd0799 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java @@ -0,0 +1,73 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +package org.sleuthkit.autopsy.modules.interestingitems; + +import java.util.Set; +import org.openide.util.Exceptions; +import org.sleuthkit.datamodel.AbstractFile; + +/** + * + * + */ +public class FilesFilter { + + FilesSet currentRules; + boolean processUnallocatedSpace; + + public static Set getKeys() throws InterestingItemDefsManager.InterestingItemDefsManagerException { + InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); + return manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").keySet(); + } + + public FilesFilter() { + InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); + try { + for (FilesSet fs : manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").values()) { + currentRules = fs; + break; + } + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + Exceptions.printStackTrace(ex); + } + processUnallocatedSpace = true; + } + + public FilesFilter(String key) { + InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); + try { + currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").get(key); + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + Exceptions.printStackTrace(ex); + } + processUnallocatedSpace = true; + } + + /** + * + * + * @return - the active file filter set from the InterestingItemsDefsManager + */ + FilesSet getFileFilterSet() { + return currentRules; + } + + /** + * Return whether or not the file meets any of the rules specified + * + * @param file + * @return fileMatches - true if the file matches a rule, false if no rules + * are matched + */ + public boolean match(AbstractFile file) { + boolean fileMatches = false; + + if (currentRules.fileIsMemberOf(file) != null) { + fileMatches = true; + } + return fileMatches; + } +} diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index bab3117d3a..976900b341 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -83,7 +83,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS */ List filesSetRows = new ArrayList<>(); try { - this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME)); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError()); this.filesSetSnapshot = new TreeMap<>(); @@ -138,7 +138,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS List rowModels = new ArrayList<>(); TreeMap newFilesSetSnapshot; try { - newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME)); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError()); return; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index 95f52b06e1..26e29091a1 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -82,7 +82,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { // to disable the interesting files set definition UI during ingest. List filesSets = new ArrayList<>(); try { - for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets().values()) { + for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME).values()) { if (settings.interestingFilesSetIsEnabled(set.getName())) { filesSets.add(set); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 95ab09eff1..721fb73110 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -51,10 +51,11 @@ final class InterestingItemDefsManager extends Observable { private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); - private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS - private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings"; - private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME; - private static final String LEGACY_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator + LEGACY_FILES_SET_DEFS_FILE_NAME; + static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS + static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings"; + static final String FILE_FILTER_SET_DEFS_SERIALIZATION_NAME = "FileFilterSets.settings"; + private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; + private static final String LEGACY_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; private static InterestingItemDefsManager instance; /** @@ -92,8 +93,8 @@ final class InterestingItemDefsManager extends Observable { * @return A map of interesting files set names to interesting file sets, * possibly empty. */ - synchronized Map getInterestingFilesSets() throws InterestingItemDefsManagerException { - return FilesSetXML.readDefinitionsFile(LEGACY_FILE_SET_DEFS_PATH); + synchronized Map getInterestingFilesSets(String serialFileName, String legacyFilePath) throws InterestingItemDefsManagerException { + return FilesSetXML.readDefinitionsFile(serialFileName, LEGACY_FILE_SET_DEFS_PATH); } /** @@ -103,8 +104,8 @@ final class InterestingItemDefsManager extends Observable { * @param filesSets A mapping of interesting files set names to files sets, * used to enforce unique files set names. */ - synchronized void setInterestingFilesSets(Map filesSets) throws InterestingItemDefsManagerException { - FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH, filesSets); + synchronized void setInterestingFilesSets(Map filesSets, String serialFileName) throws InterestingItemDefsManagerException { + FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH+serialFileName, filesSets); this.setChanged(); this.notifyObservers(); } @@ -143,49 +144,51 @@ final class InterestingItemDefsManager extends Observable { /** * Reads interesting file set definitions from an XML file. * - * @param filePath Path of the set definitions file as a string. + * @param legacyFileName Path of the set definitions file as a string. * * @return The set definitions in a map of set names to sets. */ // Note: This method takes a file path to support the possibility of // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. - static Map readDefinitionsFile(String filePath) throws InterestingItemDefsManagerException { - Map filesSets = readSerializedDefinitions(); + static Map readDefinitionsFile(String serialFileName, String legacyFileName) throws InterestingItemDefsManagerException { + Map filesSets = readSerializedDefinitions(serialFileName); if (!filesSets.isEmpty()) { return filesSets; } // Check if the legacy xml file exists. - File defsFile = new File(filePath); - if (!defsFile.exists()) { - return filesSets; - } + if(!legacyFileName.isEmpty()){ + File defsFile = new File(LEGACY_FILE_SET_DEFS_PATH+legacyFileName); + if (!defsFile.exists()) { + return filesSets; + } - // Check if the file can be read. - if (!defsFile.canRead()) { - logger.log(Level.SEVERE, "Interesting file sets definition file at {0} exists, but cannot be read", filePath); // NON-NLS - return filesSets; - } + // Check if the file can be read. + if (!defsFile.canRead()) { + logger.log(Level.SEVERE, "Interesting file sets definition file at {0} exists, but cannot be read", legacyFileName); // NON-NLS + return filesSets; + } - // Parse the XML in the file. - Document doc = XMLUtil.loadDoc(FilesSetXML.class, filePath); - if (doc == null) { - logger.log(Level.SEVERE, "Failed to parse interesting file sets definition file at {0}", filePath); // NON-NLS - return filesSets; - } + // Parse the XML in the file. + Document doc = XMLUtil.loadDoc(FilesSetXML.class, legacyFileName); + if (doc == null) { + logger.log(Level.SEVERE, "Failed to parse interesting file sets definition file at {0}", legacyFileName); // NON-NLS + return filesSets; + } - // Get the root element. - Element root = doc.getDocumentElement(); - if (root == null) { - logger.log(Level.SEVERE, "Failed to get root {0} element tag of interesting file sets definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, filePath}); // NON-NLS - return filesSets; - } + // Get the root element. + Element root = doc.getDocumentElement(); + if (root == null) { + logger.log(Level.SEVERE, "Failed to get root {0} element tag of interesting file sets definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, legacyFileName}); // NON-NLS + return filesSets; + } - // Read in the files set definitions. - NodeList setElems = root.getElementsByTagName(FILE_SET_TAG); - for (int i = 0; i < setElems.getLength(); ++i) { - readFilesSet((Element) setElems.item(i), filesSets, filePath); + // Read in the files set definitions. + NodeList setElems = root.getElementsByTagName(FILE_SET_TAG); + for (int i = 0; i < setElems.getLength(); ++i) { + readFilesSet((Element) setElems.item(i), filesSets, legacyFileName); + } } return filesSets; } @@ -198,8 +201,9 @@ final class InterestingItemDefsManager extends Observable { * * @throws InterestingItemDefsManagerException if file could not be read */ - private static Map readSerializedDefinitions() throws InterestingItemDefsManagerException { - String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH; + private static Map readSerializedDefinitions(String serialFileName) throws InterestingItemDefsManagerException { + String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH + serialFileName; + System.out.println(filePath); File fileSetFile = new File(filePath); if (fileSetFile.exists()) { try { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index ea1b2f2fdb..7e47fbb022 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -126,7 +126,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp @Override public void saveSettings() { try { - InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets); + InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets, InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_saveError()); } @@ -150,7 +150,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp try { // Get a working copy of the interesting files set definitions and sort // by set name. - this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets()); + this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME)); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_loadError()); this.filesSets = new TreeMap<>(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index 1779c8b3c2..efb33d642f 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -84,7 +84,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto // Doing so also keeps the serialization simple. List enabledFilesSetNames = new ArrayList<>(); try { - for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets().keySet()) { + for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME).keySet()) { enabledFilesSetNames.add(name); } } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { From 5731b442f1904f7ba541582b614a5652950adba7 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 21 Nov 2016 10:23:33 -0500 Subject: [PATCH 02/50] 1903-added Label and unconnected JComboBox to IngestJobSettingsPanel --- .../ingest/IngestJobSettingsPanel.form | 57 +++++++++++++++---- .../ingest/IngestJobSettingsPanel.java | 37 +++++++++--- 2 files changed, 75 insertions(+), 19 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form index 8c98480783..c417ceba0d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form @@ -32,10 +32,14 @@ - - - + + + + + + + @@ -47,22 +51,33 @@ + + + + + + + + - - - + + + + + + - + @@ -74,7 +89,7 @@ - + @@ -83,6 +98,28 @@ + + + + + + + + + + + + + + + + + + + + + + @@ -138,7 +175,7 @@ - + @@ -152,7 +189,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index df7b9c1039..5b18fafa1b 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -188,6 +188,8 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private void initComponents() { timeGroup = new javax.swing.ButtonGroup(); + jLabel1 = new javax.swing.JLabel(); + jComboBox1 = new javax.swing.JComboBox<>(); modulesScrollPane = new javax.swing.JScrollPane(); modulesTable = new javax.swing.JTable(); jPanel1 = new javax.swing.JPanel(); @@ -205,6 +207,10 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { setMinimumSize(new java.awt.Dimension(0, 0)); setPreferredSize(new java.awt.Dimension(625, 450)); + jLabel1.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jLabel1.text_1")); // NOI18N + + jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "All Files and Unallocated Space", "All Files", "Create New...", "Filter 3242" })); + modulesScrollPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(160, 160, 160))); modulesScrollPane.setMinimumSize(new java.awt.Dimension(0, 0)); modulesScrollPane.setPreferredSize(new java.awt.Dimension(160, 160)); @@ -252,7 +258,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 321, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(globalSettingsButton))) @@ -262,7 +268,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(8, 8, 8) @@ -307,9 +313,12 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 256, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(jLabel1)) + .addComponent(modulesScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(processUnallocCheckbox) .addGroup(layout.createSequentialGroup() @@ -318,18 +327,26 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addComponent(pastJobsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(5, 5, 5) .addComponent(jButtonDeselectAll))) - .addGap(0, 0, Short.MAX_VALUE))) + .addGap(0, 34, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 343, Short.MAX_VALUE) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE) + .addGroup(layout.createSequentialGroup() + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addContainerGap() + .addGap(6, 6, 6) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jLabel1)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 335, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButtonSelectAll) @@ -339,7 +356,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(processUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(layout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE) .addContainerGap()))) ); }// //GEN-END:initComponents @@ -403,6 +420,8 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private javax.swing.JPanel ingestSettingsPanel; private javax.swing.JButton jButtonDeselectAll; private javax.swing.JButton jButtonSelectAll; + private javax.swing.JComboBox jComboBox1; + private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator2; From 94e7dc21fb4c592fe29625fef8813fbfde42ecf0 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 23 Nov 2016 15:15:03 -0500 Subject: [PATCH 03/50] 1903 JCombo Box populated with options for file Filter --- .../autopsy/ingest/Bundle.properties | 3 + .../ingest/IngestJobSettingsPanel.form | 12 +- .../ingest/IngestJobSettingsPanel.java | 43 ++++- .../interestingitems/Bundle.properties | 29 ++++ .../interestingitems/Bundle_ja.properties | 23 +++ .../FileFilterDefsOptionsPanelController.java | 161 ++++++++++++++++++ .../modules/interestingitems/FilesFilter.java | 6 +- ...FilesIdentifierIngestJobSettingsPanel.java | 4 +- .../FilesIdentifierIngestModule.java | 2 +- .../InterestingItemDefsManager.java | 27 ++- ...restingItemDefsOptionsPanelController.java | 2 +- .../InterestingItemDefsPanel.java | 25 ++- .../InterestingItemsIngestModuleFactory.java | 4 +- 13 files changed, 309 insertions(+), 32 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties index f8c1816e85..20b6575ebf 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties @@ -115,3 +115,6 @@ gest IngestJobSettingsPanel.globalSettingsButton.actionCommand=Advanced IngestJobSettingsPanel.globalSettingsButton.text=Global Settings IngestJobSettingsPanel.pastJobsButton.text=View Ingest History +IngestJobSettingsPanel.jLabel1.text= +IngestJobSettingsPanel.jLabel2.text=Run Ingest Modules on: +IngestJobSettingsPanel.jLabel1.text_1=Run Ingest Modules on: diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form index c417ceba0d..293b29684d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form @@ -107,15 +107,13 @@ - - - - - - - + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index 5b18fafa1b..f8343b5f49 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -28,6 +28,7 @@ import java.util.ArrayList; import java.util.List; import java.util.logging.Level; import java.util.logging.Logger; +import javax.swing.DefaultComboBoxModel; import javax.swing.Icon; import javax.swing.ImageIcon; import javax.swing.JDialog; @@ -43,6 +44,7 @@ import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; +import org.sleuthkit.autopsy.modules.interestingitems.FileFilterDefsOptionsPanelController; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestModuleInfo; @@ -63,7 +65,8 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private final List modules = new ArrayList<>(); private final IngestModulesTableModel tableModel = new IngestModulesTableModel(); private IngestModuleModel selectedModule; - private static final Logger logger = Logger.getLogger(IngestJobSettingsPanel.class.getName()); + private static final Logger LOGGER = Logger.getLogger(IngestJobSettingsPanel.class.getName()); + private final FileFilterDefsOptionsPanelController controller; /** * Construct a panel to allow a user to make ingest job settings. @@ -72,9 +75,12 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { */ public IngestJobSettingsPanel(IngestJobSettings settings) { this.settings = settings; + this.controller = new FileFilterDefsOptionsPanelController(); + controller.getComponent(controller.getLookup()); for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) { modules.add(new IngestModuleModel(moduleTemplate)); } + initComponents(); customizeComponents(); } @@ -82,23 +88,26 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { /** * Construct a panel to allow a user to make ingest job settings. * - * @param settings The initial settings for the ingest job. + * @param settings The initial settings for the ingest job. * @param dataSources The data sources ingest is being run on. */ IngestJobSettingsPanel(IngestJobSettings settings, List dataSources) { this.settings = settings; this.dataSources.addAll(dataSources); + this.controller = new FileFilterDefsOptionsPanelController(); + controller.getComponent(controller.getLookup()); try { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); ingestJobs.addAll(skCase.getIngestJobs()); } catch (IllegalStateException ex) { - logger.log(Level.SEVERE, "No open case", ex); + LOGGER.log(Level.SEVERE, "No open case", ex); } catch (TskCoreException ex) { - logger.log(Level.SEVERE, "Failed to load ingest job information", ex); + LOGGER.log(Level.SEVERE, "Failed to load ingest job information", ex); } for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) { this.modules.add(new IngestModuleModel(moduleTemplate)); } + initComponents(); customizeComponents(); } @@ -209,7 +218,12 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jLabel1.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jLabel1.text_1")); // NOI18N - jComboBox1.setModel(new javax.swing.DefaultComboBoxModel<>(new String[] { "All Files and Unallocated Space", "All Files", "Create New...", "Filter 3242" })); + jComboBox1.setModel(new DefaultComboBoxModel(controller.getComboBoxContents().toArray())); + jComboBox1.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + jComboBox1ActionPerformed(evt); + } + }); modulesScrollPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(160, 160, 160))); modulesScrollPane.setMinimumSize(new java.awt.Dimension(0, 0)); @@ -407,6 +421,25 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { dialog.setVisible(true); }//GEN-LAST:event_pastJobsButtonActionPerformed + /** + * Perform the appropriate action when Jcombobox items are selected, most + * notably opening the File filter settings when Create New is chosen. + * + * @param evt + */ + private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed + + if (evt.toString().contains("Create New...")) { + final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); + // values.controller.getComboBoxContents().toArray(); + dialog.addApplyButtonListener((ActionEvent e) -> { + controller.applyChanges(); + dialog.close(); + }); + dialog.display((IngestModuleGlobalSettingsPanel)controller.getComponent(controller.getLookup())); + } + }//GEN-LAST:event_jComboBox1ActionPerformed + private void SelectAllModules(boolean set) { for (IngestModuleModel module : modules) { module.setEnabled(set); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 3a1ced09a3..b7828fc6ae 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -4,6 +4,8 @@ OpenIDE-Module-Short-Description=Interesting Files Identifier ingest module. OpenIDE-Module-Name=Interesting Files Identifier OptionsCategory_Name_InterestingItemDefinitions=Interesting Files OptionsCategory_Keywords_InterestingItemDefinitions=InterestingItemDefinitions +OptionsCategory_Name_FileFilterDefinitions=File Filter +OptionsCategory_Keywords_FileFilterDefinitions=FileFilterDefinitions InterestingItemsIdentifierIngestModule.moduleName=Interesting Files Identifier InterestingItemsIdentifierIngestModule.moduleDescription=Identifies interesting items as defined by interesting item rule sets. FilesSetPanel.title=Interesting Files Set @@ -65,3 +67,30 @@ FilesSetRulePanel.fileSizeCheck.text=File Size: FilesSetRulePanel.filesRadioButton.text=Files FilesSetRulePanel.dirsRadioButton.text=Directories FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories +FileFilterRuleDefsPanel.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. +FileFilterRuleDefsPanel.editSetButton.text=Edit Set +FileFilterRuleDefsPanel.rulePathConditionRegexCheckBox.text=Regex +FileFilterRuleDefsPanel.jLabel4.text=Path Pattern: +FileFilterRuleDefsPanel.jLabel1.text=Rule Details +FileFilterRuleDefsPanel.dirsRadioButton.text=Directories +FileFilterRuleDefsPanel.jLabel2.text=File Type: +FileFilterRuleDefsPanel.rulesListLabel.text=Rules: +FileFilterRuleDefsPanel.newSetButton.text=New Set +FileFilterRuleDefsPanel.editRuleButton.text=Edit Rule +FileFilterRuleDefsPanel.deleteRuleButton.text=Delete Rule +FileFilterRuleDefsPanel.filesRadioButton.text=Files +FileFilterRuleDefsPanel.deleteSetButton.text=Delete Set +FileFilterRuleDefsPanel.newRuleButton.text=New Rule +FileFilterRuleDefsPanel.bothRadioButton.text=Files and Directories +FileFilterRuleDefsPanel.setsListLabel.text=Rule Sets +FileFilterRuleDefsPanel.jLabel6.text=Set Details +FileFilterRuleDefsPanel.fileNameRegexCheckbox.text=Regex +FileFilterRuleDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files +FileFilterRuleDefsPanel.rulePathConditionTextField.text= +FileFilterRuleDefsPanel.fileNameRadioButton.text=File Name +FileFilterRuleDefsPanel.jLabel5.text=Description: +FileFilterRuleDefsPanel.fileNameTextField.text= +FileFilterRuleDefsPanel.jLabel8.text=File Size: +FileFilterRuleDefsPanel.jLabel3.text=Name Pattern: +FileFilterRuleDefsPanel.fileNameExtensionRadioButton.text=Extension Only +FileFilterRuleDefsPanel.jLabel7.text=MIME Type: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 487925a7b4..d5f40f74b3 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -72,3 +72,26 @@ InterestingItemDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb InterestingItemDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe +FileFilterRuleDefsPanel.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 +FileFilterRuleDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe +FileFilterRuleDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a +FileFilterRuleDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 +FileFilterRuleDefsPanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +FileFilterRuleDefsPanel.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a +FileFilterRuleDefsPanel.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a +FileFilterRuleDefsPanel.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 +FileFilterRuleDefsPanel.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 +FileFilterRuleDefsPanel.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 +FileFilterRuleDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb +FileFilterRuleDefsPanel.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 +FileFilterRuleDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb +FileFilterRuleDefsPanel.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +FileFilterRuleDefsPanel.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 +FileFilterRuleDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 +FileFilterRuleDefsPanel.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe +FileFilterRuleDefsPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 +FileFilterRuleDefsPanel.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d +FileFilterRuleDefsPanel.jLabel5.text=\u6982\u8981\uff1a +FileFilterRuleDefsPanel.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 +FileFilterRuleDefsPanel.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f +FileFilterRuleDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java new file mode 100644 index 0000000000..737b4f1121 --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java @@ -0,0 +1,161 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2014 Basis Technology Corp. + * Contact: carrier sleuthkit 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.modules.interestingitems; + +import java.beans.PropertyChangeEvent; +import java.beans.PropertyChangeListener; +import java.beans.PropertyChangeSupport; +import java.util.ArrayList; +import java.util.List; +import java.util.Set; +import javax.swing.JComponent; +import javax.swing.SwingUtilities; +import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.HelpCtx; +import org.openide.util.Lookup; + +@OptionsPanelController.TopLevelRegistration( + categoryName = "#OptionsCategory_Name_FileFilterDefinitions", + iconBase = "org/sleuthkit/autopsy/images/interesting_item_32x32.png", + keywords = "#OptionsCategory_Keywords_FileFilterDefinitions", + keywordsCategory = "FileFilterDefinitions", + position = 7 +) +public final class FileFilterDefsOptionsPanelController extends OptionsPanelController { + + private InterestingItemDefsPanel panel; + private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); + private boolean changed; + + /** + * Component should load its data here. + */ + @Override + public void update() { + getPanel().load(); + changed = false; + } + + /** + * Returns an array which will contain the names of all options which should + * exist in the "Run Ingest Modules On:" JCombobox + * + * @return -filterNames an array of all established filter names as well as + * a 'Create New...' option + */ + public List getComboBoxContents() { + List nameSet = new ArrayList<>(); + nameSet.add("All Files"); + if (!(panel == null)) { + nameSet.addAll(panel.getKeys()); + System.out.println("THIS IS THE SET, PANEL NOT NULL"); + System.out.println(nameSet.toString()); + } + nameSet.add("Create New..."); + return nameSet; + } + + /** + * This method is called when both the Ok and Apply buttons are pressed. It + * applies to any of the panels that have been opened in the process of + * using the options pane. + */ + @Override + public void applyChanges() { + if (changed) { + SwingUtilities.invokeLater(new Runnable() { + @Override + public void run() { + getPanel().store(); + changed = false; + } + }); + } + } + + /** + * This method is called when the Cancel button is pressed. It applies to + * any of the panels that have been opened in the process of using the + * options pane. + */ + @Override + public void cancel() { + // need not do anything special, if no changes have been persisted yet + } + + @Override + public boolean isValid() { + return true; + } + + /** + * Used to determine whether any changes have been made to this controller's + * panel. + * + * @return Whether or not a change has been made. + */ + @Override + public boolean isChanged() { + return changed; + } + + @Override + public HelpCtx getHelpCtx() { + return null; + } + + @Override + public JComponent getComponent(Lookup masterLookup) { + return getPanel(); + } + + @Override + public void addPropertyChangeListener(PropertyChangeListener l) { + pcs.addPropertyChangeListener(l); + } + + @Override + public void removePropertyChangeListener(PropertyChangeListener l) { + pcs.removePropertyChangeListener(l); + } + + private InterestingItemDefsPanel getPanel() { + if (panel == null) { + panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), ""); + panel.addPropertyChangeListener(new PropertyChangeListener() { + @Override + public void propertyChange(PropertyChangeEvent evt) { + if (evt.getPropertyName().equals(OptionsPanelController.PROP_CHANGED)) { + changed(); + } + } + }); + } + return panel; + } + + void changed() { + if (!changed) { + changed = true; + pcs.firePropertyChange(OptionsPanelController.PROP_CHANGED, false, true); + } + pcs.firePropertyChange(OptionsPanelController.PROP_VALID, null, null); + } + +} diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java index eb72dd0799..65824a0262 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java @@ -20,13 +20,13 @@ public class FilesFilter { public static Set getKeys() throws InterestingItemDefsManager.InterestingItemDefsManagerException { InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); - return manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").keySet(); + return manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").keySet(); } public FilesFilter() { InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); try { - for (FilesSet fs : manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").values()) { + for (FilesSet fs : manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").values()) { currentRules = fs; break; } @@ -39,7 +39,7 @@ public class FilesFilter { public FilesFilter(String key) { InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); try { - currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.FILE_FILTER_SET_DEFS_SERIALIZATION_NAME, "").get(key); + currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").get(key); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { Exceptions.printStackTrace(ex); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index 976900b341..416573ca71 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -83,7 +83,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS */ List filesSetRows = new ArrayList<>(); try { - this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME)); + this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME())); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError()); this.filesSetSnapshot = new TreeMap<>(); @@ -138,7 +138,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS List rowModels = new ArrayList<>(); TreeMap newFilesSetSnapshot; try { - newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME)); + newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME())); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError()); return; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index 10e314f7ec..04df50b406 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -83,7 +83,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { // to disable the interesting files set definition UI during ingest. List filesSets = new ArrayList<>(); try { - for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME).values()) { + for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()).values()) { if (settings.interestingFilesSetIsEnabled(set.getName())) { filesSets.add(set); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 721fb73110..498bee9255 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -51,9 +51,9 @@ final class InterestingItemDefsManager extends Observable { private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); - static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS - static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings"; - static final String FILE_FILTER_SET_DEFS_SERIALIZATION_NAME = "FileFilterSets.settings"; + private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS + private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings"; + private static final String FILE_FILTER_SET_DEFS_SERIALIZATION_NAME = "FileFilterSets.settings"; private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; private static final String LEGACY_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; private static InterestingItemDefsManager instance; @@ -87,6 +87,27 @@ final class InterestingItemDefsManager extends Observable { return InterestingItemDefsManager.ILLEGAL_FILE_PATH_CHARS; } + /** + * @return the LEGACY_FILES_SET_DEFS_FILE_NAME + */ + static String getLEGACY_FILES_SET_DEFS_FILE_NAME() { + return LEGACY_FILES_SET_DEFS_FILE_NAME; + } + + /** + * @return the INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME + */ + static String getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME() { + return INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME; + } + + /** + * @return the FILE_FILTER_SET_DEFS_SERIALIZATION_NAME + */ + static String getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME() { + return FILE_FILTER_SET_DEFS_SERIALIZATION_NAME; + } + /** * Gets a copy of the current interesting files set definitions. * diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java index 61f4e8f9fc..1118d88e64 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java @@ -115,7 +115,7 @@ public final class InterestingItemDefsOptionsPanelController extends OptionsPane private InterestingItemDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(); + panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 7e47fbb022..2c02e0e742 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -57,13 +57,15 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp "InterestingItemsDefsPanel.saveError=Error saving interesting files sets to file." }) - private static final SortedSet mediaTypes = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); + private static final SortedSet MEDIA_TYPES = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); private final DefaultListModel setsListModel = new DefaultListModel<>(); private final DefaultListModel rulesListModel = new DefaultListModel<>(); private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName()); - private JButton okButton = new JButton("OK"); - private JButton cancelButton = new JButton("Cancel"); - + private final JButton okButton = new JButton("OK"); + private final JButton cancelButton = new JButton("Cancel"); + private final String settingsFileName; + private final String settingsLegacyFileName; + // The following is a map of interesting files set names to interesting // files set definitions. It is a snapshot of the files set definitions // obtained from the interesting item definitions manager at the time the @@ -76,21 +78,28 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp /** * Constructs an interesting item definitions panel. */ - InterestingItemDefsPanel() { + InterestingItemDefsPanel(String settingsName, String legacySettingsName) { this.initComponents(); this.customInit(); this.setsList.setModel(setsListModel); this.setsList.addListSelectionListener(new InterestingItemDefsPanel.SetsListSelectionListener()); this.rulesList.setModel(rulesListModel); this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); + this.settingsFileName = settingsName; + this.settingsLegacyFileName = legacySettingsName; } + Set getKeys(){ + load(); + return filesSets.keySet(); + } + @NbBundle.Messages({"InterestingItemDefsPanel.Title=Global Interesting Items Settings"}) private void customInit() { setName(Bundle.InterestingItemDefsPanel_Title()); Set fileTypesCollated = new HashSet<>(); - for (MediaType mediaType : mediaTypes) { + for (MediaType mediaType : MEDIA_TYPES) { fileTypesCollated.add(mediaType.toString()); } @@ -126,7 +135,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp @Override public void saveSettings() { try { - InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets, InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME); + InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets, settingsFileName); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_saveError()); } @@ -150,7 +159,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp try { // Get a working copy of the interesting files set definitions and sort // by set name. - this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME)); + this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(settingsFileName, settingsLegacyFileName)); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_loadError()); this.filesSets = new TreeMap<>(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index efb33d642f..86899508f7 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -70,7 +70,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto @Override public IngestModuleGlobalSettingsPanel getGlobalSettingsPanel() { - InterestingItemDefsPanel panel = new InterestingItemDefsPanel(); + InterestingItemDefsPanel panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()); panel.load(); return panel; } @@ -84,7 +84,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto // Doing so also keeps the serialization simple. List enabledFilesSetNames = new ArrayList<>(); try { - for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME, InterestingItemDefsManager.LEGACY_FILES_SET_DEFS_FILE_NAME).keySet()) { + for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()).keySet()) { enabledFilesSetNames.add(name); } } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { From 290ef43bdffcd14863ea326c2704ae017dd2d643 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 28 Nov 2016 12:27:51 -0500 Subject: [PATCH 04/50] Data Sources Tree now refreshes on module and ingest completion --- .../sleuthkit/autopsy/datamodel/DataSourcesNode.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java index 73f4d95cd0..f696c98e40 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java @@ -28,6 +28,7 @@ import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; @@ -79,7 +80,10 @@ public class DataSourcesNode extends DisplayableItemNode { @Override public void propertyChange(PropertyChangeEvent evt) { String eventType = evt.getPropertyName(); - if (eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) { + if (eventType.equals(IngestManager.IngestModuleEvent.CONTENT_CHANGED.toString()) + || eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) + || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString()) + || eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) { reloadKeys(); } } @@ -88,12 +92,16 @@ public class DataSourcesNode extends DisplayableItemNode { @Override protected void addNotify() { Case.addPropertyChangeListener(pcl); + IngestManager.getInstance().addIngestJobEventListener(pcl); + IngestManager.getInstance().addIngestModuleEventListener(pcl); reloadKeys(); } @Override protected void removeNotify() { Case.removePropertyChangeListener(pcl); + IngestManager.getInstance().removeIngestJobEventListener(pcl); + IngestManager.getInstance().removeIngestModuleEventListener(pcl); currentKeys.clear(); setKeys(Collections.emptySet()); } From 4075fc2bc2d6405398d76aed07285054f38e328e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 28 Nov 2016 15:44:19 -0500 Subject: [PATCH 05/50] 1903 Mostly working Ingest File Selection Filter, process unallocated moved --- .../autopsy/datamodel/DataSourcesNode.java | 4 +- .../autopsy/ingest/DataSourceIngestJob.java | 10 +++ .../autopsy/ingest/IngestJobSettings.java | 67 ++++++++++------- .../ingest/IngestJobSettingsPanel.form | 57 +++++---------- .../ingest/IngestJobSettingsPanel.java | 72 ++++++++----------- .../autopsy/ingest/IngestTasksScheduler.java | 2 +- .../FileFilterDefsOptionsPanelController.java | 20 +++--- .../modules/interestingitems/FilesFilter.java | 53 ++++++++------ .../modules/interestingitems/FilesSet.java | 13 +++- .../interestingitems/FilesSetPanel.form | 37 ++++++++-- .../interestingitems/FilesSetPanel.java | 34 +++++++-- .../interestingitems/FilesSetRulePanel.java | 10 ++- .../InterestingItemDefsManager.java | 2 +- .../InterestingItemDefsPanel.java | 16 +++-- 14 files changed, 233 insertions(+), 164 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java index f696c98e40..4fb5e54ffd 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java @@ -67,7 +67,7 @@ public class DataSourcesNode extends DisplayableItemNode { */ public static class DataSourcesNodeChildren extends AbstractContentChildren { - private static final Logger logger = Logger.getLogger(DataSourcesNodeChildren.class.getName()); + private static final Logger LOGGER = Logger.getLogger(DataSourcesNodeChildren.class.getName()); List currentKeys; @@ -111,7 +111,7 @@ public class DataSourcesNode extends DisplayableItemNode { currentKeys = Case.getCurrentCase().getDataSources(); setKeys(currentKeys); } catch (TskCoreException | IllegalStateException ex) { - logger.severe("Error getting data sources: " + ex.getMessage()); // NON-NLS + LOGGER.severe("Error getting data sources: " + ex.getMessage()); // NON-NLS setKeys(Collections.emptySet()); } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java index 1869be9169..f226f22d5d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java @@ -331,6 +331,16 @@ final class DataSourceIngestJob { return this.settings.getProcessUnallocatedSpace(); } + /** + * Queries whether or not unallocated space should be processed as part of + * this job. + * + * @return True or false. + */ + String runIngestModulesOnFilter() { + return this.settings.getRunIngestModulesOnFilter(); + } + /** * Checks to see if this job has at least one ingest pipeline. * diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index bea9d2a10b..a6d6c27f5a 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -37,6 +37,7 @@ import org.python.util.PythonObjectInputStream; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; +import org.sleuthkit.autopsy.modules.interestingitems.FilesFilter; /** * Encapsulates the ingest job settings for a particular execution context. @@ -48,12 +49,15 @@ public class IngestJobSettings { private static final String ENABLED_MODULES_KEY = "Enabled_Ingest_Modules"; //NON-NLS private static final String DISABLED_MODULES_KEY = "Disabled_Ingest_Modules"; //NON-NLS - private static final String PARSE_UNALLOC_SPACE_KEY = "Process_Unallocated_Space"; //NON-NLS + private static final String PARSE_UNALLOC_SPACE_KEY = "Process_Unallocated_Space"; //NON-NLS + private static final String RUN_ON_FILTER_KEY = "Run_Ingest_On"; private static final String PROCESS_UNALLOC_SPACE_DEFAULT = "true"; //NON-NLS + private static final String RUN_ON_FILTER_DEFAULT = FilesFilter.ALL_FILES_AND_UNALLOCATED_FILTER; private static final String MODULE_SETTINGS_FOLDER = "IngestModuleSettings"; //NON-NLS private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS - private static final Logger logger = Logger.getLogger(IngestJobSettings.class.getName()); + private String runIngestModulesOnFilter; + private static final Logger LOGGER = Logger.getLogger(IngestJobSettings.class.getName()); private final String executionContext; private final IngestType ingestType; private String moduleSettingsFolderPath; @@ -62,6 +66,22 @@ public class IngestJobSettings { private boolean processUnallocatedSpace; private final List warnings; + /** + * @return the runIngestModulesOnFilter + */ + String getRunIngestModulesOnFilter() { + return runIngestModulesOnFilter; + } + + /** + * @param runIngestModulesOnFilter the runIngestModulesOnFilter to set + */ + void setRunIngestModulesOnFilter(String runIngestModulesOnFilter) { + this.runIngestModulesOnFilter = runIngestModulesOnFilter; + this.processUnallocatedSpace = (new FilesFilter(runIngestModulesOnFilter)).isProcessUnallocatedSpace(); + this.save(); + } + /** * The type of ingest modules to run. */ @@ -94,6 +114,7 @@ public class IngestJobSettings { this.ingestType = IngestType.ALL_MODULES; this.moduleTemplates = new ArrayList<>(); this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); + this.runIngestModulesOnFilter = FilesFilter.ALL_FILES_AND_UNALLOCATED_FILTER; this.warnings = new ArrayList<>(); this.createSavedModuleSettingsFolder(); this.load(); @@ -105,7 +126,7 @@ public class IngestJobSettings { * modules dialog. Different execution conterxts may have different ingest * job settings. * - * @param context The context identifier string. + * @param context The context identifier string. * @param ingestType The type of modules ingest is running. */ public IngestJobSettings(String context, IngestType ingestType) { @@ -118,7 +139,9 @@ public class IngestJobSettings { } this.moduleTemplates = new ArrayList<>(); + this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); + this.runIngestModulesOnFilter = FilesFilter.ALL_FILES_AND_UNALLOCATED_FILTER; this.warnings = new ArrayList<>(); this.createSavedModuleSettingsFolder(); this.load(); @@ -200,15 +223,6 @@ public class IngestJobSettings { return this.processUnallocatedSpace; } - /** - * Sets the process unallocated space flag for these ingest job settings. - * - * @param processUnallocatedSpace True or false. - */ - void setProcessUnallocatedSpace(boolean processUnallocatedSpace) { - this.processUnallocatedSpace = processUnallocatedSpace; - } - /** * Returns the path to the ingest module settings folder. * @@ -228,7 +242,7 @@ public class IngestJobSettings { Files.createDirectories(folder); this.moduleSettingsFolderPath = folder.toAbsolutePath().toString(); } catch (IOException | SecurityException ex) { - logger.log(Level.SEVERE, "Failed to create ingest module settings directory " + this.moduleSettingsFolderPath, ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Failed to create ingest module settings directory " + this.moduleSettingsFolderPath, ex); //NON-NLS this.warnings.add(NbBundle.getMessage(IngestJobSettings.class, "IngestJobSettings.createModuleSettingsFolder.warning")); //NON-NLS } } @@ -285,7 +299,7 @@ public class IngestJobSettings { enabledModuleNames.remove(moduleName); disabledModuleNames.remove(moduleName); String warning = NbBundle.getMessage(IngestJobSettings.class, "IngestJobSettings.missingModule.warning", moduleName); //NON-NLS - logger.log(Level.WARNING, warning); + LOGGER.log(Level.WARNING, warning); this.warnings.add(warning); } @@ -317,18 +331,21 @@ public class IngestJobSettings { ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.ENABLED_MODULES_KEY, makeCommaSeparatedValuesList(enabledModuleNames)); ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.DISABLED_MODULES_KEY, makeCommaSeparatedValuesList(disabledModuleNames)); - // Get the process unallocated space flag setting. If the setting does - // not exist yet, default it to true. - if (ModuleSettings.settingExists(this.executionContext, IngestJobSettings.PARSE_UNALLOC_SPACE_KEY) == false) { - ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.PARSE_UNALLOC_SPACE_KEY, IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); + // Get the filter setting telling it which files to run modules on. If the setting does + // not exist yet, default it to All Files and Unallocated Space filter. + if (ModuleSettings.settingExists(this.executionContext, IngestJobSettings.RUN_ON_FILTER_KEY) == false) { + ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.RUN_ON_FILTER_KEY, IngestJobSettings.RUN_ON_FILTER_DEFAULT); } - this.processUnallocatedSpace = Boolean.parseBoolean(ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.PARSE_UNALLOC_SPACE_KEY)); + this.runIngestModulesOnFilter = ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.RUN_ON_FILTER_KEY); + //set the process unallocated space setting based on the filter chosen. + this.processUnallocatedSpace = (new FilesFilter(runIngestModulesOnFilter)).isProcessUnallocatedSpace(); + } /** * Gets the module names for a given key within these ingest job settings. * - * @param key The key string. + * @param key The key string. * @param defaultSetting The default list of module names. * * @return The list of module names associated with the key. @@ -398,7 +415,7 @@ public class IngestJobSettings { settings = (IngestModuleIngestJobSettings) in.readObject(); } catch (IOException | ClassNotFoundException ex) { String warning = NbBundle.getMessage(IngestJobSettings.class, "IngestJobSettings.moduleSettingsLoad.warning", factory.getModuleDisplayName(), this.executionContext); //NON-NLS - logger.log(Level.WARNING, warning, ex); + LOGGER.log(Level.WARNING, warning, ex); this.warnings.add(warning); } } else { @@ -406,7 +423,7 @@ public class IngestJobSettings { settings = (IngestModuleIngestJobSettings) in.readObject(); } catch (IOException | ClassNotFoundException exception) { String warning = NbBundle.getMessage(IngestJobSettings.class, "IngestJobSettings.moduleSettingsLoad.warning", factory.getModuleDisplayName(), this.executionContext); //NON-NLS - logger.log(Level.WARNING, warning, exception); + LOGGER.log(Level.WARNING, warning, exception); this.warnings.add(warning); } } @@ -463,7 +480,7 @@ public class IngestJobSettings { * Serializes the ingest job settings for this context for a given ingest * module. * - * @param factory The ingest module factory for the module. + * @param factory The ingest module factory for the module. * @param settings The ingest job settings for the ingest module */ private void saveModuleSettings(IngestModuleFactory factory, IngestModuleIngestJobSettings settings) { @@ -472,7 +489,7 @@ public class IngestJobSettings { out.writeObject(settings); } catch (IOException ex) { String warning = NbBundle.getMessage(IngestJobSettings.class, "IngestJobSettings.moduleSettingsSave.warning", factory.getModuleDisplayName(), this.executionContext); //NON-NLS - logger.log(Level.SEVERE, warning, ex); + LOGGER.log(Level.SEVERE, warning, ex); this.warnings.add(warning); } } @@ -483,7 +500,7 @@ public class IngestJobSettings { * @param input A hash set of strings. * * @return The contents of the hash set as a single string of - * comma-separated values. + * comma-separated values. */ private static String makeCommaSeparatedValuesList(HashSet input) { if (input == null || input.isEmpty()) { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form index 293b29684d..eaf30f60da 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form @@ -33,35 +33,24 @@ - - - - - - + + - - - - - - - - - - + + + - + + + + + + + - - - - - - - + @@ -85,8 +74,7 @@ - - + @@ -108,7 +96,7 @@ - + @@ -173,7 +161,7 @@ - + @@ -268,19 +256,6 @@ - - - - - - - - - - - - - diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index f8343b5f49..70a38b1549 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -77,12 +77,14 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { this.settings = settings; this.controller = new FileFilterDefsOptionsPanelController(); controller.getComponent(controller.getLookup()); + for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) { modules.add(new IngestModuleModel(moduleTemplate)); } initComponents(); customizeComponents(); + jComboBox1.setSelectedItem(settings.getRunIngestModulesOnFilter()); } /** @@ -96,6 +98,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { this.dataSources.addAll(dataSources); this.controller = new FileFilterDefsOptionsPanelController(); controller.getComponent(controller.getLookup()); + try { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); ingestJobs.addAll(skCase.getIngestJobs()); @@ -110,6 +113,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { initComponents(); customizeComponents(); + jComboBox1.setSelectedItem(settings.getRunIngestModulesOnFilter()); } /** @@ -174,7 +178,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } }); modulesTable.setRowSelectionInterval(0, 0); - processUnallocCheckbox.setSelected(this.settings.getProcessUnallocatedSpace()); this.modulesTable.getColumnModel().getColumn(0).setMaxWidth(22); this.modulesTable.getColumnModel().getColumn(1).setMaxWidth(20); this.modulesTable.getColumnModel().getColumn(1).setMinWidth(20); @@ -209,7 +212,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { ingestSettingsPanel = new javax.swing.JPanel(); jButtonSelectAll = new javax.swing.JButton(); jButtonDeselectAll = new javax.swing.JButton(); - processUnallocCheckbox = new javax.swing.JCheckBox(); pastJobsButton = new javax.swing.JButton(); setMaximumSize(new java.awt.Dimension(5750, 3000)); @@ -218,7 +220,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jLabel1.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jLabel1.text_1")); // NOI18N - jComboBox1.setModel(new DefaultComboBoxModel(controller.getComboBoxContents().toArray())); + jComboBox1.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); jComboBox1.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jComboBox1ActionPerformed(evt); @@ -272,7 +274,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 326, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(globalSettingsButton))) @@ -306,14 +308,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } }); - processUnallocCheckbox.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.processUnallocCheckbox.text")); // NOI18N - processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.processUnallocCheckbox.toolTipText")); // NOI18N - processUnallocCheckbox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - processUnallocCheckboxActionPerformed(evt); - } - }); - pastJobsButton.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.pastJobsButton.text")); // NOI18N pastJobsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -327,27 +321,20 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addComponent(jLabel1)) - .addComponent(modulesScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 251, Short.MAX_VALUE) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(processUnallocCheckbox) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(jButtonSelectAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pastJobsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(5, 5, 5) - .addComponent(jButtonDeselectAll))) - .addGap(0, 34, Short.MAX_VALUE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 348, Short.MAX_VALUE) + .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE))) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(jButtonSelectAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(pastJobsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(5, 5, 5) + .addComponent(jButtonDeselectAll)) + .addGroup(layout.createSequentialGroup() + .addComponent(jLabel1) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( @@ -367,8 +354,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addComponent(jButtonDeselectAll)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(pastJobsButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(processUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(25, 25, 25)) .addGroup(layout.createSequentialGroup() .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE) .addContainerGap()))) @@ -402,10 +388,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private void jButtonDeselectAllActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jButtonDeselectAllActionPerformed SelectAllModules(false); }//GEN-LAST:event_jButtonDeselectAllActionPerformed - - private void processUnallocCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_processUnallocCheckboxActionPerformed - this.settings.setProcessUnallocatedSpace(processUnallocCheckbox.isSelected()); - }//GEN-LAST:event_processUnallocCheckboxActionPerformed @Messages({"IngestJobSettingsPanel.pastJobsButton.action.frame.title=Ingest History"}) private void pastJobsButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_pastJobsButtonActionPerformed JDialog topFrame = (JDialog) SwingUtilities.getWindowAncestor(this); @@ -428,16 +410,25 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { * @param evt */ private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed - - if (evt.toString().contains("Create New...")) { + + if (jComboBox1.getSelectedItem().toString().equals("")) { final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); // values.controller.getComboBoxContents().toArray(); dialog.addApplyButtonListener((ActionEvent e) -> { controller.applyChanges(); + ((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())).saveSettings(); + jComboBox1.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); + settings.setRunIngestModulesOnFilter(jComboBox1.getItemAt(jComboBox1.getItemCount()-1)); dialog.close(); }); - dialog.display((IngestModuleGlobalSettingsPanel)controller.getComponent(controller.getLookup())); + dialog.display((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())); + + } else { + settings.setRunIngestModulesOnFilter(jComboBox1.getSelectedItem().toString()); + settings.save(); } + jComboBox1.setSelectedItem(settings.getRunIngestModulesOnFilter()); + }//GEN-LAST:event_jComboBox1ActionPerformed private void SelectAllModules(boolean set) { @@ -461,7 +452,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private javax.swing.JScrollPane modulesScrollPane; private javax.swing.JTable modulesTable; private javax.swing.JButton pastJobsButton; - private javax.swing.JCheckBox processUnallocCheckbox; private javax.swing.ButtonGroup timeGroup; // End of variables declaration//GEN-END:variables diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index ee73af38ed..5f7d93f0fb 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -414,7 +414,7 @@ final class IngestTasksScheduler { if (file.isFile()){ //is this the criteria we want to be using(will unallocated space files show return true?) FilesFilter fileFilter; - fileFilter = new FilesFilter(); + fileFilter = new FilesFilter(task.getIngestJob().runIngestModulesOnFilter()); if (!fileFilter.match(file)){ return false; } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java index 737b4f1121..af909f72dc 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java @@ -23,7 +23,6 @@ import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; import java.util.List; -import java.util.Set; import javax.swing.JComponent; import javax.swing.SwingUtilities; import org.netbeans.spi.options.OptionsPanelController; @@ -57,18 +56,19 @@ public final class FileFilterDefsOptionsPanelController extends OptionsPanelCont * exist in the "Run Ingest Modules On:" JCombobox * * @return -filterNames an array of all established filter names as well as - * a 'Create New...' option + * a Create New option */ - public List getComboBoxContents() { - List nameSet = new ArrayList<>(); - nameSet.add("All Files"); + public String[] getComboBoxContents() { + ArrayList nameList = new ArrayList<>(); + nameList.add(FilesFilter.ALL_FILES_AND_UNALLOCATED_FILTER); + nameList.add(FilesFilter.ALL_FILES_FILTER); + nameList.add(""); if (!(panel == null)) { - nameSet.addAll(panel.getKeys()); - System.out.println("THIS IS THE SET, PANEL NOT NULL"); - System.out.println(nameSet.toString()); + nameList.addAll(panel.getKeys()); } - nameSet.add("Create New..."); - return nameSet; + String[] returnArray = {}; + nameList.toArray(returnArray); + return nameList.toArray(returnArray); } /** diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java index 65824a0262..469745d327 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java @@ -8,6 +8,7 @@ package org.sleuthkit.autopsy.modules.interestingitems; import java.util.Set; import org.openide.util.Exceptions; import org.sleuthkit.datamodel.AbstractFile; +import org.sleuthkit.datamodel.TskData; /** * @@ -16,34 +17,33 @@ import org.sleuthkit.datamodel.AbstractFile; public class FilesFilter { FilesSet currentRules; - boolean processUnallocatedSpace; + String rulesKey; + private boolean processUnallocatedSpace; + public final static String ALL_FILES_FILTER = ""; + public final static String ALL_FILES_AND_UNALLOCATED_FILTER = ""; public static Set getKeys() throws InterestingItemDefsManager.InterestingItemDefsManagerException { InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); return manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").keySet(); } - public FilesFilter() { - InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); - try { - for (FilesSet fs : manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").values()) { - currentRules = fs; - break; - } - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - Exceptions.printStackTrace(ex); - } - processUnallocatedSpace = true; - } - public FilesFilter(String key) { + this.rulesKey = key; InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); - try { - currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").get(key); - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - Exceptions.printStackTrace(ex); + if (key.equals(ALL_FILES_FILTER)) { + currentRules = null; + processUnallocatedSpace = false; + } else if (key.equals(ALL_FILES_AND_UNALLOCATED_FILTER)) { + currentRules = null; + processUnallocatedSpace = true; + } else { + try { + currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").get(key); + processUnallocatedSpace = currentRules.processesUnallocatedSpace(); + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + Exceptions.printStackTrace(ex); + } } - processUnallocatedSpace = true; } /** @@ -64,10 +64,21 @@ public class FilesFilter { */ public boolean match(AbstractFile file) { boolean fileMatches = false; - - if (currentRules.fileIsMemberOf(file) != null) { + if (isProcessUnallocatedSpace() == false && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)){ + return false; + } + if (rulesKey.equals(ALL_FILES_FILTER) || rulesKey.equals(ALL_FILES_AND_UNALLOCATED_FILTER) ) { + return true; + } else if (currentRules.fileIsMemberOf(file) != null) { fileMatches = true; } return fileMatches; } + + /** + * @return the processUnallocatedSpace + */ + public boolean isProcessUnallocatedSpace() { + return processUnallocatedSpace; + } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 7b196d17b2..8e88efa5ff 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -42,6 +42,7 @@ final class FilesSet implements Serializable { private final String name; private final String description; private final boolean ignoreKnownFiles; + private final boolean processUnallocated; private final Map rules = new HashMap<>(); /** @@ -54,13 +55,14 @@ final class FilesSet implements Serializable { * @param rules The rules that define the set. May be null, but a * set with no rules is the empty set. */ - FilesSet(String name, String description, boolean ignoreKnownFiles, Map rules) { + FilesSet(String name, String description, boolean ignoreKnownFiles, Map rules, boolean processUnallocatedSpace) { if ((name == null) || (name.isEmpty())) { throw new IllegalArgumentException("Interesting files set name cannot be null or empty"); } this.name = name; this.description = (description != null ? description : ""); this.ignoreKnownFiles = ignoreKnownFiles; + this.processUnallocated = processUnallocatedSpace; if (rules != null) { this.rules.putAll(rules); } @@ -97,6 +99,15 @@ final class FilesSet implements Serializable { return this.ignoreKnownFiles; } + /** + * Returns whether or not this set of rules will process unallocated space. + * + * @return True if unallocated space should be processed, false if it should not be. + */ + boolean processesUnallocatedSpace() { + return this.processUnallocated; + } + /** * Gets a copy of the set membership rules of this interesting files set. * diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form index fa5e501cf3..f9b1bad877 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form @@ -19,13 +19,20 @@ - - - - - - + + + + + + + + + + + + + @@ -42,7 +49,10 @@ - + + + + @@ -114,5 +124,18 @@ + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 83f83be276..7df02b8bab 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -45,6 +45,7 @@ public class FilesSetPanel extends javax.swing.JPanel { this.nameTextField.setText(filesSet.getName()); this.descTextArea.setText(filesSet.getDescription()); this.ignoreKnownFilesCheckbox.setSelected(filesSet.ignoresKnownFiles()); + this.processUnallocCheckbox.setSelected(filesSet.processesUnallocatedSpace()); } /** @@ -94,6 +95,13 @@ public class FilesSetPanel extends javax.swing.JPanel { return this.ignoreKnownFilesCheckbox.isSelected(); } + /** + * + */ + boolean getProcessUnallocatedSpace() { + return processUnallocCheckbox.isSelected(); + } + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -109,6 +117,7 @@ public class FilesSetPanel extends javax.swing.JPanel { descScrollPanel = new javax.swing.JScrollPane(); descTextArea = new javax.swing.JTextArea(); ignoreKnownFilesCheckbox = new javax.swing.JCheckBox(); + processUnallocCheckbox = new javax.swing.JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.nameLabel.text")); // NOI18N @@ -137,6 +146,9 @@ public class FilesSetPanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.ignoreKnownFilesCheckbox.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(processUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.processUnallocCheckbox.text")); // NOI18N + processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.processUnallocCheckbox.toolTipText")); // NOI18N + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -144,12 +156,17 @@ public class FilesSetPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(descPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(ignoreKnownFilesCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(ignoreKnownFilesCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(processUnallocCheckbox)))) .addContainerGap()) ); layout.setVerticalGroup( @@ -162,11 +179,15 @@ public class FilesSetPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(descPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(ignoreKnownFilesCheckbox) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ignoreKnownFilesCheckbox) + .addComponent(processUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); }// //GEN-END:initComponents + + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel descPanel; private javax.swing.JScrollPane descScrollPanel; @@ -174,5 +195,6 @@ public class FilesSetPanel extends javax.swing.JPanel { private javax.swing.JCheckBox ignoreKnownFilesCheckbox; private javax.swing.JLabel nameLabel; private javax.swing.JTextField nameTextField; + private javax.swing.JCheckBox processUnallocCheckbox; // End of variables declaration//GEN-END:variables } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 9ee7f1a172..188160499a 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -69,9 +69,15 @@ final class FilesSetRulePanel extends javax.swing.JPanel { /** * Constructs a files set rule panel in create rule mode. */ - FilesSetRulePanel(JButton okButton, JButton cancelButton) { + FilesSetRulePanel(JButton okButton, JButton cancelButton, boolean isFileFilterPanel) { initComponents(); - populateMimeTypesComboBox(); + if (isFileFilterPanel==true){ //Hide the mimetype settings when this is displaying a FileSet rule instead of a interesting item rule + mimeTypeComboBox.setVisible(false); + mimeCheck.setVisible(false); + } + else { + populateMimeTypesComboBox(); + } populateComponentsWithDefaultValues(); this.setButtons(okButton, cancelButton); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 498bee9255..b35afa8b8f 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -311,7 +311,7 @@ final class InterestingItemDefsManager extends Observable { // Make the files set. Note that degenerate sets with no rules are // allowed to facilitate the separation of set definition and rule // definitions. A set without rules is simply the empty set. - FilesSet set = new FilesSet(setName, description, ignoreKnownFiles, rules); + FilesSet set = new FilesSet(setName, description, ignoreKnownFiles, rules, true); filesSets.put(set.getName(), set); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 2c02e0e742..09b059061c 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -87,6 +87,10 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); this.settingsFileName = settingsName; this.settingsLegacyFileName = legacySettingsName; + if (legacySettingsName.equals("")){ //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules + this.mimeTypeComboBox.setVisible(false); + this.jLabel7.setVisible(false); + } } Set getKeys(){ @@ -379,7 +383,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Preserve the existing rules from the set being edited. rules.putAll(selectedSet.getRules()); } - this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), rules); + this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), rules, panel.getProcessUnallocatedSpace()); } } @@ -398,7 +402,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp panel = new FilesSetRulePanel(selectedRule, okButton, cancelButton); } else { // Creating a new rule definition. - panel = new FilesSetRulePanel(okButton, cancelButton); + panel = new FilesSetRulePanel(okButton, cancelButton, (settingsLegacyFileName.equals(""))); } // Do a dialog box with the files set panel until the user either enters // a valid definition or cancels. Note that the panel gives the user @@ -425,7 +429,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Add the new/edited files set definition, replacing any previous // definition with the same name and refreshing the display. - this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), rules); + this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), rules, selectedSet.processesUnallocatedSpace()); // Select the new/edited rule. Queue it up so it happens after the // selection listeners react to the selection of the "new" files @@ -449,7 +453,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * files. * @param rules The set membership rules for the set. */ - void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map rules) { + void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map rules, boolean processesUnallocatedSpace) { if (oldSet != null) { // Remove the set to be replaced from the working copy if the files // set definitions. @@ -458,7 +462,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Make the new/edited set definition and add it to the working copy of // the files set definitions. - FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, rules); + FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, rules, processesUnallocatedSpace); this.filesSets.put(newSet.getName(), newSet); // Redo the list model for the files set list component, which will make @@ -936,7 +940,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp Map rules = new HashMap<>(oldSet.getRules()); FilesSet.Rule selectedRule = this.rulesList.getSelectedValue(); rules.remove(selectedRule.getUuid()); - this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), rules); + this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), rules, oldSet.processesUnallocatedSpace()); if (!this.rulesListModel.isEmpty()) { this.rulesList.setSelectedIndex(0); } else { From cd62e7d0fa5d37fee7e2e28a6245b2c5c666bbbc Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 28 Nov 2016 16:22:52 -0500 Subject: [PATCH 06/50] 1903 fixed refresh of Data Source Node after ingest completion --- Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java index 4fb5e54ffd..35fd2fb0ad 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java @@ -85,6 +85,7 @@ public class DataSourcesNode extends DisplayableItemNode { || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString()) || eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) { reloadKeys(); + refreshContentKeys(); } } }; From 23e033462860f232328613422c830a553ab82cef Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 28 Nov 2016 16:28:36 -0500 Subject: [PATCH 07/50] 1903 simplified conditional and returns in match method --- .../autopsy/modules/interestingitems/FilesFilter.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java index 469745d327..050ce6ca65 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java @@ -65,10 +65,10 @@ public class FilesFilter { public boolean match(AbstractFile file) { boolean fileMatches = false; if (isProcessUnallocatedSpace() == false && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)){ - return false; + fileMatches = false; } - if (rulesKey.equals(ALL_FILES_FILTER) || rulesKey.equals(ALL_FILES_AND_UNALLOCATED_FILTER) ) { - return true; + else if (rulesKey.equals(ALL_FILES_FILTER) || rulesKey.equals(ALL_FILES_AND_UNALLOCATED_FILTER) ) { + fileMatches = true; } else if (currentRules.fileIsMemberOf(file) != null) { fileMatches = true; } From ce5d879d489c51ce1e8481c8c8d13e765a5ef518 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 29 Nov 2016 13:01:13 -0500 Subject: [PATCH 08/50] 1903 Most text changes for IngestSetFilter completed --- .../autopsy/ingest/IngestJobSettings.java | 12 ++-- .../ingest/IngestJobSettingsPanel.java | 12 ++-- .../autopsy/ingest/IngestTasksScheduler.java | 10 ++-- .../interestingitems/Bundle.properties | 58 +++++++++---------- .../interestingitems/Bundle_ja.properties | 46 +++++++-------- .../interestingitems/FilesSetPanel.java | 7 ++- ...{FilesFilter.java => IngestSetFilter.java} | 24 ++++++-- ...tSetFilterDefsOptionsPanelController.java} | 23 ++++---- .../InterestingItemDefsPanel.java | 29 +++++++--- 9 files changed, 126 insertions(+), 95 deletions(-) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{FilesFilter.java => IngestSetFilter.java} (77%) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{FileFilterDefsOptionsPanelController.java => IngestSetFilterDefsOptionsPanelController.java} (87%) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index a6d6c27f5a..408e8213b3 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -37,7 +37,7 @@ import org.python.util.PythonObjectInputStream; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; -import org.sleuthkit.autopsy.modules.interestingitems.FilesFilter; +import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilter; /** * Encapsulates the ingest job settings for a particular execution context. @@ -52,7 +52,7 @@ public class IngestJobSettings { private static final String PARSE_UNALLOC_SPACE_KEY = "Process_Unallocated_Space"; //NON-NLS private static final String RUN_ON_FILTER_KEY = "Run_Ingest_On"; private static final String PROCESS_UNALLOC_SPACE_DEFAULT = "true"; //NON-NLS - private static final String RUN_ON_FILTER_DEFAULT = FilesFilter.ALL_FILES_AND_UNALLOCATED_FILTER; + private static final String RUN_ON_FILTER_DEFAULT = IngestSetFilter.ALL_FILES_AND_UNALLOCATED_FILTER; private static final String MODULE_SETTINGS_FOLDER = "IngestModuleSettings"; //NON-NLS private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS @@ -78,7 +78,7 @@ public class IngestJobSettings { */ void setRunIngestModulesOnFilter(String runIngestModulesOnFilter) { this.runIngestModulesOnFilter = runIngestModulesOnFilter; - this.processUnallocatedSpace = (new FilesFilter(runIngestModulesOnFilter)).isProcessUnallocatedSpace(); + this.processUnallocatedSpace = (new IngestSetFilter(runIngestModulesOnFilter)).isProcessUnallocatedSpace(); this.save(); } @@ -114,7 +114,7 @@ public class IngestJobSettings { this.ingestType = IngestType.ALL_MODULES; this.moduleTemplates = new ArrayList<>(); this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); - this.runIngestModulesOnFilter = FilesFilter.ALL_FILES_AND_UNALLOCATED_FILTER; + this.runIngestModulesOnFilter = IngestSetFilter.ALL_FILES_AND_UNALLOCATED_FILTER; this.warnings = new ArrayList<>(); this.createSavedModuleSettingsFolder(); this.load(); @@ -141,7 +141,7 @@ public class IngestJobSettings { this.moduleTemplates = new ArrayList<>(); this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); - this.runIngestModulesOnFilter = FilesFilter.ALL_FILES_AND_UNALLOCATED_FILTER; + this.runIngestModulesOnFilter = IngestSetFilter.ALL_FILES_AND_UNALLOCATED_FILTER; this.warnings = new ArrayList<>(); this.createSavedModuleSettingsFolder(); this.load(); @@ -338,7 +338,7 @@ public class IngestJobSettings { } this.runIngestModulesOnFilter = ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.RUN_ON_FILTER_KEY); //set the process unallocated space setting based on the filter chosen. - this.processUnallocatedSpace = (new FilesFilter(runIngestModulesOnFilter)).isProcessUnallocatedSpace(); + this.processUnallocatedSpace = (new IngestSetFilter(runIngestModulesOnFilter)).isProcessUnallocatedSpace(); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index 70a38b1549..e292fe08f7 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -44,7 +44,8 @@ import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; -import org.sleuthkit.autopsy.modules.interestingitems.FileFilterDefsOptionsPanelController; +import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilterDefsOptionsPanelController; +import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilter; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestModuleInfo; @@ -66,7 +67,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private final IngestModulesTableModel tableModel = new IngestModulesTableModel(); private IngestModuleModel selectedModule; private static final Logger LOGGER = Logger.getLogger(IngestJobSettingsPanel.class.getName()); - private final FileFilterDefsOptionsPanelController controller; + private final IngestSetFilterDefsOptionsPanelController controller; /** * Construct a panel to allow a user to make ingest job settings. @@ -75,7 +76,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { */ public IngestJobSettingsPanel(IngestJobSettings settings) { this.settings = settings; - this.controller = new FileFilterDefsOptionsPanelController(); + this.controller = new IngestSetFilterDefsOptionsPanelController(); controller.getComponent(controller.getLookup()); for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) { @@ -96,7 +97,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { IngestJobSettingsPanel(IngestJobSettings settings, List dataSources) { this.settings = settings; this.dataSources.addAll(dataSources); - this.controller = new FileFilterDefsOptionsPanelController(); + this.controller = new IngestSetFilterDefsOptionsPanelController(); controller.getComponent(controller.getLookup()); try { @@ -411,14 +412,13 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { */ private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed - if (jComboBox1.getSelectedItem().toString().equals("")) { + if (jComboBox1.getSelectedItem().toString().equals(IngestSetFilter.NEW_INGEST_FILTER)) { final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); // values.controller.getComboBoxContents().toArray(); dialog.addApplyButtonListener((ActionEvent e) -> { controller.applyChanges(); ((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())).saveSettings(); jComboBox1.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); - settings.setRunIngestModulesOnFilter(jComboBox1.getItemAt(jComboBox1.getItemCount()-1)); dialog.close(); }); dialog.display((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index 5f7d93f0fb..2fd8ed4222 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2012-2015 Basis Technology Corp. + * Copyright 2012-2016 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -33,7 +33,7 @@ import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.modules.interestingitems.FilesFilter; +import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilter; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.FileSystem; @@ -413,9 +413,9 @@ final class IngestTasksScheduler { } if (file.isFile()){ //is this the criteria we want to be using(will unallocated space files show return true?) - FilesFilter fileFilter; - fileFilter = new FilesFilter(task.getIngestJob().runIngestModulesOnFilter()); - if (!fileFilter.match(file)){ + IngestSetFilter ingestSetFilter; + ingestSetFilter = new IngestSetFilter(task.getIngestJob().runIngestModulesOnFilter()); + if (!ingestSetFilter.match(file)){ return false; } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index b7828fc6ae..58a05ab228 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -4,8 +4,8 @@ OpenIDE-Module-Short-Description=Interesting Files Identifier ingest module. OpenIDE-Module-Name=Interesting Files Identifier OptionsCategory_Name_InterestingItemDefinitions=Interesting Files OptionsCategory_Keywords_InterestingItemDefinitions=InterestingItemDefinitions -OptionsCategory_Name_FileFilterDefinitions=File Filter -OptionsCategory_Keywords_FileFilterDefinitions=FileFilterDefinitions +OptionsCategory_Name_IngestSetFilterDefinitions=File Filter +OptionsCategory_Keywords_IngestSetFilterDefinitions=IngestSetFilterDefinitions InterestingItemsIdentifierIngestModule.moduleName=Interesting Files Identifier InterestingItemsIdentifierIngestModule.moduleDescription=Identifies interesting items as defined by interesting item rule sets. FilesSetPanel.title=Interesting Files Set @@ -67,30 +67,30 @@ FilesSetRulePanel.fileSizeCheck.text=File Size: FilesSetRulePanel.filesRadioButton.text=Files FilesSetRulePanel.dirsRadioButton.text=Directories FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories -FileFilterRuleDefsPanel.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. -FileFilterRuleDefsPanel.editSetButton.text=Edit Set -FileFilterRuleDefsPanel.rulePathConditionRegexCheckBox.text=Regex -FileFilterRuleDefsPanel.jLabel4.text=Path Pattern: -FileFilterRuleDefsPanel.jLabel1.text=Rule Details -FileFilterRuleDefsPanel.dirsRadioButton.text=Directories -FileFilterRuleDefsPanel.jLabel2.text=File Type: -FileFilterRuleDefsPanel.rulesListLabel.text=Rules: -FileFilterRuleDefsPanel.newSetButton.text=New Set -FileFilterRuleDefsPanel.editRuleButton.text=Edit Rule -FileFilterRuleDefsPanel.deleteRuleButton.text=Delete Rule -FileFilterRuleDefsPanel.filesRadioButton.text=Files -FileFilterRuleDefsPanel.deleteSetButton.text=Delete Set -FileFilterRuleDefsPanel.newRuleButton.text=New Rule -FileFilterRuleDefsPanel.bothRadioButton.text=Files and Directories -FileFilterRuleDefsPanel.setsListLabel.text=Rule Sets -FileFilterRuleDefsPanel.jLabel6.text=Set Details -FileFilterRuleDefsPanel.fileNameRegexCheckbox.text=Regex -FileFilterRuleDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files -FileFilterRuleDefsPanel.rulePathConditionTextField.text= -FileFilterRuleDefsPanel.fileNameRadioButton.text=File Name -FileFilterRuleDefsPanel.jLabel5.text=Description: -FileFilterRuleDefsPanel.fileNameTextField.text= -FileFilterRuleDefsPanel.jLabel8.text=File Size: -FileFilterRuleDefsPanel.jLabel3.text=Name Pattern: -FileFilterRuleDefsPanel.fileNameExtensionRadioButton.text=Extension Only -FileFilterRuleDefsPanel.jLabel7.text=MIME Type: +IngestSetFilterDefinitions.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. +IngestSetFilterDefinitions.editSetButton.text=Edit Set +IngestSetFilterDefinitions.rulePathConditionRegexCheckBox.text=Regex +IngestSetFilterDefinitions.jLabel4.text=Path Pattern: +IngestSetFilterDefinitions.jLabel1.text=Rule Details +IngestSetFilterDefinitions.dirsRadioButton.text=Directories +IngestSetFilterDefinitions.jLabel2.text=File Type: +IngestSetFilterDefinitions.rulesListLabel.text=Rules: +IngestSetFilterDefinitions.newSetButton.text=New Set +IngestSetFilterDefinitions.editRuleButton.text=Edit Rule +IngestSetFilterDefinitions.deleteRuleButton.text=Delete Rule +IngestSetFilterDefinitions.filesRadioButton.text=Files +IngestSetFilterDefinitions.deleteSetButton.text=Delete Set +IngestSetFilterDefinitions.newRuleButton.text=New Rule +IngestSetFilterDefinitions.bothRadioButton.text=Files and Directories +IngestSetFilterDefinitions.setsListLabel.text=Rule Sets +IngestSetFilterDefinitions.jLabel6.text=Set Details +IngestSetFilterDefinitions.fileNameRegexCheckbox.text=Regex +IngestSetFilterDefinitions.ignoreKnownFilesCheckbox.text=Ignore Known Files +IngestSetFilterDefinitions.rulePathConditionTextField.text= +IngestSetFilterDefinitions.fileNameRadioButton.text=File Name +IngestSetFilterDefinitions.jLabel5.text=Description: +IngestSetFilterDefinitions.fileNameTextField.text= +IngestSetFilterDefinitions.jLabel8.text=File Size: +IngestSetFilterDefinitions.jLabel3.text=Name Pattern: +IngestSetFilterDefinitions.fileNameExtensionRadioButton.text=Extension Only +IngestSetFilterDefinitions.jLabel7.text=MIME Type: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index d5f40f74b3..954bd133fc 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -72,26 +72,26 @@ InterestingItemDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb InterestingItemDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe -FileFilterRuleDefsPanel.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 -FileFilterRuleDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe -FileFilterRuleDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a -FileFilterRuleDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 -FileFilterRuleDefsPanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea -FileFilterRuleDefsPanel.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a -FileFilterRuleDefsPanel.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a -FileFilterRuleDefsPanel.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 -FileFilterRuleDefsPanel.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 -FileFilterRuleDefsPanel.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 -FileFilterRuleDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb -FileFilterRuleDefsPanel.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 -FileFilterRuleDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb -FileFilterRuleDefsPanel.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea -FileFilterRuleDefsPanel.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 -FileFilterRuleDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 -FileFilterRuleDefsPanel.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe -FileFilterRuleDefsPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 -FileFilterRuleDefsPanel.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d -FileFilterRuleDefsPanel.jLabel5.text=\u6982\u8981\uff1a -FileFilterRuleDefsPanel.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 -FileFilterRuleDefsPanel.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f -FileFilterRuleDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 +IngestSetFilterDefinitions.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 +IngestSetFilterDefinitions.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe +IngestSetFilterDefinitions.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a +IngestSetFilterDefinitions.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 +IngestSetFilterDefinitions.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +IngestSetFilterDefinitions.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a +IngestSetFilterDefinitions.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a +IngestSetFilterDefinitions.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 +IngestSetFilterDefinitions.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 +IngestSetFilterDefinitions.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 +IngestSetFilterDefinitions.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb +IngestSetFilterDefinitions.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 +IngestSetFilterDefinitions.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb +IngestSetFilterDefinitions.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +IngestSetFilterDefinitions.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 +IngestSetFilterDefinitions.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 +IngestSetFilterDefinitions.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe +IngestSetFilterDefinitions.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 +IngestSetFilterDefinitions.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d +IngestSetFilterDefinitions.jLabel5.text=\u6982\u8981\uff1a +IngestSetFilterDefinitions.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 +IngestSetFilterDefinitions.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f +IngestSetFilterDefinitions.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 7df02b8bab..6994d3314e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014 Basis Technology Corp. + * Copyright 2014-2016 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -21,6 +21,7 @@ package org.sleuthkit.autopsy.modules.interestingitems; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; /** * A panel that allows a user to create and edit interesting files set @@ -146,8 +147,8 @@ public class FilesSetPanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.ignoreKnownFilesCheckbox.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(processUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.processUnallocCheckbox.text")); // NOI18N - processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.processUnallocCheckbox.toolTipText")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(processUnallocCheckbox, org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.processUnallocCheckbox.text")); // NOI18N + processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.processUnallocCheckbox.toolTipText")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java similarity index 77% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java index 050ce6ca65..1a5ea46072 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesFilter.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java @@ -1,7 +1,20 @@ /* - * To change this license header, choose License Headers in Project Properties. - * To change this template file, choose Tools | Templates - * and open the template in the editor. + * Autopsy Forensic Browser + * + * Copyright 2016 Basis Technology Corp. + * Contact: carrier sleuthkit 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. + * See the License for the specific language governing permissions and + * limitations under the License. */ package org.sleuthkit.autopsy.modules.interestingitems; @@ -14,20 +27,21 @@ import org.sleuthkit.datamodel.TskData; * * */ -public class FilesFilter { +public class IngestSetFilter { FilesSet currentRules; String rulesKey; private boolean processUnallocatedSpace; public final static String ALL_FILES_FILTER = ""; public final static String ALL_FILES_AND_UNALLOCATED_FILTER = ""; + public final static String NEW_INGEST_FILTER= ""; public static Set getKeys() throws InterestingItemDefsManager.InterestingItemDefsManagerException { InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); return manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").keySet(); } - public FilesFilter(String key) { + public IngestSetFilter(String key) { this.rulesKey = key; InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); if (key.equals(ALL_FILES_FILTER)) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java similarity index 87% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java index af909f72dc..e98c74ad89 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java @@ -1,7 +1,7 @@ /* * Autopsy Forensic Browser * - * Copyright 2014 Basis Technology Corp. + * Copyright 2016 Basis Technology Corp. * Contact: carrier sleuthkit org * * Licensed under the Apache License, Version 2.0 (the "License"); @@ -22,7 +22,6 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; -import java.util.List; import javax.swing.JComponent; import javax.swing.SwingUtilities; import org.netbeans.spi.options.OptionsPanelController; @@ -30,18 +29,22 @@ import org.openide.util.HelpCtx; import org.openide.util.Lookup; @OptionsPanelController.TopLevelRegistration( - categoryName = "#OptionsCategory_Name_FileFilterDefinitions", + categoryName = "#OptionsCategory_Name_IngestSetFilterDefinitions", iconBase = "org/sleuthkit/autopsy/images/interesting_item_32x32.png", - keywords = "#OptionsCategory_Keywords_FileFilterDefinitions", - keywordsCategory = "FileFilterDefinitions", + keywords = "#OptionsCategory_Keywords_IngestSetFilterDefinitions", + keywordsCategory = "IngestSetFilterDefinitions", position = 7 ) -public final class FileFilterDefsOptionsPanelController extends OptionsPanelController { + +/** + * Class for creating an InterestingItemDefsPanel which will be used for configuring the IngestSetFilter. + */ +public final class IngestSetFilterDefsOptionsPanelController extends OptionsPanelController { private InterestingItemDefsPanel panel; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; - + /** * Component should load its data here. */ @@ -60,9 +63,9 @@ public final class FileFilterDefsOptionsPanelController extends OptionsPanelCont */ public String[] getComboBoxContents() { ArrayList nameList = new ArrayList<>(); - nameList.add(FilesFilter.ALL_FILES_AND_UNALLOCATED_FILTER); - nameList.add(FilesFilter.ALL_FILES_FILTER); - nameList.add(""); + nameList.add(IngestSetFilter.ALL_FILES_AND_UNALLOCATED_FILTER); + nameList.add(IngestSetFilter.ALL_FILES_FILTER); + nameList.add(IngestSetFilter.NEW_INGEST_FILTER); if (!(panel == null)) { nameList.addAll(panel.getKeys()); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 09b059061c..f5eddd81c9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -54,7 +54,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp "InterestingItemDefsPanel.megaBytes=Megabytes", "InterestingItemDefsPanel.gigaBytes=Gigabytes", "InterestingItemsDefsPanel.loadError=Error loading interesting files sets from file.", - "InterestingItemsDefsPanel.saveError=Error saving interesting files sets to file." + "InterestingItemsDefsPanel.saveError=Error saving interesting files sets to file.", + "IngestFileFilter.title=Ingest File Set" }) private static final SortedSet MEDIA_TYPES = MimeTypes.getDefaultMimeTypes().getMediaTypeRegistry().getTypes(); @@ -65,6 +66,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private final JButton cancelButton = new JButton("Cancel"); private final String settingsFileName; private final String settingsLegacyFileName; + private final String ruleDialogTitle; // The following is a map of interesting files set names to interesting // files set definitions. It is a snapshot of the files set definitions @@ -79,18 +81,24 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * Constructs an interesting item definitions panel. */ InterestingItemDefsPanel(String settingsName, String legacySettingsName) { - this.initComponents(); + this.initComponents(); + this.settingsLegacyFileName = legacySettingsName; this.customInit(); this.setsList.setModel(setsListModel); this.setsList.addListSelectionListener(new InterestingItemDefsPanel.SetsListSelectionListener()); this.rulesList.setModel(rulesListModel); this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); this.settingsFileName = settingsName; - this.settingsLegacyFileName = legacySettingsName; + if (legacySettingsName.equals("")){ //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules this.mimeTypeComboBox.setVisible(false); this.jLabel7.setVisible(false); + this.ruleDialogTitle = "IngestFileFilter.title"; } + else { + this.ruleDialogTitle = "FilesSetPanel.title"; + } + } Set getKeys(){ @@ -98,10 +106,15 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp return filesSets.keySet(); } - @NbBundle.Messages({"InterestingItemDefsPanel.Title=Global Interesting Items Settings"}) + @NbBundle.Messages({"InterestingItemDefsPanel.Title=Global Interesting Items Settings", + "IngestFilterItemDefsPanel.Title=Global Ingest Filter Settings" }) private void customInit() { - setName(Bundle.InterestingItemDefsPanel_Title()); - + if (settingsLegacyFileName.equals("")){ + setName(Bundle.IngestFilterItemDefsPanel_Title()); + } + else { + setName(Bundle.InterestingItemDefsPanel_Title()); + } Set fileTypesCollated = new HashSet<>(); for (MediaType mediaType : MEDIA_TYPES) { fileTypesCollated.add(mediaType.toString()); @@ -363,7 +376,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // feedback when isValidDefinition() is called. int option = JOptionPane.OK_OPTION; do { - option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); + option = JOptionPane.showConfirmDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, ruleDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE); } while (option == JOptionPane.OK_OPTION && !panel.isValidDefinition()); // While adding new ruleset(selectedSet == null), if rule set with same name already exists, do not add to the filesSets hashMap. @@ -409,7 +422,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // feedback when isValidDefinition() is called. int option = JOptionPane.OK_OPTION; do { - option = JOptionPane.showOptionDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.title"), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton); + option = JOptionPane.showOptionDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, ruleDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton); } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition()); if (option == JOptionPane.OK_OPTION) { From 97f9064d30e1fe56032c660ccc72a442be4227fa Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 5 Dec 2016 15:20:47 -0500 Subject: [PATCH 09/50] 1903-saving of previously used filter fixed --- .../autopsy/ingest/IngestJobSettings.java | 34 +-- .../ingest/IngestJobSettingsPanel.java | 12 +- .../autopsy/ingest/IngestTasksScheduler.java | 22 +- .../interestingitems/Bundle.properties | 4 +- ...FilesIdentifierIngestJobSettingsPanel.java | 12 +- .../FilesIdentifierIngestModule.java | 4 +- .../interestingitems/IngestSetFilter.java | 132 +++++++-- ...stSetFilterDefsOptionsPanelController.java | 23 +- .../InterestingItemDefsManager.java | 49 ++-- ...restingItemDefsOptionsPanelController.java | 2 +- .../InterestingItemDefsPanel.form | 250 ++++++++++-------- .../InterestingItemDefsPanel.java | 223 +++++++++------- .../InterestingItemsIngestModuleFactory.java | 5 +- 13 files changed, 438 insertions(+), 334 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 408e8213b3..702b5014ea 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -42,21 +42,18 @@ import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilter; /** * Encapsulates the ingest job settings for a particular execution context. * Examples of execution contexts include the add data source wizard and the run - * ingest modules dialog. Different execution conterxts may have different - * ingest job settings. + * ingest modules dialog. Different execution contexts may have different ingest + * job settings. */ public class IngestJobSettings { private static final String ENABLED_MODULES_KEY = "Enabled_Ingest_Modules"; //NON-NLS private static final String DISABLED_MODULES_KEY = "Disabled_Ingest_Modules"; //NON-NLS private static final String PARSE_UNALLOC_SPACE_KEY = "Process_Unallocated_Space"; //NON-NLS - private static final String RUN_ON_FILTER_KEY = "Run_Ingest_On"; private static final String PROCESS_UNALLOC_SPACE_DEFAULT = "true"; //NON-NLS - private static final String RUN_ON_FILTER_DEFAULT = IngestSetFilter.ALL_FILES_AND_UNALLOCATED_FILTER; private static final String MODULE_SETTINGS_FOLDER = "IngestModuleSettings"; //NON-NLS private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS - private String runIngestModulesOnFilter; private static final Logger LOGGER = Logger.getLogger(IngestJobSettings.class.getName()); private final String executionContext; private final IngestType ingestType; @@ -66,22 +63,6 @@ public class IngestJobSettings { private boolean processUnallocatedSpace; private final List warnings; - /** - * @return the runIngestModulesOnFilter - */ - String getRunIngestModulesOnFilter() { - return runIngestModulesOnFilter; - } - - /** - * @param runIngestModulesOnFilter the runIngestModulesOnFilter to set - */ - void setRunIngestModulesOnFilter(String runIngestModulesOnFilter) { - this.runIngestModulesOnFilter = runIngestModulesOnFilter; - this.processUnallocatedSpace = (new IngestSetFilter(runIngestModulesOnFilter)).isProcessUnallocatedSpace(); - this.save(); - } - /** * The type of ingest modules to run. */ @@ -114,7 +95,6 @@ public class IngestJobSettings { this.ingestType = IngestType.ALL_MODULES; this.moduleTemplates = new ArrayList<>(); this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); - this.runIngestModulesOnFilter = IngestSetFilter.ALL_FILES_AND_UNALLOCATED_FILTER; this.warnings = new ArrayList<>(); this.createSavedModuleSettingsFolder(); this.load(); @@ -141,7 +121,6 @@ public class IngestJobSettings { this.moduleTemplates = new ArrayList<>(); this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); - this.runIngestModulesOnFilter = IngestSetFilter.ALL_FILES_AND_UNALLOCATED_FILTER; this.warnings = new ArrayList<>(); this.createSavedModuleSettingsFolder(); this.load(); @@ -331,14 +310,8 @@ public class IngestJobSettings { ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.ENABLED_MODULES_KEY, makeCommaSeparatedValuesList(enabledModuleNames)); ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.DISABLED_MODULES_KEY, makeCommaSeparatedValuesList(disabledModuleNames)); - // Get the filter setting telling it which files to run modules on. If the setting does - // not exist yet, default it to All Files and Unallocated Space filter. - if (ModuleSettings.settingExists(this.executionContext, IngestJobSettings.RUN_ON_FILTER_KEY) == false) { - ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.RUN_ON_FILTER_KEY, IngestJobSettings.RUN_ON_FILTER_DEFAULT); - } - this.runIngestModulesOnFilter = ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.RUN_ON_FILTER_KEY); //set the process unallocated space setting based on the filter chosen. - this.processUnallocatedSpace = (new IngestSetFilter(runIngestModulesOnFilter)).isProcessUnallocatedSpace(); + this.processUnallocatedSpace = (new IngestSetFilter()).isProcessUnallocatedSpace(); } @@ -474,6 +447,7 @@ public class IngestJobSettings { */ String processUnalloc = Boolean.toString(this.processUnallocatedSpace); ModuleSettings.setConfigSetting(this.executionContext, PARSE_UNALLOC_SPACE_KEY, processUnalloc); + } /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index e292fe08f7..d2a707d1cd 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -85,7 +85,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { initComponents(); customizeComponents(); - jComboBox1.setSelectedItem(settings.getRunIngestModulesOnFilter()); + jComboBox1.setSelectedItem(controller.getIngestSetFilter().getLastSelected()); } /** @@ -114,7 +114,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { initComponents(); customizeComponents(); - jComboBox1.setSelectedItem(settings.getRunIngestModulesOnFilter()); + jComboBox1.setSelectedItem(controller.getIngestSetFilter().getLastSelected()); } /** @@ -422,12 +422,12 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { dialog.close(); }); dialog.display((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())); + jComboBox1.setSelectedItem(controller.getIngestSetFilter().getLastSelected()); - } else { - settings.setRunIngestModulesOnFilter(jComboBox1.getSelectedItem().toString()); - settings.save(); + } else if (evt.getActionCommand().equals("comboBoxChanged")) { + controller.getIngestSetFilter().setLastSelected(jComboBox1.getSelectedItem().toString()); } - jComboBox1.setSelectedItem(settings.getRunIngestModulesOnFilter()); + }//GEN-LAST:event_jComboBox1ActionPerformed diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index 2fd8ed4222..169f404b61 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -150,7 +150,7 @@ final class IngestTasksScheduler { * @param job The job for which the tasks are to be scheduled. * * @throws InterruptedException if the calling thread is blocked due to a - * full tasks queue and is interrupted. + * full tasks queue and is interrupted. */ synchronized void scheduleIngestTasks(DataSourceIngestJob job) { if (!job.isCancelled()) { @@ -210,7 +210,7 @@ final class IngestTasksScheduler { /** * Schedules a file ingest task for an ingest job. * - * @param job The job for which the tasks are to be scheduled. + * @param job The job for which the tasks are to be scheduled. * @param file The file to be associated with the task. */ synchronized void scheduleFileIngestTask(DataSourceIngestJob job, AbstractFile file) { @@ -411,13 +411,13 @@ final class IngestTasksScheduler { if (fileName.equals(".") || fileName.equals("..")) { return false; } - - if (file.isFile()){ //is this the criteria we want to be using(will unallocated space files show return true?) - IngestSetFilter ingestSetFilter; - ingestSetFilter = new IngestSetFilter(task.getIngestJob().runIngestModulesOnFilter()); - if (!ingestSetFilter.match(file)){ - return false; - } + + if (file.isFile()) { //is this the criteria we want to be using(will unallocated space files show return true?) + IngestSetFilter ingestSetFilter; + ingestSetFilter = new IngestSetFilter(); + if (!ingestSetFilter.match(file)) { + return false; + } } // Skip the task if the file is one of a select group of special, large // NTFS or FAT file system files. @@ -487,7 +487,7 @@ final class IngestTasksScheduler { * well. * * @param taskQueue The queue from which to remove the tasks. - * @param jobId The id of the job for which the tasks are to be removed. + * @param jobId The id of the job for which the tasks are to be removed. */ synchronized private void removeTasksForJob(Collection taskQueue, long jobId) { Iterator iterator = taskQueue.iterator(); @@ -563,12 +563,12 @@ final class IngestTasksScheduler { static final List MEDIUM_PRI_PATHS = new ArrayList<>(); static final List HIGH_PRI_PATHS = new ArrayList<>(); + /* * prioritize root directory folders based on the assumption that we * are looking for user content. Other types of investigations may * want different priorities. */ - static /* * prioritize root directory folders based on the assumption that we * are looking for user content. Other types of investigations may diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 58a05ab228..5a954351ac 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -4,7 +4,7 @@ OpenIDE-Module-Short-Description=Interesting Files Identifier ingest module. OpenIDE-Module-Name=Interesting Files Identifier OptionsCategory_Name_InterestingItemDefinitions=Interesting Files OptionsCategory_Keywords_InterestingItemDefinitions=InterestingItemDefinitions -OptionsCategory_Name_IngestSetFilterDefinitions=File Filter +OptionsCategory_Name_IngestSetFilterDefinitions=Ingest Set Filter OptionsCategory_Keywords_IngestSetFilterDefinitions=IngestSetFilterDefinitions InterestingItemsIdentifierIngestModule.moduleName=Interesting Files Identifier InterestingItemsIdentifierIngestModule.moduleDescription=Identifies interesting items as defined by interesting item rule sets. @@ -33,6 +33,8 @@ FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: FilesSetRulePanel.jLabel1.text=Type: FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. +InterestingItemDefsPanel.processUnallocCheckbox.toolTipText=Processes unallocated space, such as deleted files. Produces more complete results, but it may take longer to process on large images. +InterestingItemDefsPanel.processUnallocCheckbox.text=Process Unallocated Space InterestingItemDefsPanel.jLabel6.text=Set Details InterestingItemDefsPanel.jLabel8.text=File Size: InterestingItemDefsPanel.jLabel7.text=MIME Type: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index 416573ca71..cd6741a6c0 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -26,7 +26,6 @@ import java.util.TreeMap; import javax.swing.JTable; import javax.swing.table.AbstractTableModel; import javax.swing.table.TableColumn; -import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil; import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettings; @@ -36,6 +35,7 @@ import org.sleuthkit.autopsy.ingest.IngestModuleIngestJobSettingsPanel; * Ingest job settings panel for interesting files identifier ingest modules. */ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobSettingsPanel implements Observer { + @Messages({ "FilesIdentifierIngestJobSettingsPanel.updateError=Error updating interesting files sets settings file.", "FilesIdentifierIngestJobSettingsPanel.getError=Error getting interesting files sets from settings file." @@ -53,7 +53,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS * constructor. * * @return An instance of the ingest job settings panel interesting files - * identifier ingest modules. + * identifier ingest modules. */ static FilesIdentifierIngestJobSettingsPanel makePanel(FilesIdentifierIngestJobSettings settings) { FilesIdentifierIngestJobSettingsPanel panel = new FilesIdentifierIngestJobSettingsPanel(settings); @@ -83,7 +83,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS */ List filesSetRows = new ArrayList<>(); try { - this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME())); + this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName())); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError()); this.filesSetSnapshot = new TreeMap<>(); @@ -138,7 +138,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS List rowModels = new ArrayList<>(); TreeMap newFilesSetSnapshot; try { - newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME())); + newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName())); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError()); return; @@ -172,7 +172,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS * job. * * @param filesSetRows A collection of row objects that bundles an - * interesting files set with an enabled flag + * interesting files set with an enabled flag */ FilesSetsTableModel(List filesSetRows) { this.filesSetRows = filesSetRows; @@ -182,7 +182,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS * Refreshes the table with a new set of rows. * * @param filesSetRows A collection of row objects that bundles an - * interesting files set with an enabled flag + * interesting files set with an enabled flag */ void resetTableData(List filesSetRows) { this.filesSetRows = filesSetRows; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index 04df50b406..84c193be90 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -83,7 +83,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { // to disable the interesting files set definition UI during ingest. List filesSets = new ArrayList<>(); try { - for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()).values()) { + for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()).values()) { if (settings.interestingFilesSetIsEnabled(set.getName())) { filesSets.add(set); } @@ -103,7 +103,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { @Messages({"FilesIdentifierIngestModule.indexError.message=Failed to index interesting file hit artifact for keyword search."}) public ProcessResult process(AbstractFile file) { blackboard = Case.getCurrentCase().getServices().getBlackboard(); - + // Skip slack space files. if (file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) { return ProcessResult.OK; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java index 1a5ea46072..d158bfa0f6 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java @@ -20,48 +20,97 @@ package org.sleuthkit.autopsy.modules.interestingitems; import java.util.Set; import org.openide.util.Exceptions; +import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; /** - * + * Allows limiting which files ingest is run on by storing rules and allowing + * files to be compared to them. * */ -public class IngestSetFilter { +public final class IngestSetFilter { FilesSet currentRules; String rulesKey; private boolean processUnallocatedSpace; public final static String ALL_FILES_FILTER = ""; public final static String ALL_FILES_AND_UNALLOCATED_FILTER = ""; - public final static String NEW_INGEST_FILTER= ""; - - public static Set getKeys() throws InterestingItemDefsManager.InterestingItemDefsManagerException { - InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); - return manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").keySet(); - } + public final static String NEW_INGEST_FILTER = ""; + private String lastSelected; + private static final String LAST_INGEST_FILTER_FILE = "CurrentIngestFilter"; + private static final String LAST_INGEST_FILTER_PROPERTY = "LastIngestFilter"; + /** + * Creates an IngestSetFilter for the filter specified by the key. + * + * @param key - The name of the filter you wish to create. + */ public IngestSetFilter(String key) { this.rulesKey = key; InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); - if (key.equals(ALL_FILES_FILTER)) { - currentRules = null; - processUnallocatedSpace = false; - } else if (key.equals(ALL_FILES_AND_UNALLOCATED_FILTER)) { - currentRules = null; - processUnallocatedSpace = true; - } else { - try { - currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), "").get(key); - processUnallocatedSpace = currentRules.processesUnallocatedSpace(); - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - Exceptions.printStackTrace(ex); - } + switch (key) { + case ALL_FILES_FILTER: + currentRules = null; + processUnallocatedSpace = false; + break; + case ALL_FILES_AND_UNALLOCATED_FILTER: + currentRules = null; + processUnallocatedSpace = true; + break; + default: + try { + currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getIngestSetFilterDefsName(), "").get(key); + processUnallocatedSpace = currentRules.processesUnallocatedSpace(); + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + Exceptions.printStackTrace(ex); + } + break; } } /** + * No argument constructor for IngestSetFilter, creates a filter using the + * same filter that was selected previously. + */ + public IngestSetFilter() { + InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); + this.rulesKey = getLastSelected(); + switch (rulesKey) { + case ALL_FILES_FILTER: + currentRules = null; + processUnallocatedSpace = false; + break; + case ALL_FILES_AND_UNALLOCATED_FILTER: + currentRules = null; + processUnallocatedSpace = true; + break; + default: + try { + currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getIngestSetFilterDefsName(), "").get(rulesKey); + processUnallocatedSpace = currentRules.processesUnallocatedSpace(); + } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + Exceptions.printStackTrace(ex); + } + break; + } + + } + + /** + * Get the set of available Ingest Set Filters. * + * @return - the set of filter names + * @throws + * org.sleuthkit.autopsy.modules.interestingitems.InterestingItemDefsManager.InterestingItemDefsManagerException + */ + public static Set getKeys() throws InterestingItemDefsManager.InterestingItemDefsManagerException { + InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); + return manager.getInterestingFilesSets(InterestingItemDefsManager.getIngestSetFilterDefsName(), "").keySet(); + } + + /** + * Returns access to the Rules currently being used by the Ingest Set Filter * * @return - the active file filter set from the InterestingItemsDefsManager */ @@ -78,11 +127,10 @@ public class IngestSetFilter { */ public boolean match(AbstractFile file) { boolean fileMatches = false; - if (isProcessUnallocatedSpace() == false && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)){ + if (isProcessUnallocatedSpace() == false && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) { fileMatches = false; - } - else if (rulesKey.equals(ALL_FILES_FILTER) || rulesKey.equals(ALL_FILES_AND_UNALLOCATED_FILTER) ) { - fileMatches = true; + } else if (rulesKey.equals(ALL_FILES_FILTER) || rulesKey.equals(ALL_FILES_AND_UNALLOCATED_FILTER)) { + fileMatches = true; } else if (currentRules.fileIsMemberOf(file) != null) { fileMatches = true; } @@ -90,7 +138,39 @@ public class IngestSetFilter { } /** - * @return the processUnallocatedSpace + * Get the name of the Ingest Set Filter which was last used, so that when + * running on the same set of files you will not have to reselect that set. + * + * @return lastSelected - the string which represents the Ingest Set Filter + * which was last used. + */ + public String getLastSelected() { + if (lastSelected == null) { + if (ModuleSettings.configExists(LAST_INGEST_FILTER_FILE)) { + lastSelected = ModuleSettings.getConfigSetting(LAST_INGEST_FILTER_FILE, LAST_INGEST_FILTER_PROPERTY); + } else { + lastSelected = ALL_FILES_AND_UNALLOCATED_FILTER; + } + } + return lastSelected; + } + + /** + * Saves the last selected IngestSetFilter, to a file so that it can be + * loaded later. + * + * @return True if value was saved successfully, false if it was not. + */ + public void setLastSelected(String lastSelectedFilter) { + lastSelected = lastSelectedFilter; + ModuleSettings.setConfigSetting(LAST_INGEST_FILTER_FILE, LAST_INGEST_FILTER_PROPERTY, lastSelected); + } + + /** + * Get whether or not unallocated space should be processed as a boolean. + * + * @return the processUnallocatedSpace true if unallocated space should be + * processed false if unallocated space should not be processed */ public boolean isProcessUnallocatedSpace() { return processUnallocatedSpace; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java index e98c74ad89..0e94f371eb 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java @@ -30,21 +30,23 @@ import org.openide.util.Lookup; @OptionsPanelController.TopLevelRegistration( categoryName = "#OptionsCategory_Name_IngestSetFilterDefinitions", - iconBase = "org/sleuthkit/autopsy/images/interesting_item_32x32.png", + iconBase = "org/sleuthkit/autopsy/images/ingest_set_filter32x32.png", keywords = "#OptionsCategory_Keywords_IngestSetFilterDefinitions", keywordsCategory = "IngestSetFilterDefinitions", position = 7 ) /** - * Class for creating an InterestingItemDefsPanel which will be used for configuring the IngestSetFilter. + * Class for creating an InterestingItemDefsPanel which will be used for + * configuring the IngestSetFilter. */ public final class IngestSetFilterDefsOptionsPanelController extends OptionsPanelController { private InterestingItemDefsPanel panel; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; - + private final IngestSetFilter filter = new IngestSetFilter(); + /** * Component should load its data here. */ @@ -69,11 +71,15 @@ public final class IngestSetFilterDefsOptionsPanelController extends OptionsPane if (!(panel == null)) { nameList.addAll(panel.getKeys()); } - String[] returnArray = {}; + String[] returnArray = {}; nameList.toArray(returnArray); return nameList.toArray(returnArray); } + public IngestSetFilter getIngestSetFilter() { + return filter; + } + /** * This method is called when both the Ok and Apply buttons are pressed. It * applies to any of the panels that have been opened in the process of @@ -138,9 +144,16 @@ public final class IngestSetFilterDefsOptionsPanelController extends OptionsPane pcs.removePropertyChangeListener(l); } + /** + * Creates an interestingItemsDefPanel that will be labeled to indicate it + * is for Ingest Set Filter settings + * + * @return an InterestingItemDefsPanel which has text and fields modified to + * indicate it is for Ingest Set Filtering. + */ private InterestingItemDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME(), ""); + panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getIngestSetFilterDefsName(), ""); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index b35afa8b8f..5c814c10d2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -52,9 +52,9 @@ final class InterestingItemDefsManager extends Observable { private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS - private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME = "InterestingFileSets.settings"; - private static final String FILE_FILTER_SET_DEFS_SERIALIZATION_NAME = "FileFilterSets.settings"; - private static final String INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; + private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings"; + private static final String INGEST_SET_FILTER_DEFS_NAME = "IngestSetFilterDefs.settings"; + private static final String INTERESTING_FILES_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; private static final String LEGACY_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; private static InterestingItemDefsManager instance; @@ -90,29 +90,29 @@ final class InterestingItemDefsManager extends Observable { /** * @return the LEGACY_FILES_SET_DEFS_FILE_NAME */ - static String getLEGACY_FILES_SET_DEFS_FILE_NAME() { + static String getLegacyFilesSetDefsFileName() { return LEGACY_FILES_SET_DEFS_FILE_NAME; } /** - * @return the INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME + * @return the INTERESTING_FILES_SET_DEFS_NAME */ - static String getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME() { - return INTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME; + static String getInterestingFilesSetDefsSerializationName() { + return INTERESTING_FILES_SET_DEFS_NAME; } /** - * @return the FILE_FILTER_SET_DEFS_SERIALIZATION_NAME + * @return the INGEST_SET_FILTER_DEFS_NAME */ - static String getFILE_FILTER_SET_DEFS_SERIALIZATION_NAME() { - return FILE_FILTER_SET_DEFS_SERIALIZATION_NAME; + static String getIngestSetFilterDefsName() { + return INGEST_SET_FILTER_DEFS_NAME; } /** * Gets a copy of the current interesting files set definitions. * * @return A map of interesting files set names to interesting file sets, - * possibly empty. + * possibly empty. */ synchronized Map getInterestingFilesSets(String serialFileName, String legacyFilePath) throws InterestingItemDefsManagerException { return FilesSetXML.readDefinitionsFile(serialFileName, LEGACY_FILE_SET_DEFS_PATH); @@ -123,10 +123,10 @@ final class InterestingItemDefsManager extends Observable { * previous definitions. * * @param filesSets A mapping of interesting files set names to files sets, - * used to enforce unique files set names. + * used to enforce unique files set names. */ synchronized void setInterestingFilesSets(Map filesSets, String serialFileName) throws InterestingItemDefsManagerException { - FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH+serialFileName, filesSets); + FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_PATH + serialFileName, filesSets); this.setChanged(); this.notifyObservers(); } @@ -179,8 +179,8 @@ final class InterestingItemDefsManager extends Observable { return filesSets; } // Check if the legacy xml file exists. - if(!legacyFileName.isEmpty()){ - File defsFile = new File(LEGACY_FILE_SET_DEFS_PATH+legacyFileName); + if (!legacyFileName.isEmpty()) { + File defsFile = new File(LEGACY_FILE_SET_DEFS_PATH + legacyFileName); if (!defsFile.exists()) { return filesSets; } @@ -218,12 +218,13 @@ final class InterestingItemDefsManager extends Observable { * Reads the definitions from the serialization file * * @return the map representing settings saved to serialization file, - * empty set if the file does not exist. + * empty set if the file does not exist. * * @throws InterestingItemDefsManagerException if file could not be read */ private static Map readSerializedDefinitions(String serialFileName) throws InterestingItemDefsManagerException { - String filePath = INTERESTING_FILES_SET_DEFS_SERIALIZATION_PATH + serialFileName; + String filePath; + filePath = INTERESTING_FILES_SET_DEFS_PATH + serialFileName; System.out.println(filePath); File fileSetFile = new File(filePath); if (fileSetFile.exists()) { @@ -236,16 +237,16 @@ final class InterestingItemDefsManager extends Observable { throw new InterestingItemDefsManagerException(String.format("Failed to read settings from %s", filePath), ex); } } else { - return new HashMap(); + return new HashMap<>(); } } /** * Reads in an interesting files set. * - * @param setElem An interesting files set XML element + * @param setElem An interesting files set XML element * @param filesSets A collection to which the set is to be added. - * @param filePath The source file, used for error reporting. + * @param filePath The source file, used for error reporting. */ private static void readFilesSet(Element setElem, Map filesSets, String filePath) { // The file set must have a unique name. @@ -319,10 +320,10 @@ final class InterestingItemDefsManager extends Observable { * Construct an interesting files set file name rule from the data in an * XML element. * - * @param elem The file name rule XML element. + * @param elem The file name rule XML element. * * @return A file name rule, or null if there is an error (the error is - * logged). + * logged). */ private static FilesSet.Rule readFileNameRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); @@ -380,7 +381,7 @@ final class InterestingItemDefsManager extends Observable { * @param elem The file name extension rule XML element. * * @return A file name extension rule, or null if there is an error (the - * error is logged). + * error is logged). */ private static FilesSet.Rule readFileExtensionRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); @@ -473,7 +474,7 @@ final class InterestingItemDefsManager extends Observable { * @param ruleElement The XML element. * * @return The meta-type condition, or null if there is an error - * (logged). + * (logged). */ private static FilesSet.Rule.MetaTypeCondition readMetaTypeCondition(Element ruleElement) { FilesSet.Rule.MetaTypeCondition condition = null; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java index 1118d88e64..b0666ad9ab 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java @@ -115,7 +115,7 @@ public final class InterestingItemDefsOptionsPanelController extends OptionsPane private InterestingItemDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()); + panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index b4c3076206..48a03bd2b7 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -63,126 +63,126 @@ + - - - - - - - - - - + + + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -214,7 +214,10 @@ - + + + + @@ -839,6 +842,19 @@ + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index f5eddd81c9..a230ce8157 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -67,7 +67,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private final String settingsFileName; private final String settingsLegacyFileName; private final String ruleDialogTitle; - + // The following is a map of interesting files set names to interesting // files set definitions. It is a snapshot of the files set definitions // obtained from the interesting item definitions manager at the time the @@ -81,7 +81,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * Constructs an interesting item definitions panel. */ InterestingItemDefsPanel(String settingsName, String legacySettingsName) { - this.initComponents(); + this.initComponents(); this.settingsLegacyFileName = legacySettingsName; this.customInit(); this.setsList.setModel(setsListModel); @@ -89,30 +89,28 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.rulesList.setModel(rulesListModel); this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); this.settingsFileName = settingsName; - - if (legacySettingsName.equals("")){ //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules + + if (legacySettingsName.equals("")) { //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules this.mimeTypeComboBox.setVisible(false); this.jLabel7.setVisible(false); this.ruleDialogTitle = "IngestFileFilter.title"; - } - else { + } else { this.ruleDialogTitle = "FilesSetPanel.title"; } - + } - Set getKeys(){ + Set getKeys() { load(); return filesSets.keySet(); } - + @NbBundle.Messages({"InterestingItemDefsPanel.Title=Global Interesting Items Settings", - "IngestFilterItemDefsPanel.Title=Global Ingest Filter Settings" }) + "IngestFilterItemDefsPanel.Title=Global Ingest Filter Settings"}) private void customInit() { - if (settingsLegacyFileName.equals("")){ + if (settingsLegacyFileName.equals("")) { setName(Bundle.IngestFilterItemDefsPanel_Title()); - } - else { + } else { setName(Bundle.InterestingItemDefsPanel_Title()); } Set fileTypesCollated = new HashSet<>(); @@ -145,7 +143,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.fileSizeUnitComboBox.setSelectedIndex(1); this.equalitySignComboBox.setSelectedIndex(2); } - + /** * @inheritDoc */ @@ -205,6 +203,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.setsListModel.clear(); this.setDescriptionTextArea.setText(""); this.ignoreKnownFilesCheckbox.setSelected(true); + this.processUnallocCheckbox.setSelected(true); this.newSetButton.setEnabled(true); this.editSetButton.setEnabled(false); this.deleteSetButton.setEnabled(false); @@ -252,7 +251,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // selected files set. InterestingItemDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription()); InterestingItemDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles()); - + InterestingItemDefsPanel.this.processUnallocCheckbox.setSelected(selectedSet.processesUnallocatedSpace()); // Enable the new, edit and delete set buttons. InterestingItemDefsPanel.this.newSetButton.setEnabled(true); InterestingItemDefsPanel.this.editSetButton.setEnabled(true); @@ -357,8 +356,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * respond to user interactions with the dialog. * * @param selectedSet The currently selected files set, may be null to - * indicate a new interesting files set definition is to - * be created. + * indicate a new interesting files set definition is to be created. */ private void doFileSetsDialog(FilesSet selectedSet) { // Create a files set defintion panle. @@ -405,7 +403,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * dialog box and respond to user interactions with the dialog. * * @param selectedRule The currently selected rule, may be null to indicate - * a new rule definition is to be created. + * a new rule definition is to be created. */ private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) { // Create a files set rule panel. @@ -452,19 +450,21 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp }); } } + /** * Adds an interesting files set definition to the collection of definitions * owned by this panel. If there is a definition with the same name, it will * be replaced, so this is an add/edit operation. * - * @param oldSet A set to replace, null if the new set is not a - * replacement. - * @param name The name of the files set. - * @param description The description of the files set. + * @param oldSet A set to replace, null if the new set is not a replacement. + * @param name The name of the files set. + * @param description The description of the files set. * @param ignoresKnownFiles Whether or not the files set ignores known - * files. - * @param rules The set membership rules for the set. + * files. + * @param rules The set membership rules for the set. + * @param processesUnallocatedSpace Whether or not this set of rules processes + * unallocated space */ void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map rules, boolean processesUnallocatedSpace) { if (oldSet != null) { @@ -496,6 +496,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * WARNING: Do NOT modify this code. The content of this method is always * regenerated by the Form Editor. */ + @SuppressWarnings("unchecked") // //GEN-BEGIN:initComponents private void initComponents() { @@ -543,6 +544,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp equalitySignComboBox = new javax.swing.JComboBox(); fileSizeSpinner = new javax.swing.JSpinner(); fileSizeUnitComboBox = new javax.swing.JComboBox(); + processUnallocCheckbox = new javax.swing.JCheckBox(); setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11)); @@ -750,101 +752,111 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() })); fileSizeUnitComboBox.setEnabled(false); + org.openide.awt.Mnemonics.setLocalizedText(processUnallocCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.processUnallocCheckbox.text")); // NOI18N + processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.processUnallocCheckbox.toolTipText")); // NOI18N + processUnallocCheckbox.setEnabled(false); + processUnallocCheckbox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + processUnallocCheckboxActionPerformed(evt); + } + }); + javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(360, 360, 360) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rulesListLabel) + .addComponent(jLabel5) + .addComponent(jLabel6) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(ignoreKnownFilesCheckbox) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(processUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(360, 360, 360) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rulesListLabel) - .addComponent(jLabel5) - .addComponent(ignoreKnownFilesCheckbox) - .addComponent(jLabel6)) - .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(setsListLabel) + .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(18, 18, 18) + .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)) .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() + .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(deleteSetButton))) + .addGap(12, 12, 12) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(20, 20, 20) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(setsListLabel) - .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(18, 18, 18) - .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(deleteSetButton))) - .addGap(12, 12, 12) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(20, 20, 20) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3) - .addComponent(jLabel2)) - .addGap(6, 6, 6)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(jLabel4) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(fileNameTextField))) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel7) - .addComponent(jLabel8)) - .addGap(6, 6, 6) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(8, 8, 8)) - .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) + .addComponent(jLabel3) + .addComponent(jLabel2)) + .addGap(6, 6, 6)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(fileNameTextField))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(setDescScrollPanel) - .addComponent(rulesListScrollPane)) - .addGap(7, 7, 7)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel1) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(92, 92, 92) - .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(dirsRadioButton) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addGap(6, 6, 6) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(bothRadioButton)) + .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(8, 8, 8)) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(setDescScrollPanel) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)) + .addGap(7, 7, 7)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(92, 92, 92) + .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(dirsRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(bothRadioButton)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(newRuleButton) + .addGap(18, 18, 18) + .addComponent(editRuleButton) + .addGap(18, 18, 18) + .addComponent(deleteRuleButton)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(96, 96, 96) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(newRuleButton) - .addGap(18, 18, 18) - .addComponent(editRuleButton) - .addGap(18, 18, 18) - .addComponent(deleteRuleButton)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(96, 96, 96) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(fileNameRadioButton) - .addGap(4, 4, 4) - .addComponent(fileNameExtensionRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(fileNameRegexCheckbox)) - .addComponent(rulePathConditionRegexCheckBox)))) - .addGap(4, 4, 4))))) - .addGap(23, 23, 23)) + .addComponent(fileNameRadioButton) + .addGap(4, 4, 4) + .addComponent(fileNameExtensionRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(fileNameRegexCheckbox)) + .addComponent(rulePathConditionRegexCheckBox)))) + .addGap(4, 4, 4))) + .addGap(85, 85, 85)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -872,7 +884,9 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(ignoreKnownFilesCheckbox) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) + .addComponent(ignoreKnownFilesCheckbox) + .addComponent(processUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rulesListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -1000,6 +1014,10 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // TODO add your handling code here: }//GEN-LAST:event_fileNameTextFieldActionPerformed + private void processUnallocCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_processUnallocCheckboxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_processUnallocCheckboxActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton bothRadioButton; private javax.swing.JButton deleteRuleButton; @@ -1032,6 +1050,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.JButton newRuleButton; private javax.swing.JButton newSetButton; + private javax.swing.JCheckBox processUnallocCheckbox; private javax.swing.JCheckBox rulePathConditionRegexCheckBox; private javax.swing.JTextField rulePathConditionTextField; private javax.swing.JList rulesList; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index 86899508f7..a327f665b2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.modules.interestingitems; import java.util.ArrayList; import java.util.List; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.openide.util.lookup.ServiceProvider; @@ -70,7 +69,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto @Override public IngestModuleGlobalSettingsPanel getGlobalSettingsPanel() { - InterestingItemDefsPanel panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()); + InterestingItemDefsPanel panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()); panel.load(); return panel; } @@ -84,7 +83,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto // Doing so also keeps the serialization simple. List enabledFilesSetNames = new ArrayList<>(); try { - for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getINTERESTING_FILES_SET_DEFS_SERIALIZATION_NAME(), InterestingItemDefsManager.getLEGACY_FILES_SET_DEFS_FILE_NAME()).keySet()) { + for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()).keySet()) { enabledFilesSetNames.add(name); } } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { From c1463b91b5d9a929fb9479be697dd5fb98487d35 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 5 Dec 2016 15:23:27 -0500 Subject: [PATCH 10/50] 1903-Added placeholder icon for Ingest Set Filter --- .../autopsy/images/ingest_set_filter32x32.png | Bin 0 -> 1666 bytes 1 file changed, 0 insertions(+), 0 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/images/ingest_set_filter32x32.png diff --git a/Core/src/org/sleuthkit/autopsy/images/ingest_set_filter32x32.png b/Core/src/org/sleuthkit/autopsy/images/ingest_set_filter32x32.png new file mode 100644 index 0000000000000000000000000000000000000000..a31d8023e49843ef2b3cdbe0fa8ec115a5d00fe9 GIT binary patch literal 1666 zcmV-|27UR7P)Ak&we!t&2k1uYi zn=nc#Jjr=;&hMP(`}>~rJkR%0?d|OVN^AXeKA%sQN~Oqg9PY$K1g$k&w{A_ex3|B$ zW5m z8(QmgfXZgGGS4~HgOpOZt_wgam6~@X5(#|YpJQXwrcE3=bci4b(#Du(GOW3sm(D*O({f~jg0%&e-rn9q?p`js$hljax zfr`t;woY}uj#!UGRiH`q_Iyl4PQDS{xNwzihq+FD%KB?to1S_3Ro zN|DWGAyEsdMl6cb!S(kJz^yC{LuHIXDOCo@WHS8mf#yqjkxIX|SDzi+c(QXNC%CG2W-7R^BX(o^U) z+i!D-p?LT)%+*1xSj1WyC*H10U;a~Gry3qq+QUX=;+gA}aQdUp)cOqpl`y`mD^PwC z|EtfFI(PxQ@*(2lG-3rMpss(2H5MyEz2pE#l`6YJpDwV(enyB}8xPB6lxtthRipIv#&p^7%h2m&J6iR6%D$?-ttM?`k2q0Dv zV~|<;6(CAutx?t(gIHYOr&287`TJd1X4eV_kytiZL_&MDm+l59RvDp7^7ryKj%U*UKGj_YAf zgu#WSD{!ujAPCpo#$sJ@%yIo7@cg7>ooJ^C!%SQ*9`m&?`gv6hjM5&HZ4 zZ!61{30ePU2Z=-y?IjR|usp-{#AkSa^FcoM&Z{(=VF0czUsvo|+R*a#%NGW`Ao+mf zc{qNM(w_HXrI7!LoAi@+)tEffc!h1vMT`}41voywn$akQQi^Ara%@>P4G6|xazusG z`@&)#;1R9e*S#QE2@sY`2fQHB<<`~J0f^Rm-^9d3I+x4M+nVhMUVCh2&pXr3VCTQ; z&%lRsYjyScr^I+)79hSpmUq1XFG%sh^3A;~J~-22qUb0}wY9u7-j(~#a&F0UTU*<0 zALQ>_hXI@?`&WOWBE7cZGQi7z5PVw+l)`Yo@B1$bV4?~w-Q(oGyBxr2=^i(qT8#So z`fkgB{nAn#$1#7X0wIoLL@BJ5xq=`fD6D9z@++EMYv~>bFpH{&N~xQg7_Ie<2B#E- zp#@RaN+}G(YDgOMsq*oj*~oK^010EvXJ^I6WwbUo!u<2EOx?8Szxnp?KC#yX4gdfE M07*qoM6N<$g6Q!x`Tzg` literal 0 HcmV?d00001 From 5287772dc5bd4f48420e923dc94d6135916e7daf Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 7 Dec 2016 10:29:47 -0500 Subject: [PATCH 11/50] 1903-Removed changes to DataSourceNode which trigger contents to refresh but tree to collapse --- .../autopsy/datamodel/DataSourcesNode.java | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java b/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java index 4155d46076..7ac9e37398 100644 --- a/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java +++ b/Core/src/org/sleuthkit/autopsy/datamodel/DataSourcesNode.java @@ -29,7 +29,6 @@ import org.openide.util.NbBundle; import org.openide.util.lookup.Lookups; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.ingest.IngestManager; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.TskCoreException; @@ -68,7 +67,7 @@ public class DataSourcesNode extends DisplayableItemNode { */ public static class DataSourcesNodeChildren extends AbstractContentChildren { - private static final Logger LOGGER = Logger.getLogger(DataSourcesNodeChildren.class.getName()); + private static final Logger logger = Logger.getLogger(DataSourcesNodeChildren.class.getName()); List currentKeys; @@ -81,12 +80,8 @@ public class DataSourcesNode extends DisplayableItemNode { @Override public void propertyChange(PropertyChangeEvent evt) { String eventType = evt.getPropertyName(); - if (eventType.equals(IngestManager.IngestModuleEvent.CONTENT_CHANGED.toString()) - || eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()) - || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString()) - || eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) { + if (eventType.equals(Case.Events.DATA_SOURCE_ADDED.toString())) { reloadKeys(); - refreshContentKeys(); } } }; @@ -94,16 +89,12 @@ public class DataSourcesNode extends DisplayableItemNode { @Override protected void addNotify() { Case.addPropertyChangeListener(pcl); - IngestManager.getInstance().addIngestJobEventListener(pcl); - IngestManager.getInstance().addIngestModuleEventListener(pcl); reloadKeys(); } @Override protected void removeNotify() { Case.removePropertyChangeListener(pcl); - IngestManager.getInstance().removeIngestJobEventListener(pcl); - IngestManager.getInstance().removeIngestModuleEventListener(pcl); currentKeys.clear(); setKeys(Collections.emptySet()); } @@ -113,7 +104,7 @@ public class DataSourcesNode extends DisplayableItemNode { currentKeys = Case.getCurrentCase().getDataSources(); setKeys(currentKeys); } catch (TskCoreException | IllegalStateException ex) { - LOGGER.log(Level.SEVERE, "Error getting data sources: {0}", ex.getMessage()); // NON-NLS + logger.log(Level.SEVERE, "Error getting data sources: {0}", ex.getMessage()); // NON-NLS setKeys(Collections.emptySet()); } } From 5adf9d3ea7ecb1fdc3a97d021c02cd7df9a01571 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 7 Dec 2016 12:30:55 -0500 Subject: [PATCH 12/50] 1903 minor fixes to naming and property text --- .../autopsy/ingest/Bundle.properties | 4 +-- .../ingest/IngestJobSettingsPanel.java | 2 +- ...FilesIdentifierIngestJobSettingsPanel.java | 4 +-- .../FilesIdentifierIngestModule.java | 2 +- .../InterestingItemDefsManager.java | 32 ++++++++++--------- ...restingItemDefsOptionsPanelController.java | 2 +- .../InterestingItemsIngestModuleFactory.java | 4 +-- 7 files changed, 25 insertions(+), 25 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties index 20b6575ebf..d1402b9f49 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties @@ -115,6 +115,4 @@ gest IngestJobSettingsPanel.globalSettingsButton.actionCommand=Advanced IngestJobSettingsPanel.globalSettingsButton.text=Global Settings IngestJobSettingsPanel.pastJobsButton.text=View Ingest History -IngestJobSettingsPanel.jLabel1.text= -IngestJobSettingsPanel.jLabel2.text=Run Ingest Modules on: -IngestJobSettingsPanel.jLabel1.text_1=Run Ingest Modules on: +IngestJobSettingsPanel.jLabel1.text=Run Ingest Modules on: \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index d2a707d1cd..c77bced378 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -219,7 +219,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { setMinimumSize(new java.awt.Dimension(0, 0)); setPreferredSize(new java.awt.Dimension(625, 450)); - jLabel1.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jLabel1.text_1")); // NOI18N + jLabel1.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jLabel1.text")); // NOI18N jComboBox1.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); jComboBox1.addActionListener(new java.awt.event.ActionListener() { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index cd6741a6c0..ede36f4cec 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -83,7 +83,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS */ List filesSetRows = new ArrayList<>(); try { - this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName())); + this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName())); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError()); this.filesSetSnapshot = new TreeMap<>(); @@ -138,7 +138,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS List rowModels = new ArrayList<>(); TreeMap newFilesSetSnapshot; try { - newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName())); + newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName())); } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError()); return; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index 84c193be90..df4535e068 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -83,7 +83,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { // to disable the interesting files set definition UI during ingest. List filesSets = new ArrayList<>(); try { - for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()).values()) { + for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()).values()) { if (settings.interestingFilesSetIsEnabled(set.getName())) { filesSets.add(set); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index 5c814c10d2..c9fbba1a41 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -97,7 +97,7 @@ final class InterestingItemDefsManager extends Observable { /** * @return the INTERESTING_FILES_SET_DEFS_NAME */ - static String getInterestingFilesSetDefsSerializationName() { + static String getInterestingFilesSetDefsName() { return INTERESTING_FILES_SET_DEFS_NAME; } @@ -114,8 +114,8 @@ final class InterestingItemDefsManager extends Observable { * @return A map of interesting files set names to interesting file sets, * possibly empty. */ - synchronized Map getInterestingFilesSets(String serialFileName, String legacyFilePath) throws InterestingItemDefsManagerException { - return FilesSetXML.readDefinitionsFile(serialFileName, LEGACY_FILE_SET_DEFS_PATH); + synchronized Map getInterestingFilesSets(String fileName, String legacyFilePath) throws InterestingItemDefsManagerException { + return FilesSetXML.readDefinitionsFile(fileName, LEGACY_FILE_SET_DEFS_PATH); } /** @@ -125,8 +125,8 @@ final class InterestingItemDefsManager extends Observable { * @param filesSets A mapping of interesting files set names to files sets, * used to enforce unique files set names. */ - synchronized void setInterestingFilesSets(Map filesSets, String serialFileName) throws InterestingItemDefsManagerException { - FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_PATH + serialFileName, filesSets); + synchronized void setInterestingFilesSets(Map filesSets, String fileName) throws InterestingItemDefsManagerException { + FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_PATH + fileName, filesSets); this.setChanged(); this.notifyObservers(); } @@ -165,50 +165,52 @@ final class InterestingItemDefsManager extends Observable { /** * Reads interesting file set definitions from an XML file. * - * @param legacyFileName Path of the set definitions file as a string. + * @param fileName The name of the file which is expected to store the + * serialized definitions + * @param legacyFilePath Path of the set definitions file as a string. * * @return The set definitions in a map of set names to sets. */ // Note: This method takes a file path to support the possibility of // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. - static Map readDefinitionsFile(String serialFileName, String legacyFileName) throws InterestingItemDefsManagerException { - Map filesSets = readSerializedDefinitions(serialFileName); + static Map readDefinitionsFile(String fileName, String legacyFilePath) throws InterestingItemDefsManagerException { + Map filesSets = readSerializedDefinitions(fileName); if (!filesSets.isEmpty()) { return filesSets; } // Check if the legacy xml file exists. - if (!legacyFileName.isEmpty()) { - File defsFile = new File(LEGACY_FILE_SET_DEFS_PATH + legacyFileName); + if (!legacyFilePath.isEmpty()) { + File defsFile = new File(legacyFilePath); if (!defsFile.exists()) { return filesSets; } // Check if the file can be read. if (!defsFile.canRead()) { - logger.log(Level.SEVERE, "Interesting file sets definition file at {0} exists, but cannot be read", legacyFileName); // NON-NLS + logger.log(Level.SEVERE, "Interesting file sets definition file at {0} exists, but cannot be read", legacyFilePath); // NON-NLS return filesSets; } // Parse the XML in the file. - Document doc = XMLUtil.loadDoc(FilesSetXML.class, legacyFileName); + Document doc = XMLUtil.loadDoc(FilesSetXML.class, legacyFilePath); if (doc == null) { - logger.log(Level.SEVERE, "Failed to parse interesting file sets definition file at {0}", legacyFileName); // NON-NLS + logger.log(Level.SEVERE, "Failed to parse interesting file sets definition file at {0}", legacyFilePath); // NON-NLS return filesSets; } // Get the root element. Element root = doc.getDocumentElement(); if (root == null) { - logger.log(Level.SEVERE, "Failed to get root {0} element tag of interesting file sets definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, legacyFileName}); // NON-NLS + logger.log(Level.SEVERE, "Failed to get root {0} element tag of interesting file sets definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, legacyFilePath}); // NON-NLS return filesSets; } // Read in the files set definitions. NodeList setElems = root.getElementsByTagName(FILE_SET_TAG); for (int i = 0; i < setElems.getLength(); ++i) { - readFilesSet((Element) setElems.item(i), filesSets, legacyFileName); + readFilesSet((Element) setElems.item(i), filesSets, legacyFilePath); } } return filesSets; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java index b0666ad9ab..cbf1d3e4a3 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java @@ -115,7 +115,7 @@ public final class InterestingItemDefsOptionsPanelController extends OptionsPane private InterestingItemDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()); + panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index a327f665b2..6aab03d17d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -69,7 +69,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto @Override public IngestModuleGlobalSettingsPanel getGlobalSettingsPanel() { - InterestingItemDefsPanel panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()); + InterestingItemDefsPanel panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()); panel.load(); return panel; } @@ -83,7 +83,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto // Doing so also keeps the serialization simple. List enabledFilesSetNames = new ArrayList<>(); try { - for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsSerializationName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()).keySet()) { + for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()).keySet()) { enabledFilesSetNames.add(name); } } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { From af43a7c56236b641aa571f231e810f9dd98de4ef Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 7 Dec 2016 12:41:19 -0500 Subject: [PATCH 13/50] 1903 added text for moved processUnalloc button to Bundle_ja props --- .../autopsy/modules/interestingitems/Bundle_ja.properties | 3 +++ 1 file changed, 3 insertions(+) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 954bd133fc..cb0a54b838 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -28,6 +28,9 @@ OptionsCategory_Name_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30d5\u OptionsCategory_Keywords_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u5b9a\u7fa9 InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540d\u524d\u304c{0}\u306e\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306f\u65e2\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 FilesSetRulePanel.jLabel5.text=\u898b\u3064\u3051\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +InterestingItemDefsPanel.processUnallocCheckbox.toolTipText=\u524a\u9664\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u7b49\u306e\u672a\u5272\u308a\u5f53\u3066\u9818\u57df\u3092\u51e6\u7406\u3002\u3088\u308a\u5b8c\u5168\u306a\u7d50\u679c\u304c\u51fa\u307e\u3059\u304c\u3001\u5927\u304d\u3044\u30a4\u30e1\u30fc\u30b8\u3067\u306f\u51e6\u7406\u6642\u9593\u304c\u9577\u304f\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002 + +InterestingItemDefsPanel.processUnallocCheckbox.text=\u672a\u5272\u308a\u5f53\u3066\u9818\u57df\u306e\u51e6\u7406 InterestingItemDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 InterestingItemDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a From 6843b4fab2cb296da5b76476cc17e5b1effc6008 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 4 Jan 2017 12:02:22 -0500 Subject: [PATCH 14/50] 1903 File Ingest Filter changes to bring execution more in line with design --- ...r32x32.png => file_ingest_filter32x32.png} | Bin .../autopsy/ingest/Bundle.properties | 2 - .../autopsy/ingest/Bundle_ja.properties | 2 - .../autopsy/ingest/DataSourceIngestJob.java | 10 + .../autopsy/ingest/IngestJobSettings.java | 75 ++++++-- .../ingest/IngestJobSettingsPanel.form | 2 +- .../ingest/IngestJobSettingsPanel.java | 26 +-- .../autopsy/ingest/IngestTasksScheduler.java | 15 +- .../interestingitems/Bundle.properties | 64 ++++--- .../interestingitems/Bundle_ja.properties | 48 +++-- ...gestFilterDefsOptionsPanelController.java} | 35 ++-- .../modules/interestingitems/FilesSet.java | 65 ++++--- .../interestingitems/FilesSetPanel.form | 12 +- .../interestingitems/FilesSetPanel.java | 19 +- .../interestingitems/IngestSetFilter.java | 178 ------------------ .../InterestingItemDefsManager.java | 83 +++++--- .../InterestingItemDefsPanel.form | 12 +- .../InterestingItemDefsPanel.java | 46 ++--- 18 files changed, 309 insertions(+), 385 deletions(-) rename Core/src/org/sleuthkit/autopsy/images/{ingest_set_filter32x32.png => file_ingest_filter32x32.png} (100%) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{IngestSetFilterDefsOptionsPanelController.java => FileIngestFilterDefsOptionsPanelController.java} (83%) delete mode 100644 Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java diff --git a/Core/src/org/sleuthkit/autopsy/images/ingest_set_filter32x32.png b/Core/src/org/sleuthkit/autopsy/images/file_ingest_filter32x32.png similarity index 100% rename from Core/src/org/sleuthkit/autopsy/images/ingest_set_filter32x32.png rename to Core/src/org/sleuthkit/autopsy/images/file_ingest_filter32x32.png diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties index d1402b9f49..eaca1515d6 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties @@ -96,8 +96,6 @@ ModuleTableModel.colName.module=Module ModuleTableModel.colName.duration=Duration IngestJobSettingsPanel.jButtonSelectAll.text=Select All IngestJobSettingsPanel.jButtonDeselectAll.text=Deselect All -IngestJobSettingsPanel.processUnallocCheckbox.toolTipText=Processes unallocated space, such as deleted files. Produces more complete results, but it may take longer to process on large images. -IngestJobSettingsPanel.processUnallocCheckbox.text=Process Unallocated Space IngestManager.cancellingIngest.msgDlg.text=Cancelling all currently running ingest jobs IngestManager.serviceIsDown.msgDlg.text={0} is down RunIngestSubMenu.menuItem.empty=-Empty- diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties index 130c0c3171..6ecb763bc2 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle_ja.properties @@ -89,9 +89,7 @@ IngestJobTableModel.colName.start=\u30b9\u30bf\u30fc\u30c8 IngestModuleFactoryLoader.errorMessages.duplicateDisplayName=\u5225\u306e\u30e2\u30b8\u30e5\u30fc\u30eb\u306e\u540d\u524d\u3092\u91cd\u8907\u3059\u308b\u3001{0}\u306e\u540d\u524d\u3092\u6301\u3064\u30e2\u30b8\u30e5\u30fc\u30eb\u304c\u898b\u3064\u304b\u308a\u307e\u3057\u305f\u3002\u30e2\u30b8\u30e5\u30fc\u30eb\u306f\u4f7f\u7528\u3057\u307e\u305b\u3093\u3002 IngestProgressSnapshotPanel.SnapshotsTableModel.colNames.jobID=\u30b8\u30e7\u30d6ID ModuleTableModel.colName.module=\u30e2\u30b8\u30e5\u30fc\u30eb -IngestJobSettingsPanel.processUnallocCheckbox.toolTipText=\u524a\u9664\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u7b49\u306e\u672a\u5272\u308a\u5f53\u3066\u9818\u57df\u3092\u51e6\u7406\u3002\u3088\u308a\u5b8c\u5168\u306a\u7d50\u679c\u304c\u51fa\u307e\u3059\u304c\u3001\u5927\u304d\u3044\u30a4\u30e1\u30fc\u30b8\u3067\u306f\u51e6\u7406\u6642\u9593\u304c\u9577\u304f\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002 -IngestJobSettingsPanel.processUnallocCheckbox.text=\u672a\u5272\u308a\u5f53\u3066\u9818\u57df\u306e\u51e6\u7406 Menu/Tools/RunIngestModules=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb\u3092\u5b9f\u884c IngestJob.progress.fileIngest.cancelMessage={1}\u306e{0}\u3092\u5f85\u3063\u3066\u3044\u307e\u3059 IngestManager.OpenEventChannel.Fail.ErrMsg=\u3053\u306e\u30b1\u30fc\u30b9\u3067\u4f7f\u308f\u308c\u3066\u3044\u308b\u304b\u3082\u3057\u308c\u306a\u3044\u4ed6\u306e\u30ce\u30fc\u30c9\u306b\u89e3\u6790\u30d7\u30ed\u30bb\u30b9\u304c\u63a5\u7d9a\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java index f9b8b468cd..353e1c5e3d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java @@ -43,6 +43,7 @@ import org.sleuthkit.datamodel.IngestModuleInfo; import org.sleuthkit.datamodel.IngestModuleInfo.IngestModuleType; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; /** * Encapsulates a data source and the ingest module pipelines used to process @@ -331,6 +332,15 @@ final class DataSourceIngestJob { return this.settings.getProcessUnallocatedSpace(); } + /** + * Gets the Selected File Ingest Filter from settings. + * + * @return True or false. + */ + FilesSet getFileIngestFilter() { + return this.settings.getFileIngestFilter(); + } + /** * Checks to see if this job has at least one ingest pipeline. * diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 702b5014ea..fa41c9fa61 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -26,9 +26,11 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Objects; import java.util.logging.Level; import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; @@ -37,7 +39,8 @@ import org.python.util.PythonObjectInputStream; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; -import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilter; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; +import org.sleuthkit.autopsy.modules.interestingitems.InterestingItemDefsManager; /** * Encapsulates the ingest job settings for a particular execution context. @@ -50,19 +53,50 @@ public class IngestJobSettings { private static final String ENABLED_MODULES_KEY = "Enabled_Ingest_Modules"; //NON-NLS private static final String DISABLED_MODULES_KEY = "Disabled_Ingest_Modules"; //NON-NLS private static final String PARSE_UNALLOC_SPACE_KEY = "Process_Unallocated_Space"; //NON-NLS - private static final String PROCESS_UNALLOC_SPACE_DEFAULT = "true"; //NON-NLS + private static final String LAST_FILE_INGEST_FILTER_KEY = "Last File Ingest Filter Used"; private static final String MODULE_SETTINGS_FOLDER = "IngestModuleSettings"; //NON-NLS private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS private static final Logger LOGGER = Logger.getLogger(IngestJobSettings.class.getName()); + private static FilesSet ALL_FILES_INGEST_FILTER = new FilesSet("All Files", "All Files", false, true, Collections.emptyMap()); //NON-NLS + private static FilesSet ALL_AND_UNALLOC_FILES_INGEST_FILTER = new FilesSet("All Files and Unallocated Space", "All Files and Unallocated Space", false, false, Collections.emptyMap()); //NON-NLS + private FilesSet fileIngestFilter; private final String executionContext; private final IngestType ingestType; private String moduleSettingsFolderPath; private static final CharSequence pythonModuleSettingsPrefixCS = "org.python.proxies.".subSequence(0, "org.python.proxies.".length() - 1); //NON-NLS private final List moduleTemplates; - private boolean processUnallocatedSpace; private final List warnings; + /** + * Gets the current FileIngestFilter saved in settings which is represented + * by a FilesSet + * + * @return FilesSet which represents the FileIngestFilter + */ + protected FilesSet getFileIngestFilter() { + return fileIngestFilter; + } + + /** + * Sets the FileIngestFilter which is currently being used by ingest. + * + * @param fileIngestFilter the FilesSet which represents the + * FileIngestFilter + */ + protected void setFileIngestFilter(FilesSet fileIngestFilter) { + this.fileIngestFilter = fileIngestFilter; + } + + /** + * Get a list of default FileIngestFilters. + * + * @return a list of FilesSets which cover default options. + */ + public static List getStandardFileIngestFilters() { + return Arrays.asList(ALL_AND_UNALLOC_FILES_INGEST_FILTER, ALL_FILES_INGEST_FILTER); + } + /** * The type of ingest modules to run. */ @@ -94,7 +128,6 @@ public class IngestJobSettings { this.executionContext = executionContext; this.ingestType = IngestType.ALL_MODULES; this.moduleTemplates = new ArrayList<>(); - this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); this.warnings = new ArrayList<>(); this.createSavedModuleSettingsFolder(); this.load(); @@ -120,7 +153,6 @@ public class IngestJobSettings { this.moduleTemplates = new ArrayList<>(); - this.processUnallocatedSpace = Boolean.parseBoolean(IngestJobSettings.PROCESS_UNALLOC_SPACE_DEFAULT); this.warnings = new ArrayList<>(); this.createSavedModuleSettingsFolder(); this.load(); @@ -193,13 +225,20 @@ public class IngestJobSettings { } /** - * Gets the process unallocated space flag part of these ingest job - * settings. + * If unallocated space should be processed Gets the the opposite of the + * File Ingest Filter's skip unallocated space flag. So that the existing + * logic in PhotoRec Carver and any other modules that may use this will + * continue to work without modification. * - * @return True or false. + * @return True for process unallocated space or false for skip unallocated + * space. */ boolean getProcessUnallocatedSpace() { - return this.processUnallocatedSpace; + boolean processUnallocated = true; + if (!Objects.isNull(this.fileIngestFilter)) { + processUnallocated = (this.fileIngestFilter.getSkipUnallocatedSpace() == false); + } + return processUnallocated; } /** @@ -310,9 +349,15 @@ public class IngestJobSettings { ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.ENABLED_MODULES_KEY, makeCommaSeparatedValuesList(enabledModuleNames)); ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.DISABLED_MODULES_KEY, makeCommaSeparatedValuesList(disabledModuleNames)); - //set the process unallocated space setting based on the filter chosen. - this.processUnallocatedSpace = (new IngestSetFilter()).isProcessUnallocatedSpace(); - + /** + * Restore the last used File Ingest Filter + */ + if (ModuleSettings.settingExists(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY) == false) { + ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY, IngestJobSettings.ALL_AND_UNALLOC_FILES_INGEST_FILTER.getName()); + } + this.fileIngestFilter = InterestingItemDefsManager.getInstance() + .getFileIngestFilters() + .get(ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY)); } /** @@ -445,9 +490,13 @@ public class IngestJobSettings { /** * Save the process unallocated space setting. */ - String processUnalloc = Boolean.toString(this.processUnallocatedSpace); + String processUnalloc = Boolean.toString(getProcessUnallocatedSpace()); ModuleSettings.setConfigSetting(this.executionContext, PARSE_UNALLOC_SPACE_KEY, processUnalloc); + /** + * Save the last used File Ingest Filter setting for this context. + */ + ModuleSettings.setConfigSetting(this.executionContext, LAST_FILE_INGEST_FILTER_KEY, fileIngestFilter.getName()); } /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form index eaf30f60da..bab773131a 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form @@ -50,7 +50,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index c77bced378..84b8caa00b 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -44,8 +44,8 @@ import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; -import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilterDefsOptionsPanelController; -import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilter; +import org.sleuthkit.autopsy.modules.interestingitems.FileIngestFilterDefsOptionsPanelController; +import org.sleuthkit.autopsy.modules.interestingitems.InterestingItemDefsManager; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestModuleInfo; @@ -67,7 +67,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private final IngestModulesTableModel tableModel = new IngestModulesTableModel(); private IngestModuleModel selectedModule; private static final Logger LOGGER = Logger.getLogger(IngestJobSettingsPanel.class.getName()); - private final IngestSetFilterDefsOptionsPanelController controller; + private final FileIngestFilterDefsOptionsPanelController controller; /** * Construct a panel to allow a user to make ingest job settings. @@ -76,7 +76,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { */ public IngestJobSettingsPanel(IngestJobSettings settings) { this.settings = settings; - this.controller = new IngestSetFilterDefsOptionsPanelController(); + this.controller = new FileIngestFilterDefsOptionsPanelController(); controller.getComponent(controller.getLookup()); for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) { @@ -85,7 +85,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { initComponents(); customizeComponents(); - jComboBox1.setSelectedItem(controller.getIngestSetFilter().getLastSelected()); + jComboBox1.setSelectedItem(settings.getFileIngestFilter().getName()); } /** @@ -97,7 +97,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { IngestJobSettingsPanel(IngestJobSettings settings, List dataSources) { this.settings = settings; this.dataSources.addAll(dataSources); - this.controller = new IngestSetFilterDefsOptionsPanelController(); + this.controller = new FileIngestFilterDefsOptionsPanelController(); controller.getComponent(controller.getLookup()); try { @@ -114,7 +114,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { initComponents(); customizeComponents(); - jComboBox1.setSelectedItem(controller.getIngestSetFilter().getLastSelected()); + jComboBox1.setSelectedItem(settings.getFileIngestFilter().getName()); } /** @@ -335,7 +335,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 237, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( @@ -412,9 +412,8 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { */ private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed - if (jComboBox1.getSelectedItem().toString().equals(IngestSetFilter.NEW_INGEST_FILTER)) { + if (jComboBox1.getSelectedItem().toString().equals(FileIngestFilterDefsOptionsPanelController.NEW_INGEST_FILTER)) { final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); - // values.controller.getComboBoxContents().toArray(); dialog.addApplyButtonListener((ActionEvent e) -> { controller.applyChanges(); ((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())).saveSettings(); @@ -422,10 +421,13 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { dialog.close(); }); dialog.display((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())); - jComboBox1.setSelectedItem(controller.getIngestSetFilter().getLastSelected()); + jComboBox1.setSelectedItem(settings.getFileIngestFilter().getName()); } else if (evt.getActionCommand().equals("comboBoxChanged")) { - controller.getIngestSetFilter().setLastSelected(jComboBox1.getSelectedItem().toString()); + + settings.setFileIngestFilter(InterestingItemDefsManager.getInstance() + .getFileIngestFilters() + .get(jComboBox1.getSelectedItem().toString())); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index 169f404b61..0f71cae4fb 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -33,7 +33,6 @@ import java.util.logging.Level; import java.util.regex.Matcher; import java.util.regex.Pattern; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.modules.interestingitems.IngestSetFilter; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.FileSystem; @@ -412,15 +411,12 @@ final class IngestTasksScheduler { return false; } - if (file.isFile()) { //is this the criteria we want to be using(will unallocated space files show return true?) - IngestSetFilter ingestSetFilter; - ingestSetFilter = new IngestSetFilter(); - if (!ingestSetFilter.match(file)) { - return false; - } + if ((task.getIngestJob().getFileIngestFilter().fileIsMemberOf(file)) == null) { + return false; } - // Skip the task if the file is one of a select group of special, large - // NTFS or FAT file system files. + +// Skip the task if the file is one of a select group of special, large +// NTFS or FAT file system files. if (file instanceof org.sleuthkit.datamodel.File) { final org.sleuthkit.datamodel.File f = (org.sleuthkit.datamodel.File) file; @@ -530,6 +526,7 @@ final class IngestTasksScheduler { */ synchronized IngestJobTasksSnapshot getTasksSnapshotForJob(long jobId) { return new IngestJobTasksSnapshot(jobId); + } /** diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 5a954351ac..7bf183f17d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -4,8 +4,8 @@ OpenIDE-Module-Short-Description=Interesting Files Identifier ingest module. OpenIDE-Module-Name=Interesting Files Identifier OptionsCategory_Name_InterestingItemDefinitions=Interesting Files OptionsCategory_Keywords_InterestingItemDefinitions=InterestingItemDefinitions -OptionsCategory_Name_IngestSetFilterDefinitions=Ingest Set Filter -OptionsCategory_Keywords_IngestSetFilterDefinitions=IngestSetFilterDefinitions +OptionsCategory_Name_FileIngestFilterDefinitions=File Ingest Filter +OptionsCategory_Keywords_FileIngestFilterDefinitions=FileIngestFilterDefinitions InterestingItemsIdentifierIngestModule.moduleName=Interesting Files Identifier InterestingItemsIdentifierIngestModule.moduleDescription=Identifies interesting items as defined by interesting item rule sets. FilesSetPanel.title=Interesting Files Set @@ -14,6 +14,8 @@ FilesSetPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files FilesSetPanel.descriptionPanel.border.title=Description FilesSetPanel.nameLabel.text=Set Name: FilesSetPanel.descPanel.border.title=Description +FilesSetPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. +FilesSetPanel.skipsUnallocCheckbox.text=Skip Unallocated Space FilesSetRulePanel.title=Interesting Files Set Rule FilesSetRulePanel.extensionRadioButton.text=Extension Only FilesSetRulePanel.pathRegexCheckBox.text=Regex @@ -33,8 +35,8 @@ FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: FilesSetRulePanel.jLabel1.text=Type: FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. -InterestingItemDefsPanel.processUnallocCheckbox.toolTipText=Processes unallocated space, such as deleted files. Produces more complete results, but it may take longer to process on large images. -InterestingItemDefsPanel.processUnallocCheckbox.text=Process Unallocated Space +InterestingItemDefsPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. +InterestingItemDefsPanel.skipsUnallocCheckbox.text=Skip Unallocated Space InterestingItemDefsPanel.jLabel6.text=Set Details InterestingItemDefsPanel.jLabel8.text=File Size: InterestingItemDefsPanel.jLabel7.text=MIME Type: @@ -69,30 +71,30 @@ FilesSetRulePanel.fileSizeCheck.text=File Size: FilesSetRulePanel.filesRadioButton.text=Files FilesSetRulePanel.dirsRadioButton.text=Directories FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories -IngestSetFilterDefinitions.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. -IngestSetFilterDefinitions.editSetButton.text=Edit Set -IngestSetFilterDefinitions.rulePathConditionRegexCheckBox.text=Regex -IngestSetFilterDefinitions.jLabel4.text=Path Pattern: -IngestSetFilterDefinitions.jLabel1.text=Rule Details -IngestSetFilterDefinitions.dirsRadioButton.text=Directories -IngestSetFilterDefinitions.jLabel2.text=File Type: -IngestSetFilterDefinitions.rulesListLabel.text=Rules: -IngestSetFilterDefinitions.newSetButton.text=New Set -IngestSetFilterDefinitions.editRuleButton.text=Edit Rule -IngestSetFilterDefinitions.deleteRuleButton.text=Delete Rule -IngestSetFilterDefinitions.filesRadioButton.text=Files -IngestSetFilterDefinitions.deleteSetButton.text=Delete Set -IngestSetFilterDefinitions.newRuleButton.text=New Rule -IngestSetFilterDefinitions.bothRadioButton.text=Files and Directories -IngestSetFilterDefinitions.setsListLabel.text=Rule Sets -IngestSetFilterDefinitions.jLabel6.text=Set Details -IngestSetFilterDefinitions.fileNameRegexCheckbox.text=Regex -IngestSetFilterDefinitions.ignoreKnownFilesCheckbox.text=Ignore Known Files -IngestSetFilterDefinitions.rulePathConditionTextField.text= -IngestSetFilterDefinitions.fileNameRadioButton.text=File Name -IngestSetFilterDefinitions.jLabel5.text=Description: -IngestSetFilterDefinitions.fileNameTextField.text= -IngestSetFilterDefinitions.jLabel8.text=File Size: -IngestSetFilterDefinitions.jLabel3.text=Name Pattern: -IngestSetFilterDefinitions.fileNameExtensionRadioButton.text=Extension Only -IngestSetFilterDefinitions.jLabel7.text=MIME Type: +FileIngestFilterDefinitions.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. +FileIngestFilterDefinitions.editSetButton.text=Edit Set +FileIngestFilterDefinitions.rulePathConditionRegexCheckBox.text=Regex +FileIngestFilterDefinitions.jLabel4.text=Path Pattern: +FileIngestFilterDefinitions.jLabel1.text=Rule Details +FileIngestFilterDefinitions.dirsRadioButton.text=Directories +FileIngestFilterDefinitions.jLabel2.text=File Type: +FileIngestFilterDefinitions.rulesListLabel.text=Rules: +FileIngestFilterDefinitions.newSetButton.text=New Set +FileIngestFilterDefinitions.editRuleButton.text=Edit Rule +FileIngestFilterDefinitions.deleteRuleButton.text=Delete Rule +FileIngestFilterDefinitions.filesRadioButton.text=Files +FileIngestFilterDefinitions.deleteSetButton.text=Delete Set +FileIngestFilterDefinitions.newRuleButton.text=New Rule +FileIngestFilterDefinitions.bothRadioButton.text=Files and Directories +FileIngestFilterDefinitions.setsListLabel.text=Rule Sets +FileIngestFilterDefinitions.jLabel6.text=Set Details +FileIngestFilterDefinitions.fileNameRegexCheckbox.text=Regex +FileIngestFilterDefinitions.ignoreKnownFilesCheckbox.text=Ignore Known Files +FileIngestFilterDefinitions.rulePathConditionTextField.text= +FileIngestFilterDefinitions.fileNameRadioButton.text=File Name +FileIngestFilterDefinitions.jLabel5.text=Description: +FileIngestFilterDefinitions.fileNameTextField.text= +FileIngestFilterDefinitions.jLabel8.text=File Size: +FileIngestFilterDefinitions.jLabel3.text=Name Pattern: +FileIngestFilterDefinitions.fileNameExtensionRadioButton.text=Extension Only +FileIngestFilterDefinitions.jLabel7.text=MIME Type: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index cb0a54b838..b49ae2f305 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -28,9 +28,7 @@ OptionsCategory_Name_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30d5\u OptionsCategory_Keywords_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u5b9a\u7fa9 InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540d\u524d\u304c{0}\u306e\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306f\u65e2\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 FilesSetRulePanel.jLabel5.text=\u898b\u3064\u3051\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -InterestingItemDefsPanel.processUnallocCheckbox.toolTipText=\u524a\u9664\u3055\u308c\u305f\u30d5\u30a1\u30a4\u30eb\u7b49\u306e\u672a\u5272\u308a\u5f53\u3066\u9818\u57df\u3092\u51e6\u7406\u3002\u3088\u308a\u5b8c\u5168\u306a\u7d50\u679c\u304c\u51fa\u307e\u3059\u304c\u3001\u5927\u304d\u3044\u30a4\u30e1\u30fc\u30b8\u3067\u306f\u51e6\u7406\u6642\u9593\u304c\u9577\u304f\u306a\u308b\u304b\u3082\u3057\u308c\u307e\u305b\u3093\u3002 -InterestingItemDefsPanel.processUnallocCheckbox.text=\u672a\u5272\u308a\u5f53\u3066\u9818\u57df\u306e\u51e6\u7406 InterestingItemDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 InterestingItemDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a @@ -75,26 +73,26 @@ InterestingItemDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb InterestingItemDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe -IngestSetFilterDefinitions.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 -IngestSetFilterDefinitions.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe -IngestSetFilterDefinitions.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a -IngestSetFilterDefinitions.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 -IngestSetFilterDefinitions.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea -IngestSetFilterDefinitions.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a -IngestSetFilterDefinitions.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a -IngestSetFilterDefinitions.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 -IngestSetFilterDefinitions.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 -IngestSetFilterDefinitions.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 -IngestSetFilterDefinitions.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb -IngestSetFilterDefinitions.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 -IngestSetFilterDefinitions.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb -IngestSetFilterDefinitions.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea -IngestSetFilterDefinitions.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 -IngestSetFilterDefinitions.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 -IngestSetFilterDefinitions.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe -IngestSetFilterDefinitions.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 -IngestSetFilterDefinitions.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d -IngestSetFilterDefinitions.jLabel5.text=\u6982\u8981\uff1a -IngestSetFilterDefinitions.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 -IngestSetFilterDefinitions.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f -IngestSetFilterDefinitions.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 +FileIngestFilterDefinitions.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 +FileIngestFilterDefinitions.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe +FileIngestFilterDefinitions.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a +FileIngestFilterDefinitions.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 +FileIngestFilterDefinitions.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +FileIngestFilterDefinitions.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a +FileIngestFilterDefinitions.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a +FileIngestFilterDefinitions.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 +FileIngestFilterDefinitions.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 +FileIngestFilterDefinitions.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 +FileIngestFilterDefinitions.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb +FileIngestFilterDefinitions.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 +FileIngestFilterDefinitions.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb +FileIngestFilterDefinitions.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +FileIngestFilterDefinitions.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 +FileIngestFilterDefinitions.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 +FileIngestFilterDefinitions.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe +FileIngestFilterDefinitions.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 +FileIngestFilterDefinitions.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d +FileIngestFilterDefinitions.jLabel5.text=\u6982\u8981\uff1a +FileIngestFilterDefinitions.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 +FileIngestFilterDefinitions.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f +FileIngestFilterDefinitions.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java similarity index 83% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index 0e94f371eb..c4df869609 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -27,26 +27,26 @@ import javax.swing.SwingUtilities; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.HelpCtx; import org.openide.util.Lookup; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; @OptionsPanelController.TopLevelRegistration( - categoryName = "#OptionsCategory_Name_IngestSetFilterDefinitions", - iconBase = "org/sleuthkit/autopsy/images/ingest_set_filter32x32.png", - keywords = "#OptionsCategory_Keywords_IngestSetFilterDefinitions", - keywordsCategory = "IngestSetFilterDefinitions", + categoryName = "#OptionsCategory_Name_FileIngestFilterDefinitions", + iconBase = "org/sleuthkit/autopsy/images/file_ingest_filter32x32.png", + keywords = "#OptionsCategory_Keywords_FileIngestFilterDefinitions", + keywordsCategory = "FileIngestFilterDefinitions", position = 7 ) /** * Class for creating an InterestingItemDefsPanel which will be used for - * configuring the IngestSetFilter. + * configuring the FileIngestFilter. */ -public final class IngestSetFilterDefsOptionsPanelController extends OptionsPanelController { +public final class FileIngestFilterDefsOptionsPanelController extends OptionsPanelController { private InterestingItemDefsPanel panel; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; - private final IngestSetFilter filter = new IngestSetFilter(); - + public final static String NEW_INGEST_FILTER = ""; /** * Component should load its data here. */ @@ -64,10 +64,11 @@ public final class IngestSetFilterDefsOptionsPanelController extends OptionsPane * a Create New option */ public String[] getComboBoxContents() { - ArrayList nameList = new ArrayList<>(); - nameList.add(IngestSetFilter.ALL_FILES_AND_UNALLOCATED_FILTER); - nameList.add(IngestSetFilter.ALL_FILES_FILTER); - nameList.add(IngestSetFilter.NEW_INGEST_FILTER); + ArrayList nameList = new ArrayList<>(); + for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { + nameList.add(fSet.getName()); + } + nameList.add(NEW_INGEST_FILTER); if (!(panel == null)) { nameList.addAll(panel.getKeys()); } @@ -76,10 +77,6 @@ public final class IngestSetFilterDefsOptionsPanelController extends OptionsPane return nameList.toArray(returnArray); } - public IngestSetFilter getIngestSetFilter() { - return filter; - } - /** * This method is called when both the Ok and Apply buttons are pressed. It * applies to any of the panels that have been opened in the process of @@ -146,14 +143,14 @@ public final class IngestSetFilterDefsOptionsPanelController extends OptionsPane /** * Creates an interestingItemsDefPanel that will be labeled to indicate it - * is for Ingest Set Filter settings + * is for File Ingest Filter settings * * @return an InterestingItemDefsPanel which has text and fields modified to - * indicate it is for Ingest Set Filtering. + * indicate it is for File Ingest Filtering. */ private InterestingItemDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getIngestSetFilterDefsName(), ""); + panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getFileIngestFilterDefsName(), ""); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 8e88efa5ff..6a0a74b80e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.regex.Pattern; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; @@ -36,33 +37,33 @@ import org.sleuthkit.datamodel.TskData; * Interesting files set definition objects are immutable, so they may be safely * published to multiple threads. */ -final class FilesSet implements Serializable { +public final class FilesSet implements Serializable { private static final long serialVersionUID = 1L; private final String name; private final String description; private final boolean ignoreKnownFiles; - private final boolean processUnallocated; + private final boolean skipUnallocatedSpace; private final Map rules = new HashMap<>(); /** * Constructs an interesting files set. * - * @param name The name of the set. - * @param description A description of the set, may be null. + * @param name The name of the set. + * @param description A description of the set, may be null. * @param ignoreKnownFiles Whether or not to exclude known files from the - * set. - * @param rules The rules that define the set. May be null, but a - * set with no rules is the empty set. + * set. + * @param rules The rules that define the set. May be null, but a set with + * no rules is the empty set. */ - FilesSet(String name, String description, boolean ignoreKnownFiles, Map rules, boolean processUnallocatedSpace) { + public FilesSet(String name, String description, boolean ignoreKnownFiles, boolean skipUnallocatedSpace, Map rules ) { if ((name == null) || (name.isEmpty())) { throw new IllegalArgumentException("Interesting files set name cannot be null or empty"); } this.name = name; this.description = (description != null ? description : ""); this.ignoreKnownFiles = ignoreKnownFiles; - this.processUnallocated = processUnallocatedSpace; + this.skipUnallocatedSpace = skipUnallocatedSpace; if (rules != null) { this.rules.putAll(rules); } @@ -73,7 +74,7 @@ final class FilesSet implements Serializable { * * @return A name string. */ - String getName() { + public String getName() { return this.name; } @@ -101,13 +102,14 @@ final class FilesSet implements Serializable { /** * Returns whether or not this set of rules will process unallocated space. - * - * @return True if unallocated space should be processed, false if it should not be. + * + * @return True if unallocated space should be processed, false if it should + * not be. */ - boolean processesUnallocatedSpace() { - return this.processUnallocated; + public boolean getSkipUnallocatedSpace() { + return this.skipUnallocatedSpace; } - + /** * Gets a copy of the set membership rules of this interesting files set. * @@ -123,12 +125,24 @@ final class FilesSet implements Serializable { * @param file A file to test for set membership. * * @return The name of the first set membership rule satisfied by the file, - * will be null if the file does not belong to the set. + * will be null if the file does not belong to the set. */ - String fileIsMemberOf(AbstractFile file) { + public String fileIsMemberOf(AbstractFile file) { if ((this.ignoreKnownFiles) && (file.getKnown() == TskData.FileKnown.KNOWN)) { return null; } + + if ((this.skipUnallocatedSpace) && + (file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || + file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) || + file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) { + return null; + } + + if ((rules.isEmpty())){ + return "All Files"; //WJS-TODO Figure out how to make this return non-null when filter is default filter with no rules correctly + } + for (Rule rule : rules.values()) { if (rule.isSatisfied(file)) { return rule.getName(); @@ -163,10 +177,10 @@ final class FilesSet implements Serializable { /** * Construct an interesting files set membership rule. * - * @param ruleName The name of the rule. Can be empty string. + * @param ruleName The name of the rule. Can be empty string. * @param fileNameCondition A file name condition, may be null. * @param metaTypeCondition A file meta-type condition. - * @param pathCondition A file path condition, may be null. + * @param pathCondition A file path condition, may be null. * @param mimeTypeCondition A file mime type condition, may be null. * @param fileSizeCondition A file size condition, may be null. */ @@ -508,7 +522,8 @@ final class FilesSet implements Serializable { FILES, DIRECTORIES, - FILES_AND_DIRECTORIES + FILES_AND_DIRECTORIES, + ALL } private final Type type; @@ -529,6 +544,8 @@ final class FilesSet implements Serializable { return file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG; case DIRECTORIES: return file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR; + case ALL: + return true; default: return file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG || file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR; @@ -562,7 +579,7 @@ final class FilesSet implements Serializable { * regular expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ boolean isRegex(); @@ -622,7 +639,7 @@ final class FilesSet implements Serializable { * regular expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ @Override public boolean isRegex() { @@ -747,7 +764,7 @@ final class FilesSet implements Serializable { * Construct a file name extension regular expression condition. * * @param extension The file name extension regular expression to be - * matched. + * matched. */ ExtensionCondition(Pattern extension) { super(extension.pattern(), false); @@ -778,7 +795,7 @@ final class FilesSet implements Serializable { * expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ boolean isRegex(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form index f9b1bad877..2d5499d016 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form @@ -30,7 +30,7 @@ - + @@ -51,7 +51,7 @@ - + @@ -124,17 +124,17 @@ - + - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 6994d3314e..b275e621c3 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.modules.interestingitems; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; -import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; /** * A panel that allows a user to create and edit interesting files set @@ -46,7 +45,7 @@ public class FilesSetPanel extends javax.swing.JPanel { this.nameTextField.setText(filesSet.getName()); this.descTextArea.setText(filesSet.getDescription()); this.ignoreKnownFilesCheckbox.setSelected(filesSet.ignoresKnownFiles()); - this.processUnallocCheckbox.setSelected(filesSet.processesUnallocatedSpace()); + this.skipsUnallocCheckbox.setSelected(filesSet.getSkipUnallocatedSpace()); } /** @@ -99,8 +98,8 @@ public class FilesSetPanel extends javax.swing.JPanel { /** * */ - boolean getProcessUnallocatedSpace() { - return processUnallocCheckbox.isSelected(); + boolean getSkipUnallocatedSpace() { + return skipsUnallocCheckbox.isSelected(); } /** @@ -118,7 +117,7 @@ public class FilesSetPanel extends javax.swing.JPanel { descScrollPanel = new javax.swing.JScrollPane(); descTextArea = new javax.swing.JTextArea(); ignoreKnownFilesCheckbox = new javax.swing.JCheckBox(); - processUnallocCheckbox = new javax.swing.JCheckBox(); + skipsUnallocCheckbox = new javax.swing.JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.nameLabel.text")); // NOI18N @@ -147,8 +146,8 @@ public class FilesSetPanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.ignoreKnownFilesCheckbox.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(processUnallocCheckbox, org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.processUnallocCheckbox.text")); // NOI18N - processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.processUnallocCheckbox.toolTipText")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(skipsUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.skipsUnallocCheckbox.text")); // NOI18N + skipsUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.skipsUnallocCheckbox.toolTipText")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -167,7 +166,7 @@ public class FilesSetPanel extends javax.swing.JPanel { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(ignoreKnownFilesCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(processUnallocCheckbox)))) + .addComponent(skipsUnallocCheckbox)))) .addContainerGap()) ); layout.setVerticalGroup( @@ -182,7 +181,7 @@ public class FilesSetPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ignoreKnownFilesCheckbox) - .addComponent(processUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); }// //GEN-END:initComponents @@ -196,6 +195,6 @@ public class FilesSetPanel extends javax.swing.JPanel { private javax.swing.JCheckBox ignoreKnownFilesCheckbox; private javax.swing.JLabel nameLabel; private javax.swing.JTextField nameTextField; - private javax.swing.JCheckBox processUnallocCheckbox; + private javax.swing.JCheckBox skipsUnallocCheckbox; // End of variables declaration//GEN-END:variables } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java deleted file mode 100644 index d158bfa0f6..0000000000 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/IngestSetFilter.java +++ /dev/null @@ -1,178 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2016 Basis Technology Corp. - * Contact: carrier sleuthkit 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.modules.interestingitems; - -import java.util.Set; -import org.openide.util.Exceptions; -import org.sleuthkit.autopsy.coreutils.ModuleSettings; -import org.sleuthkit.datamodel.AbstractFile; -import org.sleuthkit.datamodel.TskData; - -/** - * Allows limiting which files ingest is run on by storing rules and allowing - * files to be compared to them. - * - */ -public final class IngestSetFilter { - - FilesSet currentRules; - String rulesKey; - private boolean processUnallocatedSpace; - public final static String ALL_FILES_FILTER = ""; - public final static String ALL_FILES_AND_UNALLOCATED_FILTER = ""; - public final static String NEW_INGEST_FILTER = ""; - private String lastSelected; - private static final String LAST_INGEST_FILTER_FILE = "CurrentIngestFilter"; - private static final String LAST_INGEST_FILTER_PROPERTY = "LastIngestFilter"; - - /** - * Creates an IngestSetFilter for the filter specified by the key. - * - * @param key - The name of the filter you wish to create. - */ - public IngestSetFilter(String key) { - this.rulesKey = key; - InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); - switch (key) { - case ALL_FILES_FILTER: - currentRules = null; - processUnallocatedSpace = false; - break; - case ALL_FILES_AND_UNALLOCATED_FILTER: - currentRules = null; - processUnallocatedSpace = true; - break; - default: - try { - currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getIngestSetFilterDefsName(), "").get(key); - processUnallocatedSpace = currentRules.processesUnallocatedSpace(); - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - Exceptions.printStackTrace(ex); - } - break; - } - } - - /** - * No argument constructor for IngestSetFilter, creates a filter using the - * same filter that was selected previously. - */ - public IngestSetFilter() { - InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); - this.rulesKey = getLastSelected(); - switch (rulesKey) { - case ALL_FILES_FILTER: - currentRules = null; - processUnallocatedSpace = false; - break; - case ALL_FILES_AND_UNALLOCATED_FILTER: - currentRules = null; - processUnallocatedSpace = true; - break; - default: - try { - currentRules = manager.getInterestingFilesSets(InterestingItemDefsManager.getIngestSetFilterDefsName(), "").get(rulesKey); - processUnallocatedSpace = currentRules.processesUnallocatedSpace(); - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { - Exceptions.printStackTrace(ex); - } - break; - } - - } - - /** - * Get the set of available Ingest Set Filters. - * - * @return - the set of filter names - * @throws - * org.sleuthkit.autopsy.modules.interestingitems.InterestingItemDefsManager.InterestingItemDefsManagerException - */ - public static Set getKeys() throws InterestingItemDefsManager.InterestingItemDefsManagerException { - InterestingItemDefsManager manager = InterestingItemDefsManager.getInstance(); - return manager.getInterestingFilesSets(InterestingItemDefsManager.getIngestSetFilterDefsName(), "").keySet(); - } - - /** - * Returns access to the Rules currently being used by the Ingest Set Filter - * - * @return - the active file filter set from the InterestingItemsDefsManager - */ - FilesSet getFileFilterSet() { - return currentRules; - } - - /** - * Return whether or not the file meets any of the rules specified - * - * @param file - * @return fileMatches - true if the file matches a rule, false if no rules - * are matched - */ - public boolean match(AbstractFile file) { - boolean fileMatches = false; - if (isProcessUnallocatedSpace() == false && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) { - fileMatches = false; - } else if (rulesKey.equals(ALL_FILES_FILTER) || rulesKey.equals(ALL_FILES_AND_UNALLOCATED_FILTER)) { - fileMatches = true; - } else if (currentRules.fileIsMemberOf(file) != null) { - fileMatches = true; - } - return fileMatches; - } - - /** - * Get the name of the Ingest Set Filter which was last used, so that when - * running on the same set of files you will not have to reselect that set. - * - * @return lastSelected - the string which represents the Ingest Set Filter - * which was last used. - */ - public String getLastSelected() { - if (lastSelected == null) { - if (ModuleSettings.configExists(LAST_INGEST_FILTER_FILE)) { - lastSelected = ModuleSettings.getConfigSetting(LAST_INGEST_FILTER_FILE, LAST_INGEST_FILTER_PROPERTY); - } else { - lastSelected = ALL_FILES_AND_UNALLOCATED_FILTER; - } - } - return lastSelected; - } - - /** - * Saves the last selected IngestSetFilter, to a file so that it can be - * loaded later. - * - * @return True if value was saved successfully, false if it was not. - */ - public void setLastSelected(String lastSelectedFilter) { - lastSelected = lastSelectedFilter; - ModuleSettings.setConfigSetting(LAST_INGEST_FILTER_FILE, LAST_INGEST_FILTER_PROPERTY, lastSelected); - } - - /** - * Get whether or not unallocated space should be processed as a boolean. - * - * @return the processUnallocatedSpace true if unallocated space should be - * processed false if unallocated space should not be processed - */ - public boolean isProcessUnallocatedSpace() { - return processUnallocatedSpace; - } -} diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java index c9fbba1a41..3cb22421da 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java @@ -32,11 +32,13 @@ import java.util.Observable; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import org.openide.util.Exceptions; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.XMLUtil; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -47,21 +49,20 @@ import org.w3c.dom.NodeList; * synchronized methods, allowing the definitions to be safely published to * multiple threads. */ -final class InterestingItemDefsManager extends Observable { +public final class InterestingItemDefsManager extends Observable { private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings"; - private static final String INGEST_SET_FILTER_DEFS_NAME = "IngestSetFilterDefs.settings"; - private static final String INTERESTING_FILES_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; - private static final String LEGACY_FILE_SET_DEFS_PATH = PlatformUtil.getUserConfigDirectory() + File.separator; + private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings"; private static InterestingItemDefsManager instance; /** * Gets the interesting item definitions manager singleton. */ - synchronized static InterestingItemDefsManager getInstance() { + + public synchronized static InterestingItemDefsManager getInstance() { if (instance == null) { instance = new InterestingItemDefsManager(); } @@ -102,10 +103,10 @@ final class InterestingItemDefsManager extends Observable { } /** - * @return the INGEST_SET_FILTER_DEFS_NAME + * @return the FILE_INGEST_FILTER_DEFS_NAME */ - static String getIngestSetFilterDefsName() { - return INGEST_SET_FILTER_DEFS_NAME; + public static String getFileIngestFilterDefsName() { + return FILE_INGEST_FILTER_DEFS_NAME; } /** @@ -114,10 +115,32 @@ final class InterestingItemDefsManager extends Observable { * @return A map of interesting files set names to interesting file sets, * possibly empty. */ - synchronized Map getInterestingFilesSets(String fileName, String legacyFilePath) throws InterestingItemDefsManagerException { - return FilesSetXML.readDefinitionsFile(fileName, LEGACY_FILE_SET_DEFS_PATH); + synchronized Map getInterestingFilesSets(String fileName, String legacyFileName) throws InterestingItemDefsManagerException { + return FilesSetXML.readDefinitionsFile(fileName, legacyFileName); } + + /** + * Gets a copy of the current ingest file set definitions. + * + * @return A map of FilesSet names to file ingest sets, + * possibly empty. + */ + public synchronized Map getFileIngestFilters() { + Map returnMap = new HashMap<>(); + try { + returnMap.putAll(FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), "")); + } catch (InterestingItemDefsManagerException ex) { + Exceptions.printStackTrace(ex); //WJS-TODO change manager to not use file names, if this function is still needed fix error handling to be done properly. + + } + for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()){ + returnMap.put(fSet.getName(), fSet); + } + return returnMap; + } + + /** * Sets the current interesting file sets definitions, replacing any * previous definitions. @@ -126,7 +149,7 @@ final class InterestingItemDefsManager extends Observable { * used to enforce unique files set names. */ synchronized void setInterestingFilesSets(Map filesSets, String fileName) throws InterestingItemDefsManagerException { - FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_PATH + fileName, filesSets); + FilesSetXML.writeDefinitionsFile(fileName, filesSets); this.setChanged(); this.notifyObservers(); } @@ -151,6 +174,7 @@ final class InterestingItemDefsManager extends Observable { private static final String RULE_UUID_ATTR = "ruleUUID"; //NON-NLS private static final String DESC_ATTR = "description"; //NON-NLS private static final String IGNORE_KNOWN_FILES_ATTR = "ignoreKnown"; //NON-NLS + private static final String SKIP_UNALLOCATED_SPACE = "skipUnallocated"; //NON-NLS private static final String TYPE_FILTER_ATTR = "typeFilter"; //NON-NLS private static final String PATH_FILTER_ATTR = "pathFilter"; //NON-NLS private static final String TYPE_FILTER_VALUE_FILES = "file"; //NON-NLS @@ -174,43 +198,43 @@ final class InterestingItemDefsManager extends Observable { // Note: This method takes a file path to support the possibility of // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. - static Map readDefinitionsFile(String fileName, String legacyFilePath) throws InterestingItemDefsManagerException { + static Map readDefinitionsFile(String fileName, String legacyFileName) throws InterestingItemDefsManagerException { Map filesSets = readSerializedDefinitions(fileName); if (!filesSets.isEmpty()) { return filesSets; } // Check if the legacy xml file exists. - if (!legacyFilePath.isEmpty()) { - File defsFile = new File(legacyFilePath); + if (!legacyFileName.isEmpty()) { + File defsFile = new File(PlatformUtil.getUserConfigDirectory() + File.separator + legacyFileName); if (!defsFile.exists()) { return filesSets; } // Check if the file can be read. if (!defsFile.canRead()) { - logger.log(Level.SEVERE, "Interesting file sets definition file at {0} exists, but cannot be read", legacyFilePath); // NON-NLS + logger.log(Level.SEVERE, "Interesting file sets definition file at {0} exists, but cannot be read", defsFile.getPath()); // NON-NLS return filesSets; } // Parse the XML in the file. - Document doc = XMLUtil.loadDoc(FilesSetXML.class, legacyFilePath); + Document doc = XMLUtil.loadDoc(FilesSetXML.class, defsFile.getPath()); if (doc == null) { - logger.log(Level.SEVERE, "Failed to parse interesting file sets definition file at {0}", legacyFilePath); // NON-NLS + logger.log(Level.SEVERE, "Failed to parse interesting file sets definition file at {0}", defsFile.getPath()); // NON-NLS return filesSets; } // Get the root element. Element root = doc.getDocumentElement(); if (root == null) { - logger.log(Level.SEVERE, "Failed to get root {0} element tag of interesting file sets definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, legacyFilePath}); // NON-NLS + logger.log(Level.SEVERE, "Failed to get root {0} element tag of interesting file sets definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, defsFile.getPath()}); // NON-NLS return filesSets; } // Read in the files set definitions. NodeList setElems = root.getElementsByTagName(FILE_SET_TAG); for (int i = 0; i < setElems.getLength(); ++i) { - readFilesSet((Element) setElems.item(i), filesSets, legacyFilePath); + readFilesSet((Element) setElems.item(i), filesSets, defsFile.getPath()); } } return filesSets; @@ -226,7 +250,7 @@ final class InterestingItemDefsManager extends Observable { */ private static Map readSerializedDefinitions(String serialFileName) throws InterestingItemDefsManagerException { String filePath; - filePath = INTERESTING_FILES_SET_DEFS_PATH + serialFileName; + filePath = PlatformUtil.getUserConfigDirectory() + File.separator + serialFileName; System.out.println(filePath); File fileSetFile = new File(filePath); if (fileSetFile.exists()) { @@ -273,6 +297,13 @@ final class InterestingItemDefsManager extends Observable { ignoreKnownFiles = Boolean.parseBoolean(ignoreKnown); } + // The file set may or may not skip unallocated space. The default behavior + // is not to skip it. + String skipUnallocated = setElem.getAttribute(FilesSetXML.SKIP_UNALLOCATED_SPACE); + boolean skipsUnallocatedSpace = false; + if (!skipUnallocated.isEmpty()) { + skipsUnallocatedSpace = Boolean.parseBoolean(skipUnallocated); + } // Read file name set membership rules, if any. FilesSetXML.unnamedLegacyRuleCounter = 1; Map rules = new HashMap<>(); @@ -314,7 +345,7 @@ final class InterestingItemDefsManager extends Observable { // Make the files set. Note that degenerate sets with no rules are // allowed to facilitate the separation of set definition and rule // definitions. A set without rules is simply the empty set. - FilesSet set = new FilesSet(setName, description, ignoreKnownFiles, rules, true); + FilesSet set = new FilesSet(setName, description, ignoreKnownFiles, skipsUnallocatedSpace, rules); filesSets.put(set.getName(), set); } @@ -533,7 +564,7 @@ final class InterestingItemDefsManager extends Observable { * Writes interesting files set definitions to disk as an XML file, * logging any errors. * - * @param filePath Path of the set definitions file as a string. + * @param fileName Name of the set definitions file as a string. * * @returns True if the definitions are written to disk, false * otherwise. @@ -541,17 +572,17 @@ final class InterestingItemDefsManager extends Observable { // Note: This method takes a file path to support the possibility of // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. - static boolean writeDefinitionsFile(String filePath, Map interestingFilesSets) throws InterestingItemDefsManagerException { - try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(filePath))) { + static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws InterestingItemDefsManagerException { + try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(PlatformUtil.getUserConfigDirectory() + File.separator + fileName))) { out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); } catch (IOException ex) { - throw new InterestingItemDefsManagerException(String.format("Failed to write settings to %s", filePath), ex); + throw new InterestingItemDefsManagerException(String.format("Failed to write settings to %s", fileName), ex); } return true; } } - static class InterestingItemDefsManagerException extends Exception { + public static class InterestingItemDefsManagerException extends Exception { InterestingItemDefsManagerException() { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form index 48a03bd2b7..ab87102386 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form @@ -71,7 +71,7 @@ - + @@ -216,7 +216,7 @@ - + @@ -842,17 +842,17 @@ - + - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 9e44fe05a2..93c3a558cb 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -52,7 +52,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp "InterestingItemDefsPanel.gigaBytes=Gigabytes", "InterestingItemsDefsPanel.loadError=Error loading interesting files sets from file.", "InterestingItemsDefsPanel.saveError=Error saving interesting files sets to file.", - "IngestFileFilter.title=Ingest File Set" + "FileIngestFilter.title=Ingest File Set" }) private final DefaultListModel setsListModel = new DefaultListModel<>(); @@ -89,13 +89,18 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp if (legacySettingsName.equals("")) { //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules this.mimeTypeComboBox.setVisible(false); this.jLabel7.setVisible(false); - this.ruleDialogTitle = "IngestFileFilter.title"; + this.ruleDialogTitle = "FileIngestFilter.title"; } else { this.ruleDialogTitle = "FilesSetPanel.title"; } } - + + FilesSet getFilesSetByKey(String name) { + load(); + return filesSets.get(name); + } + Set getKeys() { load(); return filesSets.keySet(); @@ -201,7 +206,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp this.setsListModel.clear(); this.setDescriptionTextArea.setText(""); this.ignoreKnownFilesCheckbox.setSelected(true); - this.processUnallocCheckbox.setSelected(true); + this.skipsUnallocCheckbox.setSelected(true); this.newSetButton.setEnabled(true); this.editSetButton.setEnabled(false); this.deleteSetButton.setEnabled(false); @@ -249,7 +254,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // selected files set. InterestingItemDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription()); InterestingItemDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles()); - InterestingItemDefsPanel.this.processUnallocCheckbox.setSelected(selectedSet.processesUnallocatedSpace()); + InterestingItemDefsPanel.this.skipsUnallocCheckbox.setSelected(selectedSet.getSkipUnallocatedSpace()); // Enable the new, edit and delete set buttons. InterestingItemDefsPanel.this.newSetButton.setEnabled(true); InterestingItemDefsPanel.this.editSetButton.setEnabled(true); @@ -392,7 +397,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Preserve the existing rules from the set being edited. rules.putAll(selectedSet.getRules()); } - this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), rules, panel.getProcessUnallocatedSpace()); + this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getSkipUnallocatedSpace(), rules); //WJS-TODO add support for skipUnallocatedSpaceFlag } } @@ -438,7 +443,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Add the new/edited files set definition, replacing any previous // definition with the same name and refreshing the display. - this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), rules, selectedSet.processesUnallocatedSpace()); + this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), selectedSet.getSkipUnallocatedSpace(), rules); // Select the new/edited rule. Queue it up so it happens after the // selection listeners react to the selection of the "new" files @@ -463,7 +468,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp * @param processesUnallocatedSpace Whether or not this set of rules * processes unallocated space */ - void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, Map rules, boolean processesUnallocatedSpace) { + void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, boolean skipsUnallocatedSpace, Map rules) { if (oldSet != null) { // Remove the set to be replaced from the working copy if the files // set definitions. @@ -472,7 +477,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Make the new/edited set definition and add it to the working copy of // the files set definitions. - FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, rules, processesUnallocatedSpace); + FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, skipsUnallocatedSpace, rules); this.filesSets.put(newSet.getName(), newSet); // Redo the list model for the files set list component, which will make @@ -540,7 +545,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp equalitySignComboBox = new javax.swing.JComboBox(); fileSizeSpinner = new javax.swing.JSpinner(); fileSizeUnitComboBox = new javax.swing.JComboBox(); - processUnallocCheckbox = new javax.swing.JCheckBox(); + skipsUnallocCheckbox = new javax.swing.JCheckBox(); setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11)); @@ -748,12 +753,11 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() })); fileSizeUnitComboBox.setEnabled(false); - org.openide.awt.Mnemonics.setLocalizedText(processUnallocCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.processUnallocCheckbox.text")); // NOI18N - processUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.processUnallocCheckbox.toolTipText")); // NOI18N - processUnallocCheckbox.setEnabled(false); - processUnallocCheckbox.addActionListener(new java.awt.event.ActionListener() { + org.openide.awt.Mnemonics.setLocalizedText(skipsUnallocCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.skipsUnallocCheckbox.text")); // NOI18N + skipsUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.skipsUnallocCheckbox.toolTipText")); // NOI18N + skipsUnallocCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - processUnallocCheckboxActionPerformed(evt); + skipsUnallocCheckboxActionPerformed(evt); } }); @@ -770,7 +774,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(ignoreKnownFilesCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(processUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))) .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() @@ -882,7 +886,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ignoreKnownFilesCheckbox) - .addComponent(processUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rulesListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -963,7 +967,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp Map rules = new HashMap<>(oldSet.getRules()); FilesSet.Rule selectedRule = this.rulesList.getSelectedValue(); rules.remove(selectedRule.getUuid()); - this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), rules, oldSet.processesUnallocatedSpace()); + this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), oldSet.getSkipUnallocatedSpace(), rules); if (!this.rulesListModel.isEmpty()) { this.rulesList.setSelectedIndex(0); } else { @@ -1010,9 +1014,9 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // TODO add your handling code here: }//GEN-LAST:event_fileNameTextFieldActionPerformed - private void processUnallocCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_processUnallocCheckboxActionPerformed + private void skipsUnallocCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipsUnallocCheckboxActionPerformed // TODO add your handling code here: - }//GEN-LAST:event_processUnallocCheckboxActionPerformed + }//GEN-LAST:event_skipsUnallocCheckboxActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton bothRadioButton; @@ -1046,7 +1050,6 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JComboBox mimeTypeComboBox; private javax.swing.JButton newRuleButton; private javax.swing.JButton newSetButton; - private javax.swing.JCheckBox processUnallocCheckbox; private javax.swing.JCheckBox rulePathConditionRegexCheckBox; private javax.swing.JTextField rulePathConditionTextField; private javax.swing.JList rulesList; @@ -1058,6 +1061,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JList setsList; private javax.swing.JLabel setsListLabel; private javax.swing.JScrollPane setsListScrollPane; + private javax.swing.JCheckBox skipsUnallocCheckbox; private javax.swing.ButtonGroup typeButtonGroup; // End of variables declaration//GEN-END:variables From ec8ea1179e70729c3aee9d63a02edc8f94c8348b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 4 Jan 2017 12:33:24 -0500 Subject: [PATCH 15/50] 1903 renamed Manager and Settings class for handling FilesSet objects --- .../autopsy/ingest/IngestJobSettings.java | 4 +- .../ingest/IngestJobSettingsPanel.java | 4 +- ...ngestFilterDefsOptionsPanelController.java | 2 +- ...FilesIdentifierIngestJobSettingsPanel.java | 10 ++-- .../FilesIdentifierIngestModule.java | 4 +- .../interestingitems/FilesSetRulePanel.java | 4 +- ...SetSettings.java => FilesSetSettings.java} | 7 +-- ...DefsManager.java => FilesSetsManager.java} | 54 +++++++++---------- ...restingItemDefsOptionsPanelController.java | 2 +- .../InterestingItemDefsPanel.java | 8 +-- .../InterestingItemsIngestModuleFactory.java | 6 +-- 11 files changed, 53 insertions(+), 52 deletions(-) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{InterestingItemsFilesSetSettings.java => FilesSetSettings.java} (85%) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{InterestingItemDefsManager.java => FilesSetsManager.java} (92%) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index fa41c9fa61..0ee239d852 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -40,7 +40,7 @@ import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.ModuleSettings; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; -import org.sleuthkit.autopsy.modules.interestingitems.InterestingItemDefsManager; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager; /** * Encapsulates the ingest job settings for a particular execution context. @@ -355,7 +355,7 @@ public class IngestJobSettings { if (ModuleSettings.settingExists(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY) == false) { ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY, IngestJobSettings.ALL_AND_UNALLOC_FILES_INGEST_FILTER.getName()); } - this.fileIngestFilter = InterestingItemDefsManager.getInstance() + this.fileIngestFilter = FilesSetsManager.getInstance() .getFileIngestFilters() .get(ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY)); } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index 84b8caa00b..ba4cdf45f5 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -45,7 +45,7 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.modules.interestingitems.FileIngestFilterDefsOptionsPanelController; -import org.sleuthkit.autopsy.modules.interestingitems.InterestingItemDefsManager; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestModuleInfo; @@ -425,7 +425,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } else if (evt.getActionCommand().equals("comboBoxChanged")) { - settings.setFileIngestFilter(InterestingItemDefsManager.getInstance() + settings.setFileIngestFilter(FilesSetsManager.getInstance() .getFileIngestFilters() .get(jComboBox1.getSelectedItem().toString())); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index c4df869609..2acf462938 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -150,7 +150,7 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan */ private InterestingItemDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getFileIngestFilterDefsName(), ""); + panel = new InterestingItemDefsPanel(FilesSetsManager.getFileIngestFilterDefsName(), ""); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index ede36f4cec..c97fdd5398 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -62,7 +62,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS // interesting file set definitions. This is used to keep this panel in // synch with changes made using the global settings/option panel for // this module. - InterestingItemDefsManager.getInstance().addObserver(panel); + FilesSetsManager.getInstance().addObserver(panel); return panel; } @@ -83,8 +83,8 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS */ List filesSetRows = new ArrayList<>(); try { - this.filesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName())); - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + this.filesSetSnapshot = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName())); + } catch (FilesSetsManager.FilesSetsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError()); this.filesSetSnapshot = new TreeMap<>(); } @@ -138,8 +138,8 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS List rowModels = new ArrayList<>(); TreeMap newFilesSetSnapshot; try { - newFilesSetSnapshot = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName())); - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + newFilesSetSnapshot = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName())); + } catch (FilesSetsManager.FilesSetsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError()); return; } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index df4535e068..6695a4a058 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -83,12 +83,12 @@ final class FilesIdentifierIngestModule implements FileIngestModule { // to disable the interesting files set definition UI during ingest. List filesSets = new ArrayList<>(); try { - for (FilesSet set : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()).values()) { + for (FilesSet set : FilesSetsManager.getInstance().getInterestingFilesSets(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName()).values()) { if (settings.interestingFilesSetIsEnabled(set.getName())) { filesSets.add(set); } } - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + } catch (FilesSetsManager.FilesSetsManagerException ex) { throw new IngestModuleException(Bundle.FilesIdentifierIngestModule_getFilesError(), ex); } FilesIdentifierIngestModule.interestingFileSetsByJob.put(context.getJobId(), filesSets); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index b7a8f51031..6166368202 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -57,8 +57,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { private static final Logger logger = Logger.getLogger(FilesSetRulePanel.class.getName()); private static final String SLEUTHKIT_PATH_SEPARATOR = "/"; // NON-NLS - private static final List ILLEGAL_FILE_NAME_CHARS = InterestingItemDefsManager.getIllegalFileNameChars(); - private static final List ILLEGAL_FILE_PATH_CHARS = InterestingItemDefsManager.getIllegalFilePathChars(); + private static final List ILLEGAL_FILE_NAME_CHARS = FilesSetsManager.getIllegalFileNameChars(); + private static final List ILLEGAL_FILE_PATH_CHARS = FilesSetsManager.getIllegalFilePathChars(); private JButton okButton; private JButton cancelButton; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java similarity index 85% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java index 14771992eb..35036326a3 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java @@ -22,13 +22,14 @@ import java.io.Serializable; import java.util.Map; /** - * + * A map of FilesSets for saving all the settings in FilesSetsManager in one item. + * * @author oliver */ -class InterestingItemsFilesSetSettings implements Serializable { +class FilesSetSettings implements Serializable { private static final long serialVersionUID = 1L; private Map filesSets; - InterestingItemsFilesSetSettings(Map filesSets) { + FilesSetSettings(Map filesSets) { this.filesSets = filesSets; } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java similarity index 92% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 3cb22421da..da03a29512 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -44,27 +44,27 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** - * Provides access to interesting item definitions persisted to disk. Clients - * receive copies of the most recent interesting item definitions via - * synchronized methods, allowing the definitions to be safely published to - * multiple threads. + * Provides access to collections of FilesSet definitions persisted to disk. Clients + * receive copies of the most recent FilesSet definitions for Interesting Items or + * File Ingest Filters via synchronized methods, allowing the definitions to be + * safely published to multiple threads. */ -public final class InterestingItemDefsManager extends Observable { +public final class FilesSetsManager extends Observable { private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings"; private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings"; - private static InterestingItemDefsManager instance; + private static FilesSetsManager instance; /** * Gets the interesting item definitions manager singleton. */ - public synchronized static InterestingItemDefsManager getInstance() { + public synchronized static FilesSetsManager getInstance() { if (instance == null) { - instance = new InterestingItemDefsManager(); + instance = new FilesSetsManager(); } return instance; } @@ -75,7 +75,7 @@ public final class InterestingItemDefsManager extends Observable { * @return A list of characters. */ static List getIllegalFileNameChars() { - return InterestingItemDefsManager.ILLEGAL_FILE_NAME_CHARS; + return FilesSetsManager.ILLEGAL_FILE_NAME_CHARS; } /** @@ -85,7 +85,7 @@ public final class InterestingItemDefsManager extends Observable { * @return A list of characters. */ static List getIllegalFilePathChars() { - return InterestingItemDefsManager.ILLEGAL_FILE_PATH_CHARS; + return FilesSetsManager.ILLEGAL_FILE_PATH_CHARS; } /** @@ -115,7 +115,7 @@ public final class InterestingItemDefsManager extends Observable { * @return A map of interesting files set names to interesting file sets, * possibly empty. */ - synchronized Map getInterestingFilesSets(String fileName, String legacyFileName) throws InterestingItemDefsManagerException { + synchronized Map getInterestingFilesSets(String fileName, String legacyFileName) throws FilesSetsManagerException { return FilesSetXML.readDefinitionsFile(fileName, legacyFileName); } @@ -130,7 +130,7 @@ public final class InterestingItemDefsManager extends Observable { Map returnMap = new HashMap<>(); try { returnMap.putAll(FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), "")); - } catch (InterestingItemDefsManagerException ex) { + } catch (FilesSetsManagerException ex) { Exceptions.printStackTrace(ex); //WJS-TODO change manager to not use file names, if this function is still needed fix error handling to be done properly. } @@ -148,7 +148,7 @@ public final class InterestingItemDefsManager extends Observable { * @param filesSets A mapping of interesting files set names to files sets, * used to enforce unique files set names. */ - synchronized void setInterestingFilesSets(Map filesSets, String fileName) throws InterestingItemDefsManagerException { + synchronized void setInterestingFilesSets(Map filesSets, String fileName) throws FilesSetsManagerException { FilesSetXML.writeDefinitionsFile(fileName, filesSets); this.setChanged(); this.notifyObservers(); @@ -162,7 +162,7 @@ public final class InterestingItemDefsManager extends Observable { private static final Logger logger = Logger.getLogger(FilesSetXML.class.getName()); private static final String XML_ENCODING = "UTF-8"; //NON-NLS - private static final List illegalFileNameChars = InterestingItemDefsManager.getIllegalFileNameChars(); + private static final List illegalFileNameChars = FilesSetsManager.getIllegalFileNameChars(); // The following tags and attributes are identical to those used in the // TSK Framework interesting files set definitions file schema. @@ -198,7 +198,7 @@ public final class InterestingItemDefsManager extends Observable { // Note: This method takes a file path to support the possibility of // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. - static Map readDefinitionsFile(String fileName, String legacyFileName) throws InterestingItemDefsManagerException { + static Map readDefinitionsFile(String fileName, String legacyFileName) throws FilesSetsManagerException { Map filesSets = readSerializedDefinitions(fileName); if (!filesSets.isEmpty()) { @@ -246,9 +246,9 @@ public final class InterestingItemDefsManager extends Observable { * @return the map representing settings saved to serialization file, * empty set if the file does not exist. * - * @throws InterestingItemDefsManagerException if file could not be read + * @throws FilesSetsManagerException if file could not be read */ - private static Map readSerializedDefinitions(String serialFileName) throws InterestingItemDefsManagerException { + private static Map readSerializedDefinitions(String serialFileName) throws FilesSetsManagerException { String filePath; filePath = PlatformUtil.getUserConfigDirectory() + File.separator + serialFileName; System.out.println(filePath); @@ -256,11 +256,11 @@ public final class InterestingItemDefsManager extends Observable { if (fileSetFile.exists()) { try { try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePath))) { - InterestingItemsFilesSetSettings filesSetsSettings = (InterestingItemsFilesSetSettings) in.readObject(); + FilesSetSettings filesSetsSettings = (FilesSetSettings) in.readObject(); return filesSetsSettings.getFilesSets(); } } catch (IOException | ClassNotFoundException ex) { - throw new InterestingItemDefsManagerException(String.format("Failed to read settings from %s", filePath), ex); + throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePath), ex); } } else { return new HashMap<>(); @@ -572,31 +572,31 @@ public final class InterestingItemDefsManager extends Observable { // Note: This method takes a file path to support the possibility of // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. - static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws InterestingItemDefsManagerException { + static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws FilesSetsManagerException { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(PlatformUtil.getUserConfigDirectory() + File.separator + fileName))) { - out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); + out.writeObject(new FilesSetSettings(interestingFilesSets)); } catch (IOException ex) { - throw new InterestingItemDefsManagerException(String.format("Failed to write settings to %s", fileName), ex); + throw new FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex); } return true; } } - public static class InterestingItemDefsManagerException extends Exception { + public static class FilesSetsManagerException extends Exception { - InterestingItemDefsManagerException() { + FilesSetsManagerException() { } - InterestingItemDefsManagerException(String message) { + FilesSetsManagerException(String message) { super(message); } - InterestingItemDefsManagerException(String message, Throwable cause) { + FilesSetsManagerException(String message, Throwable cause) { super(message, cause); } - InterestingItemDefsManagerException(Throwable cause) { + FilesSetsManagerException(Throwable cause) { super(cause); } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java index cbf1d3e4a3..0704466552 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java @@ -115,7 +115,7 @@ public final class InterestingItemDefsOptionsPanelController extends OptionsPane private InterestingItemDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()); + panel = new InterestingItemDefsPanel(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName()); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java index 93c3a558cb..2c7a3ad873 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java @@ -153,8 +153,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp @Override public void saveSettings() { try { - InterestingItemDefsManager.getInstance().setInterestingFilesSets(this.filesSets, settingsFileName); - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + FilesSetsManager.getInstance().setInterestingFilesSets(this.filesSets, settingsFileName); + } catch (FilesSetsManager.FilesSetsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_saveError()); } } @@ -177,8 +177,8 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp try { // Get a working copy of the interesting files set definitions and sort // by set name. - this.filesSets = new TreeMap<>(InterestingItemDefsManager.getInstance().getInterestingFilesSets(settingsFileName, settingsLegacyFileName)); - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets(settingsFileName, settingsLegacyFileName)); + } catch (FilesSetsManager.FilesSetsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_loadError()); this.filesSets = new TreeMap<>(); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index 6aab03d17d..9a96459e73 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -69,7 +69,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto @Override public IngestModuleGlobalSettingsPanel getGlobalSettingsPanel() { - InterestingItemDefsPanel panel = new InterestingItemDefsPanel(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()); + InterestingItemDefsPanel panel = new InterestingItemDefsPanel(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName()); panel.load(); return panel; } @@ -83,10 +83,10 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto // Doing so also keeps the serialization simple. List enabledFilesSetNames = new ArrayList<>(); try { - for (String name : InterestingItemDefsManager.getInstance().getInterestingFilesSets(InterestingItemDefsManager.getInterestingFilesSetDefsName(), InterestingItemDefsManager.getLegacyFilesSetDefsFileName()).keySet()) { + for (String name : FilesSetsManager.getInstance().getInterestingFilesSets(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName()).keySet()) { enabledFilesSetNames.add(name); } - } catch (InterestingItemDefsManager.InterestingItemDefsManagerException ex) { + } catch (FilesSetsManager.FilesSetsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.InterestingItemsIngestModuleFactory_defaultSettingsError()); } return new FilesIdentifierIngestJobSettings(enabledFilesSetNames); From 8d9782709c17dec300d7d27ed8f4d73957171697 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 4 Jan 2017 14:31:35 -0500 Subject: [PATCH 16/50] 1903 some fixes to sizing on IngestJobSettingsPanel --- .../autopsy/ingest/Bundle.properties | 2 +- .../ingest/IngestJobSettingsPanel.form | 76 +++++++++--------- .../ingest/IngestJobSettingsPanel.java | 79 +++++++++---------- 3 files changed, 74 insertions(+), 83 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties index eaca1515d6..947249781b 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties @@ -113,4 +113,4 @@ gest IngestJobSettingsPanel.globalSettingsButton.actionCommand=Advanced IngestJobSettingsPanel.globalSettingsButton.text=Global Settings IngestJobSettingsPanel.pastJobsButton.text=View Ingest History -IngestJobSettingsPanel.jLabel1.text=Run Ingest Modules on: \ No newline at end of file +IngestJobSettingsPanel.fileIngestFilterLabel.text=Run ingest modules on: diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form index bab773131a..02bba94367 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form @@ -34,23 +34,24 @@ - + + + + + + - - - - - + - + @@ -58,16 +59,16 @@ - + - - + + - + - - + + @@ -77,7 +78,7 @@ - + @@ -86,26 +87,6 @@ - - - - - - - - - - - - - - - - - - - - @@ -158,24 +139,24 @@ - + - + - + - - + + @@ -266,5 +247,22 @@ + + + + + + + + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index ba4cdf45f5..c48be25a52 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -66,8 +66,8 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private final List modules = new ArrayList<>(); private final IngestModulesTableModel tableModel = new IngestModulesTableModel(); private IngestModuleModel selectedModule; - private static final Logger LOGGER = Logger.getLogger(IngestJobSettingsPanel.class.getName()); private final FileIngestFilterDefsOptionsPanelController controller; + private static final Logger logger = Logger.getLogger(IngestJobSettingsPanel.class.getName()); /** * Construct a panel to allow a user to make ingest job settings. @@ -78,14 +78,12 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { this.settings = settings; this.controller = new FileIngestFilterDefsOptionsPanelController(); controller.getComponent(controller.getLookup()); - for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) { modules.add(new IngestModuleModel(moduleTemplate)); } - initComponents(); customizeComponents(); - jComboBox1.setSelectedItem(settings.getFileIngestFilter().getName()); + fileIngestFilterComboBox.setSelectedItem(settings.getFileIngestFilter().getName()); } /** @@ -104,17 +102,17 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); ingestJobs.addAll(skCase.getIngestJobs()); } catch (IllegalStateException ex) { - LOGGER.log(Level.SEVERE, "No open case", ex); + logger.log(Level.SEVERE, "No open case", ex); } catch (TskCoreException ex) { - LOGGER.log(Level.SEVERE, "Failed to load ingest job information", ex); + logger.log(Level.SEVERE, "Failed to load ingest job information", ex); } for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) { this.modules.add(new IngestModuleModel(moduleTemplate)); } - initComponents(); customizeComponents(); - jComboBox1.setSelectedItem(settings.getFileIngestFilter().getName()); + fileIngestFilterComboBox.setSelectedItem(settings.getFileIngestFilter().getName()); + } /** @@ -201,8 +199,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private void initComponents() { timeGroup = new javax.swing.ButtonGroup(); - jLabel1 = new javax.swing.JLabel(); - jComboBox1 = new javax.swing.JComboBox<>(); modulesScrollPane = new javax.swing.JScrollPane(); modulesTable = new javax.swing.JTable(); jPanel1 = new javax.swing.JPanel(); @@ -214,20 +210,13 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jButtonSelectAll = new javax.swing.JButton(); jButtonDeselectAll = new javax.swing.JButton(); pastJobsButton = new javax.swing.JButton(); + fileIngestFilterLabel = new javax.swing.JLabel(); + fileIngestFilterComboBox = new javax.swing.JComboBox<>(); setMaximumSize(new java.awt.Dimension(5750, 3000)); setMinimumSize(new java.awt.Dimension(0, 0)); setPreferredSize(new java.awt.Dimension(625, 450)); - jLabel1.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jLabel1.text")); // NOI18N - - jComboBox1.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); - jComboBox1.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - jComboBox1ActionPerformed(evt); - } - }); - modulesScrollPane.setBorder(javax.swing.BorderFactory.createLineBorder(new java.awt.Color(160, 160, 160))); modulesScrollPane.setMinimumSize(new java.awt.Dimension(0, 0)); modulesScrollPane.setPreferredSize(new java.awt.Dimension(160, 160)); @@ -275,7 +264,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 215, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(globalSettingsButton))) @@ -285,7 +274,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 309, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(8, 8, 8) @@ -316,6 +305,10 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } }); + fileIngestFilterLabel.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.fileIngestFilterLabel.text")); // NOI18N + + fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -323,32 +316,33 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addGroup(layout.createSequentialGroup() .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createSequentialGroup() + .addComponent(fileIngestFilterLabel) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileIngestFilterComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addGroup(layout.createSequentialGroup() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) .addComponent(jButtonSelectAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addComponent(pastJobsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGap(5, 5, 5) - .addComponent(jButtonDeselectAll)) - .addGroup(layout.createSequentialGroup() - .addComponent(jLabel1) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, 244, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jButtonDeselectAll) + .addGap(0, 84, Short.MAX_VALUE))) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 148, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) .addContainerGap()) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addGap(6, 6, 6) + .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jComboBox1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jLabel1)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileIngestFilterLabel) + .addComponent(fileIngestFilterComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 335, Short.MAX_VALUE) + .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jButtonSelectAll) @@ -357,7 +351,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .addComponent(pastJobsButton) .addGap(25, 25, 25)) .addGroup(layout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 407, Short.MAX_VALUE) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE) .addContainerGap()))) ); }// //GEN-END:initComponents @@ -403,36 +397,35 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { dialog.pack(); dialog.setVisible(true); }//GEN-LAST:event_pastJobsButtonActionPerformed - + /** * Perform the appropriate action when Jcombobox items are selected, most * notably opening the File filter settings when Create New is chosen. * * @param evt */ - private void jComboBox1ActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed + private void fileIngestFilterComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed - if (jComboBox1.getSelectedItem().toString().equals(FileIngestFilterDefsOptionsPanelController.NEW_INGEST_FILTER)) { + if (fileIngestFilterComboBox.getSelectedItem().toString().equals(FileIngestFilterDefsOptionsPanelController.NEW_INGEST_FILTER)) { final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); dialog.addApplyButtonListener((ActionEvent e) -> { controller.applyChanges(); ((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())).saveSettings(); - jComboBox1.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); + fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); dialog.close(); }); dialog.display((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())); - jComboBox1.setSelectedItem(settings.getFileIngestFilter().getName()); + fileIngestFilterComboBox.setSelectedItem(settings.getFileIngestFilter().getName()); } else if (evt.getActionCommand().equals("comboBoxChanged")) { settings.setFileIngestFilter(FilesSetsManager.getInstance() .getFileIngestFilters() - .get(jComboBox1.getSelectedItem().toString())); + .get(fileIngestFilterComboBox.getSelectedItem().toString())); } - - }//GEN-LAST:event_jComboBox1ActionPerformed + private void SelectAllModules(boolean set) { for (IngestModuleModel module : modules) { module.setEnabled(set); @@ -442,12 +435,12 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JLabel descriptionLabel; + private javax.swing.JComboBox fileIngestFilterComboBox; + private javax.swing.JLabel fileIngestFilterLabel; private javax.swing.JButton globalSettingsButton; private javax.swing.JPanel ingestSettingsPanel; private javax.swing.JButton jButtonDeselectAll; private javax.swing.JButton jButtonSelectAll; - private javax.swing.JComboBox jComboBox1; - private javax.swing.JLabel jLabel1; private javax.swing.JPanel jPanel1; private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator2; From 2438fab5248adcb10d414643bfbc2aa478fbd2df Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Wed, 4 Jan 2017 15:41:31 -0500 Subject: [PATCH 17/50] 1902-added actionlistener for combo box --- .../sleuthkit/autopsy/ingest/IngestJobSettings.java | 7 ------- .../autopsy/ingest/IngestJobSettingsPanel.java | 12 ++++++++++-- .../autopsy/ingest/IngestTasksScheduler.java | 12 +++++------- .../autopsy/modules/interestingitems/FilesSet.java | 8 +++++--- 4 files changed, 20 insertions(+), 19 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 0ee239d852..cba4d6238c 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -52,7 +52,6 @@ public class IngestJobSettings { private static final String ENABLED_MODULES_KEY = "Enabled_Ingest_Modules"; //NON-NLS private static final String DISABLED_MODULES_KEY = "Disabled_Ingest_Modules"; //NON-NLS - private static final String PARSE_UNALLOC_SPACE_KEY = "Process_Unallocated_Space"; //NON-NLS private static final String LAST_FILE_INGEST_FILTER_KEY = "Last File Ingest Filter Used"; private static final String MODULE_SETTINGS_FOLDER = "IngestModuleSettings"; //NON-NLS private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); @@ -487,12 +486,6 @@ public class IngestJobSettings { ModuleSettings.setConfigSetting(this.executionContext, ENABLED_MODULES_KEY, makeCommaSeparatedValuesList(enabledModuleNames)); ModuleSettings.setConfigSetting(this.executionContext, DISABLED_MODULES_KEY, makeCommaSeparatedValuesList(disabledModuleNames)); - /** - * Save the process unallocated space setting. - */ - String processUnalloc = Boolean.toString(getProcessUnallocatedSpace()); - ModuleSettings.setConfigSetting(this.executionContext, PARSE_UNALLOC_SPACE_KEY, processUnalloc); - /** * Save the last used File Ingest Filter setting for this context. */ diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index c48be25a52..e5f2d77843 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -213,6 +213,15 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { fileIngestFilterLabel = new javax.swing.JLabel(); fileIngestFilterComboBox = new javax.swing.JComboBox<>(); + fileIngestFilterLabel.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.fileIngestFilterLabel.text")); // NOI18N + fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); + fileIngestFilterComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fileIngestFilterComboBoxActionPerformed(evt); + } + }); + + setMaximumSize(new java.awt.Dimension(5750, 3000)); setMinimumSize(new java.awt.Dimension(0, 0)); setPreferredSize(new java.awt.Dimension(625, 450)); @@ -397,7 +406,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { dialog.pack(); dialog.setVisible(true); }//GEN-LAST:event_pastJobsButtonActionPerformed - + /** * Perform the appropriate action when Jcombobox items are selected, most * notably opening the File filter settings when Create New is chosen. @@ -425,7 +434,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } }//GEN-LAST:event_jComboBox1ActionPerformed - private void SelectAllModules(boolean set) { for (IngestModuleModel module : modules) { module.setEnabled(set); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index 0f71cae4fb..c13d9ee8bd 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -397,13 +397,6 @@ final class IngestTasksScheduler { private static boolean shouldEnqueueFileTask(final FileIngestTask task) { final AbstractFile file = task.getFile(); - // Skip the task if the file is an unallocated space file and the - // process unallocated space flag is not set for this job. - if (!task.getIngestJob().shouldProcessUnallocatedSpace() - && file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS)) { - return false; - } - // Skip the task if the file is actually the pseudo-file for the parent // or current directory. String fileName = file.getName(); @@ -411,6 +404,11 @@ final class IngestTasksScheduler { return false; } + /** + * Check if the file is a member of the file ingest filter that is being + * 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) { return false; } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 6a0a74b80e..56db222bde 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -544,11 +544,13 @@ public final class FilesSet implements Serializable { return file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG; case DIRECTORIES: return file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR; - case ALL: - return true; - default: + case FILES_AND_DIRECTORIES: return file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_REG || file.getMetaType() == TskData.TSK_FS_META_TYPE_ENUM.TSK_FS_META_TYPE_DIR; + case ALL: + return true; //Effectively ignores the metatype condition when All is selected. + default: + return true; } } From efe189055fd7ec13b234e22688cf0e4d792d2a9f Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 5 Jan 2017 12:55:43 -0500 Subject: [PATCH 18/50] 1903 InterestingItemDefsPanel refactored into FilesSetDefsPanel --- .../autopsy/ingest/IngestJobSettings.java | 11 +- .../ingest/IngestJobSettingsPanel.java | 11 +- .../interestingitems/Bundle.properties | 90 +++---- .../interestingitems/Bundle_ja.properties | 93 ++----- ...ngestFilterDefsOptionsPanelController.java | 32 ++- ...FilesIdentifierIngestJobSettingsPanel.java | 4 +- .../FilesIdentifierIngestModule.java | 2 +- ...mDefsPanel.form => FilesSetDefsPanel.form} | 58 ++--- ...mDefsPanel.java => FilesSetDefsPanel.java} | 233 +++++++++--------- .../interestingitems/FilesSetPanel.form | 22 +- .../interestingitems/FilesSetPanel.java | 2 + .../interestingitems/FilesSetRulePanel.java | 9 +- .../interestingitems/FilesSetsManager.java | 77 ++++-- ...restingItemDefsOptionsPanelController.java | 6 +- .../InterestingItemsIngestModuleFactory.java | 4 +- 15 files changed, 316 insertions(+), 338 deletions(-) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{InterestingItemDefsPanel.form => FilesSetDefsPanel.form} (92%) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{InterestingItemDefsPanel.java => FilesSetDefsPanel.java} (83%) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index cba4d6238c..265f6b1e34 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -32,6 +32,7 @@ import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.logging.Level; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; @@ -354,9 +355,13 @@ public class IngestJobSettings { if (ModuleSettings.settingExists(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY) == false) { ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY, IngestJobSettings.ALL_AND_UNALLOC_FILES_INGEST_FILTER.getName()); } - this.fileIngestFilter = FilesSetsManager.getInstance() - .getFileIngestFilters() - .get(ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY)); + try { + this.fileIngestFilter = FilesSetsManager.getInstance() + .getFileIngestFiltersWithDefaults() + .get(ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY)); + } catch (FilesSetsManager.FilesSetsManagerException ex) { + LOGGER.log(Level.SEVERE, "Failed to get File Ingest Filters", ex); //NON-NLS + } } /** diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index e5f2d77843..7b3df559e8 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -40,6 +40,7 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumn; +import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; @@ -428,9 +429,13 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } else if (evt.getActionCommand().equals("comboBoxChanged")) { - settings.setFileIngestFilter(FilesSetsManager.getInstance() - .getFileIngestFilters() - .get(fileIngestFilterComboBox.getSelectedItem().toString())); + try { + settings.setFileIngestFilter(FilesSetsManager.getInstance() + .getFileIngestFiltersWithDefaults() + .get(fileIngestFilterComboBox.getSelectedItem().toString())); + } catch (FilesSetsManager.FilesSetsManagerException ex) { + logger.log(Level.SEVERE, "Failed to get File Ingest Filters", ex); //NON-NLS + } } }//GEN-LAST:event_jComboBox1ActionPerformed diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 7bf183f17d..01660cc2fb 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -8,7 +8,7 @@ OptionsCategory_Name_FileIngestFilterDefinitions=File Ingest Filter OptionsCategory_Keywords_FileIngestFilterDefinitions=FileIngestFilterDefinitions InterestingItemsIdentifierIngestModule.moduleName=Interesting Files Identifier InterestingItemsIdentifierIngestModule.moduleDescription=Identifies interesting items as defined by interesting item rule sets. -FilesSetPanel.title=Interesting Files Set +FilesSetPanel.interesting.title=Interesting Files Set FilesSetPanel.messages.filesSetsMustBeNamed=Interesting files sets must be named. FilesSetPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files FilesSetPanel.descriptionPanel.border.title=Description @@ -30,40 +30,11 @@ FilesSetRulePanel.messages.invalidNameRegex=The name regular expression is not v FilesSetRulePanel.messages.invalidCharInName=The name cannot contain \\, /, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidCharInPath=The path cannot contain \\, :, *, ?, \", <, or > unless it is a regular expression. FilesSetRulePanel.messages.invalidPathRegex=The path regular expression is not valid:\n\n{0} -InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=Rule set with name {0} already exists. +FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text=Rule set with name {0} already exists. FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: FilesSetRulePanel.jLabel1.text=Type: FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. -InterestingItemDefsPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. -InterestingItemDefsPanel.skipsUnallocCheckbox.text=Skip Unallocated Space -InterestingItemDefsPanel.jLabel6.text=Set Details -InterestingItemDefsPanel.jLabel8.text=File Size: -InterestingItemDefsPanel.jLabel7.text=MIME Type: -InterestingItemDefsPanel.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. -InterestingItemDefsPanel.jLabel4.text=Path Pattern: -InterestingItemDefsPanel.jLabel1.text=Rule Details -InterestingItemDefsPanel.dirsRadioButton.text=Directories -InterestingItemDefsPanel.jLabel2.text=File Type: -InterestingItemDefsPanel.newSetButton.text=New Set -InterestingItemDefsPanel.deleteRuleButton.text=Delete Rule -InterestingItemDefsPanel.deleteSetButton.text=Delete Set -InterestingItemDefsPanel.bothRadioButton.text=Files and Directories -InterestingItemDefsPanel.setsListLabel.text=Rule Sets -InterestingItemDefsPanel.fileNameRegexCheckbox.text=Regex -InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files -InterestingItemDefsPanel.fileNameRadioButton.text=File Name -InterestingItemDefsPanel.jLabel5.text=Description: -InterestingItemDefsPanel.fileNameTextField.text= -InterestingItemDefsPanel.jLabel3.text=Name Pattern: -InterestingItemDefsPanel.fileNameExtensionRadioButton.text=Extension Only -InterestingItemDefsPanel.editSetButton.text=Edit Set -InterestingItemDefsPanel.rulesListLabel.text=Rules: -InterestingItemDefsPanel.editRuleButton.text=Edit Rule -InterestingItemDefsPanel.filesRadioButton.text=Files -InterestingItemDefsPanel.newRuleButton.text=New Rule -InterestingItemDefsPanel.rulePathConditionTextField.text= -InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=Regex FilesSetRulePanel.nameCheck.text=Name Pattern: FilesSetRulePanel.pathCheck.text=Path Pattern: FilesSetRulePanel.mimeCheck.text=MIME Type: @@ -71,30 +42,33 @@ FilesSetRulePanel.fileSizeCheck.text=File Size: FilesSetRulePanel.filesRadioButton.text=Files FilesSetRulePanel.dirsRadioButton.text=Directories FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories -FileIngestFilterDefinitions.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. -FileIngestFilterDefinitions.editSetButton.text=Edit Set -FileIngestFilterDefinitions.rulePathConditionRegexCheckBox.text=Regex -FileIngestFilterDefinitions.jLabel4.text=Path Pattern: -FileIngestFilterDefinitions.jLabel1.text=Rule Details -FileIngestFilterDefinitions.dirsRadioButton.text=Directories -FileIngestFilterDefinitions.jLabel2.text=File Type: -FileIngestFilterDefinitions.rulesListLabel.text=Rules: -FileIngestFilterDefinitions.newSetButton.text=New Set -FileIngestFilterDefinitions.editRuleButton.text=Edit Rule -FileIngestFilterDefinitions.deleteRuleButton.text=Delete Rule -FileIngestFilterDefinitions.filesRadioButton.text=Files -FileIngestFilterDefinitions.deleteSetButton.text=Delete Set -FileIngestFilterDefinitions.newRuleButton.text=New Rule -FileIngestFilterDefinitions.bothRadioButton.text=Files and Directories -FileIngestFilterDefinitions.setsListLabel.text=Rule Sets -FileIngestFilterDefinitions.jLabel6.text=Set Details -FileIngestFilterDefinitions.fileNameRegexCheckbox.text=Regex -FileIngestFilterDefinitions.ignoreKnownFilesCheckbox.text=Ignore Known Files -FileIngestFilterDefinitions.rulePathConditionTextField.text= -FileIngestFilterDefinitions.fileNameRadioButton.text=File Name -FileIngestFilterDefinitions.jLabel5.text=Description: -FileIngestFilterDefinitions.fileNameTextField.text= -FileIngestFilterDefinitions.jLabel8.text=File Size: -FileIngestFilterDefinitions.jLabel3.text=Name Pattern: -FileIngestFilterDefinitions.fileNameExtensionRadioButton.text=Extension Only -FileIngestFilterDefinitions.jLabel7.text=MIME Type: +FilesSetDefsPanel.newRuleButton.text=New Rule +FilesSetDefsPanel.jLabel6.text=Set Details +FilesSetDefsPanel.setsListLabel.text=Rule Sets +FilesSetDefsPanel.fileNameRegexCheckbox.text=Regex +FilesSetDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files +FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. +FilesSetDefsPanel.skipsUnallocCheckbox.text=Skip Unallocated Space +FilesSetDefsPanel.rulePathConditionTextField.text= +FilesSetDefsPanel.fileNameRadioButton.text=File Name +FilesSetDefsPanel.jLabel5.text=Description: +FilesSetDefsPanel.fileNameTextField.text= +FilesSetDefsPanel.jLabel8.text=File Size: +FilesSetDefsPanel.jLabel3.text=Name Pattern: +FilesSetDefsPanel.fileNameExtensionRadioButton.text=Extension Only +FilesSetDefsPanel.jLabel7.text=MIME Type: +FilesSetDefsPanel.interesting.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. +FilesSetDefsPanel.ingest.jTextArea1.text=Add rules so that only a subset of the files in a data source are analyzed. Rules are organized into sets and one set can be used at at time. +FilesSetDefsPanel.editSetButton.text=Edit Set +FilesSetDefsPanel.rulePathConditionRegexCheckBox.text=Regex +FilesSetDefsPanel.jLabel4.text=Path Pattern: +FilesSetDefsPanel.jLabel1.text=Rule Details +FilesSetDefsPanel.dirsRadioButton.text=Directories +FilesSetDefsPanel.jLabel2.text=File Type: +FilesSetDefsPanel.rulesListLabel.text=Rules: +FilesSetDefsPanel.newSetButton.text=New Set +FilesSetDefsPanel.editRuleButton.text=Edit Rule +FilesSetDefsPanel.deleteRuleButton.text=Delete Rule +FilesSetDefsPanel.filesRadioButton.text=Files +FilesSetDefsPanel.deleteSetButton.text=Delete Set +FilesSetDefsPanel.bothRadioButton.text=Files and Directories diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index b49ae2f305..310bf0aeef 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -26,73 +26,28 @@ OpenIDE-Module-Name=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u691c\u77e5 OpenIDE-Module-Short-Description=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u691c\u77e5\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30e2\u30b8\u30e5\u30fc\u30eb OptionsCategory_Name_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb OptionsCategory_Keywords_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u5b9a\u7fa9 -InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540d\u524d\u304c{0}\u306e\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306f\u65e2\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 +FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540d\u524d\u304c{0}\u306e\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306f\u65e2\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 FilesSetRulePanel.jLabel5.text=\u898b\u3064\u3051\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 - -InterestingItemDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 - -InterestingItemDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a - -InterestingItemDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 - -InterestingItemDefsPanel.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea - -InterestingItemDefsPanel.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a - -InterestingItemDefsPanel.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 - -InterestingItemDefsPanel.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 - -InterestingItemDefsPanel.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 - -InterestingItemDefsPanel.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea - -InterestingItemDefsPanel.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 - -InterestingItemDefsPanel.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe - -InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 - -InterestingItemDefsPanel.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d - -InterestingItemDefsPanel.jLabel5.text=\u6982\u8981\uff1a - -InterestingItemDefsPanel.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 - -InterestingItemDefsPanel.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f - -InterestingItemDefsPanel.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 - -InterestingItemDefsPanel.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a - -InterestingItemDefsPanel.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 - -InterestingItemDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb - -InterestingItemDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb - -InterestingItemDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 -InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe -FileIngestFilterDefinitions.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 -FileIngestFilterDefinitions.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe -FileIngestFilterDefinitions.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a -FileIngestFilterDefinitions.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 -FileIngestFilterDefinitions.dirsRadioButton.text=\u30c7\u30a3\u30ec\u30af\u30c8\u30ea -FileIngestFilterDefinitions.jLabel2.text=\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\uff1a -FileIngestFilterDefinitions.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a -FileIngestFilterDefinitions.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 -FileIngestFilterDefinitions.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 -FileIngestFilterDefinitions.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 -FileIngestFilterDefinitions.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb -FileIngestFilterDefinitions.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 -FileIngestFilterDefinitions.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb -FileIngestFilterDefinitions.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea -FileIngestFilterDefinitions.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 -FileIngestFilterDefinitions.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 -FileIngestFilterDefinitions.fileNameRegexCheckbox.text=\u6b63\u898f\u8868\u73fe -FileIngestFilterDefinitions.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 -FileIngestFilterDefinitions.fileNameRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u540d -FileIngestFilterDefinitions.jLabel5.text=\u6982\u8981\uff1a -FileIngestFilterDefinitions.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 -FileIngestFilterDefinitions.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f -FileIngestFilterDefinitions.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 +FilesSetDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb +FilesSetDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 +FilesSetDefsPanel.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 +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 +FilesSetDefsPanel.jLabel5.text=\u6982\u8981\uff1a +FilesSetDefsPanel.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 +FilesSetDefsPanel.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f +FilesSetDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 +FilesSetDefsPanel.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 +FilesSetDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe +FilesSetDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a +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.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a +FilesSetDefsPanel.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 +FilesSetDefsPanel.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 +FilesSetDefsPanel.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 +FilesSetDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb +FilesSetDefsPanel.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 +FilesSetDefsPanel.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index 2acf462938..c2ae276a17 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -22,11 +22,15 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; +import java.util.TreeMap; +import java.util.logging.Level; import javax.swing.JComponent; import javax.swing.SwingUtilities; import org.netbeans.spi.options.OptionsPanelController; +import org.openide.util.Exceptions; import org.openide.util.HelpCtx; import org.openide.util.Lookup; +import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.ingest.IngestJobSettings; @OptionsPanelController.TopLevelRegistration( @@ -38,15 +42,17 @@ import org.sleuthkit.autopsy.ingest.IngestJobSettings; ) /** - * Class for creating an InterestingItemDefsPanel which will be used for + * Class for creating an FilesSetDefsPanel which will be used for * configuring the FileIngestFilter. */ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPanelController { - private InterestingItemDefsPanel panel; + private FilesSetDefsPanel panel; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; public final static String NEW_INGEST_FILTER = ""; + private static final Logger LOGGER = Logger.getLogger(FileIngestFilterDefsOptionsPanelController.class.getName()); + /** * Component should load its data here. */ @@ -65,15 +71,15 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan */ public String[] getComboBoxContents() { ArrayList nameList = new ArrayList<>(); - for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { - nameList.add(fSet.getName()); - } - nameList.add(NEW_INGEST_FILTER); if (!(panel == null)) { - nameList.addAll(panel.getKeys()); - } + try { + nameList.addAll(FilesSetsManager.getInstance().getFileIngestFiltersWithDefaults().keySet()); + } catch (FilesSetsManager.FilesSetsManagerException ex) { + LOGGER.log(Level.SEVERE, "Failed to get File Ingest Filters for population of of combo box.", ex); //NON-NLS + } + } + nameList.add(NEW_INGEST_FILTER); String[] returnArray = {}; - nameList.toArray(returnArray); return nameList.toArray(returnArray); } @@ -145,12 +151,12 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan * Creates an interestingItemsDefPanel that will be labeled to indicate it * is for File Ingest Filter settings * - * @return an InterestingItemDefsPanel which has text and fields modified to - * indicate it is for File Ingest Filtering. + * @return an FilesSetDefsPanel which has text and fields modified to + indicate it is for File Ingest Filtering. */ - private InterestingItemDefsPanel getPanel() { + private FilesSetDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(FilesSetsManager.getFileIngestFilterDefsName(), ""); + panel = new FilesSetDefsPanel(FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index c97fdd5398..e8f8c88e43 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -83,7 +83,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS */ List filesSetRows = new ArrayList<>(); try { - this.filesSetSnapshot = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName())); + this.filesSetSnapshot = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets()); } catch (FilesSetsManager.FilesSetsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_getError()); this.filesSetSnapshot = new TreeMap<>(); @@ -138,7 +138,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS List rowModels = new ArrayList<>(); TreeMap newFilesSetSnapshot; try { - newFilesSetSnapshot = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName())); + newFilesSetSnapshot = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets()); } catch (FilesSetsManager.FilesSetsManagerException ex) { MessageNotifyUtil.Message.error(Bundle.FilesIdentifierIngestJobSettingsPanel_updateError()); return; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java index 6695a4a058..8a9a2b8469 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java @@ -83,7 +83,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule { // to disable the interesting files set definition UI during ingest. List filesSets = new ArrayList<>(); try { - for (FilesSet set : FilesSetsManager.getInstance().getInterestingFilesSets(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName()).values()) { + for (FilesSet set : FilesSetsManager.getInstance().getInterestingFilesSets().values()) { if (settings.interestingFilesSetIsEnabled(set.getName())) { filesSets.add(set); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form similarity index 92% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index ab87102386..e69a1c820c 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -286,7 +286,7 @@ - + @@ -301,7 +301,7 @@ - + @@ -320,7 +320,7 @@ - + @@ -336,7 +336,7 @@ - + @@ -352,7 +352,7 @@ - + @@ -434,7 +434,7 @@ - + @@ -482,7 +482,7 @@ - + @@ -495,7 +495,7 @@ - + @@ -508,7 +508,7 @@ - + @@ -523,7 +523,7 @@ - + @@ -538,7 +538,7 @@ - + @@ -552,7 +552,7 @@ - + @@ -564,7 +564,7 @@ - + @@ -580,7 +580,7 @@ - + @@ -598,7 +598,7 @@ - + @@ -613,7 +613,7 @@ - + @@ -629,7 +629,7 @@ - + @@ -648,7 +648,7 @@ - + @@ -667,7 +667,7 @@ - + @@ -682,7 +682,7 @@ - + @@ -697,7 +697,7 @@ - + @@ -713,7 +713,7 @@ - + @@ -725,7 +725,7 @@ - + @@ -737,7 +737,7 @@ - + @@ -771,7 +771,7 @@ - + @@ -781,7 +781,7 @@ - + @@ -806,7 +806,7 @@ - + @@ -845,10 +845,10 @@ - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java similarity index 83% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 2c7a3ad873..22937bd97b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -43,25 +43,27 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; /** * A panel that allows a user to make interesting item definitions. */ -final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { +final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { @NbBundle.Messages({ - "InterestingItemDefsPanel.bytes=Bytes", - "InterestingItemDefsPanel.kiloBytes=Kilobytes", - "InterestingItemDefsPanel.megaBytes=Megabytes", - "InterestingItemDefsPanel.gigaBytes=Gigabytes", - "InterestingItemsDefsPanel.loadError=Error loading interesting files sets from file.", - "InterestingItemsDefsPanel.saveError=Error saving interesting files sets to file.", - "FileIngestFilter.title=Ingest File Set" + "FilesSetDefsPanel.bytes=Bytes", + "FilesSetDefsPanel.kiloBytes=Kilobytes", + "FilesSetDefsPanel.megaBytes=Megabytes", + "FilesSetDefsPanel.gigaBytes=Gigabytes", + "FilesSetDefsPanel.loadError=Error loading interesting files sets from file.", + "FilesSetDefsPanel.saveError=Error saving interesting files sets to file." }) + static enum PANEL_TYPE { + FILE_INGEST_FILTERS, + INTERESTING_FILE_SETS + } private final DefaultListModel setsListModel = new DefaultListModel<>(); private final DefaultListModel rulesListModel = new DefaultListModel<>(); - private final Logger logger = Logger.getLogger(InterestingItemDefsPanel.class.getName()); + private final Logger logger = Logger.getLogger(FilesSetDefsPanel.class.getName()); private final JButton okButton = new JButton("OK"); private final JButton cancelButton = new JButton("Cancel"); - private final String settingsFileName; - private final String settingsLegacyFileName; + private final PANEL_TYPE panelType; private final String ruleDialogTitle; // The following is a map of interesting files set names to interesting @@ -76,45 +78,39 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp /** * Constructs an interesting item definitions panel. */ - InterestingItemDefsPanel(String settingsName, String legacySettingsName) { + FilesSetDefsPanel(PANEL_TYPE panelType) { + this.panelType = panelType; this.initComponents(); - this.settingsLegacyFileName = legacySettingsName; this.customInit(); this.setsList.setModel(setsListModel); - this.setsList.addListSelectionListener(new InterestingItemDefsPanel.SetsListSelectionListener()); + this.setsList.addListSelectionListener(new FilesSetDefsPanel.SetsListSelectionListener()); this.rulesList.setModel(rulesListModel); - this.rulesList.addListSelectionListener(new InterestingItemDefsPanel.RulesListSelectionListener()); - this.settingsFileName = settingsName; + this.rulesList.addListSelectionListener(new FilesSetDefsPanel.RulesListSelectionListener()); - if (legacySettingsName.equals("")) { //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules + if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { //Hide the mimetype settings when this is displaying FileSet rules instead of interesting item rules this.mimeTypeComboBox.setVisible(false); this.jLabel7.setVisible(false); - this.ruleDialogTitle = "FileIngestFilter.title"; + this.fileSizeUnitComboBox.setVisible(false); + this.fileSizeSpinner.setVisible(false); + this.ruleDialogTitle = "FilesSetPanel.ingest.title"; + this.jLabel8.setVisible(false); + this.equalitySignComboBox.setVisible(false); + this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.jTextArea1.text")); // NOI18N } else { - this.ruleDialogTitle = "FilesSetPanel.title"; + this.ruleDialogTitle = "FilesSetPanel.interesting.title"; + this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N } } - - FilesSet getFilesSetByKey(String name) { - load(); - return filesSets.get(name); - } - - Set getKeys() { - load(); - return filesSets.keySet(); - } - @NbBundle.Messages({"InterestingItemDefsPanel.Title=Global Interesting Items Settings", - "IngestFilterItemDefsPanel.Title=Global Ingest Filter Settings"}) + @NbBundle.Messages({"FilesSetDefsPanel.Interesting.Title=Global Interesting Items Settings", + "FilesSetDefsPanel.Ingest.Title=Global Ingest Filter Settings"}) private void customInit() { - if (settingsLegacyFileName.equals("")) { - setName(Bundle.IngestFilterItemDefsPanel_Title()); + if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { + setName(Bundle.FilesSetDefsPanel_Ingest_Title()); } else { - setName(Bundle.InterestingItemDefsPanel_Title()); + setName(Bundle.FilesSetDefsPanel_Interesting_Title()); } - setName(Bundle.InterestingItemDefsPanel_Title()); Set fileTypesCollated = new HashSet<>(); for (String mediaType : FileTypeDetector.getStandardDetectedTypes()) { @@ -153,9 +149,14 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp @Override public void saveSettings() { try { - FilesSetsManager.getInstance().setInterestingFilesSets(this.filesSets, settingsFileName); + if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { + FilesSetsManager.getInstance().setFileIngestFilter(this.filesSets); + } else { + FilesSetsManager.getInstance().setInterestingFilesSets(this.filesSets); + } + } catch (FilesSetsManager.FilesSetsManagerException ex) { - MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_saveError()); + MessageNotifyUtil.Message.error(Bundle.FilesSetDefsPanel_saveError()); } } @@ -177,9 +178,14 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp try { // Get a working copy of the interesting files set definitions and sort // by set name. - this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets(settingsFileName, settingsLegacyFileName)); + if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { + this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getFileIngestFilters()); + } else { + this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets()); + } + } catch (FilesSetsManager.FilesSetsManagerException ex) { - MessageNotifyUtil.Message.error(Bundle.InterestingItemsDefsPanel_loadError()); + MessageNotifyUtil.Message.error(Bundle.FilesSetDefsPanel_loadError()); this.filesSets = new TreeMap<>(); } @@ -193,7 +199,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Select the first files set by default. The list selections // listeners will then populate the other components. EventQueue.invokeLater(() -> { - InterestingItemDefsPanel.this.setsList.setSelectedIndex(0); + FilesSetDefsPanel.this.setsList.setSelectedIndex(0); }); } } @@ -243,32 +249,32 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp return; } - InterestingItemDefsPanel.this.rulesListModel.clear(); - InterestingItemDefsPanel.this.resetRuleComponents(); + FilesSetDefsPanel.this.rulesListModel.clear(); + FilesSetDefsPanel.this.resetRuleComponents(); // Get the selected interesting files set and populate the set // components. - FilesSet selectedSet = InterestingItemDefsPanel.this.setsList.getSelectedValue(); + FilesSet selectedSet = FilesSetDefsPanel.this.setsList.getSelectedValue(); if (selectedSet != null) { // Populate the components that display the properties of the // selected files set. - InterestingItemDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription()); - InterestingItemDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles()); - InterestingItemDefsPanel.this.skipsUnallocCheckbox.setSelected(selectedSet.getSkipUnallocatedSpace()); + FilesSetDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription()); + FilesSetDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles()); + FilesSetDefsPanel.this.skipsUnallocCheckbox.setSelected(selectedSet.getSkipUnallocatedSpace()); // Enable the new, edit and delete set buttons. - InterestingItemDefsPanel.this.newSetButton.setEnabled(true); - InterestingItemDefsPanel.this.editSetButton.setEnabled(true); - InterestingItemDefsPanel.this.deleteSetButton.setEnabled(true); + FilesSetDefsPanel.this.newSetButton.setEnabled(true); + FilesSetDefsPanel.this.editSetButton.setEnabled(true); + FilesSetDefsPanel.this.deleteSetButton.setEnabled(true); // Populate the rule definitions list, sorted by name. TreeMap rules = new TreeMap<>(selectedSet.getRules()); for (FilesSet.Rule rule : rules.values()) { - InterestingItemDefsPanel.this.rulesListModel.addElement(rule); + FilesSetDefsPanel.this.rulesListModel.addElement(rule); } // Select the first rule by default. - if (!InterestingItemDefsPanel.this.rulesListModel.isEmpty()) { - InterestingItemDefsPanel.this.rulesList.setSelectedIndex(0); + if (!FilesSetDefsPanel.this.rulesListModel.isEmpty()) { + FilesSetDefsPanel.this.rulesList.setSelectedIndex(0); } } } @@ -288,7 +294,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp } // Get the selected rule and populate the rule components. - FilesSet.Rule rule = InterestingItemDefsPanel.this.rulesList.getSelectedValue(); + FilesSet.Rule rule = FilesSetDefsPanel.this.rulesList.getSelectedValue(); if (rule != null) { // Get the conditions that make up the rule. FilesSet.Rule.FileNameCondition nameCondition = rule.getFileNameCondition(); @@ -300,55 +306,55 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Populate the components that display the properties of the // selected rule. if (nameCondition != null) { - InterestingItemDefsPanel.this.fileNameTextField.setText(nameCondition.getTextToMatch()); - InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition); - InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition); - InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex()); + FilesSetDefsPanel.this.fileNameTextField.setText(nameCondition.getTextToMatch()); + FilesSetDefsPanel.this.fileNameRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.FullNameCondition); + FilesSetDefsPanel.this.fileNameExtensionRadioButton.setSelected(nameCondition instanceof FilesSet.Rule.ExtensionCondition); + FilesSetDefsPanel.this.fileNameRegexCheckbox.setSelected(nameCondition.isRegex()); } else { - InterestingItemDefsPanel.this.fileNameTextField.setText(""); - InterestingItemDefsPanel.this.fileNameRadioButton.setSelected(true); - InterestingItemDefsPanel.this.fileNameExtensionRadioButton.setSelected(false); - InterestingItemDefsPanel.this.fileNameRegexCheckbox.setSelected(false); + FilesSetDefsPanel.this.fileNameTextField.setText(""); + FilesSetDefsPanel.this.fileNameRadioButton.setSelected(true); + FilesSetDefsPanel.this.fileNameExtensionRadioButton.setSelected(false); + FilesSetDefsPanel.this.fileNameRegexCheckbox.setSelected(false); } switch (typeCondition.getMetaType()) { case FILES: - InterestingItemDefsPanel.this.filesRadioButton.setSelected(true); + FilesSetDefsPanel.this.filesRadioButton.setSelected(true); break; case DIRECTORIES: - InterestingItemDefsPanel.this.dirsRadioButton.setSelected(true); + FilesSetDefsPanel.this.dirsRadioButton.setSelected(true); break; case FILES_AND_DIRECTORIES: - InterestingItemDefsPanel.this.bothRadioButton.setSelected(true); + FilesSetDefsPanel.this.bothRadioButton.setSelected(true); break; } if (pathCondition != null) { - InterestingItemDefsPanel.this.rulePathConditionTextField.setText(pathCondition.getTextToMatch()); - InterestingItemDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(pathCondition.isRegex()); + FilesSetDefsPanel.this.rulePathConditionTextField.setText(pathCondition.getTextToMatch()); + FilesSetDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(pathCondition.isRegex()); } else { - InterestingItemDefsPanel.this.rulePathConditionTextField.setText(""); - InterestingItemDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(false); + FilesSetDefsPanel.this.rulePathConditionTextField.setText(""); + FilesSetDefsPanel.this.rulePathConditionRegexCheckBox.setSelected(false); } if (mimeTypeCondition != null) { - InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType()); + FilesSetDefsPanel.this.mimeTypeComboBox.setSelectedItem(mimeTypeCondition.getMimeType()); } else { - InterestingItemDefsPanel.this.mimeTypeComboBox.setSelectedIndex(0); + FilesSetDefsPanel.this.mimeTypeComboBox.setSelectedIndex(0); } if (fileSizeCondition != null) { - InterestingItemDefsPanel.this.fileSizeUnitComboBox.setSelectedItem(fileSizeCondition.getUnit().getName()); - InterestingItemDefsPanel.this.equalitySignComboBox.setSelectedItem(fileSizeCondition.getComparator().getSymbol()); - InterestingItemDefsPanel.this.fileSizeSpinner.setValue(fileSizeCondition.getSizeValue()); + FilesSetDefsPanel.this.fileSizeUnitComboBox.setSelectedItem(fileSizeCondition.getUnit().getName()); + FilesSetDefsPanel.this.equalitySignComboBox.setSelectedItem(fileSizeCondition.getComparator().getSymbol()); + FilesSetDefsPanel.this.fileSizeSpinner.setValue(fileSizeCondition.getSizeValue()); } else { - InterestingItemDefsPanel.this.fileSizeUnitComboBox.setSelectedIndex(1); - InterestingItemDefsPanel.this.equalitySignComboBox.setSelectedIndex(2); - InterestingItemDefsPanel.this.fileSizeSpinner.setValue(0); + FilesSetDefsPanel.this.fileSizeUnitComboBox.setSelectedIndex(1); + FilesSetDefsPanel.this.equalitySignComboBox.setSelectedIndex(2); + FilesSetDefsPanel.this.fileSizeSpinner.setValue(0); } // Enable the new, edit and delete rule buttons. - InterestingItemDefsPanel.this.newRuleButton.setEnabled(true); - InterestingItemDefsPanel.this.editRuleButton.setEnabled(true); - InterestingItemDefsPanel.this.deleteRuleButton.setEnabled(true); + FilesSetDefsPanel.this.newRuleButton.setEnabled(true); + FilesSetDefsPanel.this.editRuleButton.setEnabled(true); + FilesSetDefsPanel.this.deleteRuleButton.setEnabled(true); } else { - InterestingItemDefsPanel.this.resetRuleComponents(); + FilesSetDefsPanel.this.resetRuleComponents(); } } @@ -384,7 +390,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // In case of editing an existing ruleset(selectedSet != null), following check is not performed. if (this.filesSets.containsKey(panel.getFilesSetName()) && selectedSet == null) { MessageNotifyUtil.Message.error(NbBundle.getMessage(this.getClass(), - "InterestingItemDefsPanel.doFileSetsDialog.duplicateRuleSet.text", + "FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text", panel.getFilesSetName())); return; } @@ -416,7 +422,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp panel = new FilesSetRulePanel(selectedRule, okButton, cancelButton); } else { // Creating a new rule definition. - panel = new FilesSetRulePanel(okButton, cancelButton, (settingsLegacyFileName.equals(""))); + panel = new FilesSetRulePanel(okButton, cancelButton, panelType); } // Do a dialog box with the files set panel until the user either enters // a valid definition or cancels. Note that the panel gives the user @@ -482,7 +488,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp // Redo the list model for the files set list component, which will make // everything stays sorted as in the working copy tree set. - InterestingItemDefsPanel.this.setsListModel.clear(); + FilesSetDefsPanel.this.setsListModel.clear(); for (FilesSet set : this.filesSets.values()) { this.setsListModel.addElement(set); } @@ -554,11 +560,11 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp jPanel1.setFont(jPanel1.getFont().deriveFont(jPanel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); jLabel6.setFont(jLabel6.getFont().deriveFont(jLabel6.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel6.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel6.text")); // NOI18N newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.newRuleButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(newRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.newRuleButton.text")); // NOI18N newRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newRuleButtonActionPerformed(evt); @@ -568,12 +574,12 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp typeButtonGroup.add(filesRadioButton); filesRadioButton.setFont(filesRadioButton.getFont().deriveFont(filesRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); filesRadioButton.setSelected(true); - org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.filesRadioButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(filesRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.filesRadioButton.text")); // NOI18N filesRadioButton.setEnabled(false); editRuleButton.setFont(editRuleButton.getFont().deriveFont(editRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); editRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(editRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.editRuleButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(editRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.editRuleButton.text")); // NOI18N editRuleButton.setEnabled(false); editRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -582,7 +588,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp }); rulesListLabel.setFont(rulesListLabel.getFont().deriveFont(rulesListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(rulesListLabel, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulesListLabel.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(rulesListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulesListLabel.text")); // NOI18N rulesListScrollPane.setFont(rulesListScrollPane.getFont().deriveFont(rulesListScrollPane.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); @@ -604,7 +610,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp editSetButton.setFont(editSetButton.getFont().deriveFont(editSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); editSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.editSetButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.editSetButton.text")); // NOI18N editSetButton.setEnabled(false); editSetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -620,15 +626,15 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp fileNameButtonGroup.add(fileNameExtensionRadioButton); fileNameExtensionRadioButton.setFont(fileNameExtensionRadioButton.getFont().deriveFont(fileNameExtensionRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(fileNameExtensionRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameExtensionRadioButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(fileNameExtensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameExtensionRadioButton.text")); // NOI18N fileNameExtensionRadioButton.setEnabled(false); jLabel3.setFont(jLabel3.getFont().deriveFont(jLabel3.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel3.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel3, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel3.text")); // NOI18N fileNameTextField.setEditable(false); fileNameTextField.setFont(fileNameTextField.getFont().deriveFont(fileNameTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - fileNameTextField.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameTextField.text")); // NOI18N + fileNameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameTextField.text")); // NOI18N fileNameTextField.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fileNameTextFieldActionPerformed(evt); @@ -636,19 +642,19 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp }); jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel5.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel5.text")); // NOI18N fileNameButtonGroup.add(fileNameRadioButton); fileNameRadioButton.setFont(fileNameRadioButton.getFont().deriveFont(fileNameRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(fileNameRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameRadioButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(fileNameRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRadioButton.text")); // NOI18N fileNameRadioButton.setEnabled(false); rulePathConditionTextField.setEditable(false); rulePathConditionTextField.setFont(rulePathConditionTextField.getFont().deriveFont(rulePathConditionTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - rulePathConditionTextField.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulePathConditionTextField.text")); // NOI18N + rulePathConditionTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulePathConditionTextField.text")); // NOI18N ignoreKnownFilesCheckbox.setFont(ignoreKnownFilesCheckbox.getFont().deriveFont(ignoreKnownFilesCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.ignoreKnownFilesCheckbox.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ignoreKnownFilesCheckbox.text")); // NOI18N ignoreKnownFilesCheckbox.setEnabled(false); ignoreKnownFilesCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -657,22 +663,22 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp }); fileNameRegexCheckbox.setFont(fileNameRegexCheckbox.getFont().deriveFont(fileNameRegexCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.fileNameRegexCheckbox.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRegexCheckbox.text")); // NOI18N fileNameRegexCheckbox.setEnabled(false); separator.setOrientation(javax.swing.SwingConstants.VERTICAL); setsListLabel.setFont(setsListLabel.getFont().deriveFont(setsListLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.setsListLabel.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.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(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.bothRadioButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(bothRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.bothRadioButton.text")); // NOI18N bothRadioButton.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 - org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.deleteSetButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.deleteSetButton.text")); // NOI18N deleteSetButton.setEnabled(false); deleteSetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -682,7 +688,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp deleteRuleButton.setFont(deleteRuleButton.getFont().deriveFont(deleteRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); deleteRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(deleteRuleButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.deleteRuleButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(deleteRuleButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.deleteRuleButton.text")); // NOI18N deleteRuleButton.setEnabled(false); deleteRuleButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -692,7 +698,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp newSetButton.setFont(newSetButton.getFont().deriveFont(newSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); newSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.newSetButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.newSetButton.text")); // NOI18N newSetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newSetButtonActionPerformed(evt); @@ -700,11 +706,11 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp }); jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel2.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel2.text")); // NOI18N typeButtonGroup.add(dirsRadioButton); dirsRadioButton.setFont(dirsRadioButton.getFont().deriveFont(dirsRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.dirsRadioButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.dirsRadioButton.text")); // NOI18N dirsRadioButton.setEnabled(false); dirsRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -713,13 +719,13 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp }); jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel1.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel1.text")); // NOI18N jLabel4.setFont(jLabel4.getFont().deriveFont(jLabel4.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel4.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel4.text")); // NOI18N rulePathConditionRegexCheckBox.setFont(rulePathConditionRegexCheckBox.getFont().deriveFont(rulePathConditionRegexCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(rulePathConditionRegexCheckBox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.rulePathConditionRegexCheckBox.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(rulePathConditionRegexCheckBox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.rulePathConditionRegexCheckBox.text")); // NOI18N rulePathConditionRegexCheckBox.setEnabled(false); jScrollPane2.setFont(jScrollPane2.getFont().deriveFont(jScrollPane2.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); @@ -730,11 +736,10 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp jTextArea1.setFont(jTextArea1.getFont().deriveFont(jTextArea1.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); jTextArea1.setLineWrap(true); jTextArea1.setRows(3); - jTextArea1.setText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jTextArea1.text")); // NOI18N jTextArea1.setWrapStyleWord(true); jScrollPane2.setViewportView(jTextArea1); - org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel7.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel7.text")); // NOI18N mimeTypeComboBox.setEditable(true); mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); @@ -742,7 +747,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp mimeTypeComboBox.setMinimumSize(new java.awt.Dimension(0, 20)); mimeTypeComboBox.setPreferredSize(new java.awt.Dimension(12, 20)); - org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.jLabel8.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel8, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel8.text")); // NOI18N equalitySignComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { "=", ">", "≥", "<", "≤" })); equalitySignComboBox.setEnabled(false); @@ -750,11 +755,11 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp fileSizeSpinner.setEnabled(false); fileSizeSpinner.setMinimumSize(new java.awt.Dimension(2, 20)); - fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.InterestingItemDefsPanel_bytes(), Bundle.InterestingItemDefsPanel_kiloBytes(), Bundle.InterestingItemDefsPanel_megaBytes(), Bundle.InterestingItemDefsPanel_gigaBytes() })); + fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetDefsPanel_bytes(), Bundle.FilesSetDefsPanel_kiloBytes(), Bundle.FilesSetDefsPanel_megaBytes(), Bundle.FilesSetDefsPanel_gigaBytes() })); fileSizeUnitComboBox.setEnabled(false); - org.openide.awt.Mnemonics.setLocalizedText(skipsUnallocCheckbox, org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.skipsUnallocCheckbox.text")); // NOI18N - skipsUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(InterestingItemDefsPanel.class, "InterestingItemDefsPanel.skipsUnallocCheckbox.toolTipText")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(skipsUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.skipsUnallocCheckbox.text")); // NOI18N + skipsUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText")); // NOI18N skipsUnallocCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { skipsUnallocCheckboxActionPerformed(evt); @@ -967,7 +972,7 @@ final class InterestingItemDefsPanel extends IngestModuleGlobalSettingsPanel imp Map rules = new HashMap<>(oldSet.getRules()); FilesSet.Rule selectedRule = this.rulesList.getSelectedValue(); rules.remove(selectedRule.getUuid()); - this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), oldSet.getSkipUnallocatedSpace(), rules); + this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), oldSet.getSkipUnallocatedSpace(), rules); if (!this.rulesListModel.isEmpty()) { this.rulesList.setSelectedIndex(0); } else { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form index 2d5499d016..79f9f93cf1 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form @@ -20,18 +20,16 @@ - - - - - - - - - - - - + + + + + + + + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index b275e621c3..7bd1596837 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -28,6 +28,8 @@ import org.openide.util.NbBundle; */ public class FilesSetPanel extends javax.swing.JPanel { + + @NbBundle.Messages("FilesSetPanel.ingest.title=Ingest File Set") /** * Construct a files set panel in create mode. */ diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 6166368202..77740f90ec 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -36,6 +36,7 @@ import org.openide.util.NbBundle; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.coreutils.Logger; 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 interesting files set @@ -65,11 +66,15 @@ final class FilesSetRulePanel extends javax.swing.JPanel { /** * Constructs a files set rule panel in create rule mode. */ - FilesSetRulePanel(JButton okButton, JButton cancelButton, boolean isFileFilterPanel) { + FilesSetRulePanel(JButton okButton, JButton cancelButton, PANEL_TYPE panelType) { initComponents(); - if (isFileFilterPanel==true){ //Hide the mimetype settings when this is displaying a FileSet rule instead of a interesting item rule + if (panelType == FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS){ //Hide the mimetype settings when this is displaying a FileSet rule instead of a interesting item rule mimeTypeComboBox.setVisible(false); mimeCheck.setVisible(false); + fileSizeComboBox.setVisible(false); + fileSizeCheck.setVisible(false); + equalitySymbolComboBox.setVisible(false); + fileSizeSpinner.setVisible(false); } else { populateMimeTypesComboBox(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index da03a29512..add47187b3 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -44,10 +44,10 @@ import org.w3c.dom.Element; import org.w3c.dom.NodeList; /** - * Provides access to collections of FilesSet definitions persisted to disk. Clients - * receive copies of the most recent FilesSet definitions for Interesting Items or - * File Ingest Filters via synchronized methods, allowing the definitions to be - * safely published to multiple threads. + * Provides access to collections of FilesSet definitions persisted to disk. + * Clients receive copies of the most recent FilesSet definitions for + * Interesting Items or File Ingest Filters via synchronized methods, allowing + * the definitions to be safely published to multiple threads. */ public final class FilesSetsManager extends Observable { @@ -56,12 +56,13 @@ public final class FilesSetsManager extends Observable { private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS private static final String INTERESTING_FILES_SET_DEFS_NAME = "InterestingFileSets.settings"; private static final String FILE_INGEST_FILTER_DEFS_NAME = "FileIngestFilterDefs.settings"; + private static final Object FILE_INGEST_FILTER_LOCK = new Object(); + private static final Object INTERESTING_FILES_SET_LOCK = new Object(); private static FilesSetsManager instance; /** * Gets the interesting item definitions manager singleton. */ - public synchronized static FilesSetsManager getInstance() { if (instance == null) { instance = new FilesSetsManager(); @@ -115,32 +116,39 @@ public final class FilesSetsManager extends Observable { * @return A map of interesting files set names to interesting file sets, * possibly empty. */ - synchronized Map getInterestingFilesSets(String fileName, String legacyFileName) throws FilesSetsManagerException { - return FilesSetXML.readDefinitionsFile(fileName, legacyFileName); + Map getInterestingFilesSets() throws FilesSetsManagerException { + synchronized (INTERESTING_FILES_SET_LOCK) { + return FilesSetXML.readDefinitionsFile(INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME); + } } + /** + * Gets a copy of the current ingest file set definitions with the default values. + * + * @return A map of FilesSet names to file ingest sets, possibly empty. + */ + public Map getFileIngestFiltersWithDefaults() throws FilesSetsManagerException { + synchronized (FILE_INGEST_FILTER_LOCK) { + Map returnMap = new HashMap<>(); + returnMap.putAll(getFileIngestFilters()); + for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { + returnMap.put(fSet.getName(), fSet); + } + return returnMap; + } + } /** * Gets a copy of the current ingest file set definitions. + * + * The defaults are not included so that they will not show up in the editor. * - * @return A map of FilesSet names to file ingest sets, - * possibly empty. + * @return A map of FilesSet names to file ingest sets, possibly empty. */ - public synchronized Map getFileIngestFilters() { - Map returnMap = new HashMap<>(); - try { - returnMap.putAll(FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), "")); - } catch (FilesSetsManagerException ex) { - Exceptions.printStackTrace(ex); //WJS-TODO change manager to not use file names, if this function is still needed fix error handling to be done properly. - - } - for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()){ - returnMap.put(fSet.getName(), fSet); - } - return returnMap; + Map getFileIngestFilters() throws FilesSetsManagerException { + return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), ""); } - - + /** * Sets the current interesting file sets definitions, replacing any * previous definitions. @@ -148,10 +156,25 @@ public final class FilesSetsManager extends Observable { * @param filesSets A mapping of interesting files set names to files sets, * used to enforce unique files set names. */ - synchronized void setInterestingFilesSets(Map filesSets, String fileName) throws FilesSetsManagerException { - FilesSetXML.writeDefinitionsFile(fileName, filesSets); - this.setChanged(); - this.notifyObservers(); + void setInterestingFilesSets(Map filesSets) throws FilesSetsManagerException { + synchronized (INTERESTING_FILES_SET_LOCK) { + FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_NAME, filesSets); + this.setChanged(); + this.notifyObservers(); + } + } + + /** + * Sets the current interesting file sets definitions, replacing any + * previous definitions. + * + * @param filesSets A mapping of interesting files set names to files sets, + * used to enforce unique files set names. + */ + void setFileIngestFilter(Map filesSets) throws FilesSetsManagerException { + synchronized (FILE_INGEST_FILTER_LOCK) { + FilesSetXML.writeDefinitionsFile(FILE_INGEST_FILTER_DEFS_NAME, filesSets); + } } /** diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java index 0704466552..609fc937ac 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemDefsOptionsPanelController.java @@ -36,7 +36,7 @@ import org.openide.util.Lookup; ) public final class InterestingItemDefsOptionsPanelController extends OptionsPanelController { - private InterestingItemDefsPanel panel; + private FilesSetDefsPanel panel; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; @@ -113,9 +113,9 @@ public final class InterestingItemDefsOptionsPanelController extends OptionsPane pcs.removePropertyChangeListener(l); } - private InterestingItemDefsPanel getPanel() { + private FilesSetDefsPanel getPanel() { if (panel == null) { - panel = new InterestingItemDefsPanel(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName()); + panel = new FilesSetDefsPanel(FilesSetDefsPanel.PANEL_TYPE.INTERESTING_FILE_SETS); panel.addPropertyChangeListener(new PropertyChangeListener() { @Override public void propertyChange(PropertyChangeEvent evt) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java index 9a96459e73..04034e5016 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsIngestModuleFactory.java @@ -69,7 +69,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto @Override public IngestModuleGlobalSettingsPanel getGlobalSettingsPanel() { - InterestingItemDefsPanel panel = new InterestingItemDefsPanel(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName()); + FilesSetDefsPanel panel = new FilesSetDefsPanel(FilesSetDefsPanel.PANEL_TYPE.INTERESTING_FILE_SETS); panel.load(); return panel; } @@ -83,7 +83,7 @@ final public class InterestingItemsIngestModuleFactory extends IngestModuleFacto // Doing so also keeps the serialization simple. List enabledFilesSetNames = new ArrayList<>(); try { - for (String name : FilesSetsManager.getInstance().getInterestingFilesSets(FilesSetsManager.getInterestingFilesSetDefsName(), FilesSetsManager.getLegacyFilesSetDefsFileName()).keySet()) { + for (String name : FilesSetsManager.getInstance().getInterestingFilesSets().keySet()) { enabledFilesSetNames.add(name); } } catch (FilesSetsManager.FilesSetsManagerException ex) { From c568e08858cd456e69f876766ae05baf05593a6d Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 5 Jan 2017 14:05:21 -0500 Subject: [PATCH 19/50] 1903 fixed title of File Ingest FilesSetPanel --- .../autopsy/modules/interestingitems/FilesSetPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 7bd1596837..6b503d71ec 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -29,7 +29,7 @@ import org.openide.util.NbBundle; public class FilesSetPanel extends javax.swing.JPanel { - @NbBundle.Messages("FilesSetPanel.ingest.title=Ingest File Set") + @NbBundle.Messages("FilesSetPanel.ingest.title=File Ingest Filter") /** * Construct a files set panel in create mode. */ From ed529ac6c777def00cdf00b7e3fc7df1434c9b7f Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 5 Jan 2017 16:14:20 -0500 Subject: [PATCH 20/50] 1903 Fixed bugs with comboBox ordering and filter creation through combobox --- ...ngestFilterDefsOptionsPanelController.java | 21 +++++++++--------- .../interestingitems/FilesSetDefsPanel.java | 8 +++++-- .../interestingitems/FilesSetPanel.java | 3 ++- .../interestingitems/FilesSetsManager.java | 22 ++++++++++--------- 4 files changed, 31 insertions(+), 23 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index c2ae276a17..998c734418 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -65,22 +65,23 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan /** * Returns an array which will contain the names of all options which should * exist in the "Run Ingest Modules On:" JCombobox + * + * Keeping the default File Ingest Filters and the saved one seperate allows + * the default to always be first elements in * * @return -filterNames an array of all established filter names as well as * a Create New option */ public String[] getComboBoxContents() { - ArrayList nameList = new ArrayList<>(); - if (!(panel == null)) { - try { - nameList.addAll(FilesSetsManager.getInstance().getFileIngestFiltersWithDefaults().keySet()); - } catch (FilesSetsManager.FilesSetsManagerException ex) { - LOGGER.log(Level.SEVERE, "Failed to get File Ingest Filters for population of of combo box.", ex); //NON-NLS - } - } + ArrayList nameList = new ArrayList<>(); + for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { + nameList.add(fSet.getName()); + } nameList.add(NEW_INGEST_FILTER); - String[] returnArray = {}; - return nameList.toArray(returnArray); + if (!(panel == null)) { + nameList.addAll(panel.getKeys()); + } + return nameList.toArray(new String[nameList.size()]); } /** diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 22937bd97b..d81d69f46a 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -100,11 +100,15 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements this.ruleDialogTitle = "FilesSetPanel.interesting.title"; this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N } - } + Set getKeys() { + load(); + return filesSets.keySet(); + } + @NbBundle.Messages({"FilesSetDefsPanel.Interesting.Title=Global Interesting Items Settings", - "FilesSetDefsPanel.Ingest.Title=Global Ingest Filter Settings"}) + "FilesSetDefsPanel.Ingest.Title=File Ingest Filter Settings"}) private void customInit() { if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { setName(Bundle.FilesSetDefsPanel_Ingest_Title()); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 6b503d71ec..06294fd860 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -74,7 +74,8 @@ public class FilesSetPanel extends javax.swing.JPanel { * @return A name string. */ String getFilesSetName() { - return this.nameTextField.getText(); + String returnValue = this.nameTextField.getText(); + return returnValue; } /** diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index add47187b3..b257e692e1 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -123,32 +123,34 @@ public final class FilesSetsManager extends Observable { } /** - * Gets a copy of the current ingest file set definitions with the default values. + * Gets a copy of the current ingest file set definitions with the default + * values. * * @return A map of FilesSet names to file ingest sets, possibly empty. */ public Map getFileIngestFiltersWithDefaults() throws FilesSetsManagerException { - synchronized (FILE_INGEST_FILTER_LOCK) { - Map returnMap = new HashMap<>(); - returnMap.putAll(getFileIngestFilters()); + Map returnMap = new HashMap<>(); for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { returnMap.put(fSet.getName(), fSet); } + returnMap.putAll(getFileIngestFilters()); return returnMap; - } } - + /** * Gets a copy of the current ingest file set definitions. - * - * The defaults are not included so that they will not show up in the editor. + * + * The defaults are not included so that they will not show up in the + * editor. * * @return A map of FilesSet names to file ingest sets, possibly empty. */ Map getFileIngestFilters() throws FilesSetsManagerException { - return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), ""); + synchronized (FILE_INGEST_FILTER_LOCK) { + return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), ""); + } } - + /** * Sets the current interesting file sets definitions, replacing any * previous definitions. From 416ff5d62e20d9fdff3e4829bc94942c9797d820 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 6 Jan 2017 13:18:08 -0500 Subject: [PATCH 21/50] 1903 Fixed most of UI elements on FilesSetDefsPanel --- .../autopsy/ingest/IngestJobSettings.java | 2 +- .../interestingitems/Bundle.properties | 47 ++-- .../interestingitems/Bundle_ja.properties | 25 +- .../interestingitems/FilesSetDefsPanel.form | 216 ++++++++++-------- .../interestingitems/FilesSetDefsPanel.java | 200 ++++++++-------- 5 files changed, 263 insertions(+), 227 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 265f6b1e34..7817bb37d7 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -58,7 +58,7 @@ public class IngestJobSettings { private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS private static final Logger LOGGER = Logger.getLogger(IngestJobSettings.class.getName()); - private static FilesSet ALL_FILES_INGEST_FILTER = new FilesSet("All Files", "All Files", false, true, Collections.emptyMap()); //NON-NLS + private static FilesSet ALL_FILES_INGEST_FILTER = new FilesSet("All Files", "All Files", false, true, Collections.emptyMap()); //NON-NLS //WJS-TODO Figure out how to keep these names from being duplicated private static FilesSet ALL_AND_UNALLOC_FILES_INGEST_FILTER = new FilesSet("All Files and Unallocated Space", "All Files and Unallocated Space", false, false, Collections.emptyMap()); //NON-NLS private FilesSet fileIngestFilter; private final String executionContext; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 01660cc2fb..78eaaf630c 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -42,33 +42,38 @@ FilesSetRulePanel.fileSizeCheck.text=File Size: FilesSetRulePanel.filesRadioButton.text=Files FilesSetRulePanel.dirsRadioButton.text=Directories FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories -FilesSetDefsPanel.newRuleButton.text=New Rule -FilesSetDefsPanel.jLabel6.text=Set Details -FilesSetDefsPanel.setsListLabel.text=Rule Sets -FilesSetDefsPanel.fileNameRegexCheckbox.text=Regex -FilesSetDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files -FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. -FilesSetDefsPanel.skipsUnallocCheckbox.text=Skip Unallocated Space -FilesSetDefsPanel.rulePathConditionTextField.text= -FilesSetDefsPanel.fileNameRadioButton.text=File Name -FilesSetDefsPanel.jLabel5.text=Description: -FilesSetDefsPanel.fileNameTextField.text= -FilesSetDefsPanel.jLabel8.text=File Size: -FilesSetDefsPanel.jLabel3.text=Name Pattern: -FilesSetDefsPanel.fileNameExtensionRadioButton.text=Extension Only -FilesSetDefsPanel.jLabel7.text=MIME Type: +FilesSetDefsPanel.interesting.setsListLabel.text=Rule Sets +FilesSetDefsPanel.ingest.setsListLabel.text=File Ingest Filters FilesSetDefsPanel.interesting.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. FilesSetDefsPanel.ingest.jTextArea1.text=Add rules so that only a subset of the files in a data source are analyzed. Rules are organized into sets and one set can be used at at time. -FilesSetDefsPanel.editSetButton.text=Edit Set +FilesSetDefsPanel.interesting.editSetButton.text=Edit Set +FilesSetDefsPanel.ingest.editSetButton.text=Edit Filter +FilesSetDefsPanel.interesting.newSetButton.text=New Set +FilesSetDefsPanel.ingest.newSetButton.text=New Filter +FilesSetDefsPanel.interesting.deleteSetButton.text=Delete Set +FilesSetDefsPanel.ingest.deleteSetButton.text=Delete Filter +FilesSetDefsPanel.jLabel6.text=Set Details +FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. +FilesSetDefsPanel.skipsUnallocCheckbox.text=Skip Unallocated Space +FilesSetDefsPanel.jLabel8.text=File Size: +FilesSetDefsPanel.jLabel7.text=MIME Type: FilesSetDefsPanel.rulePathConditionRegexCheckBox.text=Regex FilesSetDefsPanel.jLabel4.text=Path Pattern: FilesSetDefsPanel.jLabel1.text=Rule Details FilesSetDefsPanel.dirsRadioButton.text=Directories FilesSetDefsPanel.jLabel2.text=File Type: -FilesSetDefsPanel.rulesListLabel.text=Rules: -FilesSetDefsPanel.newSetButton.text=New Set -FilesSetDefsPanel.editRuleButton.text=Edit Rule FilesSetDefsPanel.deleteRuleButton.text=Delete Rule -FilesSetDefsPanel.filesRadioButton.text=Files -FilesSetDefsPanel.deleteSetButton.text=Delete Set FilesSetDefsPanel.bothRadioButton.text=Files and Directories +FilesSetDefsPanel.fileNameRegexCheckbox.text=Regex +FilesSetDefsPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files +FilesSetDefsPanel.rulePathConditionTextField.text= +FilesSetDefsPanel.fileNameRadioButton.text=File Name +FilesSetDefsPanel.jLabel5.text=Description: +FilesSetDefsPanel.fileNameTextField.text= +FilesSetDefsPanel.jLabel3.text=Name Pattern: +FilesSetDefsPanel.fileNameExtensionRadioButton.text=Extension Only +FilesSetDefsPanel.rulesListLabel.text=Rules: +FilesSetDefsPanel.editRuleButton.text=Edit Rule +FilesSetDefsPanel.filesRadioButton.text=Files +FilesSetDefsPanel.newRuleButton.text=New Rule + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 310bf0aeef..6692316be8 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -28,26 +28,25 @@ OptionsCategory_Name_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30d5\u OptionsCategory_Keywords_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u5b9a\u7fa9 FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540d\u524d\u304c{0}\u306e\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306f\u65e2\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 FilesSetRulePanel.jLabel5.text=\u898b\u3064\u3051\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 -FilesSetDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb +FilesSetDefsPanel.interesting.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 +FilesSetDefsPanel.interesting.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 +FilesSetDefsPanel.interesting.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 +FilesSetDefsPanel.interesting.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 FilesSetDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 -FilesSetDefsPanel.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 +FilesSetDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe +FilesSetDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a +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 FilesSetDefsPanel.jLabel5.text=\u6982\u8981\uff1a FilesSetDefsPanel.jLabel3.text=\u30cd\u30fc\u30e0\u30d1\u30bf\u30fc\u30f3 FilesSetDefsPanel.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f -FilesSetDefsPanel.jTextArea1.text=\u6307\u5b9a\u3055\u308c\u305f\u6761\u4ef6\u3068\u4e00\u81f4\u3059\u308b\u30d5\u30a1\u30a4\u30eb\u3092\u691c\u7d22\u3059\u308b\u306e\u304c\u53ef\u80fd\u306a\u30e2\u30b8\u30e5\u30fc\u30eb\u3067\u3059\u3002\u5404\u30bb\u30c3\u30c8\u306b\u306f\u30d5\u30a1\u30a4\u30eb\u540d\u304a\u3088\u3073\u30da\u30a2\u30ec\u30f3\u30c8\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\u3092\u3082\u3068\u306b\u4e00\u81f4\u3059\u308b\u3001\u30eb\u30fc\u30eb\u30ea\u30b9\u30c8\u304c\u3042\u308a\u307e\u3059\u3002 -FilesSetDefsPanel.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 -FilesSetDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe -FilesSetDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a -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.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a -FilesSetDefsPanel.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 FilesSetDefsPanel.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 -FilesSetDefsPanel.deleteRuleButton.text=\u30eb\u30fc\u30eb\u3092\u524a\u9664 FilesSetDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb -FilesSetDefsPanel.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 -FilesSetDefsPanel.bothRadioButton.text=\u30d5\u30a1\u30a4\u30eb\u304a\u3088\u3073\u30c7\u30a3\u30ec\u30af\u30c8\u30ea +FilesSetDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index e69a1c820c..5e3a94b46d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -62,127 +62,140 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + - + - - + + + - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - + - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - - - - - - - - - - - - - - - - + - - - - - - - - - - - - - - - - - - - - - + + - + + + + + + + + + + - @@ -434,7 +447,7 @@ - + @@ -598,7 +611,7 @@ - + @@ -629,7 +642,7 @@ - + @@ -667,7 +680,7 @@ - + @@ -771,7 +784,7 @@ - + @@ -833,7 +846,7 @@ - + @@ -850,6 +863,7 @@ + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index d81d69f46a..761fba69f6 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -95,17 +95,25 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements this.ruleDialogTitle = "FilesSetPanel.ingest.title"; this.jLabel8.setVisible(false); this.equalitySignComboBox.setVisible(false); + this.ignoreKnownFilesCheckbox.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 + org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.newSetButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.deleteSetButton.text")); // NOI18N } else { this.ruleDialogTitle = "FilesSetPanel.interesting.title"; this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.setsListLabel.text")); // NOI18N + this.skipsUnallocCheckbox.setVisible(false); + } } Set getKeys() { load(); return filesSets.keySet(); - } + } @NbBundle.Messages({"FilesSetDefsPanel.Interesting.Title=Global Interesting Items Settings", "FilesSetDefsPanel.Ingest.Title=File Ingest Filter Settings"}) @@ -614,7 +622,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements editSetButton.setFont(editSetButton.getFont().deriveFont(editSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); editSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.editSetButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.editSetButton.text")); // NOI18N editSetButton.setEnabled(false); editSetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -673,7 +681,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements separator.setOrientation(javax.swing.SwingConstants.VERTICAL); 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.setsListLabel.text")); // NOI18N + 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)); @@ -682,7 +690,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements 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 - org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.deleteSetButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.deleteSetButton.text")); // NOI18N deleteSetButton.setEnabled(false); deleteSetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { @@ -702,7 +710,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements newSetButton.setFont(newSetButton.getFont().deriveFont(newSetButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); newSetButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.newSetButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.newSetButton.text")); // NOI18N newSetButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { newSetButtonActionPerformed(evt); @@ -740,6 +748,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements jTextArea1.setFont(jTextArea1.getFont().deriveFont(jTextArea1.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); jTextArea1.setLineWrap(true); jTextArea1.setRows(3); + jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N jTextArea1.setWrapStyleWord(true); jScrollPane2.setViewportView(jTextArea1); @@ -764,6 +773,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements org.openide.awt.Mnemonics.setLocalizedText(skipsUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.skipsUnallocCheckbox.text")); // NOI18N skipsUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText")); // NOI18N + skipsUnallocCheckbox.setEnabled(false); skipsUnallocCheckbox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { skipsUnallocCheckboxActionPerformed(evt); @@ -774,98 +784,106 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements jPanel1.setLayout(jPanel1Layout); jPanel1Layout.setHorizontalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(360, 360, 360) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rulesListLabel) - .addComponent(jLabel5) - .addComponent(jLabel6) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(ignoreKnownFilesCheckbox) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(setsListLabel) - .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE) - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(18, 18, 18) - .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(newSetButton) + .addGap(9, 9, 9) + .addComponent(editSetButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(deleteSetButton)) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(newSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 93, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(editSetButton, javax.swing.GroupLayout.PREFERRED_SIZE, 89, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(deleteSetButton))) - .addGap(12, 12, 12) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(setsListLabel) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGap(28, 28, 28)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(setsListScrollPane) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) + .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addGap(4, 4, 4) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(20, 20, 20) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(20, 20, 20) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3) - .addComponent(jLabel2)) - .addGap(6, 6, 6)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(jLabel4) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(fileNameTextField))) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel7) - .addComponent(jLabel8)) - .addGap(6, 6, 6) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(8, 8, 8)) - .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(setDescScrollPanel) - .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 342, Short.MAX_VALUE)) - .addGap(7, 7, 7)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel1) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(92, 92, 92) - .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(dirsRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(bothRadioButton)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(newRuleButton) - .addGap(18, 18, 18) - .addComponent(editRuleButton) - .addGap(18, 18, 18) - .addComponent(deleteRuleButton)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(96, 96, 96) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel2)) + .addGap(6, 6, 6)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(fileNameTextField))) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(fileNameRadioButton) - .addGap(4, 4, 4) - .addComponent(fileNameExtensionRadioButton) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addGap(6, 6, 6) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(8, 8, 8)) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(setDescScrollPanel) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)) + .addGap(7, 7, 7)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(92, 92, 92) + .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(fileNameRegexCheckbox)) - .addComponent(rulePathConditionRegexCheckBox)))) - .addGap(4, 4, 4))) - .addGap(85, 85, 85)) + .addComponent(dirsRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(bothRadioButton)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(newRuleButton) + .addGap(18, 18, 18) + .addComponent(editRuleButton) + .addGap(18, 18, 18) + .addComponent(deleteRuleButton)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(96, 96, 96) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(fileNameRadioButton) + .addGap(4, 4, 4) + .addComponent(fileNameExtensionRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(fileNameRegexCheckbox)) + .addComponent(rulePathConditionRegexCheckBox)))) + .addGap(4, 206, Short.MAX_VALUE)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(ignoreKnownFilesCheckbox) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE))) + .addContainerGap()) + .addGroup(jPanel1Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel5) + .addComponent(jLabel6) + .addComponent(rulesListLabel)) + .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) @@ -958,6 +976,10 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements ); }// //GEN-END:initComponents + private void skipsUnallocCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipsUnallocCheckboxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_skipsUnallocCheckboxActionPerformed + private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_dirsRadioButtonActionPerformed @@ -1004,6 +1026,10 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements // TODO add your handling code here: }//GEN-LAST:event_ignoreKnownFilesCheckboxActionPerformed + private void fileNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameTextFieldActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_fileNameTextFieldActionPerformed + private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed this.doFileSetsDialog(this.setsList.getSelectedValue()); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); @@ -1019,14 +1045,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_newRuleButtonActionPerformed - private void fileNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameTextFieldActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_fileNameTextFieldActionPerformed - - private void skipsUnallocCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipsUnallocCheckboxActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_skipsUnallocCheckboxActionPerformed - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JRadioButton bothRadioButton; private javax.swing.JButton deleteRuleButton; From d93953dc0e074571fa9fe78932119441063778cc Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 6 Jan 2017 13:45:00 -0500 Subject: [PATCH 22/50] 1903 Fixed remaining label in FilesSetDefsPanel --- .../interestingitems/Bundle.properties | 3 +- .../interestingitems/Bundle_ja.properties | 1 - .../interestingitems/FilesSetDefsPanel.form | 156 ++++++++---------- .../interestingitems/FilesSetDefsPanel.java | 129 +++++++-------- 4 files changed, 129 insertions(+), 160 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 78eaaf630c..8916519b5a 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -52,7 +52,8 @@ FilesSetDefsPanel.interesting.newSetButton.text=New Set FilesSetDefsPanel.ingest.newSetButton.text=New Filter FilesSetDefsPanel.interesting.deleteSetButton.text=Delete Set FilesSetDefsPanel.ingest.deleteSetButton.text=Delete Filter -FilesSetDefsPanel.jLabel6.text=Set Details +FilesSetDefsPanel.interesting.jLabel6.text=Set Details +FilesSetDefsPanel.ingest.jLabel6.text=Filter Details FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. FilesSetDefsPanel.skipsUnallocCheckbox.text=Skip Unallocated Space FilesSetDefsPanel.jLabel8.text=File Size: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 6692316be8..cbfcbf6fa4 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -32,7 +32,6 @@ FilesSetDefsPanel.interesting.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\ FilesSetDefsPanel.interesting.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 FilesSetDefsPanel.interesting.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 FilesSetDefsPanel.interesting.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 -FilesSetDefsPanel.jLabel6.text=\u30bb\u30c3\u30c8\u8a73\u7d30 FilesSetDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe FilesSetDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a FilesSetDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index 5e3a94b46d..8aac0f22a9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -90,112 +90,94 @@ - - - + + + - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - - - + + - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - - - - - - - - - - + + + @@ -299,7 +281,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 761fba69f6..e899c3c8d2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -101,10 +101,9 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements org.openide.awt.Mnemonics.setLocalizedText(editSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.editSetButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(newSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.newSetButton.text")); // NOI18N org.openide.awt.Mnemonics.setLocalizedText(deleteSetButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.deleteSetButton.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.jLabel6.text")); // NOI18N } else { this.ruleDialogTitle = "FilesSetPanel.interesting.title"; - this.jTextArea1.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jTextArea1.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(setsListLabel, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.setsListLabel.text")); // NOI18N this.skipsUnallocCheckbox.setVisible(false); } @@ -572,7 +571,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements jPanel1.setFont(jPanel1.getFont().deriveFont(jPanel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); jLabel6.setFont(jLabel6.getFont().deriveFont(jLabel6.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); - org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel6.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.interesting.jLabel6.text")); // NOI18N newRuleButton.setFont(newRuleButton.getFont().deriveFont(newRuleButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); newRuleButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add16.png"))); // NOI18N @@ -805,85 +804,73 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))) .addGap(4, 4, 4) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addGap(20, 20, 20) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(20, 20, 20) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3) - .addComponent(jLabel2)) - .addGap(6, 6, 6)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(jLabel4) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(fileNameTextField))) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel7) - .addComponent(jLabel8)) - .addGap(6, 6, 6) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(8, 8, 8)) - .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) + .addComponent(jLabel3) + .addComponent(jLabel2)) + .addGap(6, 6, 6)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rulePathConditionTextField) + .addComponent(fileNameTextField))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(setDescScrollPanel) - .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 538, Short.MAX_VALUE)) - .addGap(7, 7, 7)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel1) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(92, 92, 92) - .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(dirsRadioButton) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addGap(6, 6, 6) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(bothRadioButton)) + .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(8, 8, 8)) + .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rulesListLabel) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) + .addComponent(setDescScrollPanel, javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addGap(92, 92, 92) + .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(dirsRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(bothRadioButton)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addComponent(newRuleButton) + .addGap(18, 18, 18) + .addComponent(editRuleButton) + .addGap(18, 18, 18) + .addComponent(deleteRuleButton)) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addGap(96, 96, 96) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(newRuleButton) - .addGap(18, 18, 18) - .addComponent(editRuleButton) - .addGap(18, 18, 18) - .addComponent(deleteRuleButton)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(96, 96, 96) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(fileNameRadioButton) - .addGap(4, 4, 4) - .addComponent(fileNameExtensionRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(fileNameRegexCheckbox)) - .addComponent(rulePathConditionRegexCheckBox)))) - .addGap(4, 206, Short.MAX_VALUE)) - .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(fileNameRadioButton) + .addGap(4, 4, 4) + .addComponent(fileNameExtensionRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(fileNameRegexCheckbox)) + .addComponent(rulePathConditionRegexCheckBox))) + .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() .addComponent(ignoreKnownFilesCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE))) - .addContainerGap()) - .addGroup(jPanel1Layout.createSequentialGroup() - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel5) - .addComponent(jLabel6) - .addComponent(rulesListLabel)) - .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)))) + .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)) + .addComponent(jLabel5) + .addComponent(jLabel6))) + .addGap(17, 17, 17)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) From f7ad6291deff74cae3b9d07a69fb878495978938 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 9 Jan 2017 17:12:02 -0500 Subject: [PATCH 23/50] 1903 working version of File Ingest Filters --- .../autopsy/ingest/Bundle.properties | 2 +- .../autopsy/ingest/DataSourceIngestJob.java | 43 +++---- .../autopsy/ingest/IngestJobSettings.java | 24 ++-- .../ingest/IngestJobSettingsPanel.form | 86 ++++++++------ .../ingest/IngestJobSettingsPanel.java | 112 ++++++++---------- .../autopsy/ingest/IngestTasksScheduler.java | 18 +-- .../interestingitems/Bundle.properties | 7 +- .../interestingitems/Bundle_ja.properties | 4 +- ...ngestFilterDefsOptionsPanelController.java | 24 ++-- ...FilesIdentifierIngestJobSettingsPanel.java | 6 +- .../modules/interestingitems/FilesSet.java | 46 +++---- .../interestingitems/FilesSetDefsPanel.form | 12 +- .../interestingitems/FilesSetDefsPanel.java | 53 ++++----- .../interestingitems/FilesSetPanel.form | 7 +- .../interestingitems/FilesSetPanel.java | 64 +++++++--- .../interestingitems/FilesSetRulePanel.form | 2 +- .../interestingitems/FilesSetRulePanel.java | 27 +++-- .../interestingitems/FilesSetSettings.java | 11 +- .../interestingitems/FilesSetsManager.java | 34 +++--- 19 files changed, 306 insertions(+), 276 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties index 947249781b..1a58c266b2 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/ingest/Bundle.properties @@ -112,5 +112,5 @@ IngestJobSettingsPanel.globalSettingsButton.text=Global Settings gest IngestJobSettingsPanel.globalSettingsButton.actionCommand=Advanced IngestJobSettingsPanel.globalSettingsButton.text=Global Settings -IngestJobSettingsPanel.pastJobsButton.text=View Ingest History +IngestJobSettingsPanel.pastJobsButton.text=History IngestJobSettingsPanel.fileIngestFilterLabel.text=Run ingest modules on: diff --git a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java index 353e1c5e3d..856fe037f6 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * + * * Copyright 2011-2016 Basis Technology Corp. * Contact: carrier sleuthkit 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. @@ -172,12 +172,12 @@ final class DataSourceIngestJob { * Constructs an object that encapsulates a data source and the ingest * module pipelines used to process it. * - * @param parentJob The ingest job of which this data source ingest job is a - * part. - * @param dataSource The data source to be ingested. - * @param settings The settings for the ingest job. + * @param parentJob The ingest job of which this data source ingest + * job is a part. + * @param dataSource The data source to be ingested. + * @param settings The settings for the ingest job. * @param runInteractively Whether or not this job should use NetBeans - * progress handles. + * progress handles. */ DataSourceIngestJob(IngestJob parentJob, Content dataSource, IngestJobSettings settings, boolean runInteractively) { this.parentJob = parentJob; @@ -278,12 +278,12 @@ final class DataSourceIngestJob { * collection as they are added to the output collection. * * @param ingestModuleTemplates A mapping of ingest module factory class - * names to ingest module templates. - * @param pipelineConfig An ordered list of ingest module factory class - * names representing an ingest pipeline. + * names to ingest module templates. + * @param pipelineConfig An ordered list of ingest module factory + * class names representing an ingest pipeline. * * @return An ordered list of ingest module templates, i.e., an - * uninstantiated pipeline. + * uninstantiated pipeline. */ private static List getConfiguredIngestModuleTemplates(Map ingestModuleTemplates, List pipelineConfig) { List templates = new ArrayList<>(); @@ -746,8 +746,9 @@ final class DataSourceIngestJob { * @param task A file ingest task. * * @throws InterruptedException if the thread executing this code is - * interrupted while blocked on taking from or putting to the file ingest - * pipelines collection. + * interrupted while blocked on taking from or + * putting to the file ingest pipelines + * collection. */ void process(FileIngestTask task) throws InterruptedException { try { @@ -848,7 +849,7 @@ final class DataSourceIngestJob { * process the data source is known. * * @param workUnits Total number of work units for the processing of the - * data source. + * data source. */ void switchDataSourceIngestProgressBarToDeterminate(int workUnits) { if (this.doUI && !this.cancelled) { @@ -913,7 +914,7 @@ final class DataSourceIngestJob { * mode. The task name is the "subtitle" under the display name. * * @param currentTask The task name. - * @param workUnits Number of work units performed. + * @param workUnits Number of work units performed. */ void advanceDataSourceIngestProgressBar(String currentTask, int workUnits) { if (this.doUI && !this.cancelled) { @@ -1055,7 +1056,7 @@ final class DataSourceIngestJob { * To be used for more detailed cancelling. * * @param moduleName Name of module currently running. - * @param taskName Name of file the module is running on. + * @param taskName Name of file the module is running on. */ void setCurrentFileIngestModule(String moduleName, String taskName) { this.currentFileIngestModule = moduleName; @@ -1169,7 +1170,7 @@ final class DataSourceIngestJob { * Gets time these statistics were collected. * * @return The statistics collection time as number of milliseconds - * since January 1, 1970, 00:00:00 GMT. + * since January 1, 1970, 00:00:00 GMT. */ long getSnapshotTime() { return snapShotTime; @@ -1199,7 +1200,7 @@ final class DataSourceIngestJob { * Gets the time the ingest job was started. * * @return The start time as number of milliseconds since January 1, - * 1970, 00:00:00 GMT. + * 1970, 00:00:00 GMT. */ long getJobStartTime() { return jobStartTime; @@ -1299,7 +1300,7 @@ final class DataSourceIngestJob { * ingest modules * * @return A list of canceled data source level ingest module display - * names, possibly empty. + * names, possibly empty. */ List getCancelledDataSourceIngestModules() { return Collections.unmodifiableList(this.cancelledDataSourceModules); diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 7817bb37d7..b8d2e3d0f0 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * + * * Copyright 2011-2016 Basis Technology Corp. * Contact: carrier sleuthkit 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. @@ -58,7 +58,7 @@ public class IngestJobSettings { private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS private static final Logger LOGGER = Logger.getLogger(IngestJobSettings.class.getName()); - private static FilesSet ALL_FILES_INGEST_FILTER = new FilesSet("All Files", "All Files", false, true, Collections.emptyMap()); //NON-NLS //WJS-TODO Figure out how to keep these names from being duplicated + private static FilesSet ALL_FILES_INGEST_FILTER = new FilesSet("All Files", "All Files", false, true, Collections.emptyMap()); //NON-NLS private static FilesSet ALL_AND_UNALLOC_FILES_INGEST_FILTER = new FilesSet("All Files and Unallocated Space", "All Files and Unallocated Space", false, false, Collections.emptyMap()); //NON-NLS private FilesSet fileIngestFilter; private final String executionContext; @@ -82,7 +82,7 @@ public class IngestJobSettings { * Sets the FileIngestFilter which is currently being used by ingest. * * @param fileIngestFilter the FilesSet which represents the - * FileIngestFilter + * FileIngestFilter */ protected void setFileIngestFilter(FilesSet fileIngestFilter) { this.fileIngestFilter = fileIngestFilter; @@ -139,7 +139,7 @@ public class IngestJobSettings { * modules dialog. Different execution conterxts may have different ingest * job settings. * - * @param context The context identifier string. + * @param context The context identifier string. * @param ingestType The type of modules ingest is running. */ public IngestJobSettings(String context, IngestType ingestType) { @@ -231,7 +231,7 @@ public class IngestJobSettings { * continue to work without modification. * * @return True for process unallocated space or false for skip unallocated - * space. + * space. */ boolean getProcessUnallocatedSpace() { boolean processUnallocated = true; @@ -360,14 +360,14 @@ public class IngestJobSettings { .getFileIngestFiltersWithDefaults() .get(ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY)); } catch (FilesSetsManager.FilesSetsManagerException ex) { - LOGGER.log(Level.SEVERE, "Failed to get File Ingest Filters", ex); //NON-NLS + LOGGER.log(Level.SEVERE, "Failed to get File Ingest Filters", ex); //NON-NLS } } /** * Gets the module names for a given key within these ingest job settings. * - * @param key The key string. + * @param key The key string. * @param defaultSetting The default list of module names. * * @return The list of module names associated with the key. @@ -501,7 +501,7 @@ public class IngestJobSettings { * Serializes the ingest job settings for this context for a given ingest * module. * - * @param factory The ingest module factory for the module. + * @param factory The ingest module factory for the module. * @param settings The ingest job settings for the ingest module */ private void saveModuleSettings(IngestModuleFactory factory, IngestModuleIngestJobSettings settings) { @@ -521,7 +521,7 @@ public class IngestJobSettings { * @param input A hash set of strings. * * @return The contents of the hash set as a single string of - * comma-separated values. + * comma-separated values. */ private static String makeCommaSeparatedValuesList(HashSet input) { if (input == null || input.isEmpty()) { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form index 02bba94367..f3f7053bc6 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form @@ -32,56 +32,46 @@ - - - - + + + + + + - + - - - - - - - - - + + - - - + + + - + - - - - - - + + + + + + - - - - - - - + + @@ -139,24 +129,24 @@ - + - + - + - - + + @@ -222,6 +212,15 @@ + + + + + + + + + @@ -232,6 +231,9 @@ + + + @@ -242,6 +244,15 @@ + + + + + + + + + @@ -260,6 +271,9 @@ + + + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index 7b3df559e8..1b3643a50d 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -40,18 +40,17 @@ import javax.swing.event.ListSelectionEvent; import javax.swing.table.AbstractTableModel; import javax.swing.table.DefaultTableCellRenderer; import javax.swing.table.TableColumn; -import org.openide.util.Exceptions; import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.modules.interestingitems.FileIngestFilterDefsOptionsPanelController; -import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestModuleInfo; import org.sleuthkit.datamodel.SleuthkitCase; import org.sleuthkit.datamodel.TskCoreException; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSetsManager; /** * A panel to allow a user to make ingest job settings. @@ -67,7 +66,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private final List modules = new ArrayList<>(); private final IngestModulesTableModel tableModel = new IngestModulesTableModel(); private IngestModuleModel selectedModule; - private final FileIngestFilterDefsOptionsPanelController controller; + private FileIngestFilterDefsOptionsPanelController controller; private static final Logger logger = Logger.getLogger(IngestJobSettingsPanel.class.getName()); /** @@ -90,7 +89,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { /** * Construct a panel to allow a user to make ingest job settings. * - * @param settings The initial settings for the ingest job. + * @param settings The initial settings for the ingest job. * @param dataSources The data sources ingest is being run on. */ IngestJobSettingsPanel(IngestJobSettings settings, List dataSources) { @@ -98,7 +97,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { this.dataSources.addAll(dataSources); this.controller = new FileIngestFilterDefsOptionsPanelController(); controller.getComponent(controller.getLookup()); - try { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); ingestJobs.addAll(skCase.getIngestJobs()); @@ -113,7 +111,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { initComponents(); customizeComponents(); fileIngestFilterComboBox.setSelectedItem(settings.getFileIngestFilter().getName()); - } /** @@ -214,15 +211,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { fileIngestFilterLabel = new javax.swing.JLabel(); fileIngestFilterComboBox = new javax.swing.JComboBox<>(); - fileIngestFilterLabel.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.fileIngestFilterLabel.text")); // NOI18N - fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); - fileIngestFilterComboBox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - fileIngestFilterComboBoxActionPerformed(evt); - } - }); - - setMaximumSize(new java.awt.Dimension(5750, 3000)); setMinimumSize(new java.awt.Dimension(0, 0)); setPreferredSize(new java.awt.Dimension(625, 450)); @@ -271,20 +259,20 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jSeparator2, javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(jPanel1Layout.createSequentialGroup() - .addContainerGap() + .addGap(8, 8, 8) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE) - .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 276, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, 320, Short.MAX_VALUE) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addGap(0, 0, Short.MAX_VALUE) .addComponent(globalSettingsButton))) - .addContainerGap()) + .addGap(8, 8, 8)) ); jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() .addContainerGap() - .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 299, Short.MAX_VALUE) + .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 330, Short.MAX_VALUE) .addGap(18, 18, 18) .addComponent(jSeparator2, javax.swing.GroupLayout.PREFERRED_SIZE, 2, javax.swing.GroupLayout.PREFERRED_SIZE) .addGap(8, 8, 8) @@ -295,6 +283,9 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { ); jButtonSelectAll.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jButtonSelectAll.text")); // NOI18N + jButtonSelectAll.setMaximumSize(new java.awt.Dimension(87, 23)); + jButtonSelectAll.setMinimumSize(new java.awt.Dimension(87, 23)); + jButtonSelectAll.setPreferredSize(new java.awt.Dimension(86, 23)); jButtonSelectAll.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonSelectAllActionPerformed(evt); @@ -302,6 +293,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { }); jButtonDeselectAll.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.jButtonDeselectAll.text")); // NOI18N + jButtonDeselectAll.setPreferredSize(new java.awt.Dimension(86, 23)); jButtonDeselectAll.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { jButtonDeselectAllActionPerformed(evt); @@ -309,6 +301,9 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { }); pastJobsButton.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.pastJobsButton.text")); // NOI18N + pastJobsButton.setMaximumSize(new java.awt.Dimension(87, 23)); + pastJobsButton.setMinimumSize(new java.awt.Dimension(87, 23)); + pastJobsButton.setPreferredSize(new java.awt.Dimension(87, 23)); pastJobsButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { pastJobsButtonActionPerformed(evt); @@ -318,51 +313,53 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { fileIngestFilterLabel.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.fileIngestFilterLabel.text")); // NOI18N fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); + fileIngestFilterComboBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + fileIngestFilterComboBoxActionPerformed(evt); + } + }); javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() + .addGap(5, 5, 5) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) + .addGroup(layout.createSequentialGroup() + .addComponent(jButtonSelectAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(jButtonDeselectAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(pastJobsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(fileIngestFilterLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 112, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(fileIngestFilterComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) + .addGap(4, 4, 4) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addGap(5, 5, 5)) + ); + + layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {jButtonDeselectAll, jButtonSelectAll, pastJobsButton}); + + layout.setVerticalGroup( + layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) .addGroup(layout.createSequentialGroup() .addComponent(fileIngestFilterLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileIngestFilterComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(layout.createSequentialGroup() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(jButtonSelectAll, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(pastJobsButton, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)) - .addGap(5, 5, 5) - .addComponent(jButtonDeselectAll) - .addGap(0, 84, Short.MAX_VALUE))) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 298, Short.MAX_VALUE) - .addContainerGap()) - ); - layout.setVerticalGroup( - layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() - .addContainerGap() - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(fileIngestFilterLabel) - .addComponent(fileIngestFilterComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(layout.createSequentialGroup() + .addComponent(fileIngestFilterComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(modulesScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) - .addComponent(jButtonSelectAll) - .addComponent(jButtonDeselectAll)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(pastJobsButton) - .addGap(25, 25, 25)) - .addGroup(layout.createSequentialGroup() - .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 397, Short.MAX_VALUE) - .addContainerGap()))) + .addComponent(jButtonSelectAll, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jButtonDeselectAll, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(pastJobsButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))) + .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 428, Short.MAX_VALUE)) + .addContainerGap()) ); }// //GEN-END:initComponents @@ -408,15 +405,8 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { dialog.setVisible(true); }//GEN-LAST:event_pastJobsButtonActionPerformed - /** - * Perform the appropriate action when Jcombobox items are selected, most - * notably opening the File filter settings when Create New is chosen. - * - * @param evt - */ - private void fileIngestFilterComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_jComboBox1ActionPerformed - - if (fileIngestFilterComboBox.getSelectedItem().toString().equals(FileIngestFilterDefsOptionsPanelController.NEW_INGEST_FILTER)) { + private void fileIngestFilterComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileIngestFilterComboBoxActionPerformed + if (fileIngestFilterComboBox.getSelectedItem().toString().equals(FileIngestFilterDefsOptionsPanelController.NEW_FILE_INGEST_FILTER)) { final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); dialog.addApplyButtonListener((ActionEvent e) -> { controller.applyChanges(); @@ -437,7 +427,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { logger.log(Level.SEVERE, "Failed to get File Ingest Filters", ex); //NON-NLS } } - }//GEN-LAST:event_jComboBox1ActionPerformed + }//GEN-LAST:event_fileIngestFilterComboBoxActionPerformed private void SelectAllModules(boolean set) { for (IngestModuleModel module : modules) { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java index c13d9ee8bd..834f475ffd 100755 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestTasksScheduler.java @@ -1,15 +1,15 @@ /* * Autopsy Forensic Browser - * + * * Copyright 2012-2016 Basis Technology Corp. * Contact: carrier sleuthkit 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. @@ -149,7 +149,7 @@ final class IngestTasksScheduler { * @param job The job for which the tasks are to be scheduled. * * @throws InterruptedException if the calling thread is blocked due to a - * full tasks queue and is interrupted. + * full tasks queue and is interrupted. */ synchronized void scheduleIngestTasks(DataSourceIngestJob job) { if (!job.isCancelled()) { @@ -209,7 +209,7 @@ final class IngestTasksScheduler { /** * Schedules a file ingest task for an ingest job. * - * @param job The job for which the tasks are to be scheduled. + * @param job The job for which the tasks are to be scheduled. * @param file The file to be associated with the task. */ synchronized void scheduleFileIngestTask(DataSourceIngestJob job, AbstractFile file) { @@ -405,8 +405,8 @@ final class IngestTasksScheduler { } /** - * Check if the file is a member of the file ingest filter that is being - * applied to the current run of ingest, checks if unallocated space + * Check if the file is a member of the file ingest filter that is being + * 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) { @@ -481,7 +481,7 @@ final class IngestTasksScheduler { * well. * * @param taskQueue The queue from which to remove the tasks. - * @param jobId The id of the job for which the tasks are to be removed. + * @param jobId The id of the job for which the tasks are to be removed. */ synchronized private void removeTasksForJob(Collection taskQueue, long jobId) { Iterator iterator = taskQueue.iterator(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 8916519b5a..1c9c852496 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -10,9 +10,11 @@ InterestingItemsIdentifierIngestModule.moduleName=Interesting Files Identifier InterestingItemsIdentifierIngestModule.moduleDescription=Identifies interesting items as defined by interesting item rule sets. FilesSetPanel.interesting.title=Interesting Files Set FilesSetPanel.messages.filesSetsMustBeNamed=Interesting files sets must be named. +FilesSetPanel.messages.filesSetsReservedName=You have chosen a name reserved by the software, please choose a different name. FilesSetPanel.ignoreKnownFilesCheckbox.text=Ignore Known Files FilesSetPanel.descriptionPanel.border.title=Description -FilesSetPanel.nameLabel.text=Set Name: +FilesSetPanel.interesting.nameLabel.text=Set Name: +FilesSetPanel.ingest.nameLabel.text=Filter Name: FilesSetPanel.descPanel.border.title=Description FilesSetPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. FilesSetPanel.skipsUnallocCheckbox.text=Skip Unallocated Space @@ -34,7 +36,8 @@ FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text=Rule set with name {0} FilesSetRulePanel.pathSeparatorInfoLabel.text=Use / as path separator FilesIdentifierIngestJobSettingsPanel.border.title=Select interesting files sets to enable during ingest: FilesSetRulePanel.jLabel1.text=Type: -FilesSetRulePanel.jLabel5.text=Enter information about files that you want to find. +FilesSetRulePanel.interesting.jLabel5.text=Enter information about files that you want to find. +FilesSetRulePanel.ingest.jLabel5.text=Enter information about files that you want to run ingest on. FilesSetRulePanel.nameCheck.text=Name Pattern: FilesSetRulePanel.pathCheck.text=Path Pattern: FilesSetRulePanel.mimeCheck.text=MIME Type: diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index cbfcbf6fa4..60267adc77 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -3,7 +3,7 @@ FilesSetPanel.descPanel.border.title=\u6982\u8981 FilesSetPanel.descriptionPanel.border.title=\u6982\u8981 FilesSetPanel.ignoreKnownFilesCheckbox.text=\u65e2\u77e5\u30d5\u30a1\u30a4\u30eb\u3092\u7121\u8996 FilesSetPanel.messages.filesSetsMustBeNamed=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8\u306f\u540d\u524d\u304c\u5fc5\u8981\u3067\u3059\u3002 -FilesSetPanel.nameLabel.text=\u30bb\u30c3\u30c8\u540d\uff1a +FilesSetPanel.interesting.nameLabel.text=\u30bb\u30c3\u30c8\u540d\uff1a FilesSetPanel.title=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb\u30bb\u30c3\u30c8 FilesSetRulePanel.extensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u307f FilesSetRulePanel.fullNameRadioButton.text=\u30d5\u30eb\u30cd\u30fc\u30e0 @@ -27,7 +27,7 @@ OpenIDE-Module-Short-Description=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30e OptionsCategory_Name_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30d5\u30a1\u30a4\u30eb OptionsCategory_Keywords_InterestingItemDefinitions=\u7591\u308f\u3057\u3044\u30a2\u30a4\u30c6\u30e0\u5b9a\u7fa9 FilesSetDefsPanel.doFileSetsDialog.duplicateRuleSet.text=\u540d\u524d\u304c{0}\u306e\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8\u306f\u65e2\u306b\u5b58\u5728\u3057\u307e\u3059\u3002 -FilesSetRulePanel.jLabel5.text=\u898b\u3064\u3051\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 +FilesSetRulePanel.interesting.jLabel5.text=\u898b\u3064\u3051\u305f\u3044\u30d5\u30a1\u30a4\u30eb\u306e\u60c5\u5831\u3092\u5165\u529b\u3057\u3066\u304f\u3060\u3055\u3044\u3002 FilesSetDefsPanel.interesting.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\u30c8 FilesSetDefsPanel.interesting.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 FilesSetDefsPanel.interesting.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index 998c734418..fd7daa5009 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -42,17 +42,17 @@ import org.sleuthkit.autopsy.ingest.IngestJobSettings; ) /** - * Class for creating an FilesSetDefsPanel which will be used for - * configuring the FileIngestFilter. + * Class for creating an FilesSetDefsPanel which will be used for configuring + * the FileIngestFilter. */ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPanelController { private FilesSetDefsPanel panel; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; - public final static String NEW_INGEST_FILTER = ""; - private static final Logger LOGGER = Logger.getLogger(FileIngestFilterDefsOptionsPanelController.class.getName()); - + public final static String NEW_FILE_INGEST_FILTER = "Create new file ingest filter..."; + private static final Logger LOGGER = Logger.getLogger(FileIngestFilterDefsOptionsPanelController.class.getName()); + /** * Component should load its data here. */ @@ -65,22 +65,22 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan /** * Returns an array which will contain the names of all options which should * exist in the "Run Ingest Modules On:" JCombobox - * + * * Keeping the default File Ingest Filters and the saved one seperate allows - * the default to always be first elements in + * the default to always be first elements in * * @return -filterNames an array of all established filter names as well as - * a Create New option + * a Create New option */ public String[] getComboBoxContents() { ArrayList nameList = new ArrayList<>(); for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { nameList.add(fSet.getName()); } - nameList.add(NEW_INGEST_FILTER); - if (!(panel == null)) { + nameList.add(NEW_FILE_INGEST_FILTER); + if (!(panel == null)) { nameList.addAll(panel.getKeys()); - } + } return nameList.toArray(new String[nameList.size()]); } @@ -153,7 +153,7 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan * is for File Ingest Filter settings * * @return an FilesSetDefsPanel which has text and fields modified to - indicate it is for File Ingest Filtering. + * indicate it is for File Ingest Filtering. */ private FilesSetDefsPanel getPanel() { if (panel == null) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java index e8f8c88e43..934fde0fef 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestJobSettingsPanel.java @@ -53,7 +53,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS * constructor. * * @return An instance of the ingest job settings panel interesting files - * identifier ingest modules. + * identifier ingest modules. */ static FilesIdentifierIngestJobSettingsPanel makePanel(FilesIdentifierIngestJobSettings settings) { FilesIdentifierIngestJobSettingsPanel panel = new FilesIdentifierIngestJobSettingsPanel(settings); @@ -172,7 +172,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS * job. * * @param filesSetRows A collection of row objects that bundles an - * interesting files set with an enabled flag + * interesting files set with an enabled flag */ FilesSetsTableModel(List filesSetRows) { this.filesSetRows = filesSetRows; @@ -182,7 +182,7 @@ final class FilesIdentifierIngestJobSettingsPanel extends IngestModuleIngestJobS * Refreshes the table with a new set of rows. * * @param filesSetRows A collection of row objects that bundles an - * interesting files set with an enabled flag + * interesting files set with an enabled flag */ void resetTableData(List filesSetRows) { this.filesSetRows = filesSetRows; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 56db222bde..89141b2eea 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -49,14 +49,14 @@ public final class FilesSet implements Serializable { /** * Constructs an interesting files set. * - * @param name The name of the set. - * @param description A description of the set, may be null. + * @param name The name of the set. + * @param description A description of the set, may be null. * @param ignoreKnownFiles Whether or not to exclude known files from the - * set. - * @param rules The rules that define the set. May be null, but a set with - * no rules is the empty set. + * set. + * @param rules The rules that define the set. May be null, but a + * set with no rules is the empty set. */ - public FilesSet(String name, String description, boolean ignoreKnownFiles, boolean skipUnallocatedSpace, Map rules ) { + public FilesSet(String name, String description, boolean ignoreKnownFiles, boolean skipUnallocatedSpace, Map rules) { if ((name == null) || (name.isEmpty())) { throw new IllegalArgumentException("Interesting files set name cannot be null or empty"); } @@ -104,7 +104,7 @@ public final class FilesSet implements Serializable { * Returns whether or not this set of rules will process unallocated space. * * @return True if unallocated space should be processed, false if it should - * not be. + * not be. */ public boolean getSkipUnallocatedSpace() { return this.skipUnallocatedSpace; @@ -125,23 +125,23 @@ public final class FilesSet implements Serializable { * @param file A file to test for set membership. * * @return The name of the first set membership rule satisfied by the file, - * will be null if the file does not belong to the set. + * will be null if the file does not belong to the set. */ public String fileIsMemberOf(AbstractFile file) { if ((this.ignoreKnownFiles) && (file.getKnown() == TskData.FileKnown.KNOWN)) { return null; } - if ((this.skipUnallocatedSpace) && - (file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || - file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) || - file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) { - return null; + if ((this.skipUnallocatedSpace) + && (file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) + || file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) + || file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) { + return null; + } + + if ((rules.isEmpty())) { //WJS-TODO default filters have no rules they should pass, but what should non-default filters do with no rules? + return "All Files"; } - - if ((rules.isEmpty())){ - return "All Files"; //WJS-TODO Figure out how to make this return non-null when filter is default filter with no rules correctly - } for (Rule rule : rules.values()) { if (rule.isSatisfied(file)) { @@ -177,10 +177,10 @@ public final class FilesSet implements Serializable { /** * Construct an interesting files set membership rule. * - * @param ruleName The name of the rule. Can be empty string. + * @param ruleName The name of the rule. Can be empty string. * @param fileNameCondition A file name condition, may be null. * @param metaTypeCondition A file meta-type condition. - * @param pathCondition A file path condition, may be null. + * @param pathCondition A file path condition, may be null. * @param mimeTypeCondition A file mime type condition, may be null. * @param fileSizeCondition A file size condition, may be null. */ @@ -581,7 +581,7 @@ public final class FilesSet implements Serializable { * regular expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ boolean isRegex(); @@ -641,7 +641,7 @@ public final class FilesSet implements Serializable { * regular expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ @Override public boolean isRegex() { @@ -766,7 +766,7 @@ public final class FilesSet implements Serializable { * Construct a file name extension regular expression condition. * * @param extension The file name extension regular expression to be - * matched. + * matched. */ ExtensionCondition(Pattern extension) { super(extension.pattern(), false); @@ -797,7 +797,7 @@ public final class FilesSet implements Serializable { * expression. * * @return True if the text to be matched is a regular expression, - * false otherwise. + * false otherwise. */ boolean isRegex(); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index 8aac0f22a9..335159d8e4 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -66,11 +66,11 @@ - + - + - + @@ -563,9 +563,6 @@ - - - @@ -847,9 +844,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index e899c3c8d2..14bea1549e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -93,6 +93,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements this.fileSizeUnitComboBox.setVisible(false); this.fileSizeSpinner.setVisible(false); this.ruleDialogTitle = "FilesSetPanel.ingest.title"; + this.jLabel8.setVisible(false); this.equalitySignComboBox.setVisible(false); this.ignoreKnownFilesCheckbox.setVisible(false); @@ -105,7 +106,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements } else { this.ruleDialogTitle = "FilesSetPanel.interesting.title"; this.skipsUnallocCheckbox.setVisible(false); - + } } @@ -376,17 +377,18 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements * respond to user interactions with the dialog. * * @param selectedSet The currently selected files set, may be null to - * indicate a new interesting files set definition is to be created. + * indicate a new interesting files set definition is to + * be created. */ private void doFileSetsDialog(FilesSet selectedSet) { // Create a files set defintion panle. FilesSetPanel panel; if (selectedSet != null) { // Editing an existing set definition. - panel = new FilesSetPanel(selectedSet); + panel = new FilesSetPanel(selectedSet, panelType); } else { // Creating a new set definition. - panel = new FilesSetPanel(); + panel = new FilesSetPanel(panelType); } // Do a dialog box with the files set panel until the user either enters @@ -414,7 +416,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements // Preserve the existing rules from the set being edited. rules.putAll(selectedSet.getRules()); } - this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getSkipUnallocatedSpace(), rules); //WJS-TODO add support for skipUnallocatedSpaceFlag + this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getSkipUnallocatedSpace(), rules); } } @@ -423,14 +425,14 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements * dialog box and respond to user interactions with the dialog. * * @param selectedRule The currently selected rule, may be null to indicate - * a new rule definition is to be created. + * a new rule definition is to be created. */ private void doFilesSetRuleDialog(FilesSet.Rule selectedRule) { // Create a files set rule panel. FilesSetRulePanel panel; if (selectedRule != null) { // Editing an existing rule definition. - panel = new FilesSetRulePanel(selectedRule, okButton, cancelButton); + panel = new FilesSetRulePanel(selectedRule, okButton, cancelButton, panelType); } else { // Creating a new rule definition. panel = new FilesSetRulePanel(okButton, cancelButton, panelType); @@ -441,6 +443,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements int option = JOptionPane.OK_OPTION; do { option = JOptionPane.showOptionDialog(null, panel, NbBundle.getMessage(FilesSetPanel.class, ruleDialogTitle), JOptionPane.OK_CANCEL_OPTION, JOptionPane.PLAIN_MESSAGE, null, new Object[]{okButton, cancelButton}, okButton); + } while (option == JOptionPane.OK_OPTION && !panel.isValidRuleDefinition()); if (option == JOptionPane.OK_OPTION) { @@ -476,14 +479,15 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements * owned by this panel. If there is a definition with the same name, it will * be replaced, so this is an add/edit operation. * - * @param oldSet A set to replace, null if the new set is not a replacement. - * @param name The name of the files set. - * @param description The description of the files set. - * @param ignoresKnownFiles Whether or not the files set ignores known - * files. - * @param rules The set membership rules for the set. + * @param oldSet A set to replace, null if the new set is + * not a replacement. + * @param name The name of the files set. + * @param description The description of the files set. + * @param ignoresKnownFiles Whether or not the files set ignores + * known files. + * @param rules The set membership rules for the set. * @param processesUnallocatedSpace Whether or not this set of rules - * processes unallocated space + * processes unallocated space */ void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, boolean skipsUnallocatedSpace, Map rules) { if (oldSet != null) { @@ -667,11 +671,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements ignoreKnownFilesCheckbox.setFont(ignoreKnownFilesCheckbox.getFont().deriveFont(ignoreKnownFilesCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ignoreKnownFilesCheckbox.text")); // NOI18N ignoreKnownFilesCheckbox.setEnabled(false); - ignoreKnownFilesCheckbox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - ignoreKnownFilesCheckboxActionPerformed(evt); - } - }); fileNameRegexCheckbox.setFont(fileNameRegexCheckbox.getFont().deriveFont(fileNameRegexCheckbox.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(fileNameRegexCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameRegexCheckbox.text")); // NOI18N @@ -773,11 +772,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements org.openide.awt.Mnemonics.setLocalizedText(skipsUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.skipsUnallocCheckbox.text")); // NOI18N skipsUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText")); // NOI18N skipsUnallocCheckbox.setEnabled(false); - skipsUnallocCheckbox.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - skipsUnallocCheckboxActionPerformed(evt); - } - }); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); @@ -872,6 +866,9 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addComponent(jLabel6))) .addGap(17, 17, 17)) ); + + jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteSetButton, editSetButton, newSetButton}); + jPanel1Layout.setVerticalGroup( jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() @@ -963,10 +960,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements ); }// //GEN-END:initComponents - private void skipsUnallocCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_skipsUnallocCheckboxActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_skipsUnallocCheckboxActionPerformed - private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed // TODO add your handling code here: }//GEN-LAST:event_dirsRadioButtonActionPerformed @@ -1009,10 +1002,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_deleteSetButtonActionPerformed - private void ignoreKnownFilesCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_ignoreKnownFilesCheckboxActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_ignoreKnownFilesCheckboxActionPerformed - private void fileNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameTextFieldActionPerformed // TODO add your handling code here: }//GEN-LAST:event_fileNameTextFieldActionPerformed diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form index 79f9f93cf1..e11948ca0a 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form @@ -29,7 +29,7 @@ - + @@ -60,7 +60,7 @@ - + @@ -131,9 +131,6 @@ - - - diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 06294fd860..4f11c48fe7 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -18,9 +18,12 @@ */ package org.sleuthkit.autopsy.modules.interestingitems; +import java.awt.event.ActionEvent; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel.PANEL_TYPE; /** * A panel that allows a user to create and edit interesting files set @@ -28,13 +31,18 @@ import org.openide.util.NbBundle; */ public class FilesSetPanel extends javax.swing.JPanel { - @NbBundle.Messages("FilesSetPanel.ingest.title=File Ingest Filter") /** * Construct a files set panel in create mode. */ - FilesSetPanel() { + FilesSetPanel(PANEL_TYPE panelType) { initComponents(); + if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { + ignoreKnownFilesCheckbox.setVisible(false); + org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.ingest.nameLabel.text")); // NOI18N + } else { + skipsUnallocCheckbox.setVisible(false); + } } /** @@ -42,8 +50,13 @@ public class FilesSetPanel extends javax.swing.JPanel { * * @param filesSet The files set to be edited. */ - FilesSetPanel(FilesSet filesSet) { + FilesSetPanel(FilesSet filesSet, PANEL_TYPE panelType) { initComponents(); + if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { + ignoreKnownFilesCheckbox.setVisible(false); + } else { + skipsUnallocCheckbox.setVisible(false); + } this.nameTextField.setText(filesSet.getName()); this.descTextArea.setText(filesSet.getDescription()); this.ignoreKnownFilesCheckbox.setSelected(filesSet.ignoresKnownFiles()); @@ -64,6 +77,25 @@ public class FilesSetPanel extends javax.swing.JPanel { NotifyDescriptor.WARNING_MESSAGE); DialogDisplayer.getDefault().notify(notifyDesc); return false; + } else { + // The FileIngestFilters have reserved names for default filter, and creating a new filter from the jComboBox + // These names if used would have undefined results, so prohibiting the user from using them is necessary + for (FilesSet filesSet : IngestJobSettings.getStandardFileIngestFilters()) { + if (this.nameTextField.getText().equals(filesSet.getName())) { + NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( + NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.messages.filesSetsReservedName"), + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(notifyDesc); + return false; + } + } + if (this.nameTextField.getText().equals(FileIngestFilterDefsOptionsPanelController.NEW_FILE_INGEST_FILTER)) { + NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( + NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.messages.filesSetsReservedName"), + NotifyDescriptor.WARNING_MESSAGE); + DialogDisplayer.getDefault().notify(notifyDesc); + return false; + } } return true; } @@ -99,12 +131,12 @@ public class FilesSetPanel extends javax.swing.JPanel { } /** - * + * */ boolean getSkipUnallocatedSpace() { return skipsUnallocCheckbox.isSelected(); } - + /** * This method is called from within the constructor to initialize the form. * WARNING: Do NOT modify this code. The content of this method is always @@ -122,7 +154,7 @@ public class FilesSetPanel extends javax.swing.JPanel { ignoreKnownFilesCheckbox = new javax.swing.JCheckBox(); skipsUnallocCheckbox = new javax.swing.JCheckBox(); - org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.nameLabel.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.interesting.nameLabel.text")); // NOI18N descPanel.setBorder(javax.swing.BorderFactory.createTitledBorder(org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.descPanel.border.title"))); // NOI18N @@ -160,16 +192,15 @@ public class FilesSetPanel extends javax.swing.JPanel { .addContainerGap() .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(descPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addGap(0, 0, Short.MAX_VALUE) - .addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() - .addComponent(ignoreKnownFilesCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(skipsUnallocCheckbox)))) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addGap(0, 0, Short.MAX_VALUE) + .addComponent(nameLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 71, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 299, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() + .addComponent(ignoreKnownFilesCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( @@ -190,7 +221,6 @@ public class FilesSetPanel extends javax.swing.JPanel { }// //GEN-END:initComponents - // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JPanel descPanel; private javax.swing.JScrollPane descScrollPanel; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index 72b506199a..fed1dc5341 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -252,7 +252,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index 77740f90ec..cd5cf0ee04 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -68,15 +68,16 @@ final class FilesSetRulePanel extends javax.swing.JPanel { */ FilesSetRulePanel(JButton okButton, JButton cancelButton, PANEL_TYPE panelType) { initComponents(); - if (panelType == FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS){ //Hide the mimetype settings when this is displaying a FileSet rule instead of a interesting item rule + if (panelType == FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS) { //Hide the mimetype settings when this is displaying a FileSet rule instead of a interesting item rule mimeTypeComboBox.setVisible(false); mimeCheck.setVisible(false); fileSizeComboBox.setVisible(false); fileSizeCheck.setVisible(false); equalitySymbolComboBox.setVisible(false); fileSizeSpinner.setVisible(false); - } - else { + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ingest.jLabel5.text")); // NOI18N + + } else { populateMimeTypesComboBox(); } populateComponentsWithDefaultValues(); @@ -88,15 +89,25 @@ final class FilesSetRulePanel extends javax.swing.JPanel { * * @param rule The files set rule to be edited. */ - FilesSetRulePanel(FilesSet.Rule rule, JButton okButton, JButton cancelButton) { + FilesSetRulePanel(FilesSet.Rule rule, JButton okButton, JButton cancelButton, PANEL_TYPE panelType) { initComponents(); + if (panelType == FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS) { //Hide the mimetype settings when this is displaying a FileSet rule instead of a interesting item rule + mimeTypeComboBox.setVisible(false); + mimeCheck.setVisible(false); + fileSizeComboBox.setVisible(false); + fileSizeCheck.setVisible(false); + equalitySymbolComboBox.setVisible(false); + fileSizeSpinner.setVisible(false); + } else { + populateMimeTypesComboBox(); + populateMimeConditionComponents(rule); + populateSizeConditionComponents(rule); + } populateMimeTypesComboBox(); populateRuleNameComponent(rule); populateTypeConditionComponents(rule); populateNameConditionComponents(rule); populatePathConditionComponents(rule); - populateMimeConditionComponents(rule); - populateSizeConditionComponents(rule); this.setButtons(okButton, cancelButton); } @@ -632,7 +643,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(pathSeparatorInfoLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.pathSeparatorInfoLabel.text")); // NOI18N pathSeparatorInfoLabel.setEnabled(false); - org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.jLabel5.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.interesting.jLabel5.text")); // NOI18N mimeTypeComboBox.setEditable(true); mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); @@ -644,7 +655,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { fileSizeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetRulePanel_bytes(), Bundle.FilesSetRulePanel_kiloBytes(), Bundle.FilesSetRulePanel_megaBytes(), Bundle.FilesSetRulePanel_gigaBytes() })); fileSizeComboBox.setEnabled(false); - fileSizeSpinner.setModel(new javax.swing.SpinnerNumberModel(Integer.valueOf(0), Integer.valueOf(0), null, Integer.valueOf(1))); + fileSizeSpinner.setModel(new javax.swing.SpinnerNumberModel(0, 0, null, 1)); fileSizeSpinner.setEnabled(false); org.openide.awt.Mnemonics.setLocalizedText(nameCheck, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.nameCheck.text")); // NOI18N diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java index 35036326a3..478d5cf053 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java @@ -22,13 +22,16 @@ import java.io.Serializable; import java.util.Map; /** - * A map of FilesSets for saving all the settings in FilesSetsManager in one item. - * + * A map of FilesSets for saving all the settings in FilesSetsManager in one + * item. + * * @author oliver */ class FilesSetSettings implements Serializable { + private static final long serialVersionUID = 1L; private Map filesSets; + FilesSetSettings(Map filesSets) { this.filesSets = filesSets; } @@ -39,7 +42,5 @@ class FilesSetSettings implements Serializable { Map getFilesSets() { return filesSets; } - - - + } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index b257e692e1..55cffce5d9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -114,7 +114,7 @@ public final class FilesSetsManager extends Observable { * Gets a copy of the current interesting files set definitions. * * @return A map of interesting files set names to interesting file sets, - * possibly empty. + * possibly empty. */ Map getInterestingFilesSets() throws FilesSetsManagerException { synchronized (INTERESTING_FILES_SET_LOCK) { @@ -129,12 +129,12 @@ public final class FilesSetsManager extends Observable { * @return A map of FilesSet names to file ingest sets, possibly empty. */ public Map getFileIngestFiltersWithDefaults() throws FilesSetsManagerException { - Map returnMap = new HashMap<>(); - for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { - returnMap.put(fSet.getName(), fSet); - } - returnMap.putAll(getFileIngestFilters()); - return returnMap; + Map returnMap = new HashMap<>(); + for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { + returnMap.put(fSet.getName(), fSet); + } + returnMap.putAll(getFileIngestFilters()); + return returnMap; } /** @@ -156,7 +156,7 @@ public final class FilesSetsManager extends Observable { * previous definitions. * * @param filesSets A mapping of interesting files set names to files sets, - * used to enforce unique files set names. + * used to enforce unique files set names. */ void setInterestingFilesSets(Map filesSets) throws FilesSetsManagerException { synchronized (INTERESTING_FILES_SET_LOCK) { @@ -171,7 +171,7 @@ public final class FilesSetsManager extends Observable { * previous definitions. * * @param filesSets A mapping of interesting files set names to files sets, - * used to enforce unique files set names. + * used to enforce unique files set names. */ void setFileIngestFilter(Map filesSets) throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { @@ -214,8 +214,8 @@ public final class FilesSetsManager extends Observable { /** * Reads interesting file set definitions from an XML file. * - * @param fileName The name of the file which is expected to store the - * serialized definitions + * @param fileName The name of the file which is expected to store + * the serialized definitions * @param legacyFilePath Path of the set definitions file as a string. * * @return The set definitions in a map of set names to sets. @@ -269,7 +269,7 @@ public final class FilesSetsManager extends Observable { * Reads the definitions from the serialization file * * @return the map representing settings saved to serialization file, - * empty set if the file does not exist. + * empty set if the file does not exist. * * @throws FilesSetsManagerException if file could not be read */ @@ -295,9 +295,9 @@ public final class FilesSetsManager extends Observable { /** * Reads in an interesting files set. * - * @param setElem An interesting files set XML element + * @param setElem An interesting files set XML element * @param filesSets A collection to which the set is to be added. - * @param filePath The source file, used for error reporting. + * @param filePath The source file, used for error reporting. */ private static void readFilesSet(Element setElem, Map filesSets, String filePath) { // The file set must have a unique name. @@ -381,7 +381,7 @@ public final class FilesSetsManager extends Observable { * @param elem The file name rule XML element. * * @return A file name rule, or null if there is an error (the error is - * logged). + * logged). */ private static FilesSet.Rule readFileNameRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); @@ -439,7 +439,7 @@ public final class FilesSetsManager extends Observable { * @param elem The file name extension rule XML element. * * @return A file name extension rule, or null if there is an error (the - * error is logged). + * error is logged). */ private static FilesSet.Rule readFileExtensionRule(Element elem) { String ruleName = FilesSetXML.readRuleName(elem); @@ -532,7 +532,7 @@ public final class FilesSetsManager extends Observable { * @param ruleElement The XML element. * * @return The meta-type condition, or null if there is an error - * (logged). + * (logged). */ private static FilesSet.Rule.MetaTypeCondition readMetaTypeCondition(Element ruleElement) { FilesSet.Rule.MetaTypeCondition condition = null; From 4ec8e0f7ffec89798928562fee4d8e14eaaa1262 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Mon, 9 Jan 2017 17:57:39 -0500 Subject: [PATCH 24/50] 1903 fixed some netbeans warnings --- Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java | 1 - .../FileIngestFilterDefsOptionsPanelController.java | 3 --- .../sleuthkit/autopsy/modules/interestingitems/FilesSet.java | 1 - .../autopsy/modules/interestingitems/FilesSetPanel.java | 1 - .../autopsy/modules/interestingitems/FilesSetSettings.java | 2 +- .../autopsy/modules/interestingitems/FilesSetsManager.java | 1 - 6 files changed, 1 insertion(+), 8 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index b8d2e3d0f0..f858555d91 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -32,7 +32,6 @@ import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.logging.Level; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index fd7daa5009..25cae770d1 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -22,12 +22,9 @@ import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; import java.util.ArrayList; -import java.util.TreeMap; -import java.util.logging.Level; import javax.swing.JComponent; import javax.swing.SwingUtilities; import org.netbeans.spi.options.OptionsPanelController; -import org.openide.util.Exceptions; import org.openide.util.HelpCtx; import org.openide.util.Lookup; import org.sleuthkit.autopsy.coreutils.Logger; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 89141b2eea..8c661c5e3d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.regex.Pattern; -import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 4f11c48fe7..12e053a38d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -18,7 +18,6 @@ */ package org.sleuthkit.autopsy.modules.interestingitems; -import java.awt.event.ActionEvent; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java index 478d5cf053..6ce996423b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java @@ -30,7 +30,7 @@ import java.util.Map; class FilesSetSettings implements Serializable { private static final long serialVersionUID = 1L; - private Map filesSets; + private final Map filesSets; FilesSetSettings(Map filesSets) { this.filesSets = filesSets; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 55cffce5d9..ad9257812e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -32,7 +32,6 @@ import java.util.Observable; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; -import org.openide.util.Exceptions; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; import org.sleuthkit.autopsy.coreutils.Logger; From 5c8206e5ea5b1becf551a15491b23bb10dc1d4f0 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 10 Jan 2017 11:21:02 -0500 Subject: [PATCH 25/50] 1903 fixed empty rule list case to not provide hits --- .../modules/interestingitems/FilesSet.java | 14 ++++++-------- .../interestingitems/FilesSetsManager.java | 17 +++++++++-------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 8c661c5e3d..8a2946ec17 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -25,6 +25,7 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.regex.Pattern; +import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; @@ -137,14 +138,11 @@ public final class FilesSet implements Serializable { || file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) { return null; } - - if ((rules.isEmpty())) { //WJS-TODO default filters have no rules they should pass, but what should non-default filters do with no rules? - return "All Files"; - } - - for (Rule rule : rules.values()) { - if (rule.isSatisfied(file)) { - return rule.getName(); + //default filters have no rules and they need to pass this test, + //however a regular FilesSet with no rules should not pass any files + for (FilesSet defaultFilter : IngestJobSettings.getStandardFileIngestFilters()){ + if (name.equals(defaultFilter.getName())){ + return defaultFilter.getName(); } } return null; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index ad9257812e..0f87f6df1b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -22,6 +22,8 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.nio.file.Path; +import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -230,7 +232,7 @@ public final class FilesSetsManager extends Observable { } // Check if the legacy xml file exists. if (!legacyFileName.isEmpty()) { - File defsFile = new File(PlatformUtil.getUserConfigDirectory() + File.separator + legacyFileName); + File defsFile = Paths.get(PlatformUtil.getUserConfigDirectory(),legacyFileName).toFile(); if (!defsFile.exists()) { return filesSets; } @@ -273,18 +275,17 @@ public final class FilesSetsManager extends Observable { * @throws FilesSetsManagerException if file could not be read */ private static Map readSerializedDefinitions(String serialFileName) throws FilesSetsManagerException { - String filePath; - filePath = PlatformUtil.getUserConfigDirectory() + File.separator + serialFileName; - System.out.println(filePath); - File fileSetFile = new File(filePath); + Path filePath = Paths.get(PlatformUtil.getUserConfigDirectory(),serialFileName); + File fileSetFile = filePath.toFile(); + String filePathStr = filePath.toString(); if (fileSetFile.exists()) { try { - try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePath))) { + try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { FilesSetSettings filesSetsSettings = (FilesSetSettings) in.readObject(); return filesSetsSettings.getFilesSets(); } } catch (IOException | ClassNotFoundException ex) { - throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePath), ex); + throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); } } else { return new HashMap<>(); @@ -597,7 +598,7 @@ public final class FilesSetsManager extends Observable { // multiple intersting files set definition files, e.g., one for // definitions that ship with Autopsy and one for user definitions. static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws FilesSetsManagerException { - try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(PlatformUtil.getUserConfigDirectory() + File.separator + fileName))) { + try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), fileName).toString()))) { out.writeObject(new FilesSetSettings(interestingFilesSets)); } catch (IOException ex) { throw new FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex); From 9f0fa6784929adf8a853666f1fb392b334604ceb Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 10 Jan 2017 11:21:55 -0500 Subject: [PATCH 26/50] 1903 formatting in FilesSet.java --- .../sleuthkit/autopsy/modules/interestingitems/FilesSet.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 8a2946ec17..fe05a38354 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -140,8 +140,8 @@ public final class FilesSet implements Serializable { } //default filters have no rules and they need to pass this test, //however a regular FilesSet with no rules should not pass any files - for (FilesSet defaultFilter : IngestJobSettings.getStandardFileIngestFilters()){ - if (name.equals(defaultFilter.getName())){ + for (FilesSet defaultFilter : IngestJobSettings.getStandardFileIngestFilters()) { + if (name.equals(defaultFilter.getName())) { return defaultFilter.getName(); } } From 4cca7d6df2bae91d57ce04626061da0642fb59fe Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 10 Jan 2017 12:56:34 -0500 Subject: [PATCH 27/50] 1903 restored accidently removed rule checking in FilesSet --- .../sleuthkit/autopsy/modules/interestingitems/FilesSet.java | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index fe05a38354..8f78dd331b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -145,6 +145,11 @@ public final class FilesSet implements Serializable { return defaultFilter.getName(); } } + for (Rule rule : rules.values()) { + if (rule.isSatisfied(file)) { + return rule.getName(); + } + } return null; } From fa2ce5b6bb52e8306b56fe26d224be77109e566e Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 10 Jan 2017 18:04:29 -0500 Subject: [PATCH 28/50] 1903 empty space issue with FilesSetDefsPanel fixed --- .../interestingitems/FilesSetDefsPanel.form | 193 +++++++++--------- .../interestingitems/FilesSetDefsPanel.java | 172 +++++++--------- 2 files changed, 167 insertions(+), 198 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index 335159d8e4..64ec4db08b 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -29,12 +29,12 @@ - + - + @@ -65,87 +65,83 @@ - + + + - - - - - - - - - - - - - - - - + - - + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + - + + + + + - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -153,31 +149,24 @@ - - - - - - - - - - - - - - + + + + + + + + + - - - + @@ -191,11 +180,11 @@ - + - - + + @@ -206,9 +195,9 @@ - - - + + + @@ -216,8 +205,8 @@ - - + + @@ -225,7 +214,7 @@ - + @@ -243,26 +232,26 @@ - + - + - + - + @@ -387,6 +376,12 @@ + + + + + + @@ -506,9 +501,6 @@ - - - @@ -693,9 +685,6 @@ - - - @@ -779,7 +768,9 @@ - + + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 14bea1549e..d6651a3a2d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -612,6 +612,8 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements rulesListScrollPane.setViewportView(rulesList); setDescScrollPanel.setFont(setDescScrollPanel.getFont().deriveFont(setDescScrollPanel.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); + setDescScrollPanel.setMinimumSize(new java.awt.Dimension(10, 22)); + setDescScrollPanel.setPreferredSize(new java.awt.Dimension(14, 40)); setDescriptionTextArea.setEditable(false); setDescriptionTextArea.setBackground(new java.awt.Color(240, 240, 240)); @@ -650,11 +652,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements fileNameTextField.setEditable(false); fileNameTextField.setFont(fileNameTextField.getFont().deriveFont(fileNameTextField.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); fileNameTextField.setText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.fileNameTextField.text")); // NOI18N - fileNameTextField.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - fileNameTextFieldActionPerformed(evt); - } - }); jLabel5.setFont(jLabel5.getFont().deriveFont(jLabel5.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(jLabel5, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel5.text")); // NOI18N @@ -722,11 +719,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements dirsRadioButton.setFont(dirsRadioButton.getFont().deriveFont(dirsRadioButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(dirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.dirsRadioButton.text")); // NOI18N dirsRadioButton.setEnabled(false); - dirsRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - dirsRadioButtonActionPerformed(evt); - } - }); jLabel1.setFont(jLabel1.getFont().deriveFont(jLabel1.getFont().getStyle() & ~java.awt.Font.BOLD, 11)); org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel1.text")); // NOI18N @@ -752,7 +744,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements org.openide.awt.Mnemonics.setLocalizedText(jLabel7, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.jLabel7.text")); // NOI18N - mimeTypeComboBox.setEditable(true); + mimeTypeComboBox.setBackground(new java.awt.Color(240, 240, 240)); mimeTypeComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] {""})); mimeTypeComboBox.setEnabled(false); mimeTypeComboBox.setMinimumSize(new java.awt.Dimension(0, 20)); @@ -780,91 +772,85 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addGroup(jPanel1Layout.createSequentialGroup() .addContainerGap() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(setsListLabel) + .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(newSetButton) .addGap(9, 9, 9) .addComponent(editSetButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(deleteSetButton)) + .addComponent(setsListScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 344, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(setsListLabel) - .addComponent(jScrollPane2, javax.swing.GroupLayout.PREFERRED_SIZE, 314, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(28, 28, 28)) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(setsListScrollPane) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED))) - .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, 6, javax.swing.GroupLayout.PREFERRED_SIZE))) - .addGap(4, 4, 4) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addGap(20, 20, 20) + .addGap(29, 29, 29) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3) - .addComponent(jLabel2)) - .addGap(6, 6, 6)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(jLabel4) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED))) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rulePathConditionTextField) - .addComponent(fileNameTextField))) .addGroup(jPanel1Layout.createSequentialGroup() .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(jLabel7) .addComponent(jLabel8)) - .addGap(6, 6, 6) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 38, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, 314, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 83, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(8, 8, 8)) - .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.Alignment.LEADING, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))))) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(rulesListLabel) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false) - .addComponent(setDescScrollPanel, javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel1, javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addGap(92, 92, 92) - .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(dirsRadioButton) + .addGap(18, 18, 18)) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel2)) + .addGap(6, 6, 6)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(equalitySignComboBox, 0, 32, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(bothRadioButton)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileSizeUnitComboBox, 0, 73, Short.MAX_VALUE)) + .addComponent(mimeTypeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(rulePathConditionTextField) + .addComponent(fileNameTextField))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(101, 101, 101) + .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(dirsRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(bothRadioButton)) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(105, 105, 105) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(fileNameRadioButton) + .addGap(4, 4, 4) + .addComponent(fileNameExtensionRadioButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(fileNameRegexCheckbox)) + .addComponent(rulePathConditionRegexCheckBox))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(rulesListLabel) + .addComponent(jLabel1) + .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(newRuleButton) .addGap(18, 18, 18) .addComponent(editRuleButton) .addGap(18, 18, 18) .addComponent(deleteRuleButton)) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() - .addGap(96, 96, 96) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addComponent(fileNameRadioButton) - .addGap(4, 4, 4) - .addComponent(fileNameExtensionRadioButton) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(fileNameRegexCheckbox)) - .addComponent(rulePathConditionRegexCheckBox))) - .addGroup(javax.swing.GroupLayout.Alignment.LEADING, jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(ignoreKnownFilesCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addComponent(rulesListScrollPane, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 528, Short.MAX_VALUE)) - .addComponent(jLabel5) - .addComponent(jLabel6))) - .addGap(17, 17, 17)) + .addComponent(jLabel5) + .addComponent(jLabel6))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(setDescScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)))) + .addContainerGap(18, Short.MAX_VALUE)) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteSetButton, editSetButton, newSetButton}); @@ -879,10 +865,10 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(jScrollPane2, 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(setsListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(setsListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE) + .addComponent(setsListScrollPane) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newSetButton) @@ -892,24 +878,24 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addComponent(jLabel6) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel5) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(1, 1, 1) + .addComponent(setDescScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 45, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(6, 6, 6) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ignoreKnownFilesCheckbox) .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rulesListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 67, Short.MAX_VALUE) - .addGap(10, 10, 10) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 64, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(newRuleButton) .addComponent(editRuleButton) .addComponent(deleteRuleButton)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(jLabel1) - .addGap(2, 2, 2) + .addGap(8, 8, 8) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel2) .addComponent(filesRadioButton) @@ -924,23 +910,23 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addComponent(fileNameRadioButton) .addComponent(fileNameExtensionRadioButton) .addComponent(fileNameRegexCheckbox)) - .addGap(14, 14, 14) + .addGap(16, 16, 16) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel4) .addComponent(rulePathConditionTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addGap(7, 7, 7) .addComponent(rulePathConditionRegexCheckBox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel7) .addComponent(mimeTypeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(16, 16, 16) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(jLabel8) .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(13, 13, 13))) + .addGap(10, 10, 10))) .addGap(5, 5, 5)))) ); @@ -952,18 +938,14 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1) + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) ); }// //GEN-END:initComponents - private void dirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_dirsRadioButtonActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_dirsRadioButtonActionPerformed - private void newSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newSetButtonActionPerformed this.doFileSetsDialog(null); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); @@ -1002,10 +984,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); }//GEN-LAST:event_deleteSetButtonActionPerformed - private void fileNameTextFieldActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameTextFieldActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_fileNameTextFieldActionPerformed - private void editSetButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editSetButtonActionPerformed this.doFileSetsDialog(this.setsList.getSelectedValue()); firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null); From 7d5d4882894b90c6b88b3cb584c5a879fc275e66 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 10 Jan 2017 18:45:27 -0500 Subject: [PATCH 29/50] 1903 fixed minor formatting issue with panel --- .../interestingitems/Bundle.properties | 4 +- .../interestingitems/Bundle_ja.properties | 2 +- .../interestingitems/FilesSetDefsPanel.form | 87 ++++++++++--------- .../interestingitems/FilesSetDefsPanel.java | 66 +++++++------- 4 files changed, 82 insertions(+), 77 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 1c9c852496..feebbb2689 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -57,6 +57,8 @@ FilesSetDefsPanel.interesting.deleteSetButton.text=Delete Set FilesSetDefsPanel.ingest.deleteSetButton.text=Delete Filter FilesSetDefsPanel.interesting.jLabel6.text=Set Details FilesSetDefsPanel.ingest.jLabel6.text=Filter Details + +FilesSetDefsPanel.newRuleButton.text=New Rule FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. FilesSetDefsPanel.skipsUnallocCheckbox.text=Skip Unallocated Space FilesSetDefsPanel.jLabel8.text=File Size: @@ -79,5 +81,3 @@ FilesSetDefsPanel.fileNameExtensionRadioButton.text=Extension Only FilesSetDefsPanel.rulesListLabel.text=Rules: FilesSetDefsPanel.editRuleButton.text=Edit Rule FilesSetDefsPanel.filesRadioButton.text=Files -FilesSetDefsPanel.newRuleButton.text=New Rule - diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties index 60267adc77..078be65eb0 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle_ja.properties @@ -32,6 +32,7 @@ FilesSetDefsPanel.interesting.setsListLabel.text=\u30eb\u30fc\u30eb\u30bb\u30c3\ FilesSetDefsPanel.interesting.editSetButton.text=\u30bb\u30c3\u30c8\u3092\u7de8\u96c6 FilesSetDefsPanel.interesting.newSetButton.text=\u65b0\u898f\u30bb\u30c3\u30c8 FilesSetDefsPanel.interesting.deleteSetButton.text=\u30bb\u30c3\u30c8\u3092\u524a\u9664 +FilesSetDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb FilesSetDefsPanel.rulePathConditionRegexCheckBox.text=\u6b63\u898f\u8868\u73fe FilesSetDefsPanel.jLabel4.text=\u30d1\u30b9\u30d1\u30bf\u30fc\u30f3\uff1a FilesSetDefsPanel.jLabel1.text=\u30eb\u30fc\u30eb\u8a73\u7d30 @@ -48,4 +49,3 @@ FilesSetDefsPanel.fileNameExtensionRadioButton.text=\u62e1\u5f35\u5b50\u306e\u30 FilesSetDefsPanel.rulesListLabel.text=\u30eb\u30fc\u30eb\uff1a FilesSetDefsPanel.editRuleButton.text=\u30eb\u30fc\u30eb\u3092\u7de8\u96c6 FilesSetDefsPanel.filesRadioButton.text=\u30d5\u30a1\u30a4\u30eb -FilesSetDefsPanel.newRuleButton.text=\u65b0\u898f\u30eb\u30fc\u30eb diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index 64ec4db08b..df68a806ff 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -29,12 +29,15 @@ - + + + + - + @@ -79,43 +82,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -158,15 +124,52 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + - + @@ -251,7 +254,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index d6651a3a2d..3ca606ac55 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -784,33 +784,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(separator, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGap(29, 29, 29) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel7) - .addComponent(jLabel8)) - .addGap(18, 18, 18)) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(jPanel1Layout.createSequentialGroup() - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jLabel3) - .addComponent(jLabel2)) - .addGap(6, 6, 6)) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(jLabel4) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))) - .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() - .addComponent(equalitySignComboBox, 0, 32, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, 206, Short.MAX_VALUE) - .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(fileSizeUnitComboBox, 0, 73, Short.MAX_VALUE)) - .addComponent(mimeTypeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(rulePathConditionTextField) - .addComponent(fileNameTextField))) .addGroup(jPanel1Layout.createSequentialGroup() .addGap(101, 101, 101) .addComponent(filesRadioButton, javax.swing.GroupLayout.PREFERRED_SIZE, 47, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -845,12 +818,39 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel5) .addComponent(jLabel6))) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGap(29, 29, 29) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel7) + .addComponent(jLabel8)) + .addGap(18, 18, 18)) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addGroup(jPanel1Layout.createSequentialGroup() + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(jLabel3) + .addComponent(jLabel2)) + .addGap(6, 6, 6)) + .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup() + .addComponent(jLabel4) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)))) + .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) + .addComponent(mimeTypeComboBox, 0, 313, Short.MAX_VALUE) + .addComponent(rulePathConditionTextField) + .addGroup(jPanel1Layout.createSequentialGroup() + .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 44, javax.swing.GroupLayout.PREFERRED_SIZE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileSizeSpinner, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) + .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 81, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(fileNameTextField))) .addGroup(jPanel1Layout.createSequentialGroup() .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addComponent(setDescScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) - .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 424, Short.MAX_VALUE)))) - .addContainerGap(18, Short.MAX_VALUE)) + .addComponent(rulesListScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 414, Short.MAX_VALUE)))) + .addGap(18, 18, 18)) ); jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteSetButton, editSetButton, newSetButton}); @@ -926,7 +926,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements .addComponent(equalitySignComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeSpinner, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) .addComponent(fileSizeUnitComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)) - .addGap(10, 10, 10))) + .addGap(5, 5, 5))) .addGap(5, 5, 5)))) ); @@ -938,11 +938,13 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements this.setLayout(layout); layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGroup(layout.createSequentialGroup() + .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addGap(0, 0, Short.MAX_VALUE)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) + .addComponent(jScrollPane1) ); }// //GEN-END:initComponents From 39d36df4767baad967d4bce9122562cb1ac1b1bf Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 10 Jan 2017 18:56:09 -0500 Subject: [PATCH 30/50] 1903 yet another minor formatting change --- .../autopsy/modules/interestingitems/FilesSetDefsPanel.form | 4 ++-- .../autopsy/modules/interestingitems/FilesSetDefsPanel.java | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index df68a806ff..ccd3e27895 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -30,8 +30,8 @@ - - + + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 3ca606ac55..1c8bee77e6 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -939,8 +939,8 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements layout.setHorizontalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) .addGroup(layout.createSequentialGroup() - .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE) - .addGap(0, 0, Short.MAX_VALUE)) + .addComponent(jScrollPane1) + .addGap(0, 0, 0)) ); layout.setVerticalGroup( layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING) From 258cfbf4ab643ffbe652e733d8e28abf65b444e4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Tue, 10 Jan 2017 19:31:20 -0500 Subject: [PATCH 31/50] 1903-changed option for FilesAndDirs to All on rule creation --- .../interestingitems/Bundle.properties | 2 +- .../interestingitems/FilesSetRulePanel.form | 13 +++--- .../interestingitems/FilesSetRulePanel.java | 39 +++++++--------- .../interestingitems/FilesSetsManager.java | 44 +++++++++---------- 4 files changed, 43 insertions(+), 55 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index feebbb2689..1a3e158be9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -44,7 +44,6 @@ FilesSetRulePanel.mimeCheck.text=MIME Type: FilesSetRulePanel.fileSizeCheck.text=File Size: FilesSetRulePanel.filesRadioButton.text=Files FilesSetRulePanel.dirsRadioButton.text=Directories -FilesSetRulePanel.filesAndDirsRadioButton.text=Files and Directories FilesSetDefsPanel.interesting.setsListLabel.text=Rule Sets FilesSetDefsPanel.ingest.setsListLabel.text=File Ingest Filters FilesSetDefsPanel.interesting.jTextArea1.text=This module allows you to find files that match specified criteria. Each set has a list of rules, which will match on file name and parent path patterns. @@ -81,3 +80,4 @@ FilesSetDefsPanel.fileNameExtensionRadioButton.text=Extension Only FilesSetDefsPanel.rulesListLabel.text=Rules: FilesSetDefsPanel.editRuleButton.text=Edit Rule FilesSetDefsPanel.filesRadioButton.text=Files +FilesSetRulePanel.allRadioButton.text=All diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form index fed1dc5341..4777c108b4 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.form @@ -42,7 +42,7 @@ - + @@ -111,7 +111,7 @@ - + @@ -199,9 +199,6 @@ - - - @@ -370,17 +367,17 @@ - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java index cd5cf0ee04..f53700c34e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetRulePanel.java @@ -39,7 +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 interesting files set + * A panel that allows a user to create and edit files set * membership rules. */ final class FilesSetRulePanel extends javax.swing.JPanel { @@ -251,8 +251,8 @@ final class FilesSetRulePanel extends javax.swing.JPanel { case DIRECTORIES: this.dirsRadioButton.setSelected(true); break; - case FILES_AND_DIRECTORIES: - this.filesAndDirsRadioButton.setSelected(true); + case ALL: + this.allRadioButton.setSelected(true); break; } } @@ -295,7 +295,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { /** * Returns whether or not the data entered in the panel constitutes a valid - * interesting files set membership rule definition, displaying a dialog + * 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. @@ -479,7 +479,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } else if (this.dirsRadioButton.isSelected()) { return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); } else { - return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); + return new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.ALL); } } @@ -601,7 +601,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { fileSizeCheck = new javax.swing.JCheckBox(); filesRadioButton = new javax.swing.JRadioButton(); dirsRadioButton = new javax.swing.JRadioButton(); - filesAndDirsRadioButton = new javax.swing.JRadioButton(); + allRadioButton = new javax.swing.JRadioButton(); org.openide.awt.Mnemonics.setLocalizedText(ruleNameLabel, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.ruleNameLabel.text")); // NOI18N @@ -620,11 +620,6 @@ final class FilesSetRulePanel extends javax.swing.JPanel { nameButtonGroup.add(fullNameRadioButton); org.openide.awt.Mnemonics.setLocalizedText(fullNameRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.fullNameRadioButton.text")); // NOI18N fullNameRadioButton.setEnabled(false); - fullNameRadioButton.addActionListener(new java.awt.event.ActionListener() { - public void actionPerformed(java.awt.event.ActionEvent evt) { - fullNameRadioButtonActionPerformed(evt); - } - }); nameButtonGroup.add(extensionRadioButton); org.openide.awt.Mnemonics.setLocalizedText(extensionRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.extensionRadioButton.text")); // NOI18N @@ -702,11 +697,11 @@ final class FilesSetRulePanel extends javax.swing.JPanel { } }); - typeButtonGroup.add(filesAndDirsRadioButton); - org.openide.awt.Mnemonics.setLocalizedText(filesAndDirsRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.filesAndDirsRadioButton.text")); // NOI18N - filesAndDirsRadioButton.addActionListener(new java.awt.event.ActionListener() { + typeButtonGroup.add(allRadioButton); + org.openide.awt.Mnemonics.setLocalizedText(allRadioButton, org.openide.util.NbBundle.getMessage(FilesSetRulePanel.class, "FilesSetRulePanel.allRadioButton.text")); // NOI18N + allRadioButton.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { - filesAndDirsRadioButtonActionPerformed(evt); + allRadioButtonActionPerformed(evt); } }); @@ -733,7 +728,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) .addComponent(dirsRadioButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(filesAndDirsRadioButton))) + .addComponent(allRadioButton))) .addGap(0, 0, Short.MAX_VALUE)))) .addGroup(layout.createSequentialGroup() .addContainerGap() @@ -784,7 +779,7 @@ final class FilesSetRulePanel extends javax.swing.JPanel { .addComponent(jLabel1) .addComponent(filesRadioButton) .addComponent(dirsRadioButton) - .addComponent(filesAndDirsRadioButton)) + .addComponent(allRadioButton)) .addGap(5, 5, 5) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(nameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 20, javax.swing.GroupLayout.PREFERRED_SIZE) @@ -889,22 +884,18 @@ final class FilesSetRulePanel extends javax.swing.JPanel { this.setComponentsForSearchType(); }//GEN-LAST:event_dirsRadioButtonActionPerformed - private void filesAndDirsRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_filesAndDirsRadioButtonActionPerformed + private void allRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_allRadioButtonActionPerformed this.setComponentsForSearchType(); - }//GEN-LAST:event_filesAndDirsRadioButtonActionPerformed - - private void fullNameRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fullNameRadioButtonActionPerformed - // TODO add your handling code here: - }//GEN-LAST:event_fullNameRadioButtonActionPerformed + }//GEN-LAST:event_allRadioButtonActionPerformed // Variables declaration - do not modify//GEN-BEGIN:variables + private javax.swing.JRadioButton allRadioButton; private javax.swing.JRadioButton dirsRadioButton; private javax.swing.JComboBox equalitySymbolComboBox; private javax.swing.JRadioButton extensionRadioButton; private javax.swing.JCheckBox fileSizeCheck; private javax.swing.JComboBox fileSizeComboBox; private javax.swing.JSpinner fileSizeSpinner; - private javax.swing.JRadioButton filesAndDirsRadioButton; private javax.swing.JRadioButton filesRadioButton; private javax.swing.JRadioButton fullNameRadioButton; private javax.swing.JLabel jLabel1; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 0f87f6df1b..f434f1812f 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -62,7 +62,7 @@ public final class FilesSetsManager extends Observable { private static FilesSetsManager instance; /** - * Gets the interesting item definitions manager singleton. + * Gets the FilesSet definitions manager singleton. */ public synchronized static FilesSetsManager getInstance() { if (instance == null) { @@ -171,7 +171,7 @@ public final class FilesSetsManager extends Observable { * Sets the current interesting file sets definitions, replacing any * previous definitions. * - * @param filesSets A mapping of interesting files set names to files sets, + * @param filesSets A mapping of file ingest filters names to files sets, * used to enforce unique files set names. */ void setFileIngestFilter(Map filesSets) throws FilesSetsManagerException { @@ -181,7 +181,7 @@ public final class FilesSetsManager extends Observable { } /** - * Reads and writes interesting files set definitions to and from disk in + * Reads and writes FilesSet definitions to and from disk in * XML format. */ private final static class FilesSetXML { @@ -191,7 +191,7 @@ public final class FilesSetsManager extends Observable { private static final List illegalFileNameChars = FilesSetsManager.getIllegalFileNameChars(); // The following tags and attributes are identical to those used in the - // TSK Framework interesting files set definitions file schema. + // TSK Framework FilesSet definitions file schema. private static final String FILE_SETS_ROOT_TAG = "INTERESTING_FILE_SETS"; //NON-NLS private static final String FILE_SET_TAG = "INTERESTING_FILE_SET"; //NON-NLS private static final String NAME_RULE_TAG = "NAME"; //NON-NLS @@ -213,7 +213,7 @@ public final class FilesSetsManager extends Observable { private static int unnamedLegacyRuleCounter; /** - * Reads interesting file set definitions from an XML file. + * Reads FilesSet definitions from an XML file. * * @param fileName The name of the file which is expected to store * the serialized definitions @@ -239,21 +239,21 @@ public final class FilesSetsManager extends Observable { // Check if the file can be read. if (!defsFile.canRead()) { - logger.log(Level.SEVERE, "Interesting file sets definition file at {0} exists, but cannot be read", defsFile.getPath()); // NON-NLS + logger.log(Level.SEVERE, "FilesSet definition file at {0} exists, but cannot be read", defsFile.getPath()); // NON-NLS return filesSets; } // Parse the XML in the file. Document doc = XMLUtil.loadDoc(FilesSetXML.class, defsFile.getPath()); if (doc == null) { - logger.log(Level.SEVERE, "Failed to parse interesting file sets definition file at {0}", defsFile.getPath()); // NON-NLS + logger.log(Level.SEVERE, "FilesSet definition file at {0}", defsFile.getPath()); // NON-NLS return filesSets; } // Get the root element. Element root = doc.getDocumentElement(); if (root == null) { - logger.log(Level.SEVERE, "Failed to get root {0} element tag of interesting file sets definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, defsFile.getPath()}); // NON-NLS + logger.log(Level.SEVERE, "Failed to get root {0} element tag of FilesSet definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, defsFile.getPath()}); // NON-NLS return filesSets; } @@ -293,9 +293,9 @@ public final class FilesSetsManager extends Observable { } /** - * Reads in an interesting files set. + * Reads in a FilesSet. * - * @param setElem An interesting files set XML element + * @param setElem A FilesSet XML element * @param filesSets A collection to which the set is to be added. * @param filePath The source file, used for error reporting. */ @@ -303,11 +303,11 @@ public final class FilesSetsManager extends Observable { // The file set must have a unique name. String setName = setElem.getAttribute(FilesSetXML.NAME_ATTR); if (setName.isEmpty()) { - logger.log(Level.SEVERE, "Found {0} element without required {1} attribute, ignoring malformed file set definition in interesting file sets definition file at {2}", new Object[]{FilesSetXML.FILE_SET_TAG, FilesSetXML.NAME_ATTR, filePath}); // NON-NLS + logger.log(Level.SEVERE, "Found {0} element without required {1} attribute, ignoring malformed file set definition in FilesSet definition file at {2}", new Object[]{FilesSetXML.FILE_SET_TAG, FilesSetXML.NAME_ATTR, filePath}); // NON-NLS return; } if (filesSets.containsKey(setName)) { - logger.log(Level.SEVERE, "Found duplicate definition of set named {0} in interesting file sets definition file at {1}, discarding duplicate set", new Object[]{setName, filePath}); // NON-NLS + logger.log(Level.SEVERE, "Found duplicate definition of set named {0} in FilesSet definition file at {1}, discarding duplicate set", new Object[]{setName, filePath}); // NON-NLS return; } @@ -340,11 +340,11 @@ public final class FilesSetsManager extends Observable { if (!rules.containsKey(rule.getUuid())) { rules.put(rule.getUuid(), rule); } else { - logger.log(Level.SEVERE, "Found duplicate rule {0} for set named {1} in interesting file sets definition file at {2}, discarding malformed set", new Object[]{rule.getUuid(), setName, filePath}); // NON-NLS + logger.log(Level.SEVERE, "Found duplicate rule {0} for set named {1} in FilesSet definition file at {2}, discarding malformed set", new Object[]{rule.getUuid(), setName, filePath}); // NON-NLS return; } } else { - logger.log(Level.SEVERE, "Found malformed rule for set named {0} in interesting file sets definition file at {1}, discarding malformed set", new Object[]{setName, filePath}); // NON-NLS + logger.log(Level.SEVERE, "Found malformed rule for set named {0} in FilesSet definition file at {1}, discarding malformed set", new Object[]{setName, filePath}); // NON-NLS return; } } @@ -358,11 +358,11 @@ public final class FilesSetsManager extends Observable { if (!rules.containsKey(rule.getUuid())) { rules.put(rule.getUuid(), rule); } else { - logger.log(Level.SEVERE, "Found duplicate rule {0} for set named {1} in interesting file sets definition file at {2}, discarding malformed set", new Object[]{rule.getUuid(), setName, filePath}); //NOI18N NON-NLS + logger.log(Level.SEVERE, "Found duplicate rule {0} for set named {1} in FilesSet definition file at {2}, discarding malformed set", new Object[]{rule.getUuid(), setName, filePath}); //NOI18N NON-NLS return; } } else { - logger.log(Level.SEVERE, "Found malformed rule for set named {0} in interesting file sets definition file at {1}, discarding malformed set", new Object[]{setName, filePath}); //NOI18N NON-NLS + logger.log(Level.SEVERE, "Found malformed rule for set named {0} in FilesSet definition file at {1}, discarding malformed set", new Object[]{setName, filePath}); //NOI18N NON-NLS return; } } @@ -375,7 +375,7 @@ public final class FilesSetsManager extends Observable { } /** - * Construct an interesting files set file name rule from the data in an + * Construct a FilesSet file name rule from the data in an * XML element. * * @param elem The file name rule XML element. @@ -433,7 +433,7 @@ public final class FilesSetsManager extends Observable { } /** - * Construct an interesting files set file name extension rule from the + * Construct a FilesSet file name extension rule from the * data in an XML element. * * @param elem The file name extension rule XML element. @@ -526,7 +526,7 @@ public final class FilesSetsManager extends Observable { } /** - * Construct a meta-type condition for an interesting files set + * Construct a meta-type condition for a FilesSet * membership rule from data in an XML element. * * @param ruleElement The XML element. @@ -553,7 +553,7 @@ public final class FilesSetsManager extends Observable { break; } } else { - // Accept TSK Framework interesting files set definitions, + // Accept TSK Framework FilesSet definitions, // default to files. condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); } @@ -561,7 +561,7 @@ public final class FilesSetsManager extends Observable { } /** - * Construct a path condition for an interesting files set membership + * Construct a path condition for a FilesSet membership * rule from data in an XML element. * * @param ruleElement The XML element. @@ -586,7 +586,7 @@ public final class FilesSetsManager extends Observable { } /** - * Writes interesting files set definitions to disk as an XML file, + * Writes FilesSet definitions to disk as an XML file, * logging any errors. * * @param fileName Name of the set definitions file as a string. From 24426eb21989996aca48454c215b8a0a570ed962 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 13 Jan 2017 13:18:01 -0500 Subject: [PATCH 32/50] 1903 - key for Last File Ingest Filter changed to not contain spaces --- Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index f858555d91..315bebd545 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -52,7 +52,7 @@ public class IngestJobSettings { private static final String ENABLED_MODULES_KEY = "Enabled_Ingest_Modules"; //NON-NLS private static final String DISABLED_MODULES_KEY = "Disabled_Ingest_Modules"; //NON-NLS - private static final String LAST_FILE_INGEST_FILTER_KEY = "Last File Ingest Filter Used"; + private static final String LAST_FILE_INGEST_FILTER_KEY = "Last_File_Ingest_Filter"; private static final String MODULE_SETTINGS_FOLDER = "IngestModuleSettings"; //NON-NLS private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS From 242aae597e82b3537f41b10542fd17e46f108d89 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 11:18:50 -0500 Subject: [PATCH 33/50] 1903-fixed name issues with default filters --- .../org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java | 2 +- .../org/sleuthkit/autopsy/ingest/IngestJobSettings.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java index 856fe037f6..f9caad7683 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/DataSourceIngestJob.java @@ -333,7 +333,7 @@ final class DataSourceIngestJob { } /** - * Gets the Selected File Ingest Filter from settings. + * Gets the selected file ingest filter from settings. * * @return True or false. */ diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 315bebd545..b3636845ae 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -57,8 +57,8 @@ public class IngestJobSettings { private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS private static final Logger LOGGER = Logger.getLogger(IngestJobSettings.class.getName()); - private static FilesSet ALL_FILES_INGEST_FILTER = new FilesSet("All Files", "All Files", false, true, Collections.emptyMap()); //NON-NLS - private static FilesSet ALL_AND_UNALLOC_FILES_INGEST_FILTER = new FilesSet("All Files and Unallocated Space", "All Files and Unallocated Space", false, false, Collections.emptyMap()); //NON-NLS + private static FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet("All Files and Directories", "All Files and Directories", false, true, Collections.emptyMap()); //NON-NLS + private static FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet("All Files, Directories, and Unallocated Space", "All Files, Directories, and Unallocated Space", false, false, Collections.emptyMap()); //NON-NLS private FilesSet fileIngestFilter; private final String executionContext; private final IngestType ingestType; @@ -93,7 +93,7 @@ public class IngestJobSettings { * @return a list of FilesSets which cover default options. */ public static List getStandardFileIngestFilters() { - return Arrays.asList(ALL_AND_UNALLOC_FILES_INGEST_FILTER, ALL_FILES_INGEST_FILTER); + return Arrays.asList(FILES_DIRS_UNALLOC_INGEST_FILTER, FILES_DIRS_INGEST_FILTER); } /** @@ -352,7 +352,7 @@ public class IngestJobSettings { * Restore the last used File Ingest Filter */ if (ModuleSettings.settingExists(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY) == false) { - ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY, IngestJobSettings.ALL_AND_UNALLOC_FILES_INGEST_FILTER.getName()); + ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY, IngestJobSettings.FILES_DIRS_UNALLOC_INGEST_FILTER.getName()); } try { this.fileIngestFilter = FilesSetsManager.getInstance() From b001d6bc36f8f4e5accc132b545906365d49d8c4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 12:12:57 -0500 Subject: [PATCH 34/50] 1903 - fixes to IngestJobSettings, default filters moved to FilesSetsManager --- .../autopsy/ingest/IngestJobSettings.java | 36 ++++++++----------- .../ingest/IngestJobSettingsPanel.java | 3 +- ...ngestFilterDefsOptionsPanelController.java | 2 +- .../modules/interestingitems/FilesSet.java | 2 +- .../interestingitems/FilesSetPanel.java | 2 +- .../interestingitems/FilesSetsManager.java | 23 +++++++++++- 6 files changed, 42 insertions(+), 26 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index b3636845ae..7cd6d54afa 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -57,8 +57,6 @@ public class IngestJobSettings { private static final String MODULE_SETTINGS_FOLDER_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), IngestJobSettings.MODULE_SETTINGS_FOLDER).toAbsolutePath().toString(); private static final String MODULE_SETTINGS_FILE_EXT = ".settings"; //NON-NLS private static final Logger LOGGER = Logger.getLogger(IngestJobSettings.class.getName()); - private static FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet("All Files and Directories", "All Files and Directories", false, true, Collections.emptyMap()); //NON-NLS - private static FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet("All Files, Directories, and Unallocated Space", "All Files, Directories, and Unallocated Space", false, false, Collections.emptyMap()); //NON-NLS private FilesSet fileIngestFilter; private final String executionContext; private final IngestType ingestType; @@ -73,7 +71,7 @@ public class IngestJobSettings { * * @return FilesSet which represents the FileIngestFilter */ - protected FilesSet getFileIngestFilter() { + FilesSet getFileIngestFilter() { return fileIngestFilter; } @@ -83,19 +81,10 @@ public class IngestJobSettings { * @param fileIngestFilter the FilesSet which represents the * FileIngestFilter */ - protected void setFileIngestFilter(FilesSet fileIngestFilter) { + void setFileIngestFilter(FilesSet fileIngestFilter) { this.fileIngestFilter = fileIngestFilter; } - /** - * Get a list of default FileIngestFilters. - * - * @return a list of FilesSets which cover default options. - */ - public static List getStandardFileIngestFilters() { - return Arrays.asList(FILES_DIRS_UNALLOC_INGEST_FILTER, FILES_DIRS_INGEST_FILTER); - } - /** * The type of ingest modules to run. */ @@ -224,15 +213,19 @@ public class IngestJobSettings { } /** - * If unallocated space should be processed Gets the the opposite of the - * File Ingest Filter's skip unallocated space flag. So that the existing - * logic in PhotoRec Carver and any other modules that may use this will - * continue to work without modification. + * Gets the process unallocated space flag part of these ingest job + * settings. + * + * @return True or false. * - * @return True for process unallocated space or false for skip unallocated - * space. */ boolean getProcessUnallocatedSpace() { + /* + * Used to be a simple flag but the processUnallocated checkbox was changed + * to a skip unallocated. This was due to the FileIngestFilters needing + * a default value which did not skip unallocated files. This method + * exists to maintain existing functionality. + */ boolean processUnallocated = true; if (!Objects.isNull(this.fileIngestFilter)) { processUnallocated = (this.fileIngestFilter.getSkipUnallocatedSpace() == false); @@ -352,14 +345,15 @@ public class IngestJobSettings { * Restore the last used File Ingest Filter */ if (ModuleSettings.settingExists(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY) == false) { - ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY, IngestJobSettings.FILES_DIRS_UNALLOC_INGEST_FILTER.getName()); + ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY, FilesSetsManager.getDefaultFilter().getName()); } try { this.fileIngestFilter = FilesSetsManager.getInstance() .getFileIngestFiltersWithDefaults() .get(ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY)); } catch (FilesSetsManager.FilesSetsManagerException ex) { - LOGGER.log(Level.SEVERE, "Failed to get File Ingest Filters", ex); //NON-NLS + this.fileIngestFilter = FilesSetsManager.getDefaultFilter(); + LOGGER.log(Level.SEVERE, "Failed to get file ingest filter from .properties file, default filter being used", ex); //NON-NLS } } diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index 1b3643a50d..fc592985e3 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -424,7 +424,8 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { .getFileIngestFiltersWithDefaults() .get(fileIngestFilterComboBox.getSelectedItem().toString())); } catch (FilesSetsManager.FilesSetsManagerException ex) { - logger.log(Level.SEVERE, "Failed to get File Ingest Filters", ex); //NON-NLS + settings.setFileIngestFilter(FilesSetsManager.getDefaultFilter()); + logger.log(Level.SEVERE, "Failed to get file ingest filter from combobox, default filter being used", ex); //NON-NLS } } }//GEN-LAST:event_fileIngestFilterComboBoxActionPerformed diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index 25cae770d1..43b7ed4b6a 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -71,7 +71,7 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan */ public String[] getComboBoxContents() { ArrayList nameList = new ArrayList<>(); - for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { + for (FilesSet fSet : FilesSetsManager.getStandardFileIngestFilters()) { nameList.add(fSet.getName()); } nameList.add(NEW_FILE_INGEST_FILTER); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index 8f78dd331b..d0c75b74e5 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -140,7 +140,7 @@ public final class FilesSet implements Serializable { } //default filters have no rules and they need to pass this test, //however a regular FilesSet with no rules should not pass any files - for (FilesSet defaultFilter : IngestJobSettings.getStandardFileIngestFilters()) { + for (FilesSet defaultFilter : FilesSetsManager.getStandardFileIngestFilters()) { if (name.equals(defaultFilter.getName())) { return defaultFilter.getName(); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 12e053a38d..8c36cdef3c 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -79,7 +79,7 @@ public class FilesSetPanel extends javax.swing.JPanel { } else { // The FileIngestFilters have reserved names for default filter, and creating a new filter from the jComboBox // These names if used would have undefined results, so prohibiting the user from using them is necessary - for (FilesSet filesSet : IngestJobSettings.getStandardFileIngestFilters()) { + for (FilesSet filesSet : FilesSetsManager.getStandardFileIngestFilters()) { if (this.nameTextField.getText().equals(filesSet.getName())) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.messages.filesSetsReservedName"), diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index f434f1812f..1b27c342c9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -60,6 +60,8 @@ public final class FilesSetsManager extends Observable { private static final Object FILE_INGEST_FILTER_LOCK = new Object(); private static final Object INTERESTING_FILES_SET_LOCK = new Object(); private static FilesSetsManager instance; + private static FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet("All Files and Directories", "All Files and Directories", false, true, Collections.emptyMap()); //NON-NLS + private static FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet("All Files, Directories, and Unallocated Space", "All Files, Directories, and Unallocated Space", false, false, Collections.emptyMap()); //NON-NLS /** * Gets the FilesSet definitions manager singleton. @@ -111,6 +113,25 @@ public final class FilesSetsManager extends Observable { return FILE_INGEST_FILTER_DEFS_NAME; } + /** + * Get a list of default FileIngestFilters. + * + * @return a list of FilesSets which cover default options. + */ + public static List getStandardFileIngestFilters() { + return Arrays.asList(FILES_DIRS_UNALLOC_INGEST_FILTER, FILES_DIRS_INGEST_FILTER); + } + + /** + * Get the filter that should be used as the default value, + * if no filter is specified. + * + * @return FILES_DIRS_UNALLOC_INGEST_FILTER + */ + public static FilesSet getDefaultFilter(){ + return FILES_DIRS_UNALLOC_INGEST_FILTER; + } + /** * Gets a copy of the current interesting files set definitions. * @@ -131,7 +152,7 @@ public final class FilesSetsManager extends Observable { */ public Map getFileIngestFiltersWithDefaults() throws FilesSetsManagerException { Map returnMap = new HashMap<>(); - for (FilesSet fSet : IngestJobSettings.getStandardFileIngestFilters()) { + for (FilesSet fSet : getStandardFileIngestFilters()) { returnMap.put(fSet.getName(), fSet); } returnMap.putAll(getFileIngestFilters()); From 55d158e422ed13ca602dabb00c1ed0ec48c362fa Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 14:30:53 -0500 Subject: [PATCH 35/50] 1903-Fixes to InjestJobSettingsPanel regarding file ingest filters --- .../autopsy/ingest/IngestJobSettings.java | 17 ++++-- .../ingest/IngestJobSettingsPanel.form | 2 +- .../ingest/IngestJobSettingsPanel.java | 57 ++++++++++++++----- ...ngestFilterDefsOptionsPanelController.java | 22 ------- .../interestingitems/FilesSetDefsPanel.java | 11 +--- .../interestingitems/FilesSetPanel.java | 5 +- .../interestingitems/FilesSetsManager.java | 6 +- 7 files changed, 65 insertions(+), 55 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 7cd6d54afa..436c22770f 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -32,6 +32,7 @@ import java.util.HashSet; import java.util.List; import java.util.Objects; import java.util.logging.Level; +import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; @@ -66,12 +67,16 @@ public class IngestJobSettings { private final List warnings; /** - * Gets the current FileIngestFilter saved in settings which is represented - * by a FilesSet + * Gets the last selected FileIngestFilter saved in settings which is represented + * by a FilesSet, if the last selected filter is null + * the default filter will be returned. * * @return FilesSet which represents the FileIngestFilter */ FilesSet getFileIngestFilter() { + if (fileIngestFilter==null){ + fileIngestFilter=FilesSetsManager.getDefaultFilter(); + } return fileIngestFilter; } @@ -221,10 +226,10 @@ public class IngestJobSettings { */ boolean getProcessUnallocatedSpace() { /* - * Used to be a simple flag but the processUnallocated checkbox was changed - * to a skip unallocated. This was due to the FileIngestFilters needing - * a default value which did not skip unallocated files. This method - * exists to maintain existing functionality. + * Used to be a simple flag but the processUnallocated checkbox was + * changed to a skip unallocated. This was due to the FileIngestFilters + * needing a default value which did not skip unallocated files. This + * method exists to maintain existing functionality. */ boolean processUnallocated = true; if (!Objects.isNull(this.fileIngestFilter)) { diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form index f3f7053bc6..e66f0f4d3f 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.form @@ -268,7 +268,7 @@ - + diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index fc592985e3..f1621ba693 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -45,6 +45,9 @@ import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; import org.sleuthkit.autopsy.modules.interestingitems.FileIngestFilterDefsOptionsPanelController; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSetPanel; import org.sleuthkit.datamodel.Content; import org.sleuthkit.datamodel.IngestJobInfo; import org.sleuthkit.datamodel.IngestModuleInfo; @@ -66,7 +69,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { private final List modules = new ArrayList<>(); private final IngestModulesTableModel tableModel = new IngestModulesTableModel(); private IngestModuleModel selectedModule; - private FileIngestFilterDefsOptionsPanelController controller; private static final Logger logger = Logger.getLogger(IngestJobSettingsPanel.class.getName()); /** @@ -76,8 +78,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { */ public IngestJobSettingsPanel(IngestJobSettings settings) { this.settings = settings; - this.controller = new FileIngestFilterDefsOptionsPanelController(); - controller.getComponent(controller.getLookup()); for (IngestModuleTemplate moduleTemplate : settings.getIngestModuleTemplates()) { modules.add(new IngestModuleModel(moduleTemplate)); } @@ -95,8 +95,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { IngestJobSettingsPanel(IngestJobSettings settings, List dataSources) { this.settings = settings; this.dataSources.addAll(dataSources); - this.controller = new FileIngestFilterDefsOptionsPanelController(); - controller.getComponent(controller.getLookup()); try { SleuthkitCase skCase = Case.getCurrentCase().getSleuthkitCase(); ingestJobs.addAll(skCase.getIngestJobs()); @@ -312,7 +310,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { fileIngestFilterLabel.setText(org.openide.util.NbBundle.getMessage(IngestJobSettingsPanel.class, "IngestJobSettingsPanel.fileIngestFilterLabel.text")); // NOI18N - fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); + fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(getComboBoxContents())); fileIngestFilterComboBox.addActionListener(new java.awt.event.ActionListener() { public void actionPerformed(java.awt.event.ActionEvent evt) { fileIngestFilterComboBoxActionPerformed(evt); @@ -406,15 +404,20 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { }//GEN-LAST:event_pastJobsButtonActionPerformed private void fileIngestFilterComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileIngestFilterComboBoxActionPerformed - if (fileIngestFilterComboBox.getSelectedItem().toString().equals(FileIngestFilterDefsOptionsPanelController.NEW_FILE_INGEST_FILTER)) { + if (fileIngestFilterComboBox.getSelectedItem().toString().equals(FilesSetPanel.NEW_FILE_INGEST_FILTER)) { final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); - dialog.addApplyButtonListener((ActionEvent e) -> { - controller.applyChanges(); - ((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())).saveSettings(); - fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(controller.getComboBoxContents())); - dialog.close(); - }); - dialog.display((IngestModuleGlobalSettingsPanel) controller.getComponent(controller.getLookup())); + FilesSetDefsPanel fileIngestFilterPanel; + fileIngestFilterPanel = new FilesSetDefsPanel(FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS); + fileIngestFilterPanel.load(); + dialog.addApplyButtonListener( + (ActionEvent e) -> { + fileIngestFilterPanel.store(); + fileIngestFilterComboBox.setModel(new DefaultComboBoxModel<>(getComboBoxContents())); + dialog.close(); + } + ); + dialog.display(fileIngestFilterPanel); + fileIngestFilterComboBox.setSelectedItem(settings.getFileIngestFilter().getName()); } else if (evt.getActionCommand().equals("comboBoxChanged")) { @@ -430,6 +433,32 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } }//GEN-LAST:event_fileIngestFilterComboBoxActionPerformed + /** + * Returns an array which will contain the names of all options which should + * exist in the "Run Ingest Modules On:" JCombobox + * + * Keeping the default File Ingest Filters and the saved one separate allows + * the default to always be first elements. + * + * @return -filterNames an array of all established filter names as well as + * a Create New option + */ + private String[] getComboBoxContents() { + ArrayList nameList = new ArrayList<>(); + for (FilesSet fSet : FilesSetsManager.getStandardFileIngestFilters()) { + nameList.add(fSet.getName()); + } + nameList.add(FilesSetPanel.NEW_FILE_INGEST_FILTER); + try { + for (FilesSet fSet : FilesSetsManager.getInstance().getFileIngestFilters().values()) { + nameList.add(fSet.getName()); + } + } catch (FilesSetsManager.FilesSetsManagerException ex) { + logger.log(Level.SEVERE, "Failed to get user created file ingest filters for combo box, only default available for selection", ex); //NON-NLS + } + return nameList.toArray(new String[nameList.size()]); + } + private void SelectAllModules(boolean set) { for (IngestModuleModel module : modules) { module.setEnabled(set); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index 43b7ed4b6a..dd7a1e3a57 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -47,7 +47,6 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan private FilesSetDefsPanel panel; private final PropertyChangeSupport pcs = new PropertyChangeSupport(this); private boolean changed; - public final static String NEW_FILE_INGEST_FILTER = "Create new file ingest filter..."; private static final Logger LOGGER = Logger.getLogger(FileIngestFilterDefsOptionsPanelController.class.getName()); /** @@ -59,27 +58,6 @@ public final class FileIngestFilterDefsOptionsPanelController extends OptionsPan changed = false; } - /** - * Returns an array which will contain the names of all options which should - * exist in the "Run Ingest Modules On:" JCombobox - * - * Keeping the default File Ingest Filters and the saved one seperate allows - * the default to always be first elements in - * - * @return -filterNames an array of all established filter names as well as - * a Create New option - */ - public String[] getComboBoxContents() { - ArrayList nameList = new ArrayList<>(); - for (FilesSet fSet : FilesSetsManager.getStandardFileIngestFilters()) { - nameList.add(fSet.getName()); - } - nameList.add(NEW_FILE_INGEST_FILTER); - if (!(panel == null)) { - nameList.addAll(panel.getKeys()); - } - return nameList.toArray(new String[nameList.size()]); - } /** * This method is called when both the Ok and Apply buttons are pressed. It diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 1c8bee77e6..6404f19518 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -43,7 +43,7 @@ import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector; /** * A panel that allows a user to make interesting item definitions. */ -final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { +public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements OptionsPanel { @NbBundle.Messages({ "FilesSetDefsPanel.bytes=Bytes", @@ -53,7 +53,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements "FilesSetDefsPanel.loadError=Error loading interesting files sets from file.", "FilesSetDefsPanel.saveError=Error saving interesting files sets to file." }) - static enum PANEL_TYPE { + public static enum PANEL_TYPE { FILE_INGEST_FILTERS, INTERESTING_FILE_SETS @@ -78,7 +78,7 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements /** * Constructs an interesting item definitions panel. */ - FilesSetDefsPanel(PANEL_TYPE panelType) { + public FilesSetDefsPanel(PANEL_TYPE panelType) { this.panelType = panelType; this.initComponents(); this.customInit(); @@ -110,11 +110,6 @@ final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel implements } } - Set getKeys() { - load(); - return filesSets.keySet(); - } - @NbBundle.Messages({"FilesSetDefsPanel.Interesting.Title=Global Interesting Items Settings", "FilesSetDefsPanel.Ingest.Title=File Ingest Filter Settings"}) private void customInit() { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 8c36cdef3c..672acd2cfe 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -22,6 +22,7 @@ import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; import org.sleuthkit.autopsy.ingest.IngestJobSettings; +import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel.PANEL_TYPE; /** @@ -30,6 +31,8 @@ import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel.PANEL_TY */ public class FilesSetPanel extends javax.swing.JPanel { + public static final String NEW_FILE_INGEST_FILTER = "Create new file ingest filter..."; //WJS-TODO make this an @MESSAGES + @NbBundle.Messages("FilesSetPanel.ingest.title=File Ingest Filter") /** * Construct a files set panel in create mode. @@ -88,7 +91,7 @@ public class FilesSetPanel extends javax.swing.JPanel { return false; } } - if (this.nameTextField.getText().equals(FileIngestFilterDefsOptionsPanelController.NEW_FILE_INGEST_FILTER)) { + if (this.nameTextField.getText().equals(NEW_FILE_INGEST_FILTER)) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.messages.filesSetsReservedName"), NotifyDescriptor.WARNING_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 1b27c342c9..6f990de0da 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -60,8 +60,8 @@ public final class FilesSetsManager extends Observable { private static final Object FILE_INGEST_FILTER_LOCK = new Object(); private static final Object INTERESTING_FILES_SET_LOCK = new Object(); private static FilesSetsManager instance; - private static FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet("All Files and Directories", "All Files and Directories", false, true, Collections.emptyMap()); //NON-NLS - private static FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet("All Files, Directories, and Unallocated Space", "All Files, Directories, and Unallocated Space", false, false, Collections.emptyMap()); //NON-NLS + private static FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet("All Files and Directories", "All Files and Directories", false, true, Collections.emptyMap()); //WJS-TODO make this an @MESSAGES//NON-NLS + private static FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet("All Files, Directories, and Unallocated Space", "All Files, Directories, and Unallocated Space", false, false, Collections.emptyMap()); //WJS-TODO make this an @MESSAGES//NON-NLS /** * Gets the FilesSet definitions manager singleton. @@ -167,7 +167,7 @@ public final class FilesSetsManager extends Observable { * * @return A map of FilesSet names to file ingest sets, possibly empty. */ - Map getFileIngestFilters() throws FilesSetsManagerException { + public Map getFileIngestFilters() throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), ""); } From db3e4678d60d96525ff963fe7aa440bbc85de35b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 16:04:23 -0500 Subject: [PATCH 36/50] 1903-Changes to FilesSet to to decouple from FileIngestFilter and fix name of ignoreUnallocated flag --- .../autopsy/ingest/IngestJobSettings.java | 2 +- .../interestingitems/Bundle.properties | 9 ++--- .../modules/interestingitems/FilesSet.java | 38 ++++++++----------- .../interestingitems/FilesSetDefsPanel.form | 10 ++--- .../interestingitems/FilesSetDefsPanel.java | 30 +++++++-------- .../interestingitems/FilesSetPanel.form | 10 ++--- .../interestingitems/FilesSetPanel.java | 22 +++++------ .../interestingitems/FilesSetsManager.java | 28 +++++++++----- 8 files changed, 74 insertions(+), 75 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 436c22770f..232cbb4466 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -233,7 +233,7 @@ public class IngestJobSettings { */ boolean processUnallocated = true; if (!Objects.isNull(this.fileIngestFilter)) { - processUnallocated = (this.fileIngestFilter.getSkipUnallocatedSpace() == false); + processUnallocated = (this.fileIngestFilter.ingoresUnallocatedSpace() == false); } return processUnallocated; } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties index 1a3e158be9..405269afb6 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/Bundle.properties @@ -16,8 +16,8 @@ FilesSetPanel.descriptionPanel.border.title=Description FilesSetPanel.interesting.nameLabel.text=Set Name: FilesSetPanel.ingest.nameLabel.text=Filter Name: FilesSetPanel.descPanel.border.title=Description -FilesSetPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. -FilesSetPanel.skipsUnallocCheckbox.text=Skip Unallocated Space +FilesSetPanel.ignoreUnallocCheckbox.toolTipText=Ignores unallocated space, such as deleted files. May run faster but produce less complete results. +FilesSetPanel.ignoreUnallocCheckbox.text=Ignore Unallocated Space FilesSetRulePanel.title=Interesting Files Set Rule FilesSetRulePanel.extensionRadioButton.text=Extension Only FilesSetRulePanel.pathRegexCheckBox.text=Regex @@ -56,10 +56,7 @@ FilesSetDefsPanel.interesting.deleteSetButton.text=Delete Set FilesSetDefsPanel.ingest.deleteSetButton.text=Delete Filter FilesSetDefsPanel.interesting.jLabel6.text=Set Details FilesSetDefsPanel.ingest.jLabel6.text=Filter Details - FilesSetDefsPanel.newRuleButton.text=New Rule -FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText=Skips unallocated space, such as deleted files. May run faster but produce less complete results. -FilesSetDefsPanel.skipsUnallocCheckbox.text=Skip Unallocated Space FilesSetDefsPanel.jLabel8.text=File Size: FilesSetDefsPanel.jLabel7.text=MIME Type: FilesSetDefsPanel.rulePathConditionRegexCheckBox.text=Regex @@ -81,3 +78,5 @@ FilesSetDefsPanel.rulesListLabel.text=Rules: FilesSetDefsPanel.editRuleButton.text=Edit Rule FilesSetDefsPanel.filesRadioButton.text=Files 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. diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java index d0c75b74e5..403ab31be7 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSet.java @@ -25,7 +25,6 @@ import java.util.List; import java.util.Map; import java.util.UUID; import java.util.regex.Pattern; -import org.sleuthkit.autopsy.ingest.IngestJobSettings; import org.sleuthkit.datamodel.AbstractFile; import org.sleuthkit.datamodel.TskData; @@ -43,27 +42,29 @@ public final class FilesSet implements Serializable { private final String name; private final String description; private final boolean ignoreKnownFiles; - private final boolean skipUnallocatedSpace; + private final boolean ignoreUnallocatedSpace; private final Map rules = new HashMap<>(); /** * Constructs an interesting files set. * - * @param name The name of the set. - * @param description A description of the set, may be null. - * @param ignoreKnownFiles Whether or not to exclude known files from the - * set. - * @param rules The rules that define the set. May be null, but a - * set with no rules is the empty set. + * @param name The name of the set. + * @param description A description of the set, may be null. + * @param ignoreKnownFiles Whether or not to exclude known files from + * the set. + * @param ignoreUnallocatedSpace Whether or not to exclude unallocated space + * from the set. + * @param rules The rules that define the set. May be null, + * but a set with no rules is the empty set. */ - public FilesSet(String name, String description, boolean ignoreKnownFiles, boolean skipUnallocatedSpace, Map rules) { + public FilesSet(String name, String description, boolean ignoreKnownFiles, boolean ignoreUnallocatedSpace, Map rules) { if ((name == null) || (name.isEmpty())) { throw new IllegalArgumentException("Interesting files set name cannot be null or empty"); } this.name = name; this.description = (description != null ? description : ""); this.ignoreKnownFiles = ignoreKnownFiles; - this.skipUnallocatedSpace = skipUnallocatedSpace; + this.ignoreUnallocatedSpace = ignoreUnallocatedSpace; if (rules != null) { this.rules.putAll(rules); } @@ -106,8 +107,8 @@ public final class FilesSet implements Serializable { * @return True if unallocated space should be processed, false if it should * not be. */ - public boolean getSkipUnallocatedSpace() { - return this.skipUnallocatedSpace; + public boolean ingoresUnallocatedSpace() { + return this.ignoreUnallocatedSpace; } /** @@ -132,19 +133,13 @@ public final class FilesSet implements Serializable { return null; } - if ((this.skipUnallocatedSpace) + if ((this.ignoreUnallocatedSpace) && (file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNALLOC_BLOCKS) || file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) || file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.UNUSED_BLOCKS))) { return null; } - //default filters have no rules and they need to pass this test, - //however a regular FilesSet with no rules should not pass any files - for (FilesSet defaultFilter : FilesSetsManager.getStandardFileIngestFilters()) { - if (name.equals(defaultFilter.getName())) { - return defaultFilter.getName(); - } - } + for (Rule rule : rules.values()) { if (rule.isSatisfied(file)) { return rule.getName(); @@ -192,9 +187,6 @@ public final class FilesSet implements Serializable { if (metaTypeCondition == null) { throw new IllegalArgumentException("Interesting files set rule meta-type condition cannot be null"); } - if (pathCondition == null && fileNameCondition == null && mimeTypeCondition == null && fileSizeCondition == null) { - throw new IllegalArgumentException("Must have at least one condition on rule."); - } this.ruleName = ruleName; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form index ccd3e27895..4565237aa8 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.form @@ -118,7 +118,7 @@ - + @@ -203,7 +203,7 @@ - + @@ -828,13 +828,13 @@ - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index 6404f19518..c25256f7e2 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -105,7 +105,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp org.openide.awt.Mnemonics.setLocalizedText(jLabel6, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingest.jLabel6.text")); // NOI18N } else { this.ruleDialogTitle = "FilesSetPanel.interesting.title"; - this.skipsUnallocCheckbox.setVisible(false); + this.ingoreUnallocCheckbox.setVisible(false); } } @@ -219,7 +219,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp this.setsListModel.clear(); this.setDescriptionTextArea.setText(""); this.ignoreKnownFilesCheckbox.setSelected(true); - this.skipsUnallocCheckbox.setSelected(true); + this.ingoreUnallocCheckbox.setSelected(true); this.newSetButton.setEnabled(true); this.editSetButton.setEnabled(false); this.deleteSetButton.setEnabled(false); @@ -267,7 +267,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp // selected files set. FilesSetDefsPanel.this.setDescriptionTextArea.setText(selectedSet.getDescription()); FilesSetDefsPanel.this.ignoreKnownFilesCheckbox.setSelected(selectedSet.ignoresKnownFiles()); - FilesSetDefsPanel.this.skipsUnallocCheckbox.setSelected(selectedSet.getSkipUnallocatedSpace()); + FilesSetDefsPanel.this.ingoreUnallocCheckbox.setSelected(selectedSet.ingoresUnallocatedSpace()); // Enable the new, edit and delete set buttons. FilesSetDefsPanel.this.newSetButton.setEnabled(true); FilesSetDefsPanel.this.editSetButton.setEnabled(true); @@ -411,7 +411,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp // Preserve the existing rules from the set being edited. rules.putAll(selectedSet.getRules()); } - this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getSkipUnallocatedSpace(), rules); + this.replaceFilesSet(selectedSet, panel.getFilesSetName(), panel.getFilesSetDescription(), panel.getFileSetIgnoresKnownFiles(), panel.getFileSetIgnoresUnallocatedSpace(), rules); } } @@ -458,7 +458,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp // Add the new/edited files set definition, replacing any previous // definition with the same name and refreshing the display. - this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), selectedSet.getSkipUnallocatedSpace(), rules); + this.replaceFilesSet(selectedSet, selectedSet.getName(), selectedSet.getDescription(), selectedSet.ignoresKnownFiles(), selectedSet.ingoresUnallocatedSpace(), rules); // Select the new/edited rule. Queue it up so it happens after the // selection listeners react to the selection of the "new" files @@ -484,7 +484,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp * @param processesUnallocatedSpace Whether or not this set of rules * processes unallocated space */ - void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, boolean skipsUnallocatedSpace, Map rules) { + void replaceFilesSet(FilesSet oldSet, String name, String description, boolean ignoresKnownFiles, boolean ignoresUnallocatedSpace, Map rules) { if (oldSet != null) { // Remove the set to be replaced from the working copy if the files // set definitions. @@ -493,7 +493,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp // Make the new/edited set definition and add it to the working copy of // the files set definitions. - FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, skipsUnallocatedSpace, rules); + FilesSet newSet = new FilesSet(name, description, ignoresKnownFiles, ignoresUnallocatedSpace, rules); this.filesSets.put(newSet.getName(), newSet); // Redo the list model for the files set list component, which will make @@ -561,7 +561,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp equalitySignComboBox = new javax.swing.JComboBox(); fileSizeSpinner = new javax.swing.JSpinner(); fileSizeUnitComboBox = new javax.swing.JComboBox(); - skipsUnallocCheckbox = new javax.swing.JCheckBox(); + ingoreUnallocCheckbox = new javax.swing.JCheckBox(); setFont(getFont().deriveFont(getFont().getStyle() & ~java.awt.Font.BOLD, 11)); @@ -756,9 +756,9 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp fileSizeUnitComboBox.setModel(new javax.swing.DefaultComboBoxModel(new String[] { Bundle.FilesSetDefsPanel_bytes(), Bundle.FilesSetDefsPanel_kiloBytes(), Bundle.FilesSetDefsPanel_megaBytes(), Bundle.FilesSetDefsPanel_gigaBytes() })); fileSizeUnitComboBox.setEnabled(false); - org.openide.awt.Mnemonics.setLocalizedText(skipsUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.skipsUnallocCheckbox.text")); // NOI18N - skipsUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.skipsUnallocCheckbox.toolTipText")); // NOI18N - skipsUnallocCheckbox.setEnabled(false); + org.openide.awt.Mnemonics.setLocalizedText(ingoreUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingoreUnallocCheckbox.text")); // NOI18N + ingoreUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetDefsPanel.class, "FilesSetDefsPanel.ingoreUnallocCheckbox.toolTipText")); // NOI18N + ingoreUnallocCheckbox.setEnabled(false); javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1); jPanel1.setLayout(jPanel1Layout); @@ -810,7 +810,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp .addGroup(jPanel1Layout.createSequentialGroup() .addComponent(ignoreKnownFilesCheckbox) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) - .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(ingoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 158, javax.swing.GroupLayout.PREFERRED_SIZE)) .addComponent(jLabel5) .addComponent(jLabel6))) .addGroup(jPanel1Layout.createSequentialGroup() @@ -878,7 +878,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp .addGap(6, 6, 6) .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ignoreKnownFilesCheckbox) - .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(ingoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addComponent(rulesListLabel) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED) @@ -957,7 +957,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp Map rules = new HashMap<>(oldSet.getRules()); FilesSet.Rule selectedRule = this.rulesList.getSelectedValue(); rules.remove(selectedRule.getUuid()); - this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), oldSet.getSkipUnallocatedSpace(), rules); + this.replaceFilesSet(oldSet, oldSet.getName(), oldSet.getDescription(), oldSet.ignoresKnownFiles(), oldSet.ingoresUnallocatedSpace(), rules); if (!this.rulesListModel.isEmpty()) { this.rulesList.setSelectedIndex(0); } else { @@ -1013,6 +1013,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JComboBox fileSizeUnitComboBox; private javax.swing.JRadioButton filesRadioButton; private javax.swing.JCheckBox ignoreKnownFilesCheckbox; + private javax.swing.JCheckBox ingoreUnallocCheckbox; private javax.swing.JLabel jLabel1; private javax.swing.JLabel jLabel2; private javax.swing.JLabel jLabel3; @@ -1039,7 +1040,6 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp private javax.swing.JList setsList; private javax.swing.JLabel setsListLabel; private javax.swing.JScrollPane setsListScrollPane; - private javax.swing.JCheckBox skipsUnallocCheckbox; private javax.swing.ButtonGroup typeButtonGroup; // End of variables declaration//GEN-END:variables diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form index e11948ca0a..0b5872a5a5 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.form @@ -29,7 +29,7 @@ - + @@ -49,7 +49,7 @@ - + @@ -122,13 +122,13 @@ - + - + - + diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index 672acd2cfe..fe1d156044 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -43,7 +43,7 @@ public class FilesSetPanel extends javax.swing.JPanel { ignoreKnownFilesCheckbox.setVisible(false); org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.ingest.nameLabel.text")); // NOI18N } else { - skipsUnallocCheckbox.setVisible(false); + ignoreUnallocCheckbox.setVisible(false); } } @@ -57,12 +57,12 @@ public class FilesSetPanel extends javax.swing.JPanel { if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { ignoreKnownFilesCheckbox.setVisible(false); } else { - skipsUnallocCheckbox.setVisible(false); + ignoreUnallocCheckbox.setVisible(false); } this.nameTextField.setText(filesSet.getName()); this.descTextArea.setText(filesSet.getDescription()); this.ignoreKnownFilesCheckbox.setSelected(filesSet.ignoresKnownFiles()); - this.skipsUnallocCheckbox.setSelected(filesSet.getSkipUnallocatedSpace()); + this.ignoreUnallocCheckbox.setSelected(filesSet.ingoresUnallocatedSpace()); } /** @@ -135,8 +135,8 @@ public class FilesSetPanel extends javax.swing.JPanel { /** * */ - boolean getSkipUnallocatedSpace() { - return skipsUnallocCheckbox.isSelected(); + boolean getFileSetIgnoresUnallocatedSpace() { + return ignoreUnallocCheckbox.isSelected(); } /** @@ -154,7 +154,7 @@ public class FilesSetPanel extends javax.swing.JPanel { descScrollPanel = new javax.swing.JScrollPane(); descTextArea = new javax.swing.JTextArea(); ignoreKnownFilesCheckbox = new javax.swing.JCheckBox(); - skipsUnallocCheckbox = new javax.swing.JCheckBox(); + ignoreUnallocCheckbox = new javax.swing.JCheckBox(); org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.interesting.nameLabel.text")); // NOI18N @@ -183,8 +183,8 @@ public class FilesSetPanel extends javax.swing.JPanel { org.openide.awt.Mnemonics.setLocalizedText(ignoreKnownFilesCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.ignoreKnownFilesCheckbox.text")); // NOI18N - org.openide.awt.Mnemonics.setLocalizedText(skipsUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.skipsUnallocCheckbox.text")); // NOI18N - skipsUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.skipsUnallocCheckbox.toolTipText")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(ignoreUnallocCheckbox, org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.ignoreUnallocCheckbox.text")); // NOI18N + ignoreUnallocCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.ignoreUnallocCheckbox.toolTipText")); // NOI18N javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); @@ -202,7 +202,7 @@ public class FilesSetPanel extends javax.swing.JPanel { .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup() .addComponent(ignoreKnownFilesCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) + .addComponent(ignoreUnallocCheckbox, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))) .addContainerGap()) ); layout.setVerticalGroup( @@ -217,7 +217,7 @@ public class FilesSetPanel extends javax.swing.JPanel { .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(ignoreKnownFilesCheckbox) - .addComponent(skipsUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) + .addComponent(ignoreUnallocCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 23, javax.swing.GroupLayout.PREFERRED_SIZE)) .addContainerGap()) ); }// //GEN-END:initComponents @@ -228,8 +228,8 @@ public class FilesSetPanel extends javax.swing.JPanel { private javax.swing.JScrollPane descScrollPanel; private javax.swing.JTextArea descTextArea; private javax.swing.JCheckBox ignoreKnownFilesCheckbox; + private javax.swing.JCheckBox ignoreUnallocCheckbox; private javax.swing.JLabel nameLabel; private javax.swing.JTextField nameTextField; - private javax.swing.JCheckBox skipsUnallocCheckbox; // End of variables declaration//GEN-END:variables } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 6f990de0da..5bc60d4a8d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -39,7 +39,8 @@ import org.openide.util.io.NbObjectOutputStream; import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.coreutils.XMLUtil; -import org.sleuthkit.autopsy.ingest.IngestJobSettings; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule; +import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition; import org.w3c.dom.Document; import org.w3c.dom.Element; import org.w3c.dom.NodeList; @@ -60,9 +61,16 @@ public final class FilesSetsManager extends Observable { private static final Object FILE_INGEST_FILTER_LOCK = new Object(); private static final Object INTERESTING_FILES_SET_LOCK = new Object(); private static FilesSetsManager instance; - private static FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet("All Files and Directories", "All Files and Directories", false, true, Collections.emptyMap()); //WJS-TODO make this an @MESSAGES//NON-NLS - private static FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet("All Files, Directories, and Unallocated Space", "All Files, Directories, and Unallocated Space", false, false, Collections.emptyMap()); //WJS-TODO make this an @MESSAGES//NON-NLS - + private static final FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet( + "All Files and Directories", "All Files and Directories", false, true, new HashMap(){{ + put("All Files and Directories",new Rule("All Files and Directories", null ,new MetaTypeCondition(MetaTypeCondition.Type.ALL), null, null, null)); + }}); //WJS-TODO make this an @MESSAGES//NON-NLS + private static final FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet( + "All Files, Directories, and Unallocated Space", "All Files, Directories, and Unallocated Space", + false, false, new HashMap(){{ + put("All Files, Directories, and Unallocated Space",new Rule("All Files, Directories, and Unallocated Space", null ,new MetaTypeCondition(MetaTypeCondition.Type.ALL), null, null, null)); + }}); //WJS-TODO make this an @MESSAGES//NON-NLS + /** * Gets the FilesSet definitions manager singleton. */ @@ -221,7 +229,7 @@ public final class FilesSetsManager extends Observable { private static final String RULE_UUID_ATTR = "ruleUUID"; //NON-NLS private static final String DESC_ATTR = "description"; //NON-NLS private static final String IGNORE_KNOWN_FILES_ATTR = "ignoreKnown"; //NON-NLS - private static final String SKIP_UNALLOCATED_SPACE = "skipUnallocated"; //NON-NLS + private static final String IGNORE_UNALLOCATED_SPACE = "ingoreUnallocated"; //NON-NLS private static final String TYPE_FILTER_ATTR = "typeFilter"; //NON-NLS private static final String PATH_FILTER_ATTR = "pathFilter"; //NON-NLS private static final String TYPE_FILTER_VALUE_FILES = "file"; //NON-NLS @@ -345,10 +353,10 @@ public final class FilesSetsManager extends Observable { // The file set may or may not skip unallocated space. The default behavior // is not to skip it. - String skipUnallocated = setElem.getAttribute(FilesSetXML.SKIP_UNALLOCATED_SPACE); - boolean skipsUnallocatedSpace = false; - if (!skipUnallocated.isEmpty()) { - skipsUnallocatedSpace = Boolean.parseBoolean(skipUnallocated); + String ignoreUnallocated = setElem.getAttribute(FilesSetXML.IGNORE_UNALLOCATED_SPACE); + boolean ignoreUnallocatedSpace = false; + if (!ignoreUnallocated.isEmpty()) { + ignoreUnallocatedSpace = Boolean.parseBoolean(ignoreUnallocated); } // Read file name set membership rules, if any. FilesSetXML.unnamedLegacyRuleCounter = 1; @@ -391,7 +399,7 @@ public final class FilesSetsManager extends Observable { // Make the files set. Note that degenerate sets with no rules are // allowed to facilitate the separation of set definition and rule // definitions. A set without rules is simply the empty set. - FilesSet set = new FilesSet(setName, description, ignoreKnownFiles, skipsUnallocatedSpace, rules); + FilesSet set = new FilesSet(setName, description, ignoreKnownFiles, ignoreUnallocatedSpace, rules); filesSets.put(set.getName(), set); } From b42759405ef0a87a5f8478a538e6e0ea56b53b37 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 17:16:31 -0500 Subject: [PATCH 37/50] 1903-partial fix to FilesSetsManager, removed unneeded methods --- .../autopsy/ingest/IngestJobSettings.java | 11 +++-- .../ingest/IngestJobSettingsPanel.java | 18 +++++--- .../interestingitems/FilesSetDefsPanel.java | 4 +- .../interestingitems/FilesSetPanel.java | 16 +++++-- .../interestingitems/FilesSetsManager.java | 46 ++----------------- ....java => InterestingFilesSetSettings.java} | 4 +- 6 files changed, 39 insertions(+), 60 deletions(-) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{FilesSetSettings.java => InterestingFilesSetSettings.java} (90%) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index 232cbb4466..ce3ffd349c 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -30,6 +30,7 @@ import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; +import java.util.Map; import java.util.Objects; import java.util.logging.Level; import org.openide.util.Exceptions; @@ -353,9 +354,13 @@ public class IngestJobSettings { ModuleSettings.setConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY, FilesSetsManager.getDefaultFilter().getName()); } try { - this.fileIngestFilter = FilesSetsManager.getInstance() - .getFileIngestFiltersWithDefaults() - .get(ModuleSettings.getConfigSetting(this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY)); + Map fileIngestFilters = FilesSetsManager.getInstance() + .getCustomFileIngestFilters(); + for (FilesSet fSet : FilesSetsManager.getStandardFileIngestFilters()){ + fileIngestFilters.put(fSet.getName(), fSet); + } + this.fileIngestFilter = fileIngestFilters.get(ModuleSettings.getConfigSetting( + this.executionContext, IngestJobSettings.LAST_FILE_INGEST_FILTER_KEY)); } catch (FilesSetsManager.FilesSetsManagerException ex) { this.fileIngestFilter = FilesSetsManager.getDefaultFilter(); LOGGER.log(Level.SEVERE, "Failed to get file ingest filter from .properties file, default filter being used", ex); //NON-NLS diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index f1621ba693..eb57097c34 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -26,6 +26,7 @@ import java.awt.event.WindowAdapter; import java.awt.event.WindowEvent; import java.util.ArrayList; import java.util.List; +import java.util.Map; import java.util.logging.Level; import java.util.logging.Logger; import javax.swing.DefaultComboBoxModel; @@ -44,7 +45,6 @@ import org.openide.util.NbBundle.Messages; import org.sleuthkit.autopsy.casemodule.Case; import org.sleuthkit.autopsy.casemodule.IngestJobInfoPanel; import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationDialog; -import org.sleuthkit.autopsy.modules.interestingitems.FileIngestFilterDefsOptionsPanelController; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetPanel; @@ -404,7 +404,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { }//GEN-LAST:event_pastJobsButtonActionPerformed private void fileIngestFilterComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileIngestFilterComboBoxActionPerformed - if (fileIngestFilterComboBox.getSelectedItem().toString().equals(FilesSetPanel.NEW_FILE_INGEST_FILTER)) { + if (fileIngestFilterComboBox.getSelectedItem().toString().equals(FilesSetPanel.getCreateNewFileIngestFilterString())) { final AdvancedConfigurationDialog dialog = new AdvancedConfigurationDialog(true); FilesSetDefsPanel fileIngestFilterPanel; fileIngestFilterPanel = new FilesSetDefsPanel(FilesSetDefsPanel.PANEL_TYPE.FILE_INGEST_FILTERS); @@ -423,12 +423,16 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } else if (evt.getActionCommand().equals("comboBoxChanged")) { try { - settings.setFileIngestFilter(FilesSetsManager.getInstance() - .getFileIngestFiltersWithDefaults() + Map fileIngestFilters = FilesSetsManager.getInstance() + .getCustomFileIngestFilters(); + for (FilesSet fSet : FilesSetsManager.getStandardFileIngestFilters()) { + fileIngestFilters.put(fSet.getName(), fSet); + } + settings.setFileIngestFilter(fileIngestFilters .get(fileIngestFilterComboBox.getSelectedItem().toString())); } catch (FilesSetsManager.FilesSetsManagerException ex) { settings.setFileIngestFilter(FilesSetsManager.getDefaultFilter()); - logger.log(Level.SEVERE, "Failed to get file ingest filter from combobox, default filter being used", ex); //NON-NLS + logger.log(Level.SEVERE, "Failed to get file ingest filter from combobox selection, default filter being used", ex); //NON-NLS } } }//GEN-LAST:event_fileIngestFilterComboBoxActionPerformed @@ -448,9 +452,9 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { for (FilesSet fSet : FilesSetsManager.getStandardFileIngestFilters()) { nameList.add(fSet.getName()); } - nameList.add(FilesSetPanel.NEW_FILE_INGEST_FILTER); + nameList.add(FilesSetPanel.getCreateNewFileIngestFilterString()); try { - for (FilesSet fSet : FilesSetsManager.getInstance().getFileIngestFilters().values()) { + for (FilesSet fSet : FilesSetsManager.getInstance().getCustomFileIngestFilters().values()) { nameList.add(fSet.getName()); } } catch (FilesSetsManager.FilesSetsManagerException ex) { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java index c25256f7e2..2afc136613 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetDefsPanel.java @@ -157,7 +157,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp public void saveSettings() { try { if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { - FilesSetsManager.getInstance().setFileIngestFilter(this.filesSets); + FilesSetsManager.getInstance().setCustomFileIngestFilters(this.filesSets); } else { FilesSetsManager.getInstance().setInterestingFilesSets(this.filesSets); } @@ -186,7 +186,7 @@ public final class FilesSetDefsPanel extends IngestModuleGlobalSettingsPanel imp // Get a working copy of the interesting files set definitions and sort // by set name. if (panelType == PANEL_TYPE.FILE_INGEST_FILTERS) { - this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getFileIngestFilters()); + this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getCustomFileIngestFilters()); } else { this.filesSets = new TreeMap<>(FilesSetsManager.getInstance().getInterestingFilesSets()); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java index fe1d156044..733902b1ec 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetPanel.java @@ -21,8 +21,6 @@ package org.sleuthkit.autopsy.modules.interestingitems; import org.openide.DialogDisplayer; import org.openide.NotifyDescriptor; import org.openide.util.NbBundle; -import org.sleuthkit.autopsy.ingest.IngestJobSettings; -import org.sleuthkit.autopsy.ingest.IngestJobSettingsPanel; import org.sleuthkit.autopsy.modules.interestingitems.FilesSetDefsPanel.PANEL_TYPE; /** @@ -30,10 +28,18 @@ 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..."}) + + private static final String CREATE_NEW_FILE_INGEST_FILTER = Bundle.FilesSetPanel_ingest_createNewFilter(); - public static final String NEW_FILE_INGEST_FILTER = "Create new file ingest filter..."; //WJS-TODO make this an @MESSAGES + /** + * @return the CREATE_NEW_FILE_INGEST_FILTER + */ + public static String getCreateNewFileIngestFilterString() { + return CREATE_NEW_FILE_INGEST_FILTER; + } - @NbBundle.Messages("FilesSetPanel.ingest.title=File Ingest Filter") + /** * Construct a files set panel in create mode. */ @@ -91,7 +97,7 @@ public class FilesSetPanel extends javax.swing.JPanel { return false; } } - if (this.nameTextField.getText().equals(NEW_FILE_INGEST_FILTER)) { + if (this.nameTextField.getText().equals(getCreateNewFileIngestFilterString())) { NotifyDescriptor notifyDesc = new NotifyDescriptor.Message( NbBundle.getMessage(FilesSetPanel.class, "FilesSetPanel.messages.filesSetsReservedName"), NotifyDescriptor.WARNING_MESSAGE); diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 5bc60d4a8d..69c23abf8e 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -100,27 +100,6 @@ public final class FilesSetsManager extends Observable { return FilesSetsManager.ILLEGAL_FILE_PATH_CHARS; } - /** - * @return the LEGACY_FILES_SET_DEFS_FILE_NAME - */ - static String getLegacyFilesSetDefsFileName() { - return LEGACY_FILES_SET_DEFS_FILE_NAME; - } - - /** - * @return the INTERESTING_FILES_SET_DEFS_NAME - */ - static String getInterestingFilesSetDefsName() { - return INTERESTING_FILES_SET_DEFS_NAME; - } - - /** - * @return the FILE_INGEST_FILTER_DEFS_NAME - */ - public static String getFileIngestFilterDefsName() { - return FILE_INGEST_FILTER_DEFS_NAME; - } - /** * Get a list of default FileIngestFilters. * @@ -152,21 +131,6 @@ public final class FilesSetsManager extends Observable { } } - /** - * Gets a copy of the current ingest file set definitions with the default - * values. - * - * @return A map of FilesSet names to file ingest sets, possibly empty. - */ - public Map getFileIngestFiltersWithDefaults() throws FilesSetsManagerException { - Map returnMap = new HashMap<>(); - for (FilesSet fSet : getStandardFileIngestFilters()) { - returnMap.put(fSet.getName(), fSet); - } - returnMap.putAll(getFileIngestFilters()); - return returnMap; - } - /** * Gets a copy of the current ingest file set definitions. * @@ -175,9 +139,9 @@ public final class FilesSetsManager extends Observable { * * @return A map of FilesSet names to file ingest sets, possibly empty. */ - public Map getFileIngestFilters() throws FilesSetsManagerException { + public Map getCustomFileIngestFilters() throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { - return FilesSetXML.readDefinitionsFile(getFileIngestFilterDefsName(), ""); + return FilesSetXML.readDefinitionsFile(FILE_INGEST_FILTER_DEFS_NAME, ""); } } @@ -203,7 +167,7 @@ public final class FilesSetsManager extends Observable { * @param filesSets A mapping of file ingest filters names to files sets, * used to enforce unique files set names. */ - void setFileIngestFilter(Map filesSets) throws FilesSetsManagerException { + void setCustomFileIngestFilters(Map filesSets) throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { FilesSetXML.writeDefinitionsFile(FILE_INGEST_FILTER_DEFS_NAME, filesSets); } @@ -310,7 +274,7 @@ public final class FilesSetsManager extends Observable { if (fileSetFile.exists()) { try { try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { - FilesSetSettings filesSetsSettings = (FilesSetSettings) in.readObject(); + InterestingFilesSetSettings filesSetsSettings = (InterestingFilesSetSettings) in.readObject(); return filesSetsSettings.getFilesSets(); } } catch (IOException | ClassNotFoundException ex) { @@ -628,7 +592,7 @@ public final class FilesSetsManager extends Observable { // definitions that ship with Autopsy and one for user definitions. static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws FilesSetsManagerException { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), fileName).toString()))) { - out.writeObject(new FilesSetSettings(interestingFilesSets)); + out.writeObject(new InterestingFilesSetSettings(interestingFilesSets)); } catch (IOException ex) { throw new FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingFilesSetSettings.java similarity index 90% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingFilesSetSettings.java index 6ce996423b..309aa1a4d1 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingFilesSetSettings.java @@ -27,12 +27,12 @@ import java.util.Map; * * @author oliver */ -class FilesSetSettings implements Serializable { +class InterestingFilesSetSettings implements Serializable { private static final long serialVersionUID = 1L; private final Map filesSets; - FilesSetSettings(Map filesSets) { + InterestingFilesSetSettings(Map filesSets) { this.filesSets = filesSets; } From ca7e1b2e4941496827a20785bbca1504f0be2762 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 17:28:30 -0500 Subject: [PATCH 38/50] 1903 returned InterestingItemsFilesSetSettings to its necessary form --- .../modules/interestingitems/FilesSetsManager.java | 4 ++-- ....java => InterestingItemsFilesSetSettings.java} | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) rename Core/src/org/sleuthkit/autopsy/modules/interestingitems/{InterestingFilesSetSettings.java => InterestingItemsFilesSetSettings.java} (79%) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 69c23abf8e..15d6133c9d 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -274,7 +274,7 @@ public final class FilesSetsManager extends Observable { if (fileSetFile.exists()) { try { try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { - InterestingFilesSetSettings filesSetsSettings = (InterestingFilesSetSettings) in.readObject(); + InterestingItemsFilesSetSettings filesSetsSettings = (InterestingItemsFilesSetSettings) in.readObject(); return filesSetsSettings.getFilesSets(); } } catch (IOException | ClassNotFoundException ex) { @@ -592,7 +592,7 @@ public final class FilesSetsManager extends Observable { // definitions that ship with Autopsy and one for user definitions. static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws FilesSetsManagerException { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), fileName).toString()))) { - out.writeObject(new InterestingFilesSetSettings(interestingFilesSets)); + out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); } catch (IOException ex) { throw new FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex); } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java similarity index 79% rename from Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingFilesSetSettings.java rename to Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java index 309aa1a4d1..14771992eb 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingFilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java @@ -22,17 +22,13 @@ import java.io.Serializable; import java.util.Map; /** - * A map of FilesSets for saving all the settings in FilesSetsManager in one - * item. * * @author oliver */ -class InterestingFilesSetSettings implements Serializable { - +class InterestingItemsFilesSetSettings implements Serializable { private static final long serialVersionUID = 1L; - private final Map filesSets; - - InterestingFilesSetSettings(Map filesSets) { + private Map filesSets; + InterestingItemsFilesSetSettings(Map filesSets) { this.filesSets = filesSets; } @@ -42,5 +38,7 @@ class InterestingFilesSetSettings implements Serializable { Map getFilesSets() { return filesSets; } - + + + } From 7e4e459d7516d05311e75f236988c9c3ebc42bf3 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 18:20:41 -0500 Subject: [PATCH 39/50] 1903-FileSetXML functionality moved to InterestingItemsFilesSetSettings, FileIngestFilters serialized as map --- .../interestingitems/FilesSetsManager.java | 486 ++---------------- .../InterestingItemsFilesSetSettings.java | 420 ++++++++++++++- 2 files changed, 461 insertions(+), 445 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 15d6133c9d..12a01f3fd4 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -34,6 +34,7 @@ import java.util.Observable; import java.util.logging.Level; import java.util.regex.Pattern; import java.util.regex.PatternSyntaxException; +import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; import org.sleuthkit.autopsy.coreutils.Logger; @@ -53,6 +54,8 @@ import org.w3c.dom.NodeList; */ public final class FilesSetsManager extends Observable { + @NbBundle.Messages({"FilesSetsManager.allFilesAndDirectories=All Files and Directories", + "FilesSetsManager.allFilesDirectoriesAndUnallocated=All Files, Directories, and Unallocated Space"}) private static final List ILLEGAL_FILE_NAME_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", "/", ":", "*", "?", "\"", "<", ">"))); private static final List ILLEGAL_FILE_PATH_CHARS = Collections.unmodifiableList(new ArrayList<>(Arrays.asList("\\", ":", "*", "?", "\"", "<", ">"))); private static final String LEGACY_FILES_SET_DEFS_FILE_NAME = "InterestingFilesSetDefs.xml"; //NON-NLS @@ -62,15 +65,23 @@ public final class FilesSetsManager extends Observable { private static final Object INTERESTING_FILES_SET_LOCK = new Object(); private static FilesSetsManager instance; private static final FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet( - "All Files and Directories", "All Files and Directories", false, true, new HashMap(){{ - put("All Files and Directories",new Rule("All Files and Directories", null ,new MetaTypeCondition(MetaTypeCondition.Type.ALL), null, null, null)); - }}); //WJS-TODO make this an @MESSAGES//NON-NLS + Bundle.FilesSetsManager_AllFilesAndDirectories(), Bundle.FilesSetsManager_AllFilesAndDirectories(), false, true, new HashMap() { + { + put(Bundle.FilesSetsManager_AllFilesAndDirectories(), + new Rule(Bundle.FilesSetsManager_AllFilesAndDirectories(), null, + new MetaTypeCondition(MetaTypeCondition.Type.ALL), null, null, null)); + } + }); //WJS-TODO make this an @MESSAGES//NON-NLS private static final FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet( - "All Files, Directories, and Unallocated Space", "All Files, Directories, and Unallocated Space", - false, false, new HashMap(){{ - put("All Files, Directories, and Unallocated Space",new Rule("All Files, Directories, and Unallocated Space", null ,new MetaTypeCondition(MetaTypeCondition.Type.ALL), null, null, null)); - }}); //WJS-TODO make this an @MESSAGES//NON-NLS - + Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), + false, false, new HashMap() { + { + put(Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), + new Rule(Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), null, + new MetaTypeCondition(MetaTypeCondition.Type.ALL), null, null, null)); + } + }); //WJS-TODO make this an @MESSAGES//NON-NLS + /** * Gets the FilesSet definitions manager singleton. */ @@ -110,15 +121,15 @@ public final class FilesSetsManager extends Observable { } /** - * Get the filter that should be used as the default value, - * if no filter is specified. - * + * Get the filter that should be used as the default value, if no filter is + * specified. + * * @return FILES_DIRS_UNALLOC_INGEST_FILTER */ - public static FilesSet getDefaultFilter(){ + public static FilesSet getDefaultFilter() { return FILES_DIRS_UNALLOC_INGEST_FILTER; } - + /** * Gets a copy of the current interesting files set definitions. * @@ -127,7 +138,7 @@ public final class FilesSetsManager extends Observable { */ Map getInterestingFilesSets() throws FilesSetsManagerException { synchronized (INTERESTING_FILES_SET_LOCK) { - return FilesSetXML.readDefinitionsFile(INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME); + return InterestingItemsFilesSetSettings.readDefinitionsFile(INTERESTING_FILES_SET_DEFS_NAME, LEGACY_FILES_SET_DEFS_FILE_NAME); } } @@ -141,7 +152,21 @@ public final class FilesSetsManager extends Observable { */ public Map getCustomFileIngestFilters() throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { - return FilesSetXML.readDefinitionsFile(FILE_INGEST_FILTER_DEFS_NAME, ""); + Path filePath = Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME); + File fileSetFile = filePath.toFile(); + String filePathStr = filePath.toString(); + if (fileSetFile.exists()) { + try { + try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { + Map filesSetsSettings = (Map) in.readObject(); + return filesSetsSettings; + } + } catch (IOException | ClassNotFoundException ex) { + throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); + } + } else { + return new HashMap<>(); + } } } @@ -154,7 +179,7 @@ public final class FilesSetsManager extends Observable { */ void setInterestingFilesSets(Map filesSets) throws FilesSetsManagerException { synchronized (INTERESTING_FILES_SET_LOCK) { - FilesSetXML.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_NAME, filesSets); + InterestingItemsFilesSetSettings.writeDefinitionsFile(INTERESTING_FILES_SET_DEFS_NAME, filesSets); this.setChanged(); this.notifyObservers(); } @@ -169,434 +194,11 @@ public final class FilesSetsManager extends Observable { */ void setCustomFileIngestFilters(Map filesSets) throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { - FilesSetXML.writeDefinitionsFile(FILE_INGEST_FILTER_DEFS_NAME, filesSets); - } - } - - /** - * Reads and writes FilesSet definitions to and from disk in - * XML format. - */ - private final static class FilesSetXML { - - private static final Logger logger = Logger.getLogger(FilesSetXML.class.getName()); - private static final String XML_ENCODING = "UTF-8"; //NON-NLS - private static final List illegalFileNameChars = FilesSetsManager.getIllegalFileNameChars(); - - // The following tags and attributes are identical to those used in the - // TSK Framework FilesSet definitions file schema. - private static final String FILE_SETS_ROOT_TAG = "INTERESTING_FILE_SETS"; //NON-NLS - private static final String FILE_SET_TAG = "INTERESTING_FILE_SET"; //NON-NLS - private static final String NAME_RULE_TAG = "NAME"; //NON-NLS - private static final String EXTENSION_RULE_TAG = "EXTENSION"; //NON-NLS - private static final String NAME_ATTR = "name"; //NON-NLS - private static final String RULE_UUID_ATTR = "ruleUUID"; //NON-NLS - private static final String DESC_ATTR = "description"; //NON-NLS - private static final String IGNORE_KNOWN_FILES_ATTR = "ignoreKnown"; //NON-NLS - private static final String IGNORE_UNALLOCATED_SPACE = "ingoreUnallocated"; //NON-NLS - private static final String TYPE_FILTER_ATTR = "typeFilter"; //NON-NLS - private static final String PATH_FILTER_ATTR = "pathFilter"; //NON-NLS - private static final String TYPE_FILTER_VALUE_FILES = "file"; //NON-NLS - private static final String TYPE_FILTER_VALUE_DIRS = "dir"; //NON-NLS - - private static final String REGEX_ATTR = "regex"; //NON-NLS - private static final String PATH_REGEX_ATTR = "pathRegex"; //NON-NLS - private static final String TYPE_FILTER_VALUE_FILES_AND_DIRS = "files_and_dirs"; //NON-NLS - private static final String UNNAMED_LEGACY_RULE_PREFIX = "Unnamed Rule "; // NON-NLS - private static int unnamedLegacyRuleCounter; - - /** - * Reads FilesSet definitions from an XML file. - * - * @param fileName The name of the file which is expected to store - * the serialized definitions - * @param legacyFilePath Path of the set definitions file as a string. - * - * @return The set definitions in a map of set names to sets. - */ - // Note: This method takes a file path to support the possibility of - // multiple intersting files set definition files, e.g., one for - // definitions that ship with Autopsy and one for user definitions. - static Map readDefinitionsFile(String fileName, String legacyFileName) throws FilesSetsManagerException { - Map filesSets = readSerializedDefinitions(fileName); - - if (!filesSets.isEmpty()) { - return filesSets; - } - // Check if the legacy xml file exists. - if (!legacyFileName.isEmpty()) { - File defsFile = Paths.get(PlatformUtil.getUserConfigDirectory(),legacyFileName).toFile(); - if (!defsFile.exists()) { - return filesSets; - } - - // Check if the file can be read. - if (!defsFile.canRead()) { - logger.log(Level.SEVERE, "FilesSet definition file at {0} exists, but cannot be read", defsFile.getPath()); // NON-NLS - return filesSets; - } - - // Parse the XML in the file. - Document doc = XMLUtil.loadDoc(FilesSetXML.class, defsFile.getPath()); - if (doc == null) { - logger.log(Level.SEVERE, "FilesSet definition file at {0}", defsFile.getPath()); // NON-NLS - return filesSets; - } - - // Get the root element. - Element root = doc.getDocumentElement(); - if (root == null) { - logger.log(Level.SEVERE, "Failed to get root {0} element tag of FilesSet definition file at {1}", new Object[]{FilesSetXML.FILE_SETS_ROOT_TAG, defsFile.getPath()}); // NON-NLS - return filesSets; - } - - // Read in the files set definitions. - NodeList setElems = root.getElementsByTagName(FILE_SET_TAG); - for (int i = 0; i < setElems.getLength(); ++i) { - readFilesSet((Element) setElems.item(i), filesSets, defsFile.getPath()); - } - } - return filesSets; - } - - /** - * Reads the definitions from the serialization file - * - * @return the map representing settings saved to serialization file, - * empty set if the file does not exist. - * - * @throws FilesSetsManagerException if file could not be read - */ - private static Map readSerializedDefinitions(String serialFileName) throws FilesSetsManagerException { - Path filePath = Paths.get(PlatformUtil.getUserConfigDirectory(),serialFileName); - File fileSetFile = filePath.toFile(); - String filePathStr = filePath.toString(); - if (fileSetFile.exists()) { - try { - try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { - InterestingItemsFilesSetSettings filesSetsSettings = (InterestingItemsFilesSetSettings) in.readObject(); - return filesSetsSettings.getFilesSets(); - } - } catch (IOException | ClassNotFoundException ex) { - throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); - } - } else { - return new HashMap<>(); - } - } - - /** - * Reads in a FilesSet. - * - * @param setElem A FilesSet XML element - * @param filesSets A collection to which the set is to be added. - * @param filePath The source file, used for error reporting. - */ - private static void readFilesSet(Element setElem, Map filesSets, String filePath) { - // The file set must have a unique name. - String setName = setElem.getAttribute(FilesSetXML.NAME_ATTR); - if (setName.isEmpty()) { - logger.log(Level.SEVERE, "Found {0} element without required {1} attribute, ignoring malformed file set definition in FilesSet definition file at {2}", new Object[]{FilesSetXML.FILE_SET_TAG, FilesSetXML.NAME_ATTR, filePath}); // NON-NLS - return; - } - if (filesSets.containsKey(setName)) { - logger.log(Level.SEVERE, "Found duplicate definition of set named {0} in FilesSet definition file at {1}, discarding duplicate set", new Object[]{setName, filePath}); // NON-NLS - return; - } - - // The file set may have a description. The empty string is o.k. - String description = setElem.getAttribute(FilesSetXML.DESC_ATTR); - - // The file set may or may not ignore known files. The default behavior - // is to not ignore them. - String ignoreKnown = setElem.getAttribute(FilesSetXML.IGNORE_KNOWN_FILES_ATTR); - boolean ignoreKnownFiles = false; - if (!ignoreKnown.isEmpty()) { - ignoreKnownFiles = Boolean.parseBoolean(ignoreKnown); - } - - // The file set may or may not skip unallocated space. The default behavior - // is not to skip it. - String ignoreUnallocated = setElem.getAttribute(FilesSetXML.IGNORE_UNALLOCATED_SPACE); - boolean ignoreUnallocatedSpace = false; - if (!ignoreUnallocated.isEmpty()) { - ignoreUnallocatedSpace = Boolean.parseBoolean(ignoreUnallocated); - } - // Read file name set membership rules, if any. - FilesSetXML.unnamedLegacyRuleCounter = 1; - Map rules = new HashMap<>(); - NodeList nameRuleElems = setElem.getElementsByTagName(FilesSetXML.NAME_RULE_TAG); - for (int j = 0; j < nameRuleElems.getLength(); ++j) { - Element elem = (Element) nameRuleElems.item(j); - FilesSet.Rule rule = FilesSetXML.readFileNameRule(elem); - if (rule != null) { - if (!rules.containsKey(rule.getUuid())) { - rules.put(rule.getUuid(), rule); - } else { - logger.log(Level.SEVERE, "Found duplicate rule {0} for set named {1} in FilesSet definition file at {2}, discarding malformed set", new Object[]{rule.getUuid(), setName, filePath}); // NON-NLS - return; - } - } else { - logger.log(Level.SEVERE, "Found malformed rule for set named {0} in FilesSet definition file at {1}, discarding malformed set", new Object[]{setName, filePath}); // NON-NLS - return; - } - } - - // Read file extension set membership rules, if any. - NodeList extRuleElems = setElem.getElementsByTagName(FilesSetXML.EXTENSION_RULE_TAG); - for (int j = 0; j < extRuleElems.getLength(); ++j) { - Element elem = (Element) extRuleElems.item(j); - FilesSet.Rule rule = FilesSetXML.readFileExtensionRule(elem); - if (rule != null) { - if (!rules.containsKey(rule.getUuid())) { - rules.put(rule.getUuid(), rule); - } else { - logger.log(Level.SEVERE, "Found duplicate rule {0} for set named {1} in FilesSet definition file at {2}, discarding malformed set", new Object[]{rule.getUuid(), setName, filePath}); //NOI18N NON-NLS - return; - } - } else { - logger.log(Level.SEVERE, "Found malformed rule for set named {0} in FilesSet definition file at {1}, discarding malformed set", new Object[]{setName, filePath}); //NOI18N NON-NLS - return; - } - } - - // Make the files set. Note that degenerate sets with no rules are - // allowed to facilitate the separation of set definition and rule - // definitions. A set without rules is simply the empty set. - FilesSet set = new FilesSet(setName, description, ignoreKnownFiles, ignoreUnallocatedSpace, rules); - filesSets.put(set.getName(), set); - } - - /** - * Construct a FilesSet file name rule from the data in an - * XML element. - * - * @param elem The file name rule XML element. - * - * @return A file name rule, or null if there is an error (the error is - * logged). - */ - private static FilesSet.Rule readFileNameRule(Element elem) { - String ruleName = FilesSetXML.readRuleName(elem); - - // The content of the rule tag is a file name condition. It may be a - // regex, or it may be from a TSK Framework rule definition with a - // "*" globbing char, or it may be simple text. - String content = elem.getTextContent(); - FilesSet.Rule.FullNameCondition nameCondition; - String regex = elem.getAttribute(FilesSetXML.REGEX_ATTR); - if ((!regex.isEmpty() && regex.equalsIgnoreCase("true")) || content.contains("*")) { // NON-NLS - Pattern pattern = compileRegex(content); - if (pattern != null) { - nameCondition = new FilesSet.Rule.FullNameCondition(pattern); - } else { - logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.NAME_RULE_TAG + " regex, ignoring malformed '{0}' rule definition", ruleName); // NON-NLS - return null; - } - } else { - for (String illegalChar : illegalFileNameChars) { - if (content.contains(illegalChar)) { - logger.log(Level.SEVERE, FilesSetXML.NAME_RULE_TAG + " content has illegal chars, ignoring malformed '{0}' rule definition", new Object[]{FilesSetXML.NAME_RULE_TAG, ruleName}); // NON-NLS - return null; - } - } - nameCondition = new FilesSet.Rule.FullNameCondition(content); - } - - // Read in the type condition. - FilesSet.Rule.MetaTypeCondition metaTypeCondition = FilesSetXML.readMetaTypeCondition(elem); - if (metaTypeCondition == null) { - // Malformed attribute. - return null; - } - - // Read in the optional path condition. Null is o.k., but if the attribute - // is there, be sure it is not malformed. - FilesSet.Rule.ParentPathCondition pathCondition = null; - if (!elem.getAttribute(FilesSetXML.PATH_FILTER_ATTR).isEmpty() - || !elem.getAttribute(FilesSetXML.PATH_REGEX_ATTR).isEmpty()) { - pathCondition = FilesSetXML.readPathCondition(elem); - if (pathCondition == null) { - // Malformed attribute. - return null; - } - } - - return new FilesSet.Rule(ruleName, nameCondition, metaTypeCondition, pathCondition, null, null); - } - - /** - * Construct a FilesSet file name extension rule from the - * data in an XML element. - * - * @param elem The file name extension rule XML element. - * - * @return A file name extension rule, or null if there is an error (the - * error is logged). - */ - private static FilesSet.Rule readFileExtensionRule(Element elem) { - String ruleName = FilesSetXML.readRuleName(elem); - - // The content of the rule tag is a file name extension condition. It may - // be a regex, or it may be from a TSK Framework rule definition - // with a "*" globbing char. - String content = elem.getTextContent(); - FilesSet.Rule.ExtensionCondition extCondition; - String regex = elem.getAttribute(FilesSetXML.REGEX_ATTR); - if ((!regex.isEmpty() && regex.equalsIgnoreCase("true")) || content.contains("*")) { // NON-NLS - Pattern pattern = compileRegex(content); - if (pattern != null) { - extCondition = new FilesSet.Rule.ExtensionCondition(pattern); - } else { - logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.EXTENSION_RULE_TAG + " regex, ignoring malformed {0} rule definition", ruleName); // NON-NLS - return null; - } - } else { - for (String illegalChar : illegalFileNameChars) { - if (content.contains(illegalChar)) { - logger.log(Level.SEVERE, "{0} content has illegal chars, ignoring malformed {1} rule definition", ruleName); // NON-NLS - return null; - } - } - extCondition = new FilesSet.Rule.ExtensionCondition(content); - } - - // The rule must have a meta-type condition, unless a TSK Framework - // definitions file is being read. - FilesSet.Rule.MetaTypeCondition metaTypeCondition = null; - if (!elem.getAttribute(FilesSetXML.TYPE_FILTER_ATTR).isEmpty()) { - metaTypeCondition = FilesSetXML.readMetaTypeCondition(elem); - if (metaTypeCondition == null) { - // Malformed attribute. - return null; - } - } else { - metaTypeCondition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); - } - - // The rule may have a path condition. Null is o.k., but if the attribute - // is there, it must not be malformed. - FilesSet.Rule.ParentPathCondition pathCondition = null; - if (!elem.getAttribute(FilesSetXML.PATH_FILTER_ATTR).isEmpty() - || !elem.getAttribute(FilesSetXML.PATH_REGEX_ATTR).isEmpty()) { - pathCondition = FilesSetXML.readPathCondition(elem); - if (pathCondition == null) { - // Malformed attribute. - return null; - } - } - - return new FilesSet.Rule(ruleName, extCondition, metaTypeCondition, pathCondition, null, null); - } - - /** - * Read a rule name attribute from a rule element. - * - * @param elem A rule element. - * - * @return A rule name. - */ - private static String readRuleName(Element elem) { - // The rule must have a name. - String ruleName = elem.getAttribute(FilesSetXML.NAME_ATTR); - return ruleName; - } - - /** - * Attempts to compile a regular expression. - * - * @param regex The regular expression. - * - * @return A pattern object, or null if the compilation fails. - */ - private static Pattern compileRegex(String regex) { - try { - return Pattern.compile(regex); - } catch (PatternSyntaxException ex) { - logger.log(Level.SEVERE, "Error compiling rule regex: " + ex.getMessage(), ex); // NON-NLS - return null; - } - } - - /** - * Construct a meta-type condition for a FilesSet - * membership rule from data in an XML element. - * - * @param ruleElement The XML element. - * - * @return The meta-type condition, or null if there is an error - * (logged). - */ - private static FilesSet.Rule.MetaTypeCondition readMetaTypeCondition(Element ruleElement) { - FilesSet.Rule.MetaTypeCondition condition = null; - String conditionAttribute = ruleElement.getAttribute(FilesSetXML.TYPE_FILTER_ATTR); - if (!conditionAttribute.isEmpty()) { - switch (conditionAttribute) { - case FilesSetXML.TYPE_FILTER_VALUE_FILES: - condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); - break; - case FilesSetXML.TYPE_FILTER_VALUE_DIRS: - condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); - break; - case FilesSetXML.TYPE_FILTER_VALUE_FILES_AND_DIRS: - condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); - break; - default: - logger.log(Level.SEVERE, "Found {0} " + FilesSetXML.TYPE_FILTER_ATTR + " attribute with unrecognized value ''{0}'', ignoring malformed rule definition", conditionAttribute); // NON-NLS - break; - } - } else { - // Accept TSK Framework FilesSet definitions, - // default to files. - condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); - } - return condition; - } - - /** - * Construct a path condition for a FilesSet membership - * rule from data in an XML element. - * - * @param ruleElement The XML element. - * - * @return The path condition, or null if there is an error (logged). - */ - private static FilesSet.Rule.ParentPathCondition readPathCondition(Element ruleElement) { - FilesSet.Rule.ParentPathCondition condition = null; - String path = ruleElement.getAttribute(FilesSetXML.PATH_FILTER_ATTR); - String pathRegex = ruleElement.getAttribute(FilesSetXML.PATH_REGEX_ATTR); - if (!pathRegex.isEmpty() && path.isEmpty()) { - try { - Pattern pattern = Pattern.compile(pathRegex); - condition = new FilesSet.Rule.ParentPathCondition(pattern); - } catch (PatternSyntaxException ex) { - logger.log(Level.SEVERE, "Error compiling " + FilesSetXML.PATH_REGEX_ATTR + " regex, ignoring malformed path condition definition", ex); // NON-NLS - } - } else if (!path.isEmpty() && pathRegex.isEmpty()) { - condition = new FilesSet.Rule.ParentPathCondition(path); - } - return condition; - } - - /** - * Writes FilesSet definitions to disk as an XML file, - * logging any errors. - * - * @param fileName Name of the set definitions file as a string. - * - * @returns True if the definitions are written to disk, false - * otherwise. - */ - // Note: This method takes a file path to support the possibility of - // multiple intersting files set definition files, e.g., one for - // definitions that ship with Autopsy and one for user definitions. - static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws FilesSetsManagerException { - try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), fileName).toString()))) { - out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); + try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME).toString()))) { + out.writeObject(filesSets); } catch (IOException ex) { - throw new FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex); + throw new FilesSetsManagerException(String.format("Failed to write settings to %s", FILE_INGEST_FILTER_DEFS_NAME), ex); } - return true; } } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java index 14771992eb..bdd9f53a49 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/InterestingItemsFilesSetSettings.java @@ -18,16 +18,61 @@ */ package org.sleuthkit.autopsy.modules.interestingitems; +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; import java.io.Serializable; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.List; import java.util.Map; +import java.util.logging.Level; +import java.util.regex.Pattern; +import java.util.regex.PatternSyntaxException; +import org.openide.util.io.NbObjectInputStream; +import org.openide.util.io.NbObjectOutputStream; +import org.sleuthkit.autopsy.coreutils.Logger; +import org.sleuthkit.autopsy.coreutils.PlatformUtil; +import org.sleuthkit.autopsy.coreutils.XMLUtil; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; /** * * @author oliver */ class InterestingItemsFilesSetSettings implements Serializable { + private static final long serialVersionUID = 1L; + // The following tags and attributes are identical to those used in the + // TSK Framework FilesSet definitions file schema. + private static final String FILE_SETS_ROOT_TAG = "INTERESTING_FILE_SETS"; //NON-NLS + private static final String DESC_ATTR = "description"; //NON-NLS + private static final String RULE_UUID_ATTR = "ruleUUID"; //NON-NLS + private static final String IGNORE_KNOWN_FILES_ATTR = "ignoreKnown"; //NON-NLS + private static final String PATH_REGEX_ATTR = "pathRegex"; //NON-NLS + private static final String TYPE_FILTER_VALUE_FILES_AND_DIRS = "files_and_dirs"; //NON-NLS + private static final String IGNORE_UNALLOCATED_SPACE = "ingoreUnallocated"; //NON-NLS + private static final String PATH_FILTER_ATTR = "pathFilter"; //NON-NLS + private static final String TYPE_FILTER_VALUE_DIRS = "dir"; //NON-NLS + private static final String REGEX_ATTR = "regex"; //NON-NLS + private static final List illegalFileNameChars = FilesSetsManager.getIllegalFileNameChars(); + private static final String FILE_SET_TAG = "INTERESTING_FILE_SET"; //NON-NLS + private static final String NAME_RULE_TAG = "NAME"; //NON-NLS + private static final String UNNAMED_LEGACY_RULE_PREFIX = "Unnamed Rule "; // NON-NLS + private static final String NAME_ATTR = "name"; //NON-NLS + private static final String TYPE_FILTER_VALUE_FILES = "file"; //NON-NLS + private static final String XML_ENCODING = "UTF-8"; //NON-NLS + private static final Logger logger = Logger.getLogger(InterestingItemsFilesSetSettings.class.getName()); + private static int unnamedLegacyRuleCounter; + private static final String TYPE_FILTER_ATTR = "typeFilter"; //NON-NLS + private static final String EXTENSION_RULE_TAG = "EXTENSION"; //NON-NLS + private Map filesSets; + InterestingItemsFilesSetSettings(Map filesSets) { this.filesSets = filesSets; } @@ -38,7 +83,376 @@ class InterestingItemsFilesSetSettings implements Serializable { Map getFilesSets() { return filesSets; } - - - + + /** + * Read a rule name attribute from a rule element. + * + * @param elem A rule element. + * + * @return A rule name. + */ + private static String readRuleName(Element elem) { + // The rule must have a name. + String ruleName = elem.getAttribute(InterestingItemsFilesSetSettings.NAME_ATTR); + return ruleName; + } + + /** + * Reads the definitions from the serialization file + * + * @return the map representing settings saved to serialization file, empty + * set if the file does not exist. + * + * @throws FilesSetsManagerException if file could not be read + */ + private static Map readSerializedDefinitions(String serialFileName) throws FilesSetsManager.FilesSetsManagerException { + Path filePath = Paths.get(PlatformUtil.getUserConfigDirectory(), serialFileName); + File fileSetFile = filePath.toFile(); + String filePathStr = filePath.toString(); + if (fileSetFile.exists()) { + try { + try (final NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { + InterestingItemsFilesSetSettings filesSetsSettings = (InterestingItemsFilesSetSettings) in.readObject(); + return filesSetsSettings.getFilesSets(); + } + } catch (IOException | ClassNotFoundException ex) { + throw new FilesSetsManager.FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); + } + } else { + return new HashMap<>(); + } + } + + /** + * Construct a path condition for a FilesSet membership rule from data in an + * XML element. + * + * @param ruleElement The XML element. + * + * @return The path condition, or null if there is an error (logged). + */ + private static FilesSet.Rule.ParentPathCondition readPathCondition(Element ruleElement) { + FilesSet.Rule.ParentPathCondition condition = null; + String path = ruleElement.getAttribute(InterestingItemsFilesSetSettings.PATH_FILTER_ATTR); + String pathRegex = ruleElement.getAttribute(InterestingItemsFilesSetSettings.PATH_REGEX_ATTR); + if (!pathRegex.isEmpty() && path.isEmpty()) { + try { + Pattern pattern = Pattern.compile(pathRegex); + condition = new FilesSet.Rule.ParentPathCondition(pattern); + } catch (PatternSyntaxException ex) { + logger.log(Level.SEVERE, "Error compiling " + InterestingItemsFilesSetSettings.PATH_REGEX_ATTR + " regex, ignoring malformed path condition definition", ex); // NON-NLS + } + } else if (!path.isEmpty() && pathRegex.isEmpty()) { + condition = new FilesSet.Rule.ParentPathCondition(path); + } + return condition; + } + + /** + * Attempts to compile a regular expression. + * + * @param regex The regular expression. + * + * @return A pattern object, or null if the compilation fails. + */ + private static Pattern compileRegex(String regex) { + try { + return Pattern.compile(regex); + } catch (PatternSyntaxException ex) { + logger.log(Level.SEVERE, "Error compiling rule regex: " + ex.getMessage(), ex); // NON-NLS + return null; + } + } + + /** + * Construct a FilesSet file name extension rule from the data in an XML + * element. + * + * @param elem The file name extension rule XML element. + * + * @return A file name extension rule, or null if there is an error (the + * error is logged). + */ + private static FilesSet.Rule readFileExtensionRule(Element elem) { + String ruleName = InterestingItemsFilesSetSettings.readRuleName(elem); + // The content of the rule tag is a file name extension condition. It may + // be a regex, or it may be from a TSK Framework rule definition + // with a "*" globbing char. + String content = elem.getTextContent(); + FilesSet.Rule.ExtensionCondition extCondition; + String regex = elem.getAttribute(InterestingItemsFilesSetSettings.REGEX_ATTR); + if ((!regex.isEmpty() && regex.equalsIgnoreCase("true")) || content.contains("*")) { + // NON-NLS + Pattern pattern = compileRegex(content); + if (pattern != null) { + extCondition = new FilesSet.Rule.ExtensionCondition(pattern); + } else { + logger.log(Level.SEVERE, "Error compiling " + InterestingItemsFilesSetSettings.EXTENSION_RULE_TAG + " regex, ignoring malformed {0} rule definition", ruleName); // NON-NLS + return null; + } + } else { + for (String illegalChar : illegalFileNameChars) { + if (content.contains(illegalChar)) { + logger.log(Level.SEVERE, "{0} content has illegal chars, ignoring malformed {1} rule definition", ruleName); // NON-NLS + return null; + } + } + extCondition = new FilesSet.Rule.ExtensionCondition(content); + } + // The rule must have a meta-type condition, unless a TSK Framework + // definitions file is being read. + FilesSet.Rule.MetaTypeCondition metaTypeCondition = null; + if (!elem.getAttribute(InterestingItemsFilesSetSettings.TYPE_FILTER_ATTR).isEmpty()) { + metaTypeCondition = InterestingItemsFilesSetSettings.readMetaTypeCondition(elem); + if (metaTypeCondition == null) { + // Malformed attribute. + return null; + } + } else { + metaTypeCondition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); + } + // The rule may have a path condition. Null is o.k., but if the attribute + // is there, it must not be malformed. + FilesSet.Rule.ParentPathCondition pathCondition = null; + if (!elem.getAttribute(InterestingItemsFilesSetSettings.PATH_FILTER_ATTR).isEmpty() || !elem.getAttribute(InterestingItemsFilesSetSettings.PATH_REGEX_ATTR).isEmpty()) { + pathCondition = InterestingItemsFilesSetSettings.readPathCondition(elem); + if (pathCondition == null) { + // Malformed attribute. + return null; + } + } + return new FilesSet.Rule(ruleName, extCondition, metaTypeCondition, pathCondition, null, null); + } + + /** + * Construct a FilesSet file name rule from the data in an XML element. + * + * @param elem The file name rule XML element. + * + * @return A file name rule, or null if there is an error (the error is + * logged). + */ + private static FilesSet.Rule readFileNameRule(Element elem) { + String ruleName = InterestingItemsFilesSetSettings.readRuleName(elem); + // The content of the rule tag is a file name condition. It may be a + // regex, or it may be from a TSK Framework rule definition with a + // "*" globbing char, or it may be simple text. + String content = elem.getTextContent(); + FilesSet.Rule.FullNameCondition nameCondition; + String regex = elem.getAttribute(InterestingItemsFilesSetSettings.REGEX_ATTR); + if ((!regex.isEmpty() && regex.equalsIgnoreCase("true")) || content.contains("*")) { + // NON-NLS + Pattern pattern = compileRegex(content); + if (pattern != null) { + nameCondition = new FilesSet.Rule.FullNameCondition(pattern); + } else { + logger.log(Level.SEVERE, "Error compiling " + InterestingItemsFilesSetSettings.NAME_RULE_TAG + " regex, ignoring malformed '{0}' rule definition", ruleName); // NON-NLS + return null; + } + } else { + for (String illegalChar : illegalFileNameChars) { + if (content.contains(illegalChar)) { + logger.log(Level.SEVERE, InterestingItemsFilesSetSettings.NAME_RULE_TAG + " content has illegal chars, ignoring malformed '{0}' rule definition", new Object[]{InterestingItemsFilesSetSettings.NAME_RULE_TAG, ruleName}); // NON-NLS + return null; + } + } + nameCondition = new FilesSet.Rule.FullNameCondition(content); + } + // Read in the type condition. + FilesSet.Rule.MetaTypeCondition metaTypeCondition = InterestingItemsFilesSetSettings.readMetaTypeCondition(elem); + if (metaTypeCondition == null) { + // Malformed attribute. + return null; + } + // Read in the optional path condition. Null is o.k., but if the attribute + // is there, be sure it is not malformed. + FilesSet.Rule.ParentPathCondition pathCondition = null; + if (!elem.getAttribute(InterestingItemsFilesSetSettings.PATH_FILTER_ATTR).isEmpty() || !elem.getAttribute(InterestingItemsFilesSetSettings.PATH_REGEX_ATTR).isEmpty()) { + pathCondition = InterestingItemsFilesSetSettings.readPathCondition(elem); + if (pathCondition == null) { + // Malformed attribute. + return null; + } + } + return new FilesSet.Rule(ruleName, nameCondition, metaTypeCondition, pathCondition, null, null); + } + + /** + * Reads in a FilesSet. + * + * @param setElem A FilesSet XML element + * @param filesSets A collection to which the set is to be added. + * @param filePath The source file, used for error reporting. + */ + private static void readFilesSet(Element setElem, Map filesSets, String filePath) { + // The file set must have a unique name. + String setName = setElem.getAttribute(InterestingItemsFilesSetSettings.NAME_ATTR); + if (setName.isEmpty()) { + logger.log(Level.SEVERE, "Found {0} element without required {1} attribute, ignoring malformed file set definition in FilesSet definition file at {2}", new Object[]{InterestingItemsFilesSetSettings.FILE_SET_TAG, InterestingItemsFilesSetSettings.NAME_ATTR, filePath}); // NON-NLS + return; + } + if (filesSets.containsKey(setName)) { + logger.log(Level.SEVERE, "Found duplicate definition of set named {0} in FilesSet definition file at {1}, discarding duplicate set", new Object[]{setName, filePath}); // NON-NLS + return; + } + // The file set may have a description. The empty string is o.k. + String description = setElem.getAttribute(InterestingItemsFilesSetSettings.DESC_ATTR); + // The file set may or may not ignore known files. The default behavior + // is to not ignore them. + String ignoreKnown = setElem.getAttribute(InterestingItemsFilesSetSettings.IGNORE_KNOWN_FILES_ATTR); + boolean ignoreKnownFiles = false; + if (!ignoreKnown.isEmpty()) { + ignoreKnownFiles = Boolean.parseBoolean(ignoreKnown); + } + // The file set may or may not skip unallocated space. The default behavior + // is not to skip it. + String ignoreUnallocated = setElem.getAttribute(InterestingItemsFilesSetSettings.IGNORE_UNALLOCATED_SPACE); + boolean ignoreUnallocatedSpace = false; + if (!ignoreUnallocated.isEmpty()) { + ignoreUnallocatedSpace = Boolean.parseBoolean(ignoreUnallocated); + } + // Read file name set membership rules, if any. + InterestingItemsFilesSetSettings.unnamedLegacyRuleCounter = 1; + Map rules = new HashMap<>(); + NodeList nameRuleElems = setElem.getElementsByTagName(InterestingItemsFilesSetSettings.NAME_RULE_TAG); + for (int j = 0; j < nameRuleElems.getLength(); ++j) { + Element elem = (Element) nameRuleElems.item(j); + FilesSet.Rule rule = InterestingItemsFilesSetSettings.readFileNameRule(elem); + if (rule != null) { + if (!rules.containsKey(rule.getUuid())) { + rules.put(rule.getUuid(), rule); + } else { + logger.log(Level.SEVERE, "Found duplicate rule {0} for set named {1} in FilesSet definition file at {2}, discarding malformed set", new Object[]{rule.getUuid(), setName, filePath}); // NON-NLS + return; + } + } else { + logger.log(Level.SEVERE, "Found malformed rule for set named {0} in FilesSet definition file at {1}, discarding malformed set", new Object[]{setName, filePath}); // NON-NLS + return; + } + } + // Read file extension set membership rules, if any. + NodeList extRuleElems = setElem.getElementsByTagName(InterestingItemsFilesSetSettings.EXTENSION_RULE_TAG); + for (int j = 0; j < extRuleElems.getLength(); ++j) { + Element elem = (Element) extRuleElems.item(j); + FilesSet.Rule rule = InterestingItemsFilesSetSettings.readFileExtensionRule(elem); + if (rule != null) { + if (!rules.containsKey(rule.getUuid())) { + rules.put(rule.getUuid(), rule); + } else { + logger.log(Level.SEVERE, "Found duplicate rule {0} for set named {1} in FilesSet definition file at {2}, discarding malformed set", new Object[]{rule.getUuid(), setName, filePath}); //NOI18N NON-NLS + return; + } + } else { + logger.log(Level.SEVERE, "Found malformed rule for set named {0} in FilesSet definition file at {1}, discarding malformed set", new Object[]{setName, filePath}); //NOI18N NON-NLS + return; + } + } + // Make the files set. Note that degenerate sets with no rules are + // allowed to facilitate the separation of set definition and rule + // definitions. A set without rules is simply the empty set. + FilesSet set = new FilesSet(setName, description, ignoreKnownFiles, ignoreUnallocatedSpace, rules); + filesSets.put(set.getName(), set); + } + + // Note: This method takes a file path to support the possibility of + // multiple intersting files set definition files, e.g., one for + // definitions that ship with Autopsy and one for user definitions. + /** + * Reads FilesSet definitions from an XML file. + * + * @param fileName The name of the file which is expected to store the + * serialized definitions + * @param legacyFilePath Path of the set definitions file as a string. + * + * @return The set definitions in a map of set names to sets. + */ + static Map readDefinitionsFile(String fileName, String legacyFileName) throws FilesSetsManager.FilesSetsManagerException { + Map filesSets = readSerializedDefinitions(fileName); + if (!filesSets.isEmpty()) { + return filesSets; + } + // Check if the legacy xml file exists. + if (!legacyFileName.isEmpty()) { + File defsFile = Paths.get(PlatformUtil.getUserConfigDirectory(), legacyFileName).toFile(); + if (!defsFile.exists()) { + return filesSets; + } + // Check if the file can be read. + if (!defsFile.canRead()) { + logger.log(Level.SEVERE, "FilesSet definition file at {0} exists, but cannot be read", defsFile.getPath()); // NON-NLS + return filesSets; + } + // Parse the XML in the file. + Document doc = XMLUtil.loadDoc(InterestingItemsFilesSetSettings.class, defsFile.getPath()); + if (doc == null) { + logger.log(Level.SEVERE, "FilesSet definition file at {0}", defsFile.getPath()); // NON-NLS + return filesSets; + } + // Get the root element. + Element root = doc.getDocumentElement(); + if (root == null) { + logger.log(Level.SEVERE, "Failed to get root {0} element tag of FilesSet definition file at {1}", new Object[]{InterestingItemsFilesSetSettings.FILE_SETS_ROOT_TAG, defsFile.getPath()}); // NON-NLS + return filesSets; + } + // Read in the files set definitions. + NodeList setElems = root.getElementsByTagName(FILE_SET_TAG); + for (int i = 0; i < setElems.getLength(); ++i) { + readFilesSet((Element) setElems.item(i), filesSets, defsFile.getPath()); + } + } + return filesSets; + } + + // Note: This method takes a file path to support the possibility of + // multiple intersting files set definition files, e.g., one for + // definitions that ship with Autopsy and one for user definitions. + /** + * Writes FilesSet definitions to disk as an XML file, logging any errors. + * + * @param fileName Name of the set definitions file as a string. + * + * @returns True if the definitions are written to disk, false otherwise. + */ + static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException { + try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), fileName).toString()))) { + out.writeObject(new InterestingItemsFilesSetSettings(interestingFilesSets)); + } catch (IOException ex) { + throw new FilesSetsManager.FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex); + } + return true; + } + + /** + * Construct a meta-type condition for a FilesSet membership rule from data + * in an XML element. + * + * @param ruleElement The XML element. + * + * @return The meta-type condition, or null if there is an error (logged). + */ + private static FilesSet.Rule.MetaTypeCondition readMetaTypeCondition(Element ruleElement) { + FilesSet.Rule.MetaTypeCondition condition = null; + String conditionAttribute = ruleElement.getAttribute(InterestingItemsFilesSetSettings.TYPE_FILTER_ATTR); + if (!conditionAttribute.isEmpty()) { + switch (conditionAttribute) { + case InterestingItemsFilesSetSettings.TYPE_FILTER_VALUE_FILES: + condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); + break; + case InterestingItemsFilesSetSettings.TYPE_FILTER_VALUE_DIRS: + condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.DIRECTORIES); + break; + case InterestingItemsFilesSetSettings.TYPE_FILTER_VALUE_FILES_AND_DIRS: + condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES_AND_DIRECTORIES); + break; + default: + logger.log(Level.SEVERE, "Found {0} " + InterestingItemsFilesSetSettings.TYPE_FILTER_ATTR + " attribute with unrecognized value ''{0}'', ignoring malformed rule definition", conditionAttribute); // NON-NLS + break; + } + } else { + // Accept TSK Framework FilesSet definitions, + // default to files. + condition = new FilesSet.Rule.MetaTypeCondition(FilesSet.Rule.MetaTypeCondition.Type.FILES); + } + return condition; + } } From 0753f545db9d1b6b42d6b4cbc20a0bffeca3f87d Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 18:38:38 -0500 Subject: [PATCH 40/50] 1903 - removed notes to self --- .../modules/interestingitems/FilesSetsManager.java | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 12a01f3fd4..4b5e789395 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -65,13 +65,13 @@ public final class FilesSetsManager extends Observable { private static final Object INTERESTING_FILES_SET_LOCK = new Object(); private static FilesSetsManager instance; private static final FilesSet FILES_DIRS_INGEST_FILTER = new FilesSet( - Bundle.FilesSetsManager_AllFilesAndDirectories(), Bundle.FilesSetsManager_AllFilesAndDirectories(), false, true, new HashMap() { + Bundle.FilesSetsManager_allFilesAndDirectories(), Bundle.FilesSetsManager_allFilesAndDirectories(), false, true, new HashMap() { { - put(Bundle.FilesSetsManager_AllFilesAndDirectories(), - new Rule(Bundle.FilesSetsManager_AllFilesAndDirectories(), null, + put(Bundle.FilesSetsManager_allFilesAndDirectories(), + new Rule(Bundle.FilesSetsManager_allFilesAndDirectories(), null, new MetaTypeCondition(MetaTypeCondition.Type.ALL), null, null, null)); } - }); //WJS-TODO make this an @MESSAGES//NON-NLS + }); private static final FilesSet FILES_DIRS_UNALLOC_INGEST_FILTER = new FilesSet( Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), false, false, new HashMap() { @@ -80,7 +80,7 @@ public final class FilesSetsManager extends Observable { new Rule(Bundle.FilesSetsManager_allFilesDirectoriesAndUnallocated(), null, new MetaTypeCondition(MetaTypeCondition.Type.ALL), null, null, null)); } - }); //WJS-TODO make this an @MESSAGES//NON-NLS + }); /** * Gets the FilesSet definitions manager singleton. @@ -158,7 +158,8 @@ public final class FilesSetsManager extends Observable { if (fileSetFile.exists()) { try { try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { - Map filesSetsSettings = (Map) in.readObject(); + @SuppressWarnings("unchecked") + Map filesSetsSettings = (Map)in.readObject(); return filesSetsSettings; } } catch (IOException | ClassNotFoundException ex) { From 773f5c2549d7c930aed7f9f0b7897c1690d93730 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 19:03:56 -0500 Subject: [PATCH 41/50] 1903 removed some unused imports --- .../org/sleuthkit/autopsy/ingest/IngestJobSettings.java | 2 -- .../FileIngestFilterDefsOptionsPanelController.java | 2 -- .../modules/interestingitems/FilesSetsManager.java | 9 +-------- 3 files changed, 1 insertion(+), 12 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java index ce3ffd349c..fc2c8b38e9 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettings.java @@ -26,14 +26,12 @@ import java.nio.file.Files; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; -import java.util.Arrays; import java.util.Collections; import java.util.HashSet; import java.util.List; import java.util.Map; import java.util.Objects; import java.util.logging.Level; -import org.openide.util.Exceptions; import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java index dd7a1e3a57..af394bf2c3 100644 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileIngestFilterDefsOptionsPanelController.java @@ -21,14 +21,12 @@ package org.sleuthkit.autopsy.modules.interestingitems; import java.beans.PropertyChangeEvent; import java.beans.PropertyChangeListener; import java.beans.PropertyChangeSupport; -import java.util.ArrayList; import javax.swing.JComponent; import javax.swing.SwingUtilities; import org.netbeans.spi.options.OptionsPanelController; import org.openide.util.HelpCtx; import org.openide.util.Lookup; import org.sleuthkit.autopsy.coreutils.Logger; -import org.sleuthkit.autopsy.ingest.IngestJobSettings; @OptionsPanelController.TopLevelRegistration( categoryName = "#OptionsCategory_Name_FileIngestFilterDefinitions", diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 4b5e789395..0173561770 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -31,20 +31,13 @@ import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Observable; -import java.util.logging.Level; -import java.util.regex.Pattern; -import java.util.regex.PatternSyntaxException; import org.openide.util.NbBundle; import org.openide.util.io.NbObjectInputStream; import org.openide.util.io.NbObjectOutputStream; -import org.sleuthkit.autopsy.coreutils.Logger; import org.sleuthkit.autopsy.coreutils.PlatformUtil; -import org.sleuthkit.autopsy.coreutils.XMLUtil; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition; -import org.w3c.dom.Document; -import org.w3c.dom.Element; -import org.w3c.dom.NodeList; + /** * Provides access to collections of FilesSet definitions persisted to disk. From 89fff3813a114ee5f419fd9c59a90c92d2458400 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 19:17:54 -0500 Subject: [PATCH 42/50] 1903 added wrapper for serialization of FileIngestFilters to avoid unchecked casting warning --- .../interestingitems/FilesSetsManager.java | 30 +++++++++++++++---- 1 file changed, 25 insertions(+), 5 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 0173561770..2a691081a9 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; +import java.io.Serializable; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -38,7 +39,6 @@ import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition; - /** * Provides access to collections of FilesSet definitions persisted to disk. * Clients receive copies of the most recent FilesSet definitions for @@ -151,9 +151,8 @@ public final class FilesSetsManager extends Observable { if (fileSetFile.exists()) { try { try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { - @SuppressWarnings("unchecked") - Map filesSetsSettings = (Map)in.readObject(); - return filesSetsSettings; + FileIngestFiltersSerializable filesSetsSettings = (FileIngestFiltersSerializable)in.readObject(); + return filesSetsSettings.getFilesSets(); } } catch (IOException | ClassNotFoundException ex) { throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); @@ -189,13 +188,34 @@ public final class FilesSetsManager extends Observable { void setCustomFileIngestFilters(Map filesSets) throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME).toString()))) { - out.writeObject(filesSets); + out.writeObject(new FileIngestFiltersSerializable(filesSets)); } catch (IOException ex) { throw new FilesSetsManagerException(String.format("Failed to write settings to %s", FILE_INGEST_FILTER_DEFS_NAME), ex); } } } + /** + * Class for storage of FileIngestFilters as serialized objects. + */ + private class FileIngestFiltersSerializable implements Serializable { + + + private static final long serialVersionUID = 1L; + private Map filesSets; + + FileIngestFiltersSerializable(Map filesSets) { + this.filesSets = filesSets; + } + + /** + * @return the filesSets + */ + Map getFilesSets() { + return filesSets; + } + } + public static class FilesSetsManagerException extends Exception { FilesSetsManagerException() { From 4c3d050b9b58d3f73ce018e1827318ae273d4af7 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 19:33:01 -0500 Subject: [PATCH 43/50] 1903 removed class to serialize FileIngestFilters when back to raw map --- .../interestingitems/FilesSetsManager.java | 33 ++++--------------- 1 file changed, 6 insertions(+), 27 deletions(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 2a691081a9..f5586d92fd 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -150,9 +150,9 @@ public final class FilesSetsManager extends Observable { String filePathStr = filePath.toString(); if (fileSetFile.exists()) { try { - try (NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { - FileIngestFiltersSerializable filesSetsSettings = (FileIngestFiltersSerializable)in.readObject(); - return filesSetsSettings.getFilesSets(); + try (final NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { + Map filesSetsSettings = (Map)in.readObject(); + return filesSetsSettings; } } catch (IOException | ClassNotFoundException ex) { throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); @@ -187,35 +187,14 @@ public final class FilesSetsManager extends Observable { */ void setCustomFileIngestFilters(Map filesSets) throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { - try (NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME).toString()))) { - out.writeObject(new FileIngestFiltersSerializable(filesSets)); + try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME).toString()))) { + out.writeObject(filesSets); } catch (IOException ex) { throw new FilesSetsManagerException(String.format("Failed to write settings to %s", FILE_INGEST_FILTER_DEFS_NAME), ex); } } } - - /** - * Class for storage of FileIngestFilters as serialized objects. - */ - private class FileIngestFiltersSerializable implements Serializable { - - - private static final long serialVersionUID = 1L; - private Map filesSets; - - FileIngestFiltersSerializable(Map filesSets) { - this.filesSets = filesSets; - } - - /** - * @return the filesSets - */ - Map getFilesSets() { - return filesSets; - } - } - + public static class FilesSetsManagerException extends Exception { FilesSetsManagerException() { From d74583041515d46f5116fa237c58920add8ccddb Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Thu, 19 Jan 2017 19:34:20 -0500 Subject: [PATCH 44/50] 1903 surpress warning from unchecked cast of FilesSets map --- .../autopsy/modules/interestingitems/FilesSetsManager.java | 1 + 1 file changed, 1 insertion(+) diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index f5586d92fd..d26198f6bd 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -151,6 +151,7 @@ public final class FilesSetsManager extends Observable { if (fileSetFile.exists()) { try { try (final NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { + @SuppressWarnings("unchecked") Map filesSetsSettings = (Map)in.readObject(); return filesSetsSettings; } From 1d82336c81920ab9f9022290e8be1a480b3a19de Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 20 Jan 2017 10:49:17 -0500 Subject: [PATCH 45/50] 1903 added class for serializing filesSets other than interesting ones --- .../interestingitems/FilesSetsManager.java | 9 ++-- .../FilesSetsSerializable.java | 45 +++++++++++++++++++ 2 files changed, 48 insertions(+), 6 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsSerializable.java diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index d26198f6bd..93e586f517 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -22,7 +22,6 @@ import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; -import java.io.Serializable; import java.nio.file.Path; import java.nio.file.Paths; import java.util.ArrayList; @@ -151,9 +150,8 @@ public final class FilesSetsManager extends Observable { if (fileSetFile.exists()) { try { try (final NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { - @SuppressWarnings("unchecked") - Map filesSetsSettings = (Map)in.readObject(); - return filesSetsSettings; + FilesSetsSerializable filesSetsSettings = (FilesSetsSerializable)in.readObject(); + return filesSetsSettings.getFilesSets(); } } catch (IOException | ClassNotFoundException ex) { throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); @@ -189,7 +187,7 @@ public final class FilesSetsManager extends Observable { void setCustomFileIngestFilters(Map filesSets) throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME).toString()))) { - out.writeObject(filesSets); + out.writeObject(new FilesSetsSerializable(filesSets)); } catch (IOException ex) { throw new FilesSetsManagerException(String.format("Failed to write settings to %s", FILE_INGEST_FILTER_DEFS_NAME), ex); } @@ -214,5 +212,4 @@ public final class FilesSetsManager extends Observable { super(cause); } } - } diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsSerializable.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsSerializable.java new file mode 100644 index 0000000000..35b2a9477d --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsSerializable.java @@ -0,0 +1,45 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.modules.interestingitems; + +import java.io.Serializable; +import java.util.Map; + +/** + * Class for wrapping a map which stores FilesSets as values with a String key. + */ +class FilesSetsSerializable implements Serializable { + + + private static final long serialVersionUID = 1L; + //By wrapping the map in this class we avoid warnings for unchecked casting when serializing + private final Map filesSets; + + FilesSetsSerializable(Map filesSets) { + this.filesSets = filesSets; + } + + /** + * @return the filesSets + */ + Map getFilesSets() { + return filesSets; + } + +} \ No newline at end of file From c09ebd99aaa3145a284c370801ec5844ff31d0c4 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 20 Jan 2017 12:32:04 -0500 Subject: [PATCH 46/50] 1903 renamed FilesSetsSerializable to FileSetsDefinitions, added read write methods to it --- .../interestingitems/FileSetsDefinitions.java | 97 +++++++++++++++++++ .../interestingitems/FilesSetsManager.java | 33 +------ .../FilesSetsSerializable.java | 45 --------- 3 files changed, 100 insertions(+), 75 deletions(-) create mode 100644 Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java delete mode 100644 Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsSerializable.java diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java new file mode 100644 index 0000000000..8272f2e3ab --- /dev/null +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FileSetsDefinitions.java @@ -0,0 +1,97 @@ +/* + * Autopsy Forensic Browser + * + * Copyright 2011-2017 Basis Technology Corp. + * Contact: carrier sleuthkit 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. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.sleuthkit.autopsy.modules.interestingitems; + +import java.io.File; +import java.io.FileInputStream; +import java.io.FileOutputStream; +import java.io.IOException; +import java.io.Serializable; +import java.nio.file.Path; +import java.nio.file.Paths; +import java.util.HashMap; +import java.util.Map; +import org.openide.util.io.NbObjectInputStream; +import org.openide.util.io.NbObjectOutputStream; +import org.sleuthkit.autopsy.coreutils.PlatformUtil; + +/** + * Class for wrapping a map which stores FilesSets as values with a String key. + */ +class FileSetsDefinitions implements Serializable { + + + private static final long serialVersionUID = 1L; + //By wrapping the map in this class we avoid warnings for unchecked casting when serializing + private final Map filesSets; + + FileSetsDefinitions(Map filesSets) { + this.filesSets = filesSets; + } + + /** + * @return the filesSets + */ + Map getFilesSets() { + return filesSets; + } + + /** + * Writes FilesSet definitions to disk as an XML file, logging any errors. + * + * @param fileName Name of the set definitions file as a string. + * + * @returns True if the definitions are written to disk, false otherwise. + */ + static boolean writeDefinitionsFile(String fileName, Map interestingFilesSets) throws FilesSetsManager.FilesSetsManagerException { + try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), fileName).toString()))) { + out.writeObject(new FileSetsDefinitions(interestingFilesSets)); + } catch (IOException ex) { + throw new FilesSetsManager.FilesSetsManagerException(String.format("Failed to write settings to %s", fileName), ex); + } + return true; + } + + /** + * Reads the definitions from the serialization file + * + * @return the map representing settings saved to serialization file, empty + * set if the file does not exist. + * + * @throws FilesSetsManagerException if file could not be read + */ + static Map readSerializedDefinitions(String serialFileName) throws FilesSetsManager.FilesSetsManagerException { + Path filePath = Paths.get(PlatformUtil.getUserConfigDirectory(), serialFileName); + File fileSetFile = filePath.toFile(); + String filePathStr = filePath.toString(); + if (fileSetFile.exists()) { + try { + try (final NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { + FileSetsDefinitions filesSetsSettings = (FileSetsDefinitions) in.readObject(); + return filesSetsSettings.getFilesSets(); + } + } catch (IOException | ClassNotFoundException ex) { + throw new FilesSetsManager.FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); + } + } else { + return new HashMap<>(); + } + } + +} \ No newline at end of file diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java index 93e586f517..6350805ee6 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java +++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsManager.java @@ -18,12 +18,6 @@ */ package org.sleuthkit.autopsy.modules.interestingitems; -import java.io.File; -import java.io.FileInputStream; -import java.io.FileOutputStream; -import java.io.IOException; -import java.nio.file.Path; -import java.nio.file.Paths; import java.util.ArrayList; import java.util.Arrays; import java.util.Collections; @@ -32,9 +26,6 @@ import java.util.List; import java.util.Map; import java.util.Observable; import org.openide.util.NbBundle; -import org.openide.util.io.NbObjectInputStream; -import org.openide.util.io.NbObjectOutputStream; -import org.sleuthkit.autopsy.coreutils.PlatformUtil; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule; import org.sleuthkit.autopsy.modules.interestingitems.FilesSet.Rule.MetaTypeCondition; @@ -144,21 +135,7 @@ public final class FilesSetsManager extends Observable { */ public Map getCustomFileIngestFilters() throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { - Path filePath = Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME); - File fileSetFile = filePath.toFile(); - String filePathStr = filePath.toString(); - if (fileSetFile.exists()) { - try { - try (final NbObjectInputStream in = new NbObjectInputStream(new FileInputStream(filePathStr))) { - FilesSetsSerializable filesSetsSettings = (FilesSetsSerializable)in.readObject(); - return filesSetsSettings.getFilesSets(); - } - } catch (IOException | ClassNotFoundException ex) { - throw new FilesSetsManagerException(String.format("Failed to read settings from %s", filePathStr), ex); - } - } else { - return new HashMap<>(); - } + return FileSetsDefinitions.readSerializedDefinitions(FILE_INGEST_FILTER_DEFS_NAME); } } @@ -186,14 +163,10 @@ public final class FilesSetsManager extends Observable { */ void setCustomFileIngestFilters(Map filesSets) throws FilesSetsManagerException { synchronized (FILE_INGEST_FILTER_LOCK) { - try (final NbObjectOutputStream out = new NbObjectOutputStream(new FileOutputStream(Paths.get(PlatformUtil.getUserConfigDirectory(), FILE_INGEST_FILTER_DEFS_NAME).toString()))) { - out.writeObject(new FilesSetsSerializable(filesSets)); - } catch (IOException ex) { - throw new FilesSetsManagerException(String.format("Failed to write settings to %s", FILE_INGEST_FILTER_DEFS_NAME), ex); - } + FileSetsDefinitions.writeDefinitionsFile(FILE_INGEST_FILTER_DEFS_NAME, filesSets); } } - + public static class FilesSetsManagerException extends Exception { FilesSetsManagerException() { diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsSerializable.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsSerializable.java deleted file mode 100644 index 35b2a9477d..0000000000 --- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesSetsSerializable.java +++ /dev/null @@ -1,45 +0,0 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011-2017 Basis Technology Corp. - * Contact: carrier sleuthkit 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. - * See the License for the specific language governing permissions and - * limitations under the License. - */ -package org.sleuthkit.autopsy.modules.interestingitems; - -import java.io.Serializable; -import java.util.Map; - -/** - * Class for wrapping a map which stores FilesSets as values with a String key. - */ -class FilesSetsSerializable implements Serializable { - - - private static final long serialVersionUID = 1L; - //By wrapping the map in this class we avoid warnings for unchecked casting when serializing - private final Map filesSets; - - FilesSetsSerializable(Map filesSets) { - this.filesSets = filesSets; - } - - /** - * @return the filesSets - */ - Map getFilesSets() { - return filesSets; - } - -} \ No newline at end of file From e45dfea90a8731f7863d28da6532870faae016b8 Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 20 Jan 2017 12:52:31 -0500 Subject: [PATCH 47/50] 1903 updated error message for PhotoRecCarver when ignore unallocated is enabled --- .../modules/photoreccarver/PhotoRecCarverFileIngestModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index d1a8e7e5a3..0fe47b8af7 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -68,7 +68,7 @@ import org.sleuthkit.datamodel.TskData; "PhotoRecIngestModule.PermissionsNotSufficient=Insufficient permissions accessing", "PhotoRecIngestModule.PermissionsNotSufficientSeeReference=See 'Shared Drive Authentication' in Autopsy help.", "# {0} - output directory name", "cannotCreateOutputDir.message=Unable to create output directory: {0}.", - "unallocatedSpaceProcessingSettingsError.message='Process Unallocated Space' is not checked. The PhotoRec module is designed to carve unallocated space. Either enable processing of unallocated space or disable this module.", + "unallocatedSpaceProcessingSettingsError.message=The selected filter ignores unallocated space. The PhotoRec module is designed to carve unallocated space. Either choose a filter which does process unallocated space or disable this module.", "unsupportedOS.message=PhotoRec module is supported on Windows platforms only.", "missingExecutable.message=Unable to locate PhotoRec executable.", "cannotRunExecutable.message=Unable to execute PhotoRec.", From 8bf973a1eebbb7c6f5861bcfcdfe1f6f80c6a94b Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 20 Jan 2017 13:15:59 -0500 Subject: [PATCH 48/50] 1903-Removed manipulation of process unallocated checkbox from regression test --- .../src/org/sleuthkit/autopsy/testing/RegressionTest.java | 4 ---- 1 file changed, 4 deletions(-) diff --git a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java index 33d73c2044..f8cd7a5b59 100755 --- a/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java +++ b/Testing/test/qa-functional/src/org/sleuthkit/autopsy/testing/RegressionTest.java @@ -299,10 +299,6 @@ public class RegressionTest extends TestCase { JButtonOperator jbo2 = new JButtonOperator(jdo, "OK", 0); jbo2.pushNoBlock(); WizardOperator wo = new WizardOperator("Add Data"); - JCheckBoxOperator jbco0 = new JCheckBoxOperator(wo, "Process Unallocated Space"); - if (Boolean.parseBoolean(System.getProperty("ignore_unalloc"))) { - jbco0.doClick(); - } new Timeout("pausing", 10000).sleep(); // let things catch up wo.btNext().clickMouse(); } From be8483efcad2a7cb16d8184a11587de77b54fabe Mon Sep 17 00:00:00 2001 From: William Schaefer Date: Fri, 20 Jan 2017 13:28:37 -0500 Subject: [PATCH 49/50] 1903 - create new file ingest fitler will now always be last option in jcombobox --- .../org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java index eb57097c34..2f2480b694 100644 --- a/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java +++ b/Core/src/org/sleuthkit/autopsy/ingest/IngestJobSettingsPanel.java @@ -452,7 +452,6 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { for (FilesSet fSet : FilesSetsManager.getStandardFileIngestFilters()) { nameList.add(fSet.getName()); } - nameList.add(FilesSetPanel.getCreateNewFileIngestFilterString()); try { for (FilesSet fSet : FilesSetsManager.getInstance().getCustomFileIngestFilters().values()) { nameList.add(fSet.getName()); @@ -460,6 +459,7 @@ public final class IngestJobSettingsPanel extends javax.swing.JPanel { } catch (FilesSetsManager.FilesSetsManagerException ex) { logger.log(Level.SEVERE, "Failed to get user created file ingest filters for combo box, only default available for selection", ex); //NON-NLS } + nameList.add(FilesSetPanel.getCreateNewFileIngestFilterString()); return nameList.toArray(new String[nameList.size()]); } From 570282e8c3c70c70ff406e6a8c98c7b8da66362c Mon Sep 17 00:00:00 2001 From: Richard Cordovano Date: Fri, 20 Jan 2017 14:11:21 -0500 Subject: [PATCH 50/50] Update PhotoRec ingest module startup error message --- .../modules/photoreccarver/PhotoRecCarverFileIngestModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java index 0fe47b8af7..30aa69ba75 100755 --- a/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java +++ b/Core/src/org/sleuthkit/autopsy/modules/photoreccarver/PhotoRecCarverFileIngestModule.java @@ -68,7 +68,7 @@ import org.sleuthkit.datamodel.TskData; "PhotoRecIngestModule.PermissionsNotSufficient=Insufficient permissions accessing", "PhotoRecIngestModule.PermissionsNotSufficientSeeReference=See 'Shared Drive Authentication' in Autopsy help.", "# {0} - output directory name", "cannotCreateOutputDir.message=Unable to create output directory: {0}.", - "unallocatedSpaceProcessingSettingsError.message=The selected filter ignores unallocated space. The PhotoRec module is designed to carve unallocated space. Either choose a filter which does process unallocated space or disable this module.", + "unallocatedSpaceProcessingSettingsError.message=The selected file ingest filter ignores unallocated space. This module carves unallocated space. Please choose a filter which does not ignore unallocated space or disable this module.", "unsupportedOS.message=PhotoRec module is supported on Windows platforms only.", "missingExecutable.message=Unable to locate PhotoRec executable.", "cannotRunExecutable.message=Unable to execute PhotoRec.",