19 package org.sleuthkit.autopsy.modules.hashdatabase;
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.util.ArrayList;
29 import java.util.List;
30 import java.util.logging.Level;
31 import javax.swing.JComponent;
32 import javax.swing.JOptionPane;
33 import javax.swing.JTable;
34 import javax.swing.ListSelectionModel;
35 import javax.swing.SwingUtilities;
36 import javax.swing.event.ListSelectionEvent;
37 import javax.swing.event.ListSelectionListener;
38 import javax.swing.table.AbstractTableModel;
39 import javax.swing.table.TableCellRenderer;
40 import org.netbeans.spi.options.OptionsPanelController;
41 import org.openide.util.NbBundle;
42 import org.openide.util.NbBundle.Messages;
61 @SuppressWarnings(
"PMD.SingularField")
64 private static final String NSRL_URL =
"https://sourceforge.net/projects/autopsy/files/NSRL/";
65 private static final String NSRL_NAME_STRING =
"nsrl";
66 private static final String NO_SELECTION_TEXT = NbBundle
68 private static final String ERROR_GETTING_PATH_TEXT = NbBundle
70 private static final String ERROR_GETTING_INDEX_STATUS_TEXT = NbBundle
75 private final List<Integer> newReferenceSetIDs =
new ArrayList<>();
79 customizeComponents();
80 updateComponentsForNoSelection();
86 public void propertyChange(PropertyChangeEvent evt) {
87 if (isLocalIngestJobEvent(evt)) {
88 EventQueue.invokeLater(
new Runnable() {
100 public void propertyChange(PropertyChangeEvent evt) {
101 String propName = evt.getPropertyName();
104 hashSetTableModel.refreshModel();
110 @NbBundle.Messages({
"HashLookupSettingsPanel.Title=Global Hash Lookup Settings"})
112 setName(Bundle.HashLookupSettingsPanel_Title());
113 this.ingestWarningLabel.setVisible(
false);
114 this.hashSetTable.setModel(hashSetTableModel);
115 this.hashSetTable.setTableHeader(null);
116 hashSetTable.getParent().setBackground(hashSetTable.getBackground());
117 hashSetTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
118 hashSetTable.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
120 public void valueChanged(ListSelectionEvent e) {
121 if (!e.getValueIsAdjusting()) {
131 updateComponentsForSelection(db);
133 updateComponentsForNoSelection();
141 hashDbNameLabel.setText(NO_SELECTION_TEXT);
142 hashDbTypeLabel.setText(NO_SELECTION_TEXT);
143 hashDbLocationLabel.setText(NO_SELECTION_TEXT);
144 hashDbVersionLabel.setText(NO_SELECTION_TEXT);
145 hashDbOrgLabel.setText(NO_SELECTION_TEXT);
146 hashDbReadOnlyLabel.setText(NO_SELECTION_TEXT);
147 indexPathLabel.setText(NO_SELECTION_TEXT);
150 hashDbIndexStatusLabel.setText(NO_SELECTION_TEXT);
151 hashDbIndexStatusLabel.setForeground(Color.black);
152 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
153 indexButton.setEnabled(
false);
154 addHashesToDatabaseButton.setEnabled(
false);
157 sendIngestMessagesCheckBox.setSelected(
false);
158 sendIngestMessagesCheckBox.setEnabled(
false);
161 createDatabaseButton.setEnabled(
true);
162 importDatabaseButton.setEnabled(
true);
163 deleteDatabaseButton.setEnabled(
false);
166 ingestWarningLabel.setVisible(ingestIsRunning);
169 @NbBundle.Messages({
"HashLookupSettingsPanel.readOnly=Read only",
170 "HashLookupSettingsPanel.editable=Editable",
171 "HashLookupSettingsPanel.updateStatusError=Error reading status",
172 "HashLookupSettingsPanel.notApplicable=N/A",
173 "HashLookupSettingsPanel.centralRepo=Central Repository"
183 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_editable());
185 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_readOnly());
187 }
catch (TskCoreException ex) {
188 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_updateStatusError());
192 addHashesToDatabaseButton.setEnabled(!ingestIsRunning && db.
isUpdateable());
193 }
catch (TskCoreException ex) {
195 addHashesToDatabaseButton.setEnabled(
false);
198 if (db instanceof SleuthkitHashSet) {
199 SleuthkitHashSet hashDb = (SleuthkitHashSet) db;
202 hashDbVersionLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
203 hashDbOrgLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
206 deleteDatabaseButton.setEnabled(!ingestIsRunning);
210 }
catch (TskCoreException ex) {
212 hashDbLocationLabel.setText(ERROR_GETTING_PATH_TEXT);
216 indexPathLabel.setText(hashDb.getIndexPath());
217 }
catch (TskCoreException ex) {
219 indexPathLabel.setText(ERROR_GETTING_PATH_TEXT);
224 if (hashDb.isIndexing()) {
226 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.indexing"));
227 hashDbIndexStatusLabel.setText(
228 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.indexGen"));
229 hashDbIndexStatusLabel.setForeground(Color.black);
230 indexButton.setEnabled(
false);
231 }
else if (hashDb.hasIndex()) {
232 if (hashDb.hasIndexOnly()) {
233 hashDbIndexStatusLabel.setText(
234 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.indexOnly"));
236 hashDbIndexStatusLabel.setText(
237 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.indexed"));
239 hashDbIndexStatusLabel.setForeground(Color.black);
240 if (hashDb.canBeReIndexed()) {
242 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.reIndex"));
243 indexButton.setEnabled(
true);
245 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
246 indexButton.setEnabled(
false);
249 hashDbIndexStatusLabel.setText(
250 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.noIndex"));
251 hashDbIndexStatusLabel.setForeground(Color.red);
252 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
253 indexButton.setEnabled(
true);
255 }
catch (TskCoreException ex) {
257 hashDbIndexStatusLabel.setText(ERROR_GETTING_INDEX_STATUS_TEXT);
258 hashDbIndexStatusLabel.setForeground(Color.red);
259 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
260 indexButton.setEnabled(
false);
265 indexPathLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
266 hashDbIndexStatusLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
267 hashDbLocationLabel.setText(Bundle.HashLookupSettingsPanel_centralRepo());
268 indexButton.setEnabled(
false);
269 deleteDatabaseButton.setEnabled(
false);
271 CentralRepoHashSet crDb = (CentralRepoHashSet) db;
273 hashDbVersionLabel.setText(crDb.getVersion());
274 hashDbOrgLabel.setText(crDb.getOrgName());
278 if (ingestIsRunning) {
279 indexButton.setEnabled(
false);
284 sendIngestMessagesCheckBox.setEnabled(!ingestIsRunning && db.
getKnownFilesType().isInboxMessagesAllowed());
287 createDatabaseButton.setEnabled(
true);
288 importDatabaseButton.setEnabled(
true);
291 ingestWarningLabel.setVisible(ingestIsRunning);
296 AutopsyEvent
event = (AutopsyEvent) evt;
297 if (event.getSourceType() == AutopsyEvent.SourceType.LOCAL) {
298 String eventType =
event.getPropertyName();
308 @Messages({
"HashLookupSettingsPanel.saveFail.message=Couldn't save hash set settings.",
309 "HashLookupSettingsPanel.saveFail.title=Save Fail"})
313 newReferenceSetIDs.clear();
316 List<SleuthkitHashSet> unindexed =
new ArrayList<>();
318 if (db instanceof SleuthkitHashSet) {
320 SleuthkitHashSet hashDatabase = (SleuthkitHashSet) db;
321 if (!hashDatabase.hasIndex()) {
322 unindexed.add(hashDatabase);
324 }
catch (TskCoreException ex) {
332 if (!unindexed.isEmpty()) {
333 SwingUtilities.invokeLater(
new Runnable() {
337 if (!unindexed.isEmpty()) {
338 showInvalidIndex(unindexed);
344 hashSetManager.save();
346 SwingUtilities.invokeLater(() -> {
347 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
355 hashSetTable.clearSelection();
356 hashSetTableModel.refreshModel();
372 for (
int refID : newReferenceSetIDs) {
389 @Messages({
"# {0} - hash lookup name",
"HashLookupSettingsPanel.removeDatabaseFailure.message=Failed to remove hash lookup: {0}"})
390 void removeThese(List<SleuthkitHashSet> toRemove) {
391 for (SleuthkitHashSet hashDb : toRemove) {
394 }
catch (HashDbManager.HashDbManagerException ex) {
395 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
398 hashSetTableModel.refreshModel();
408 @NbBundle.Messages({
"# {0} - nsrlUrlAddress",
409 "HashLookupSettingsPanel.removeUnindexedNsrl.text=Instead of indexing the NSRL, please download an already indexed version available here:\n{0}",
410 "# {0} - nsrlHashSet",
411 "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",
412 "# {0} - nsrlHashSets",
413 "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",
414 "HashLookupSettingsPanel.removeUnindexedNsrl.title=Unindexed NSRL(s) will be removed"})
417 String nsrlTotal =
"";
419 List<SleuthkitHashSet> nsrlHashsets =
new ArrayList<>();
420 for (SleuthkitHashSet hdb : unindexed) {
422 if (isWindows() && hdb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
423 nsrlHashsets.add(hdb);
424 nsrlTotal +=
"\n" + hdb.getHashSetName();
426 total +=
"\n" + hdb.getHashSetName();
429 if (!nsrlHashsets.isEmpty()) {
431 if (nsrlHashsets.size() > 1) {
432 message = Bundle.HashLookupSettingsPanel_unindexedNsrls_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
434 message = Bundle.HashLookupSettingsPanel_unindexedNsrl_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
436 JOptionPane.showMessageDialog(
this, message, Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
437 for (SleuthkitHashSet hdb : nsrlHashsets) {
438 unindexed.remove(hdb);
440 removeThese(nsrlHashsets);
442 String message = NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.dbNotIndexedMsg", total);
443 if (unindexed.isEmpty()) {
445 }
else if (unindexed.size() > 1) {
446 message = NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.dbsNotIndexedMsg", total);
448 int res = JOptionPane.showConfirmDialog(
this, message,
449 NbBundle.getMessage(
this.getClass(),
450 "HashDbConfigPanel.unindexedDbsMsg"),
451 JOptionPane.YES_NO_OPTION);
452 if (res == JOptionPane.YES_OPTION) {
453 ModalNoButtons indexingDialog =
new ModalNoButtons(
this,
new Frame(), unindexed);
454 indexingDialog.setLocationRelativeTo(null);
455 indexingDialog.setVisible(
true);
456 indexingDialog.setModal(
true);
457 hashSetTableModel.refreshModel();
459 if (res == JOptionPane.NO_OPTION) {
460 JOptionPane.showMessageDialog(
this, NbBundle.getMessage(
this.getClass(),
461 "HashDbConfigPanel.allUnindexedDbsRmFromListMsg"));
462 removeThese(unindexed);
465 hashSetManager.save();
467 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
483 JComponent cellRenderer = (JComponent) super.prepareRenderer(renderer, row, column);
484 cellRenderer.setToolTipText((String) getValueAt(row, column));
489 if (hashSetTableModel.
isValid(row)) {
490 cellRenderer.setForeground(Color.black);
492 cellRenderer.setForeground(Color.red);
499 return hashSetTableModel.getHashSetAt(getSelectionModel().getMinSelectionIndex());
503 if (index >= 0 && index < hashSetTable.getRowCount()) {
504 getSelectionModel().setSelectionInterval(index, index);
509 setSelection(hashSetTableModel.getIndexByDatabase(db));
514 setSelection(hashSetTableModel.getIndexByName(name));
533 return hashSets.size();
538 return NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.nameColLbl");
543 return hashSets.get(rowIndex).getDisplayName();
548 return hashSets.get(rowIndex).isValid();
549 }
catch (TskCoreException ex) {
561 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
562 throw new UnsupportedOperationException(
563 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.editingCellsNotSupportedMsg"));
568 return getValueAt(0, c).getClass();
571 HashDb getHashSetAt(
int index) {
572 if (!hashSets.isEmpty() && index >= 0 && index < hashSets.size()) {
573 return hashSets.get(index);
579 int getIndexByDatabase(HashDb db) {
580 for (
int i = 0; i < hashSets.size(); ++i) {
581 if (hashSets.get(i).equals(db)) {
589 int getIndexByName(String name) {
590 for (
int i = 0; i < hashSets.size(); ++i) {
591 if (hashSets.get(i).getHashSetName().equals(name)) {
598 void refreshModel() {
599 hashSets = HashDbManager.getInstance().getAllHashSets();
603 void refreshDisplay() {
604 fireTableDataChanged();
616 jScrollPane2 =
new javax.swing.JScrollPane();
617 jPanel1 =
new javax.swing.JPanel();
618 hashDatabasesLabel =
new javax.swing.JLabel();
619 jScrollPane1 =
new javax.swing.JScrollPane();
621 createDatabaseButton =
new javax.swing.JButton();
622 importDatabaseButton =
new javax.swing.JButton();
623 deleteDatabaseButton =
new javax.swing.JButton();
624 informationLabel =
new javax.swing.JLabel();
625 informationScrollPanel =
new javax.swing.JScrollPane();
626 informationPanel =
new javax.swing.JPanel();
627 nameLabel =
new javax.swing.JLabel();
628 hashDbNameLabel =
new javax.swing.JLabel();
629 typeLabel =
new javax.swing.JLabel();
630 hashDbTypeLabel =
new javax.swing.JLabel();
631 locationLabel =
new javax.swing.JLabel();
632 hashDbLocationLabel =
new javax.swing.JLabel();
633 versionLabel =
new javax.swing.JLabel();
634 hashDbVersionLabel =
new javax.swing.JLabel();
635 orgLabel =
new javax.swing.JLabel();
636 hashDbOrgLabel =
new javax.swing.JLabel();
637 readOnlyLabel =
new javax.swing.JLabel();
638 hashDbReadOnlyLabel =
new javax.swing.JLabel();
639 indexPathLabelLabel =
new javax.swing.JLabel();
640 indexPathLabel =
new javax.swing.JLabel();
641 indexLabel =
new javax.swing.JLabel();
642 hashDbIndexStatusLabel =
new javax.swing.JLabel();
643 indexButton =
new javax.swing.JButton();
644 addHashesToDatabaseButton =
new javax.swing.JButton();
645 sendIngestMessagesCheckBox =
new javax.swing.JCheckBox();
646 ingestWarningLabel =
new javax.swing.JLabel();
648 org.openide.awt.Mnemonics.setLocalizedText(hashDatabasesLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDatabasesLabel.text"));
650 hashSetTable.setModel(
new javax.swing.table.DefaultTableModel(
658 hashSetTable.setShowHorizontalLines(
false);
659 hashSetTable.setShowVerticalLines(
false);
660 hashSetTable.addKeyListener(
new java.awt.event.KeyAdapter() {
661 public void keyPressed(java.awt.event.KeyEvent evt) {
662 hashSetTableKeyPressed(evt);
665 jScrollPane1.setViewportView(hashSetTable);
667 createDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/new16.png")));
668 org.openide.awt.Mnemonics.setLocalizedText(createDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.createDatabaseButton.text"));
669 createDatabaseButton.setToolTipText(
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.createDatabaseButton.toolTipText"));
670 createDatabaseButton.setMaximumSize(
new java.awt.Dimension(140, 25));
671 createDatabaseButton.setMinimumSize(
new java.awt.Dimension(140, 25));
672 createDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
673 public void actionPerformed(java.awt.event.ActionEvent evt) {
674 createDatabaseButtonActionPerformed(evt);
678 importDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/import16.png")));
679 org.openide.awt.Mnemonics.setLocalizedText(importDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.importDatabaseButton.text"));
680 importDatabaseButton.setToolTipText(
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.importDatabaseButton.toolTipText"));
681 importDatabaseButton.setMaximumSize(
new java.awt.Dimension(140, 25));
682 importDatabaseButton.setMinimumSize(
new java.awt.Dimension(140, 25));
683 importDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
684 public void actionPerformed(java.awt.event.ActionEvent evt) {
685 importDatabaseButtonActionPerformed(evt);
689 deleteDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png")));
690 org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.deleteDatabaseButton.text"));
691 deleteDatabaseButton.setMaximumSize(
new java.awt.Dimension(140, 25));
692 deleteDatabaseButton.setMinimumSize(
new java.awt.Dimension(140, 25));
693 deleteDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
694 public void actionPerformed(java.awt.event.ActionEvent evt) {
695 deleteDatabaseButtonActionPerformed(evt);
699 org.openide.awt.Mnemonics.setLocalizedText(informationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.informationLabel.text"));
701 informationScrollPanel.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
703 org.openide.awt.Mnemonics.setLocalizedText(nameLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.nameLabel.text"));
705 org.openide.awt.Mnemonics.setLocalizedText(hashDbNameLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbNameLabel.text"));
707 org.openide.awt.Mnemonics.setLocalizedText(typeLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.typeLabel.text"));
709 org.openide.awt.Mnemonics.setLocalizedText(hashDbTypeLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbTypeLabel.text"));
711 org.openide.awt.Mnemonics.setLocalizedText(locationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.locationLabel.text"));
713 org.openide.awt.Mnemonics.setLocalizedText(hashDbLocationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbLocationLabel.text"));
715 org.openide.awt.Mnemonics.setLocalizedText(versionLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.versionLabel.text_1"));
717 org.openide.awt.Mnemonics.setLocalizedText(hashDbVersionLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbVersionLabel.text_1"));
719 org.openide.awt.Mnemonics.setLocalizedText(orgLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.orgLabel.text_1"));
721 org.openide.awt.Mnemonics.setLocalizedText(hashDbOrgLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbOrgLabel.text_1"));
723 org.openide.awt.Mnemonics.setLocalizedText(readOnlyLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.readOnlyLabel.text_1"));
725 org.openide.awt.Mnemonics.setLocalizedText(hashDbReadOnlyLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1"));
727 org.openide.awt.Mnemonics.setLocalizedText(indexPathLabelLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexPathLabelLabel.text"));
729 org.openide.awt.Mnemonics.setLocalizedText(indexPathLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexPathLabel.text"));
731 org.openide.awt.Mnemonics.setLocalizedText(indexLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexLabel.text"));
733 org.openide.awt.Mnemonics.setLocalizedText(hashDbIndexStatusLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbIndexStatusLabel.text"));
735 javax.swing.GroupLayout informationPanelLayout =
new javax.swing.GroupLayout(informationPanel);
736 informationPanel.setLayout(informationPanelLayout);
737 informationPanelLayout.setHorizontalGroup(
738 informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
739 .addGroup(informationPanelLayout.createSequentialGroup()
741 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
742 .addGroup(informationPanelLayout.createSequentialGroup()
743 .addComponent(locationLabel)
745 .addComponent(hashDbLocationLabel))
746 .addGroup(informationPanelLayout.createSequentialGroup()
747 .addComponent(nameLabel)
749 .addComponent(hashDbNameLabel))
750 .addGroup(informationPanelLayout.createSequentialGroup()
751 .addComponent(typeLabel)
753 .addComponent(hashDbTypeLabel))
754 .addGroup(informationPanelLayout.createSequentialGroup()
755 .addComponent(versionLabel)
757 .addComponent(hashDbVersionLabel))
758 .addGroup(informationPanelLayout.createSequentialGroup()
759 .addComponent(orgLabel)
761 .addComponent(hashDbOrgLabel))
762 .addGroup(informationPanelLayout.createSequentialGroup()
763 .addComponent(readOnlyLabel)
765 .addComponent(hashDbReadOnlyLabel))
766 .addGroup(informationPanelLayout.createSequentialGroup()
767 .addComponent(indexLabel)
769 .addComponent(hashDbIndexStatusLabel))
770 .addGroup(informationPanelLayout.createSequentialGroup()
771 .addComponent(indexPathLabelLabel)
773 .addComponent(indexPathLabel)))
774 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
777 informationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel});
779 informationPanelLayout.setVerticalGroup(
780 informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
781 .addGroup(informationPanelLayout.createSequentialGroup()
782 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
783 .addComponent(nameLabel)
784 .addComponent(hashDbNameLabel))
785 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
786 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
787 .addComponent(typeLabel)
788 .addComponent(hashDbTypeLabel))
789 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
790 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
791 .addComponent(locationLabel)
792 .addComponent(hashDbLocationLabel))
793 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
794 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
795 .addComponent(versionLabel)
796 .addComponent(hashDbVersionLabel))
797 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
798 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
799 .addComponent(orgLabel)
800 .addComponent(hashDbOrgLabel))
801 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
802 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
803 .addComponent(readOnlyLabel)
804 .addComponent(hashDbReadOnlyLabel))
805 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
806 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
807 .addComponent(indexPathLabelLabel)
808 .addComponent(indexPathLabel))
809 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
810 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
811 .addComponent(indexLabel)
812 .addComponent(hashDbIndexStatusLabel))
813 .addGap(0, 49, Short.MAX_VALUE))
816 informationScrollPanel.setViewportView(informationPanel);
818 org.openide.awt.Mnemonics.setLocalizedText(indexButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexButton.text"));
819 indexButton.setEnabled(
false);
820 indexButton.addActionListener(
new java.awt.event.ActionListener() {
821 public void actionPerformed(java.awt.event.ActionEvent evt) {
822 indexButtonActionPerformed(evt);
826 org.openide.awt.Mnemonics.setLocalizedText(addHashesToDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.addHashesToDatabaseButton.text"));
827 addHashesToDatabaseButton.setEnabled(
false);
828 addHashesToDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
829 public void actionPerformed(java.awt.event.ActionEvent evt) {
830 addHashesToDatabaseButtonActionPerformed(evt);
834 org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckBox,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.sendIngestMessagesCheckBox.text"));
835 sendIngestMessagesCheckBox.addActionListener(
new java.awt.event.ActionListener() {
836 public void actionPerformed(java.awt.event.ActionEvent evt) {
837 sendIngestMessagesCheckBoxActionPerformed(evt);
841 ingestWarningLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png")));
842 org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.ingestWarningLabel.text"));
844 javax.swing.GroupLayout jPanel1Layout =
new javax.swing.GroupLayout(jPanel1);
845 jPanel1.setLayout(jPanel1Layout);
846 jPanel1Layout.setHorizontalGroup(
847 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
848 .addGroup(jPanel1Layout.createSequentialGroup()
850 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
851 .addGroup(jPanel1Layout.createSequentialGroup()
853 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
854 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
855 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
856 .addComponent(informationScrollPanel)
857 .addGroup(jPanel1Layout.createSequentialGroup()
858 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
859 .addGroup(jPanel1Layout.createSequentialGroup()
860 .addComponent(indexButton)
861 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
862 .addComponent(addHashesToDatabaseButton))
863 .addComponent(sendIngestMessagesCheckBox)
864 .addComponent(ingestWarningLabel)
865 .addComponent(informationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE))
866 .addGap(0, 0, Short.MAX_VALUE)))
868 .addGroup(jPanel1Layout.createSequentialGroup()
869 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
870 .addComponent(hashDatabasesLabel)
871 .addGroup(jPanel1Layout.createSequentialGroup()
872 .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
873 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
874 .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
875 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
876 .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
877 .addGap(0, 0, Short.MAX_VALUE))))
879 jPanel1Layout.setVerticalGroup(
880 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
881 .addGroup(jPanel1Layout.createSequentialGroup()
883 .addComponent(hashDatabasesLabel)
885 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
886 .addGroup(jPanel1Layout.createSequentialGroup()
887 .addComponent(informationLabel)
888 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
889 .addComponent(informationScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
890 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
891 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
892 .addComponent(indexButton)
893 .addComponent(addHashesToDatabaseButton))
895 .addComponent(sendIngestMessagesCheckBox)
897 .addComponent(ingestWarningLabel)
898 .addGap(0, 0, Short.MAX_VALUE))
899 .addComponent(jScrollPane1))
900 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
901 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
902 .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
903 .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
904 .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
908 jScrollPane2.setViewportView(jPanel1);
910 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
911 this.setLayout(layout);
912 layout.setHorizontalGroup(
913 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
914 .addComponent(jScrollPane2)
916 layout.setVerticalGroup(
917 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
918 .addComponent(jScrollPane2)
929 HashDb hashDb =
new HashDbCreateDatabaseDialog().getHashDatabase();
930 if (null != hashDb) {
931 if (hashDb instanceof CentralRepoHashSet) {
932 int newDbIndex = ((CentralRepoHashSet) hashDb).getReferenceSetID();
933 newReferenceSetIDs.add(newDbIndex);
936 hashSetTableModel.refreshModel();
937 ((
HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
938 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
944 if (hashDb != null) {
945 hashDb.setSendIngestMessages(sendIngestMessagesCheckBox.isSelected());
946 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
959 @NbBundle.Messages({
"HashLookupSettingsPanel.indexNsrl.text=This hash set appears to be the NSRL, it will be removed from the list.\n",
960 "HashLookupSettingsPanel.indexNsrl.title=NSRL will not be indexed"})
963 assert hashDatabase != null;
964 assert hashDatabase instanceof SleuthkitHashSet;
968 SleuthkitHashSet hashDb = (SleuthkitHashSet) hashDatabase;
969 if (isWindows() && hashDb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
970 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_indexNsrl_text() + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL), Bundle.HashLookupSettingsPanel_indexNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
973 hashSetTableModel.refreshModel();
974 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
976 logger.log(Level.WARNING,
"Unable to remove unindexed NSRL from hash set list", ex);
979 hashDb.addPropertyChangeListener(
new PropertyChangeListener() {
981 public void propertyChange(PropertyChangeEvent evt) {
982 if (evt.getPropertyName().equals(SleuthkitHashSet.Event.INDEXING_DONE.toString())) {
984 if (selectedHashDb != null && hashDb != null && hashDb.equals(selectedHashDb)) {
987 hashSetTableModel.refreshDisplay();
997 ModalNoButtons indexDialog =
new ModalNoButtons(
this,
new Frame(), hashDb);
998 indexDialog.setLocationRelativeTo(null);
999 indexDialog.setVisible(
true);
1000 indexDialog.setModal(
true);
1005 HashDb hashDb =
new HashDbImportDatabaseDialog().getHashDatabase();
1006 if (null != hashDb) {
1007 if (hashDb instanceof CentralRepoHashSet) {
1008 int newReferenceSetID = ((CentralRepoHashSet) hashDb).getReferenceSetID();
1009 newReferenceSetIDs.add(newReferenceSetID);
1012 hashSetTableModel.refreshModel();
1013 ((
HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
1014 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1019 "HashLookupSettingsPanel.promptTitle.deleteHashDb=Delete Hash Database from Configuration",
1020 "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."
1023 if (JOptionPane.showConfirmDialog(
this,
1024 Bundle.HashLookupSettingsPanel_promptMessage_deleteHashDb(),
1025 Bundle.HashLookupSettingsPanel_promptTitle_deleteHashDb(),
1026 JOptionPane.YES_NO_OPTION,
1027 JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
1029 if (hashDb != null) {
1033 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.
getHashSetName()));
1035 hashSetTableModel.refreshModel();
1036 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1042 if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
1044 if (hashDb != null) {
1048 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.
getHashSetName()));
1050 hashSetTableModel.refreshModel();
1051 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
abstract boolean getSendIngestMessages()
void importDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JLabel indexLabel
static synchronized IngestManager getInstance()
javax.swing.JPanel informationPanel
boolean isCellEditable(int rowIndex, int columnIndex)
javax.swing.JLabel hashDbIndexStatusLabel
void setValueAt(Object aValue, int rowIndex, int columnIndex)
javax.swing.JLabel hashDbVersionLabel
synchronized void addPropertyChangeListener(PropertyChangeListener listener)
javax.swing.JLabel hashDatabasesLabel
javax.swing.JLabel ingestWarningLabel
javax.swing.JLabel typeLabel
javax.swing.JLabel indexPathLabel
void updateComponentsForSelection(HashDb db)
javax.swing.JButton createDatabaseButton
void createDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt)
abstract String getHashSetName()
javax.swing.JLabel hashDbOrgLabel
boolean isIngestRunning()
HashLookupSettingsPanel()
javax.swing.JScrollPane jScrollPane1
void updateComponentsForNoSelection()
javax.swing.JLabel readOnlyLabel
javax.swing.JLabel hashDbLocationLabel
javax.swing.JLabel nameLabel
javax.swing.JLabel locationLabel
javax.swing.JButton indexButton
void deleteReferenceSet(int referenceSetID)
void selectRowByDatabase(HashDb db)
javax.swing.JLabel informationLabel
void sendIngestMessagesCheckBoxActionPerformed(java.awt.event.ActionEvent evt)
Component prepareRenderer(TableCellRenderer renderer, int row, int column)
void indexButtonActionPerformed(java.awt.event.ActionEvent evt)
void customizeComponents()
void showInvalidIndex(List< SleuthkitHashSet > unindexed)
void addIngestJobEventListener(final PropertyChangeListener listener)
synchronized void removeHashDatabaseNoSave(HashDb hashDb)
javax.swing.JScrollPane jScrollPane2
static synchronized HashDbManager getInstance()
boolean isLocalIngestJobEvent(PropertyChangeEvent evt)
abstract HashDb.KnownFilesType getKnownFilesType()
javax.swing.JLabel indexPathLabelLabel
void hashSetTableKeyPressed(java.awt.event.KeyEvent evt)
void selectRowByName(String name)
javax.swing.JLabel versionLabel
javax.swing.JTable hashSetTable
javax.swing.JLabel hashDbNameLabel
String getColumnName(int column)
javax.swing.JButton addHashesToDatabaseButton
synchronized List< HashDb > getAllHashSets()
javax.swing.JButton deleteDatabaseButton
Object getValueAt(int rowIndex, int columnIndex)
abstract boolean isUpdateable()
javax.swing.JScrollPane informationScrollPanel
abstract String getDatabasePath()
Class<?> getColumnClass(int c)
void setSelection(int index)
boolean isValid(int rowIndex)
synchronized void loadLastSavedConfiguration()
synchronized static Logger getLogger(String name)
javax.swing.JLabel hashDbTypeLabel
void deleteDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt)
javax.swing.JLabel hashDbReadOnlyLabel
javax.swing.JButton importDatabaseButton
static CentralRepository getInstance()
javax.swing.JPanel jPanel1
javax.swing.JLabel orgLabel
javax.swing.JCheckBox sendIngestMessagesCheckBox
static boolean isEnabled()
void addHashesToDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt)