Autopsy  4.19.3
Graphical digital forensics platform for The Sleuth Kit and other tools.
HashLookupSettingsPanel.java
Go to the documentation of this file.
1 /*
2  * Autopsy Forensic Browser
3  *
4  * Copyright 2011-2019 Basis Technology Corp.
5  * Contact: carrier <at> sleuthkit <dot> org
6  *
7  * Licensed under the Apache License, Version 2.0 (the "License");
8  * you may not use this file except in compliance with the License.
9  * You may obtain a copy of the License at
10  *
11  * http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19 package org.sleuthkit.autopsy.modules.hashdatabase;
20 
21 import java.awt.Color;
22 import java.awt.Component;
23 import java.awt.EventQueue;
24 import java.awt.Frame;
25 import java.awt.event.KeyEvent;
26 import java.beans.PropertyChangeEvent;
27 import java.beans.PropertyChangeListener;
28 import java.io.File;
29 import java.util.ArrayList;
30 import java.util.List;
31 import java.util.MissingResourceException;
32 import java.util.logging.Level;
33 import javax.swing.JComponent;
34 import javax.swing.JOptionPane;
35 import javax.swing.JTable;
36 import javax.swing.ListSelectionModel;
37 import javax.swing.SwingUtilities;
38 import javax.swing.event.ListSelectionEvent;
39 import javax.swing.event.ListSelectionListener;
40 import javax.swing.table.AbstractTableModel;
41 import javax.swing.table.TableCellRenderer;
42 import org.apache.commons.lang3.StringUtils;
43 import org.netbeans.spi.options.OptionsPanelController;
44 import org.openide.util.NbBundle;
45 import org.openide.util.NbBundle.Messages;
55 import org.sleuthkit.datamodel.TskCoreException;
59 
64 @SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
66 
67  private static final String NSRL_URL = "https://sourceforge.net/projects/autopsy/files/NSRL/";
68  private static final String NSRL_NAME_STRING = "nsrl";
69  private static final String NO_SELECTION_TEXT = NbBundle
70  .getMessage(HashLookupSettingsPanel.class, "HashDbConfigPanel.noSelectionText");
71  private static final String ERROR_GETTING_PATH_TEXT = NbBundle
72  .getMessage(HashLookupSettingsPanel.class, "HashDbConfigPanel.errorGettingPathText");
73  private static final String ERROR_GETTING_INDEX_STATUS_TEXT = NbBundle
74  .getMessage(HashLookupSettingsPanel.class, "HashDbConfigPanel.errorGettingIndexStatusText");
75  private static final Logger logger = Logger.getLogger(HashLookupSettingsPanel.class.getName());
76  private final HashDbManager hashSetManager = HashDbManager.getInstance();
77  private final HashSetTableModel hashSetTableModel = new HashSetTableModel();
78  private final List<Integer> newReferenceSetIDs = new ArrayList<>();
79 
81  initComponents();
82  customizeComponents();
83  updateComponentsForNoSelection();
84 
85  // Listen to the ingest modules to refresh the enabled/disabled state of
86  // the components in sync with file ingest.
87  IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
88  @Override
89  public void propertyChange(PropertyChangeEvent evt) {
90  if (isLocalIngestJobEvent(evt)) {
91  EventQueue.invokeLater(new Runnable() {
92  @Override
93  public void run() {
94  updateComponents();
95  }
96  });
97  }
98  }
99  });
100 
101  HashDbManager.getInstance().addPropertyChangeListener(new PropertyChangeListener() {
102  @Override
103  public void propertyChange(PropertyChangeEvent evt) {
104  String propName = evt.getPropertyName();
105  if (propName.equals(SetEvt.DB_ADDED.toString())
106  || propName.equals(SetEvt.DB_DELETED.toString())) {
107  hashSetTableModel.refreshModel();
108  }
109  }
110  });
111  }
112 
113  @NbBundle.Messages({"HashLookupSettingsPanel.Title=Global Hash Lookup Settings"})
114  private void customizeComponents() {
115  setName(Bundle.HashLookupSettingsPanel_Title());
116  this.ingestWarningLabel.setVisible(false);
117  this.hashSetTable.setModel(hashSetTableModel);
118  this.hashSetTable.setTableHeader(null);
119  hashSetTable.getParent().setBackground(hashSetTable.getBackground());
120  hashSetTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
121  hashSetTable.getSelectionModel().addListSelectionListener(new ListSelectionListener() {
122  @Override
123  public void valueChanged(ListSelectionEvent e) {
124  if (!e.getValueIsAdjusting()) {
125  updateComponents();
126  }
127  }
128  });
129  }
130 
131  private void updateComponents() {
132  HashDb db = ((HashSetTable) hashSetTable).getSelection();
133  if (db != null) {
134  updateComponentsForSelection(db);
135  } else {
136  updateComponentsForNoSelection();
137  }
138  }
139 
141  boolean ingestIsRunning = IngestManager.getInstance().isIngestRunning();
142 
143  // Update descriptive labels.
144  hashDbNameLabel.setText(NO_SELECTION_TEXT);
145  hashDbTypeLabel.setText(NO_SELECTION_TEXT);
146  hashDbLocationLabel.setText(NO_SELECTION_TEXT);
147  hashDbVersionLabel.setText(NO_SELECTION_TEXT);
148  hashDbOrgLabel.setText(NO_SELECTION_TEXT);
149  hashDbReadOnlyLabel.setText(NO_SELECTION_TEXT);
150  indexPathLabel.setText(NO_SELECTION_TEXT);
151 
152  // Update indexing components.
153  hashDbIndexStatusLabel.setText(NO_SELECTION_TEXT);
154  hashDbIndexStatusLabel.setForeground(Color.black);
155  indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
156  indexButton.setEnabled(false);
157  addHashesToDatabaseButton.setEnabled(false);
158 
159  // Update ingest options.
160  sendIngestMessagesCheckBox.setSelected(false);
161  sendIngestMessagesCheckBox.setEnabled(false);
162 
163  // Update database action buttons.
164  createDatabaseButton.setEnabled(true);
165  importDatabaseButton.setEnabled(true);
166  deleteDatabaseButton.setEnabled(false);
167 
168  // Update ingest in progress warning label.
169  ingestWarningLabel.setVisible(ingestIsRunning);
170  }
171 
172  @NbBundle.Messages({"HashLookupSettingsPanel.readOnly=Read only",
173  "HashLookupSettingsPanel.editable=Editable",
174  "HashLookupSettingsPanel.updateStatusError=Error reading status",
175  "HashLookupSettingsPanel.notApplicable=N/A",
176  "HashLookupSettingsPanel.centralRepo=Central Repository"
177  })
179  boolean ingestIsRunning = IngestManager.getInstance().isIngestRunning();
180 
181  // Update descriptive labels.
182  hashDbNameLabel.setText(db.getHashSetName());
183  hashDbTypeLabel.setText(db.getKnownFilesType().getDisplayName());
184  try {
185  if (db.isUpdateable()) {
186  hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_editable());
187  } else {
188  hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_readOnly());
189  }
190  } catch (TskCoreException ex) {
191  hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_updateStatusError());
192  }
193 
194  try {
195  addHashesToDatabaseButton.setEnabled(!ingestIsRunning && db.isUpdateable());
196  } catch (TskCoreException ex) {
197  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error identifying if the hash set is updateable.", ex); //NON-NLS
198  addHashesToDatabaseButton.setEnabled(false);
199  }
200 
201  if (db instanceof SleuthkitHashSet) {
202  SleuthkitHashSet hashDb = (SleuthkitHashSet) db;
203  updateForSleuthkitHashSet(ingestIsRunning, hashDb);
204  } else {
205 
206  // Disable the file type fields/buttons
207  indexPathLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
208  hashDbIndexStatusLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
209  hashDbLocationLabel.setText(Bundle.HashLookupSettingsPanel_centralRepo());
210  indexButton.setEnabled(false);
211  deleteDatabaseButton.setEnabled(false);
212 
213  CentralRepoHashSet crDb = (CentralRepoHashSet) db;
214 
215  hashDbVersionLabel.setText(crDb.getVersion());
216  hashDbOrgLabel.setText(crDb.getOrgName());
217  }
218 
219  // Disable the indexing button if ingest is in progress.
220  if (ingestIsRunning) {
221  indexButton.setEnabled(false);
222  }
223 
224  // Update ingest option components.
225  sendIngestMessagesCheckBox.setSelected(db.getSendIngestMessages());
226  sendIngestMessagesCheckBox.setEnabled(!ingestIsRunning && db.getKnownFilesType().isInboxMessagesAllowed());
227 
228  // Update database action buttons.
229  createDatabaseButton.setEnabled(true);
230  importDatabaseButton.setEnabled(true);
231 
232  // Update ingest in progress warning label.
233  ingestWarningLabel.setVisible(ingestIsRunning);
234  }
235 
236  private static String getPathString(String path, boolean justFilename) {
237  if (StringUtils.isBlank(path)) {
238  return "";
239  }
240 
241  if (!justFilename) {
242  return path;
243  }
244 
245  return new File(path).getName();
246  }
247 
257  private void updateForSleuthkitHashSet(boolean ingestIsRunning, SleuthkitHashSet hashDb) throws MissingResourceException {
258  // Disable the central repo fields
259  hashDbVersionLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
260  hashDbOrgLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
261 
262  // Enable the delete button if ingest is not running and is not an official hashset
263  deleteDatabaseButton.setEnabled(!ingestIsRunning && !hashDb.isOfficialSet());
264 
265  try {
266  String dbPath = getPathString(hashDb.getDatabasePath(), hashDb.isOfficialSet());
267  hashDbLocationLabel.setText(dbPath);
268  } catch (TskCoreException ex) {
269  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting hash set path of " + hashDb.getHashSetName() + " hash set", ex); //NON-NLS
270  hashDbLocationLabel.setText(ERROR_GETTING_PATH_TEXT);
271  }
272 
273  try {
274  String indexPath = getPathString(hashDb.getIndexPath(), hashDb.isOfficialSet());
275  indexPathLabel.setText(indexPath);
276  } catch (TskCoreException ex) {
277  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index path of " + hashDb.getHashSetName() + " hash set", ex); //NON-NLS
278  indexPathLabel.setText(ERROR_GETTING_PATH_TEXT);
279  }
280 
281  // Update indexing components.
282  try {
283  if (hashDb.isIndexing()) {
284  indexButton.setText(
285  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.indexing"));
286  hashDbIndexStatusLabel.setText(
287  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexStatusText.indexGen"));
288  hashDbIndexStatusLabel.setForeground(Color.black);
289  indexButton.setEnabled(false);
290  } else if (hashDb.hasIndex()) {
291  if (hashDb.hasIndexOnly()) {
292  hashDbIndexStatusLabel.setText(
293  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexStatusText.indexOnly"));
294  } else {
295  hashDbIndexStatusLabel.setText(
296  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexStatusText.indexed"));
297  }
298  hashDbIndexStatusLabel.setForeground(Color.black);
299  if (hashDb.canBeReIndexed()) {
300  indexButton.setText(
301  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.reIndex"));
302  indexButton.setEnabled(true);
303  } else {
304  indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
305  indexButton.setEnabled(false);
306  }
307  } else {
308  hashDbIndexStatusLabel.setText(
309  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexStatusText.noIndex"));
310  hashDbIndexStatusLabel.setForeground(Color.red);
311  indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
312  indexButton.setEnabled(true);
313  }
314  } catch (TskCoreException ex) {
315  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index state of hash set", ex); //NON-NLS
316  hashDbIndexStatusLabel.setText(ERROR_GETTING_INDEX_STATUS_TEXT);
317  hashDbIndexStatusLabel.setForeground(Color.red);
318  indexButton.setText(NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.indexButtonText.index"));
319  indexButton.setEnabled(false);
320  }
321  }
322 
323  private boolean isLocalIngestJobEvent(PropertyChangeEvent evt) {
324  if (evt instanceof AutopsyEvent) {
325  AutopsyEvent event = (AutopsyEvent) evt;
326  if (event.getSourceType() == AutopsyEvent.SourceType.LOCAL) {
327  String eventType = event.getPropertyName();
328  return (eventType.equals(IngestManager.IngestJobEvent.STARTED.toString())
329  || eventType.equals(IngestManager.IngestJobEvent.CANCELLED.toString())
330  || eventType.equals(IngestManager.IngestJobEvent.COMPLETED.toString()));
331  }
332  }
333  return false;
334  }
335 
336  @Override
337  @Messages({"HashLookupSettingsPanel.saveFail.message=Couldn't save hash set settings.",
338  "HashLookupSettingsPanel.saveFail.title=Save Fail"})
339  public void saveSettings() {
340  // Clear out the list of new central repo hash sets. They don't need to be
341  // indexed so will all be saved on both code paths.
342  newReferenceSetIDs.clear();
343 
344  //Checking for for any unindexed databases
345  List<SleuthkitHashSet> unindexed = new ArrayList<>();
346  for (HashDb db : hashSetManager.getAllHashSets()) {
347  if (db instanceof SleuthkitHashSet) {
348  try {
349  SleuthkitHashSet hashDatabase = (SleuthkitHashSet) db;
350  if (!hashDatabase.hasIndex()) {
351  unindexed.add(hashDatabase);
352  }
353  } catch (TskCoreException ex) {
354  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index info for hash set", ex); //NON-NLS
355  }
356  }
357  }
358 
359  // If there are unindexed databases, give the user the option to index them now. This
360  // needs to be on the EDT, and will save the hash settings after completing
361  if (!unindexed.isEmpty()) {
362  SwingUtilities.invokeLater(new Runnable() {
363  @Override
364  public void run() {
365  //If unindexed ones are found, show a popup box that will either index them, or remove them.
366  if (!unindexed.isEmpty()) {
367  showInvalidIndex(unindexed);
368  }
369  }
370  });
371  } else {
372  try {
373  hashSetManager.save();
375  SwingUtilities.invokeLater(() -> {
376  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
377  });
378  }
379  }
380  }
381 
382  @Override
383  public void load() {
384  hashSetTable.clearSelection();
385  hashSetTableModel.refreshModel();
386  }
387 
388  @Override
389  public void store() {
390  saveSettings();
391  }
392 
393  public void cancel() {
394  /*
395  * Revert back to last settings only if the user could have made
396  * changes. Doing this while ingest is running causes hash dbs to be
397  * closed while they are still being used.
398  */
399  if (IngestManager.getInstance().isIngestRunning() == false) {
400  // Remove any new central repo hash sets from the database
401  for (int refID : newReferenceSetIDs) {
402  try {
405  } else {
406  // This is the case where the user imported a database, then switched over to the central
407  // repo panel and disabled it before cancelling. We can't delete the database at this point.
408  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.WARNING, "Error reverting central repository hash sets"); //NON-NLS
409  }
410  } catch (CentralRepoException ex) {
411  Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error reverting central repository hash sets", ex); //NON-NLS
412  }
413  }
415  }
416  }
417 
418  @Messages({"# {0} - hash lookup name", "HashLookupSettingsPanel.removeDatabaseFailure.message=Failed to remove hash lookup: {0}"})
419  void removeThese(List<SleuthkitHashSet> toRemove) {
420  for (SleuthkitHashSet hashDb : toRemove) {
421  try {
422  hashSetManager.removeHashDatabaseNoSave(hashDb);
423  } catch (HashDbManager.HashDbManagerException ex) {
424  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
425  }
426  }
427  hashSetTableModel.refreshModel();
428  }
429 
437  @NbBundle.Messages({"# {0} - nsrlUrlAddress",
438  "HashLookupSettingsPanel.removeUnindexedNsrl.text=Instead of indexing the NSRL, please download an already indexed version available here:\n{0}",
439  "# {0} - nsrlHashSet",
440  "HashLookupSettingsPanel.unindexedNsrl.base=The following hash set appears to be an unindexed version of the NSRL, it will be removed from the list.\nHash set:{0}\n",
441  "# {0} - nsrlHashSets",
442  "HashLookupSettingsPanel.unindexedNsrls.base=The following hash sets appear to be unindexed versions of the NSRL, they will be removed from the list.\nHash sets:{0}\n",
443  "HashLookupSettingsPanel.removeUnindexedNsrl.title=Unindexed NSRL(s) will be removed"})
444  private void showInvalidIndex(List<SleuthkitHashSet> unindexed) {
445  String total = "";
446  String nsrlTotal = "";
447 
448  List<SleuthkitHashSet> nsrlHashsets = new ArrayList<>();
449  for (SleuthkitHashSet hdb : unindexed) {
450  //check if this is the NSRL if so point users toward already indexed versions
451  if (isWindows() && hdb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
452  nsrlHashsets.add(hdb);
453  nsrlTotal += "\n" + hdb.getHashSetName();
454  } else {
455  total += "\n" + hdb.getHashSetName();
456  }
457  }
458  if (!nsrlHashsets.isEmpty()) {
459  String message;
460  if (nsrlHashsets.size() > 1) {
461  message = Bundle.HashLookupSettingsPanel_unindexedNsrls_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
462  } else {
463  message = Bundle.HashLookupSettingsPanel_unindexedNsrl_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
464  }
465  JOptionPane.showMessageDialog(this, message, Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
466  for (SleuthkitHashSet hdb : nsrlHashsets) {
467  unindexed.remove(hdb);
468  }
469  removeThese(nsrlHashsets);
470  }
471  String message = NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.dbNotIndexedMsg", total);
472  if (unindexed.isEmpty()) {
473  return;
474  } else if (unindexed.size() > 1) {
475  message = NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.dbsNotIndexedMsg", total);
476  }
477  int res = JOptionPane.showConfirmDialog(this, message,
478  NbBundle.getMessage(this.getClass(),
479  "HashDbConfigPanel.unindexedDbsMsg"),
480  JOptionPane.YES_NO_OPTION);
481  if (res == JOptionPane.YES_OPTION) {
482  ModalNoButtons indexingDialog = new ModalNoButtons(this, new Frame(), unindexed);
483  indexingDialog.setLocationRelativeTo(null);
484  indexingDialog.setVisible(true);
485  indexingDialog.setModal(true);
486  hashSetTableModel.refreshModel();
487  }
488  if (res == JOptionPane.NO_OPTION) {
489  JOptionPane.showMessageDialog(this, NbBundle.getMessage(this.getClass(),
490  "HashDbConfigPanel.allUnindexedDbsRmFromListMsg"));
491  removeThese(unindexed);
492  }
493  try {
494  hashSetManager.save();
496  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
497  }
498  }
499 
500  boolean valid() {
501  return true;
502  }
503 
507  private class HashSetTable extends JTable {
508 
509  @Override
510  public Component prepareRenderer(TableCellRenderer renderer, int row, int column) {
511  // Use the hash set name as the cell text.
512  JComponent cellRenderer = (JComponent) super.prepareRenderer(renderer, row, column);
513  cellRenderer.setToolTipText((String) getValueAt(row, column));
514 
515  // Give the user a visual indication of any hash sets with a hash
516  // database that needs to be indexed by displaying the hash set name
517  // in red.
518  if (hashSetTableModel.isValid(row)) {
519  cellRenderer.setForeground(Color.black);
520  } else {
521  cellRenderer.setForeground(Color.red);
522  }
523 
524  return cellRenderer;
525  }
526 
527  public HashDb getSelection() {
528  return hashSetTableModel.getHashSetAt(getSelectionModel().getMinSelectionIndex());
529  }
530 
531  public void setSelection(int index) {
532  if (index >= 0 && index < hashSetTable.getRowCount()) {
533  getSelectionModel().setSelectionInterval(index, index);
534  }
535  }
536 
537  public void selectRowByDatabase(HashDb db) {
538  setSelection(hashSetTableModel.getIndexByDatabase(db));
539  }
540 
541  @Deprecated
542  public void selectRowByName(String name) {
543  setSelection(hashSetTableModel.getIndexByName(name));
544  }
545  }
546 
551  private class HashSetTableModel extends AbstractTableModel {
552 
553  List<HashDb> hashSets = HashDbManager.getInstance().getAllHashSets();
554 
555  @Override
556  public int getColumnCount() {
557  return 1;
558  }
559 
560  @Override
561  public int getRowCount() {
562  return hashSets.size();
563  }
564 
565  @Override
566  public String getColumnName(int column) {
567  return NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.nameColLbl");
568  }
569 
570  @Override
571  public Object getValueAt(int rowIndex, int columnIndex) {
572  return hashSets.get(rowIndex).getDisplayName();
573  }
574 
575  private boolean isValid(int rowIndex) {
576  try {
577  return hashSets.get(rowIndex).isValid();
578  } catch (TskCoreException ex) {
579  Logger.getLogger(HashSetTableModel.class.getName()).log(Level.SEVERE, "Error getting index info for hash set", ex); //NON-NLS
580  return false;
581  }
582  }
583 
584  @Override
585  public boolean isCellEditable(int rowIndex, int columnIndex) {
586  return false;
587  }
588 
589  @Override
590  public void setValueAt(Object aValue, int rowIndex, int columnIndex) {
591  throw new UnsupportedOperationException(
592  NbBundle.getMessage(this.getClass(), "HashDbConfigPanel.editingCellsNotSupportedMsg"));
593  }
594 
595  @Override
596  public Class<?> getColumnClass(int c) {
597  return getValueAt(0, c).getClass();
598  }
599 
600  HashDb getHashSetAt(int index) {
601  if (!hashSets.isEmpty() && index >= 0 && index < hashSets.size()) {
602  return hashSets.get(index);
603  } else {
604  return null;
605  }
606  }
607 
608  int getIndexByDatabase(HashDb db) {
609  for (int i = 0; i < hashSets.size(); ++i) {
610  if (hashSets.get(i).equals(db)) {
611  return i;
612  }
613  }
614  return -1;
615  }
616 
617  @Deprecated
618  int getIndexByName(String name) {
619  for (int i = 0; i < hashSets.size(); ++i) {
620  if (hashSets.get(i).getHashSetName().equals(name)) {
621  return i;
622  }
623  }
624  return -1;
625  }
626 
627  void refreshModel() {
628  hashSets = HashDbManager.getInstance().getAllHashSets();
629  refreshDisplay();
630  }
631 
632  void refreshDisplay() {
633  fireTableDataChanged();
634  }
635  }
636 
642  // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
643  private void initComponents() {
644 
645  jScrollPane2 = new javax.swing.JScrollPane();
646  jPanel1 = new javax.swing.JPanel();
647  hashDatabasesLabel = new javax.swing.JLabel();
648  jScrollPane1 = new javax.swing.JScrollPane();
649  hashSetTable = new HashSetTable();
650  createDatabaseButton = new javax.swing.JButton();
651  importDatabaseButton = new javax.swing.JButton();
652  deleteDatabaseButton = new javax.swing.JButton();
653  informationLabel = new javax.swing.JLabel();
654  informationScrollPanel = new javax.swing.JScrollPane();
655  informationPanel = new javax.swing.JPanel();
656  nameLabel = new javax.swing.JLabel();
657  hashDbNameLabel = new javax.swing.JLabel();
658  typeLabel = new javax.swing.JLabel();
659  hashDbTypeLabel = new javax.swing.JLabel();
660  locationLabel = new javax.swing.JLabel();
661  hashDbLocationLabel = new javax.swing.JLabel();
662  versionLabel = new javax.swing.JLabel();
663  hashDbVersionLabel = new javax.swing.JLabel();
664  orgLabel = new javax.swing.JLabel();
665  hashDbOrgLabel = new javax.swing.JLabel();
666  readOnlyLabel = new javax.swing.JLabel();
667  hashDbReadOnlyLabel = new javax.swing.JLabel();
668  indexPathLabelLabel = new javax.swing.JLabel();
669  indexPathLabel = new javax.swing.JLabel();
670  indexLabel = new javax.swing.JLabel();
671  hashDbIndexStatusLabel = new javax.swing.JLabel();
672  indexButton = new javax.swing.JButton();
673  addHashesToDatabaseButton = new javax.swing.JButton();
674  sendIngestMessagesCheckBox = new javax.swing.JCheckBox();
675  ingestWarningLabel = new javax.swing.JLabel();
676 
677  org.openide.awt.Mnemonics.setLocalizedText(hashDatabasesLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDatabasesLabel.text")); // NOI18N
678 
679  hashSetTable.setModel(new javax.swing.table.DefaultTableModel(
680  new Object [][] {
681 
682  },
683  new String [] {
684 
685  }
686  ));
687  hashSetTable.setShowHorizontalLines(false);
688  hashSetTable.setShowVerticalLines(false);
689  hashSetTable.addKeyListener(new java.awt.event.KeyAdapter() {
690  public void keyPressed(java.awt.event.KeyEvent evt) {
691  hashSetTableKeyPressed(evt);
692  }
693  });
694  jScrollPane1.setViewportView(hashSetTable);
695 
696  createDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/new16.png"))); // NOI18N
697  org.openide.awt.Mnemonics.setLocalizedText(createDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.text")); // NOI18N
698  createDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.toolTipText")); // NOI18N
699  createDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
700  createDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
701  createDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
702  public void actionPerformed(java.awt.event.ActionEvent evt) {
703  createDatabaseButtonActionPerformed(evt);
704  }
705  });
706 
707  importDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/import16.png"))); // NOI18N
708  org.openide.awt.Mnemonics.setLocalizedText(importDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.importDatabaseButton.text")); // NOI18N
709  importDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.importDatabaseButton.toolTipText")); // NOI18N
710  importDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
711  importDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
712  importDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
713  public void actionPerformed(java.awt.event.ActionEvent evt) {
714  importDatabaseButtonActionPerformed(evt);
715  }
716  });
717 
718  deleteDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png"))); // NOI18N
719  org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.deleteDatabaseButton.text")); // NOI18N
720  deleteDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
721  deleteDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
722  deleteDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
723  public void actionPerformed(java.awt.event.ActionEvent evt) {
724  deleteDatabaseButtonActionPerformed(evt);
725  }
726  });
727 
728  org.openide.awt.Mnemonics.setLocalizedText(informationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.informationLabel.text")); // NOI18N
729 
730  informationScrollPanel.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
731 
732  org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.nameLabel.text")); // NOI18N
733 
734  org.openide.awt.Mnemonics.setLocalizedText(hashDbNameLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbNameLabel.text")); // NOI18N
735 
736  org.openide.awt.Mnemonics.setLocalizedText(typeLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.typeLabel.text")); // NOI18N
737 
738  org.openide.awt.Mnemonics.setLocalizedText(hashDbTypeLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbTypeLabel.text")); // NOI18N
739 
740  org.openide.awt.Mnemonics.setLocalizedText(locationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.locationLabel.text")); // NOI18N
741 
742  org.openide.awt.Mnemonics.setLocalizedText(hashDbLocationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbLocationLabel.text")); // NOI18N
743 
744  org.openide.awt.Mnemonics.setLocalizedText(versionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.versionLabel.text_1")); // NOI18N
745 
746  org.openide.awt.Mnemonics.setLocalizedText(hashDbVersionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbVersionLabel.text_1")); // NOI18N
747 
748  org.openide.awt.Mnemonics.setLocalizedText(orgLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.orgLabel.text_1")); // NOI18N
749 
750  org.openide.awt.Mnemonics.setLocalizedText(hashDbOrgLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbOrgLabel.text_1")); // NOI18N
751 
752  org.openide.awt.Mnemonics.setLocalizedText(readOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.readOnlyLabel.text_1")); // NOI18N
753 
754  org.openide.awt.Mnemonics.setLocalizedText(hashDbReadOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1")); // NOI18N
755 
756  org.openide.awt.Mnemonics.setLocalizedText(indexPathLabelLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabelLabel.text")); // NOI18N
757 
758  org.openide.awt.Mnemonics.setLocalizedText(indexPathLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabel.text")); // NOI18N
759 
760  org.openide.awt.Mnemonics.setLocalizedText(indexLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexLabel.text")); // NOI18N
761 
762  org.openide.awt.Mnemonics.setLocalizedText(hashDbIndexStatusLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbIndexStatusLabel.text")); // NOI18N
763 
764  javax.swing.GroupLayout informationPanelLayout = new javax.swing.GroupLayout(informationPanel);
765  informationPanel.setLayout(informationPanelLayout);
766  informationPanelLayout.setHorizontalGroup(
767  informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
768  .addGroup(informationPanelLayout.createSequentialGroup()
769  .addContainerGap()
770  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
771  .addGroup(informationPanelLayout.createSequentialGroup()
772  .addComponent(locationLabel)
773  .addGap(18, 18, 18)
774  .addComponent(hashDbLocationLabel))
775  .addGroup(informationPanelLayout.createSequentialGroup()
776  .addComponent(nameLabel)
777  .addGap(18, 18, 18)
778  .addComponent(hashDbNameLabel))
779  .addGroup(informationPanelLayout.createSequentialGroup()
780  .addComponent(typeLabel)
781  .addGap(18, 18, 18)
782  .addComponent(hashDbTypeLabel))
783  .addGroup(informationPanelLayout.createSequentialGroup()
784  .addComponent(versionLabel)
785  .addGap(18, 18, 18)
786  .addComponent(hashDbVersionLabel))
787  .addGroup(informationPanelLayout.createSequentialGroup()
788  .addComponent(orgLabel)
789  .addGap(18, 18, 18)
790  .addComponent(hashDbOrgLabel))
791  .addGroup(informationPanelLayout.createSequentialGroup()
792  .addComponent(readOnlyLabel)
793  .addGap(18, 18, 18)
794  .addComponent(hashDbReadOnlyLabel))
795  .addGroup(informationPanelLayout.createSequentialGroup()
796  .addComponent(indexLabel)
797  .addGap(18, 18, 18)
798  .addComponent(hashDbIndexStatusLabel))
799  .addGroup(informationPanelLayout.createSequentialGroup()
800  .addComponent(indexPathLabelLabel)
801  .addGap(18, 18, 18)
802  .addComponent(indexPathLabel)))
803  .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
804  );
805 
806  informationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel});
807 
808  informationPanelLayout.setVerticalGroup(
809  informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
810  .addGroup(informationPanelLayout.createSequentialGroup()
811  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
812  .addComponent(nameLabel)
813  .addComponent(hashDbNameLabel))
814  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
815  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
816  .addComponent(typeLabel)
817  .addComponent(hashDbTypeLabel))
818  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
819  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
820  .addComponent(locationLabel)
821  .addComponent(hashDbLocationLabel))
822  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
823  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
824  .addComponent(versionLabel)
825  .addComponent(hashDbVersionLabel))
826  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
827  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
828  .addComponent(orgLabel)
829  .addComponent(hashDbOrgLabel))
830  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
831  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
832  .addComponent(readOnlyLabel)
833  .addComponent(hashDbReadOnlyLabel))
834  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
835  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
836  .addComponent(indexPathLabelLabel)
837  .addComponent(indexPathLabel))
838  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
839  .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
840  .addComponent(indexLabel)
841  .addComponent(hashDbIndexStatusLabel))
842  .addGap(0, 49, Short.MAX_VALUE))
843  );
844 
845  informationScrollPanel.setViewportView(informationPanel);
846 
847  org.openide.awt.Mnemonics.setLocalizedText(indexButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexButton.text")); // NOI18N
848  indexButton.setEnabled(false);
849  indexButton.addActionListener(new java.awt.event.ActionListener() {
850  public void actionPerformed(java.awt.event.ActionEvent evt) {
851  indexButtonActionPerformed(evt);
852  }
853  });
854 
855  org.openide.awt.Mnemonics.setLocalizedText(addHashesToDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.addHashesToDatabaseButton.text")); // NOI18N
856  addHashesToDatabaseButton.setEnabled(false);
857  addHashesToDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
858  public void actionPerformed(java.awt.event.ActionEvent evt) {
859  addHashesToDatabaseButtonActionPerformed(evt);
860  }
861  });
862 
863  org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckBox, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.sendIngestMessagesCheckBox.text")); // NOI18N
864  sendIngestMessagesCheckBox.addActionListener(new java.awt.event.ActionListener() {
865  public void actionPerformed(java.awt.event.ActionEvent evt) {
866  sendIngestMessagesCheckBoxActionPerformed(evt);
867  }
868  });
869 
870  ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
871  org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.ingestWarningLabel.text")); // NOI18N
872 
873  javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
874  jPanel1.setLayout(jPanel1Layout);
875  jPanel1Layout.setHorizontalGroup(
876  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
877  .addGroup(jPanel1Layout.createSequentialGroup()
878  .addContainerGap()
879  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
880  .addGroup(jPanel1Layout.createSequentialGroup()
881  .addGap(1, 1, 1)
882  .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
883  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
884  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
885  .addComponent(informationScrollPanel)
886  .addGroup(jPanel1Layout.createSequentialGroup()
887  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
888  .addGroup(jPanel1Layout.createSequentialGroup()
889  .addComponent(indexButton)
890  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
891  .addComponent(addHashesToDatabaseButton))
892  .addComponent(sendIngestMessagesCheckBox)
893  .addComponent(ingestWarningLabel)
894  .addComponent(informationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE))
895  .addGap(0, 0, Short.MAX_VALUE)))
896  .addContainerGap())
897  .addGroup(jPanel1Layout.createSequentialGroup()
898  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
899  .addComponent(hashDatabasesLabel)
900  .addGroup(jPanel1Layout.createSequentialGroup()
901  .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
902  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
903  .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
904  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
905  .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
906  .addGap(0, 0, Short.MAX_VALUE))))
907  );
908  jPanel1Layout.setVerticalGroup(
909  jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
910  .addGroup(jPanel1Layout.createSequentialGroup()
911  .addContainerGap()
912  .addComponent(hashDatabasesLabel)
913  .addGap(6, 6, 6)
914  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
915  .addGroup(jPanel1Layout.createSequentialGroup()
916  .addComponent(informationLabel)
917  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
918  .addComponent(informationScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
919  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
920  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
921  .addComponent(indexButton)
922  .addComponent(addHashesToDatabaseButton))
923  .addGap(18, 18, 18)
924  .addComponent(sendIngestMessagesCheckBox)
925  .addGap(18, 18, 18)
926  .addComponent(ingestWarningLabel)
927  .addGap(0, 0, Short.MAX_VALUE))
928  .addComponent(jScrollPane1))
929  .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
930  .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
931  .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
932  .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
933  .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
934  .addContainerGap())
935  );
936 
937  jScrollPane2.setViewportView(jPanel1);
938 
939  javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
940  this.setLayout(layout);
941  layout.setHorizontalGroup(
942  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
943  .addComponent(jScrollPane2)
944  );
945  layout.setVerticalGroup(
946  layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
947  .addComponent(jScrollPane2)
948  );
949  }// </editor-fold>//GEN-END:initComponents
950 
951  private void addHashesToDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_addHashesToDatabaseButtonActionPerformed
952 
953  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
955  }//GEN-LAST:event_addHashesToDatabaseButtonActionPerformed
956 
957  private void createDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createDatabaseButtonActionPerformed
958  HashDb hashDb = new HashDbCreateDatabaseDialog().getHashDatabase();
959  if (null != hashDb) {
960  if (hashDb instanceof CentralRepoHashSet) {
961  int newDbIndex = ((CentralRepoHashSet) hashDb).getReferenceSetID();
962  newReferenceSetIDs.add(newDbIndex);
963  }
964 
965  hashSetTableModel.refreshModel();
966  ((HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
967  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
968  }
969  }//GEN-LAST:event_createDatabaseButtonActionPerformed
970 
971  private void sendIngestMessagesCheckBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_sendIngestMessagesCheckBoxActionPerformed
972  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
973  if (hashDb != null) {
974  hashDb.setSendIngestMessages(sendIngestMessagesCheckBox.isSelected());
975  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
976  }
977  }//GEN-LAST:event_sendIngestMessagesCheckBoxActionPerformed
978 
984  private boolean isWindows() {
985  return PlatformUtil.getOSName().toLowerCase().startsWith("Windows");
986  }
987 
988  @NbBundle.Messages({"HashLookupSettingsPanel.indexNsrl.text=This hash set appears to be the NSRL, it will be removed from the list.\n",
989  "HashLookupSettingsPanel.indexNsrl.title=NSRL will not be indexed"})
990  private void indexButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_indexButtonActionPerformed
991  final HashDb hashDatabase = ((HashSetTable) hashSetTable).getSelection();
992  assert hashDatabase != null;
993  assert hashDatabase instanceof SleuthkitHashSet;
994 
995  // Add a listener for the INDEXING_DONE event. This listener will update
996  // the UI.
997  SleuthkitHashSet hashDb = (SleuthkitHashSet) hashDatabase;
998  if (isWindows() && hashDb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
999  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_indexNsrl_text() + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL), Bundle.HashLookupSettingsPanel_indexNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
1000  try {
1001  hashSetManager.removeHashDatabaseNoSave(hashDatabase);
1002  hashSetTableModel.refreshModel();
1003  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1004  } catch (HashDbManager.HashDbManagerException ex) {
1005  logger.log(Level.WARNING, "Unable to remove unindexed NSRL from hash set list", ex);
1006  }
1007  } else {
1008  hashDb.addPropertyChangeListener(new PropertyChangeListener() {
1009  @Override
1010  public void propertyChange(PropertyChangeEvent evt) {
1011  if (evt.getPropertyName().equals(SleuthkitHashSet.Event.INDEXING_DONE.toString())) {
1012  HashDb selectedHashDb = ((HashSetTable) hashSetTable).getSelection();
1013  if (selectedHashDb != null && hashDb != null && hashDb.equals(selectedHashDb)) {
1014  updateComponents();
1015  }
1016  hashSetTableModel.refreshDisplay();
1017  }
1018  }
1019  });
1020 
1021  // Display a modal dialog box to kick off the indexing on a worker thread
1022  // and try to persuade the user to wait for the indexing task to finish.
1023  // TODO: If the user waits, this defeats the purpose of doing the indexing on a worker thread.
1024  // But if the user cancels the dialog, other operations on the database
1025  // may be attempted when it is not in a suitable state.
1026  ModalNoButtons indexDialog = new ModalNoButtons(this, new Frame(), hashDb);
1027  indexDialog.setLocationRelativeTo(null);
1028  indexDialog.setVisible(true);
1029  indexDialog.setModal(true);
1030  }
1031  }//GEN-LAST:event_indexButtonActionPerformed
1032 
1033  private void importDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_importDatabaseButtonActionPerformed
1034  HashDb hashDb = new HashDbImportDatabaseDialog().getHashDatabase();
1035  if (null != hashDb) {
1036  if (hashDb instanceof CentralRepoHashSet) {
1037  int newReferenceSetID = ((CentralRepoHashSet) hashDb).getReferenceSetID();
1038  newReferenceSetIDs.add(newReferenceSetID);
1039  }
1040 
1041  hashSetTableModel.refreshModel();
1042  ((HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
1043  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1044  }
1045  }//GEN-LAST:event_importDatabaseButtonActionPerformed
1046 
1047  @Messages({
1048  "HashLookupSettingsPanel.promptTitle.deleteHashDb=Delete Hash Database from Configuration",
1049  "HashLookupSettingsPanel.promptMessage.deleteHashDb=This will make the hash database unavailable for lookup. Do you want to proceed?\n\nNote: The hash database can still be re-imported later."
1050  })
1051  private void deleteDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteDatabaseButtonActionPerformed
1052  if (JOptionPane.showConfirmDialog(this,
1053  Bundle.HashLookupSettingsPanel_promptMessage_deleteHashDb(),
1054  Bundle.HashLookupSettingsPanel_promptTitle_deleteHashDb(),
1055  JOptionPane.YES_NO_OPTION,
1056  JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
1057  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
1058  if (hashDb != null) {
1059  try {
1060  hashSetManager.removeHashDatabaseNoSave(hashDb);
1061  } catch (HashDbManager.HashDbManagerException ex) {
1062  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
1063  }
1064  hashSetTableModel.refreshModel();
1065  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1066  }
1067  }
1068  }//GEN-LAST:event_deleteDatabaseButtonActionPerformed
1069 
1070  private void hashSetTableKeyPressed(java.awt.event.KeyEvent evt) {//GEN-FIRST:event_hashSetTableKeyPressed
1071  if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
1072  HashDb hashDb = ((HashSetTable) hashSetTable).getSelection();
1073  if (hashDb != null) {
1074  try {
1075  hashSetManager.removeHashDatabaseNoSave(hashDb);
1076  } catch (HashDbManager.HashDbManagerException ex) {
1077  JOptionPane.showMessageDialog(this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
1078  }
1079  hashSetTableModel.refreshModel();
1080  firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1081  }
1082  }
1083  }//GEN-LAST:event_hashSetTableKeyPressed
1084 
1085  // Variables declaration - do not modify//GEN-BEGIN:variables
1086  private javax.swing.JButton addHashesToDatabaseButton;
1087  private javax.swing.JButton createDatabaseButton;
1088  private javax.swing.JButton deleteDatabaseButton;
1089  private javax.swing.JLabel hashDatabasesLabel;
1090  private javax.swing.JLabel hashDbIndexStatusLabel;
1091  private javax.swing.JLabel hashDbLocationLabel;
1092  private javax.swing.JLabel hashDbNameLabel;
1093  private javax.swing.JLabel hashDbOrgLabel;
1094  private javax.swing.JLabel hashDbReadOnlyLabel;
1095  private javax.swing.JLabel hashDbTypeLabel;
1096  private javax.swing.JLabel hashDbVersionLabel;
1097  private javax.swing.JTable hashSetTable;
1098  private javax.swing.JButton importDatabaseButton;
1099  private javax.swing.JButton indexButton;
1100  private javax.swing.JLabel indexLabel;
1101  private javax.swing.JLabel indexPathLabel;
1102  private javax.swing.JLabel indexPathLabelLabel;
1103  private javax.swing.JLabel informationLabel;
1104  private javax.swing.JPanel informationPanel;
1105  private javax.swing.JScrollPane informationScrollPanel;
1106  private javax.swing.JLabel ingestWarningLabel;
1107  private javax.swing.JPanel jPanel1;
1108  private javax.swing.JScrollPane jScrollPane1;
1109  private javax.swing.JScrollPane jScrollPane2;
1110  private javax.swing.JLabel locationLabel;
1111  private javax.swing.JLabel nameLabel;
1112  private javax.swing.JLabel orgLabel;
1113  private javax.swing.JLabel readOnlyLabel;
1114  private javax.swing.JCheckBox sendIngestMessagesCheckBox;
1115  private javax.swing.JLabel typeLabel;
1116  private javax.swing.JLabel versionLabel;
1117  // End of variables declaration//GEN-END:variables
1118 }
static synchronized IngestManager getInstance()
synchronized void addPropertyChangeListener(PropertyChangeListener listener)
void updateForSleuthkitHashSet(boolean ingestIsRunning, SleuthkitHashSet hashDb)
Component prepareRenderer(TableCellRenderer renderer, int row, int column)
void addIngestJobEventListener(final PropertyChangeListener listener)
synchronized void removeHashDatabaseNoSave(HashDb hashDb)
synchronized static Logger getLogger(String name)
Definition: Logger.java:124

Copyright © 2012-2022 Basis Technology. Generated on: Fri Dec 2 2022
This work is licensed under a Creative Commons Attribution-Share Alike 3.0 United States License.