diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/Bundle.properties b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/Bundle.properties index 1b2076392e..47596c42d3 100644 --- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/Bundle.properties +++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/Bundle.properties @@ -53,3 +53,4 @@ HashDbSearchPanel.searchButton.text=Search HashDbSearchPanel.removeButton.text=Remove Selected HashDbSearchPanel.titleLabel.text=Search for files with the following MD5 hash(es): HashDbSearchPanel.errorField.text=Error: Not all files have been hashed. +HashDbSearchPanel.saveBox.text=Remember Hashes diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchAction.java b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchAction.java index 28af740519..460113ee94 100644 --- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchAction.java +++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchAction.java @@ -1,61 +1,71 @@ -/* - * Autopsy Forensic Browser - * - * Copyright 2011 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.hashdatabase; - -import java.awt.event.ActionEvent; -import java.awt.event.ActionListener; -import org.openide.util.HelpCtx; -import org.openide.util.actions.CallableSystemAction; -import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationCleanDialog; - -/** - * The HashDbSearchAction opens the HashDbSearchPanel in a dialog. - */ -class HashDbSearchAction extends CallableSystemAction { - - static final String ACTION_NAME = "Hash File Search"; - - @Override - public void performAction() { - final HashDbSearchPanel panel = HashDbSearchPanel.getDefault(); - final AdvancedConfigurationCleanDialog dialog = new AdvancedConfigurationCleanDialog(); - panel.cancelButtonListener(new ActionListener() { - @Override - public void actionPerformed(ActionEvent e) { - dialog.close(); - } - }); - dialog.display(panel); - } - - @Override - public String getName() { - return ACTION_NAME; - } - - @Override - public HelpCtx getHelpCtx() { - return HelpCtx.DEFAULT_HELP; - } - - @Override - protected boolean asynchronous() { - return false; - } -} +/* + * Autopsy Forensic Browser + * + * Copyright 2011 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.hashdatabase; + +import java.awt.event.ActionEvent; +import java.awt.event.ActionListener; +import java.awt.event.WindowAdapter; +import java.awt.event.WindowEvent; +import org.openide.util.HelpCtx; +import org.openide.util.actions.CallableSystemAction; +import org.sleuthkit.autopsy.corecomponents.AdvancedConfigurationCleanDialog; + +/** + * The HashDbSearchAction opens the HashDbSearchPanel in a dialog. + */ +class HashDbSearchAction extends CallableSystemAction { + + static final String ACTION_NAME = "Hash File Search"; + + @Override + public void performAction() { + final HashDbSearchPanel panel = HashDbSearchPanel.getDefault(); + final AdvancedConfigurationCleanDialog dialog = new AdvancedConfigurationCleanDialog(); + panel.cancelButtonListener(new ActionListener() { + @Override + public void actionPerformed(ActionEvent e) { + panel.clear(); + dialog.close(); + } + }); + dialog.addWindowListener(new WindowAdapter() { + @Override + public void windowClosing(WindowEvent e) { + panel.clear(); + dialog.close(); + } + }); + dialog.display(panel); + } + + @Override + public String getName() { + return ACTION_NAME; + } + + @Override + public HelpCtx getHelpCtx() { + return HelpCtx.DEFAULT_HELP; + } + + @Override + protected boolean asynchronous() { + return false; + } +} diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchManager.java b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchManager.java index 93e39aed8c..e0c9bfca16 100644 --- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchManager.java +++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchManager.java @@ -50,9 +50,9 @@ public class HashDbSearchManager { for(String s : map.keySet()) { for(FsContent file : map.get(s)) { Map keyMap = new LinkedHashMap(); - keyMap.put("Hash", s); + keyMap.put("MD5 Hash", s); AbstractFsContentNode.fillPropertyMap(keyMap, file); - KeyValue kv = new KeyValue("MD5 - Name", keyMap, ++id); + KeyValue kv = new KeyValue(file.getName(), keyMap, ++id); keyValues.add(kv); } } diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchPanel.form b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchPanel.form index 6014f428eb..8dd7bff1ec 100644 --- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchPanel.form +++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchPanel.form @@ -44,6 +44,8 @@ + + @@ -71,6 +73,7 @@ + @@ -179,5 +182,15 @@ + + + + + + + + + + diff --git a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchPanel.java b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchPanel.java index 6ee4d79bf8..699690f04f 100644 --- a/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchPanel.java +++ b/HashDatabase/src/org/sleuthkit/autopsy/hashdatabase/HashDbSearchPanel.java @@ -128,6 +128,7 @@ public class HashDbSearchPanel extends javax.swing.JPanel implements ActionListe jSeparator1 = new javax.swing.JSeparator(); titleLabel = new javax.swing.JLabel(); errorField = new javax.swing.JLabel(); + saveBox = new javax.swing.JCheckBox(); hashTable.setModel(new javax.swing.table.DefaultTableModel( new Object [][] { @@ -173,6 +174,13 @@ public class HashDbSearchPanel extends javax.swing.JPanel implements ActionListe errorField.setForeground(new java.awt.Color(255, 0, 0)); org.openide.awt.Mnemonics.setLocalizedText(errorField, org.openide.util.NbBundle.getMessage(HashDbSearchPanel.class, "HashDbSearchPanel.errorField.text")); // NOI18N + org.openide.awt.Mnemonics.setLocalizedText(saveBox, org.openide.util.NbBundle.getMessage(HashDbSearchPanel.class, "HashDbSearchPanel.saveBox.text")); // NOI18N + saveBox.addActionListener(new java.awt.event.ActionListener() { + public void actionPerformed(java.awt.event.ActionEvent evt) { + saveBoxActionPerformed(evt); + } + }); + javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this); this.setLayout(layout); layout.setHorizontalGroup( @@ -202,7 +210,9 @@ public class HashDbSearchPanel extends javax.swing.JPanel implements ActionListe .addGap(61, 61, 61) .addComponent(addButton) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) - .addComponent(removeButton))) + .addComponent(removeButton) + .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) + .addComponent(saveBox))) .addGap(0, 0, Short.MAX_VALUE))))) .addContainerGap()) ); @@ -220,7 +230,8 @@ public class HashDbSearchPanel extends javax.swing.JPanel implements ActionListe .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE) .addComponent(addButton) - .addComponent(removeButton)) + .addComponent(removeButton) + .addComponent(saveBox)) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 27, Short.MAX_VALUE) .addComponent(jSeparator1, javax.swing.GroupLayout.PREFERRED_SIZE, 10, javax.swing.GroupLayout.PREFERRED_SIZE) .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED) @@ -231,6 +242,11 @@ public class HashDbSearchPanel extends javax.swing.JPanel implements ActionListe .addContainerGap()) ); }// //GEN-END:initComponents + + private void saveBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_saveBoxActionPerformed + // TODO add your handling code here: + }//GEN-LAST:event_saveBoxActionPerformed + // Variables declaration - do not modify//GEN-BEGIN:variables private javax.swing.JButton addButton; private javax.swing.JButton cancelButton; @@ -241,6 +257,7 @@ public class HashDbSearchPanel extends javax.swing.JPanel implements ActionListe private javax.swing.JScrollPane jScrollPane1; private javax.swing.JSeparator jSeparator1; private javax.swing.JButton removeButton; + private javax.swing.JCheckBox saveBox; private javax.swing.JButton searchButton; private javax.swing.JLabel titleLabel; // End of variables declaration//GEN-END:variables @@ -306,4 +323,17 @@ public class HashDbSearchPanel extends javax.swing.JPanel implements ActionListe model.removeRow(rows[i]); } } + + /** + * Clears the table of hashes + */ + void clear() { + if(!saveBox.isSelected()) { + DefaultTableModel model = (DefaultTableModel) hashTable.getModel(); + int numRows = hashTable.getRowCount(); + for(int i=0; i { @Override protected Node createNodeForKey(KeyValue thing) { - return new KeyValueNode(thing, null); + return new KeyValueNode(thing, Children.LEAF); } }