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;
62 @SuppressWarnings(
"PMD.SingularField")
65 private static final String NSRL_URL =
"https://sourceforge.net/projects/autopsy/files/NSRL/";
66 private static final String NSRL_NAME_STRING =
"nsrl";
67 private static final String NO_SELECTION_TEXT = NbBundle
69 private static final String ERROR_GETTING_PATH_TEXT = NbBundle
71 private static final String ERROR_GETTING_INDEX_STATUS_TEXT = NbBundle
76 private final List<Integer> newReferenceSetIDs =
new ArrayList<>();
80 customizeComponents();
81 updateComponentsForNoSelection();
87 public void propertyChange(PropertyChangeEvent evt) {
88 if (isLocalIngestJobEvent(evt)) {
89 EventQueue.invokeLater(
new Runnable() {
101 public void propertyChange(PropertyChangeEvent evt) {
102 String propName = evt.getPropertyName();
105 hashSetTableModel.refreshModel();
111 @NbBundle.Messages({
"HashLookupSettingsPanel.Title=Global Hash Lookup Settings"})
113 setName(Bundle.HashLookupSettingsPanel_Title());
114 this.ingestWarningLabel.setVisible(
false);
115 this.hashSetTable.setModel(hashSetTableModel);
116 this.hashSetTable.setTableHeader(null);
117 hashSetTable.getParent().setBackground(hashSetTable.getBackground());
118 hashSetTable.getSelectionModel().setSelectionMode(ListSelectionModel.SINGLE_SELECTION);
119 hashSetTable.getSelectionModel().addListSelectionListener(
new ListSelectionListener() {
121 public void valueChanged(ListSelectionEvent e) {
122 if (!e.getValueIsAdjusting()) {
132 updateComponentsForSelection(db);
134 updateComponentsForNoSelection();
142 hashDbNameLabel.setText(NO_SELECTION_TEXT);
143 hashDbTypeLabel.setText(NO_SELECTION_TEXT);
144 hashDbLocationLabel.setText(NO_SELECTION_TEXT);
145 hashDbVersionLabel.setText(NO_SELECTION_TEXT);
146 hashDbOrgLabel.setText(NO_SELECTION_TEXT);
147 hashDbReadOnlyLabel.setText(NO_SELECTION_TEXT);
148 indexPathLabel.setText(NO_SELECTION_TEXT);
151 hashDbIndexStatusLabel.setText(NO_SELECTION_TEXT);
152 hashDbIndexStatusLabel.setForeground(Color.black);
153 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
154 indexButton.setEnabled(
false);
155 addHashesToDatabaseButton.setEnabled(
false);
158 sendIngestMessagesCheckBox.setSelected(
false);
159 sendIngestMessagesCheckBox.setEnabled(
false);
162 createDatabaseButton.setEnabled(
true);
163 importDatabaseButton.setEnabled(
true);
164 deleteDatabaseButton.setEnabled(
false);
167 ingestWarningLabel.setVisible(ingestIsRunning);
170 @NbBundle.Messages({
"HashLookupSettingsPanel.readOnly=Read only",
171 "HashLookupSettingsPanel.editable=Editable",
172 "HashLookupSettingsPanel.updateStatusError=Error reading status",
173 "HashLookupSettingsPanel.notApplicable=N/A",
174 "HashLookupSettingsPanel.centralRepo=Central Repository"
184 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_editable());
186 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_readOnly());
188 }
catch (TskCoreException ex) {
189 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_updateStatusError());
193 addHashesToDatabaseButton.setEnabled(!ingestIsRunning && db.
isUpdateable());
194 }
catch (TskCoreException ex) {
196 addHashesToDatabaseButton.setEnabled(
false);
199 if (db instanceof SleuthkitHashSet) {
200 SleuthkitHashSet hashDb = (SleuthkitHashSet) db;
203 hashDbVersionLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
204 hashDbOrgLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
207 deleteDatabaseButton.setEnabled(!ingestIsRunning);
211 }
catch (TskCoreException ex) {
213 hashDbLocationLabel.setText(ERROR_GETTING_PATH_TEXT);
217 indexPathLabel.setText(hashDb.getIndexPath());
218 }
catch (TskCoreException ex) {
220 indexPathLabel.setText(ERROR_GETTING_PATH_TEXT);
225 if (hashDb.isIndexing()) {
227 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.indexing"));
228 hashDbIndexStatusLabel.setText(
229 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.indexGen"));
230 hashDbIndexStatusLabel.setForeground(Color.black);
231 indexButton.setEnabled(
false);
232 }
else if (hashDb.hasIndex()) {
233 if (hashDb.hasIndexOnly()) {
234 hashDbIndexStatusLabel.setText(
235 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.indexOnly"));
237 hashDbIndexStatusLabel.setText(
238 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.indexed"));
240 hashDbIndexStatusLabel.setForeground(Color.black);
241 if (hashDb.canBeReIndexed()) {
243 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.reIndex"));
244 indexButton.setEnabled(
true);
246 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
247 indexButton.setEnabled(
false);
250 hashDbIndexStatusLabel.setText(
251 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.noIndex"));
252 hashDbIndexStatusLabel.setForeground(Color.red);
253 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
254 indexButton.setEnabled(
true);
256 }
catch (TskCoreException ex) {
258 hashDbIndexStatusLabel.setText(ERROR_GETTING_INDEX_STATUS_TEXT);
259 hashDbIndexStatusLabel.setForeground(Color.red);
260 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
261 indexButton.setEnabled(
false);
266 indexPathLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
267 hashDbIndexStatusLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
268 hashDbLocationLabel.setText(Bundle.HashLookupSettingsPanel_centralRepo());
269 indexButton.setEnabled(
false);
270 deleteDatabaseButton.setEnabled(
false);
272 CentralRepoHashSet crDb = (CentralRepoHashSet) db;
274 hashDbVersionLabel.setText(crDb.getVersion());
275 hashDbOrgLabel.setText(crDb.getOrgName());
279 if (ingestIsRunning) {
280 indexButton.setEnabled(
false);
288 createDatabaseButton.setEnabled(
true);
289 importDatabaseButton.setEnabled(
true);
292 ingestWarningLabel.setVisible(ingestIsRunning);
297 AutopsyEvent
event = (AutopsyEvent) evt;
298 if (event.getSourceType() == AutopsyEvent.SourceType.LOCAL) {
299 String eventType =
event.getPropertyName();
309 @Messages({
"HashLookupSettingsPanel.saveFail.message=Couldn't save hash set settings.",
310 "HashLookupSettingsPanel.saveFail.title=Save Fail"})
314 newReferenceSetIDs.clear();
317 List<SleuthkitHashSet> unindexed =
new ArrayList<>();
319 if (db instanceof SleuthkitHashSet) {
321 SleuthkitHashSet hashDatabase = (SleuthkitHashSet) db;
322 if (!hashDatabase.hasIndex()) {
323 unindexed.add(hashDatabase);
325 }
catch (TskCoreException ex) {
333 if (!unindexed.isEmpty()) {
334 SwingUtilities.invokeLater(
new Runnable() {
338 if (!unindexed.isEmpty()) {
339 showInvalidIndex(unindexed);
345 hashSetManager.save();
347 SwingUtilities.invokeLater(() -> {
348 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
356 hashSetTable.clearSelection();
357 hashSetTableModel.refreshModel();
373 for (
int refID : newReferenceSetIDs) {
390 @Messages({
"# {0} - hash lookup name",
"HashLookupSettingsPanel.removeDatabaseFailure.message=Failed to remove hash lookup: {0}"})
391 void removeThese(List<SleuthkitHashSet> toRemove) {
392 for (SleuthkitHashSet hashDb : toRemove) {
395 }
catch (HashDbManager.HashDbManagerException ex) {
396 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
399 hashSetTableModel.refreshModel();
409 @NbBundle.Messages({
"# {0} - nsrlUrlAddress",
410 "HashLookupSettingsPanel.removeUnindexedNsrl.text=Instead of indexing the NSRL, please download an already indexed version available here:\n{0}",
411 "# {0} - nsrlHashSet",
412 "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",
413 "# {0} - nsrlHashSets",
414 "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",
415 "HashLookupSettingsPanel.removeUnindexedNsrl.title=Unindexed NSRL(s) will be removed"})
418 String nsrlTotal =
"";
420 List<SleuthkitHashSet> nsrlHashsets =
new ArrayList<>();
421 for (SleuthkitHashSet hdb : unindexed) {
423 if (isWindows() && hdb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
424 nsrlHashsets.add(hdb);
425 nsrlTotal +=
"\n" + hdb.getHashSetName();
427 total +=
"\n" + hdb.getHashSetName();
430 if (!nsrlHashsets.isEmpty()) {
432 if (nsrlHashsets.size() > 1) {
433 message = Bundle.HashLookupSettingsPanel_unindexedNsrls_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
435 message = Bundle.HashLookupSettingsPanel_unindexedNsrl_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
437 JOptionPane.showMessageDialog(
this, message, Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
438 for (SleuthkitHashSet hdb : nsrlHashsets) {
439 unindexed.remove(hdb);
441 removeThese(nsrlHashsets);
443 String message = NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.dbNotIndexedMsg", total);
444 if (unindexed.isEmpty()) {
446 }
else if (unindexed.size() > 1) {
447 message = NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.dbsNotIndexedMsg", total);
449 int res = JOptionPane.showConfirmDialog(
this, message,
450 NbBundle.getMessage(
this.getClass(),
451 "HashDbConfigPanel.unindexedDbsMsg"),
452 JOptionPane.YES_NO_OPTION);
453 if (res == JOptionPane.YES_OPTION) {
454 ModalNoButtons indexingDialog =
new ModalNoButtons(
this,
new Frame(), unindexed);
455 indexingDialog.setLocationRelativeTo(null);
456 indexingDialog.setVisible(
true);
457 indexingDialog.setModal(
true);
458 hashSetTableModel.refreshModel();
460 if (res == JOptionPane.NO_OPTION) {
461 JOptionPane.showMessageDialog(
this, NbBundle.getMessage(
this.getClass(),
462 "HashDbConfigPanel.allUnindexedDbsRmFromListMsg"));
463 removeThese(unindexed);
466 hashSetManager.save();
468 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
484 JComponent cellRenderer = (JComponent) super.prepareRenderer(renderer, row, column);
485 cellRenderer.setToolTipText((String) getValueAt(row, column));
490 if (hashSetTableModel.
isValid(row)) {
491 cellRenderer.setForeground(Color.black);
493 cellRenderer.setForeground(Color.red);
500 return hashSetTableModel.getHashSetAt(getSelectionModel().getMinSelectionIndex());
504 if (index >= 0 && index < hashSetTable.getRowCount()) {
505 getSelectionModel().setSelectionInterval(index, index);
510 setSelection(hashSetTableModel.getIndexByDatabase(db));
515 setSelection(hashSetTableModel.getIndexByName(name));
534 return hashSets.size();
539 return NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.nameColLbl");
544 return hashSets.get(rowIndex).getDisplayName();
549 return hashSets.get(rowIndex).isValid();
550 }
catch (TskCoreException ex) {
562 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
563 throw new UnsupportedOperationException(
564 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.editingCellsNotSupportedMsg"));
569 return getValueAt(0, c).getClass();
572 HashDb getHashSetAt(
int index) {
573 if (!hashSets.isEmpty() && index >= 0 && index < hashSets.size()) {
574 return hashSets.get(index);
580 int getIndexByDatabase(HashDb db) {
581 for (
int i = 0; i < hashSets.size(); ++i) {
582 if (hashSets.get(i).equals(db)) {
590 int getIndexByName(String name) {
591 for (
int i = 0; i < hashSets.size(); ++i) {
592 if (hashSets.get(i).getHashSetName().equals(name)) {
599 void refreshModel() {
600 hashSets = HashDbManager.getInstance().getAllHashSets();
604 void refreshDisplay() {
605 fireTableDataChanged();
617 jScrollPane2 =
new javax.swing.JScrollPane();
618 jPanel1 =
new javax.swing.JPanel();
619 hashDatabasesLabel =
new javax.swing.JLabel();
620 jScrollPane1 =
new javax.swing.JScrollPane();
622 createDatabaseButton =
new javax.swing.JButton();
623 importDatabaseButton =
new javax.swing.JButton();
624 deleteDatabaseButton =
new javax.swing.JButton();
625 informationLabel =
new javax.swing.JLabel();
626 informationScrollPanel =
new javax.swing.JScrollPane();
627 informationPanel =
new javax.swing.JPanel();
628 nameLabel =
new javax.swing.JLabel();
629 hashDbNameLabel =
new javax.swing.JLabel();
630 typeLabel =
new javax.swing.JLabel();
631 hashDbTypeLabel =
new javax.swing.JLabel();
632 locationLabel =
new javax.swing.JLabel();
633 hashDbLocationLabel =
new javax.swing.JLabel();
634 versionLabel =
new javax.swing.JLabel();
635 hashDbVersionLabel =
new javax.swing.JLabel();
636 orgLabel =
new javax.swing.JLabel();
637 hashDbOrgLabel =
new javax.swing.JLabel();
638 readOnlyLabel =
new javax.swing.JLabel();
639 hashDbReadOnlyLabel =
new javax.swing.JLabel();
640 indexPathLabelLabel =
new javax.swing.JLabel();
641 indexPathLabel =
new javax.swing.JLabel();
642 indexLabel =
new javax.swing.JLabel();
643 hashDbIndexStatusLabel =
new javax.swing.JLabel();
644 indexButton =
new javax.swing.JButton();
645 addHashesToDatabaseButton =
new javax.swing.JButton();
646 sendIngestMessagesCheckBox =
new javax.swing.JCheckBox();
647 ingestWarningLabel =
new javax.swing.JLabel();
649 org.openide.awt.Mnemonics.setLocalizedText(hashDatabasesLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDatabasesLabel.text"));
651 hashSetTable.setModel(
new javax.swing.table.DefaultTableModel(
659 hashSetTable.setShowHorizontalLines(
false);
660 hashSetTable.setShowVerticalLines(
false);
661 hashSetTable.addKeyListener(
new java.awt.event.KeyAdapter() {
662 public void keyPressed(java.awt.event.KeyEvent evt) {
663 hashSetTableKeyPressed(evt);
666 jScrollPane1.setViewportView(hashSetTable);
668 createDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/new16.png")));
669 org.openide.awt.Mnemonics.setLocalizedText(createDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.createDatabaseButton.text"));
670 createDatabaseButton.setToolTipText(
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.createDatabaseButton.toolTipText"));
671 createDatabaseButton.setMaximumSize(
new java.awt.Dimension(140, 25));
672 createDatabaseButton.setMinimumSize(
new java.awt.Dimension(140, 25));
673 createDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
674 public void actionPerformed(java.awt.event.ActionEvent evt) {
675 createDatabaseButtonActionPerformed(evt);
679 importDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/import16.png")));
680 org.openide.awt.Mnemonics.setLocalizedText(importDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.importDatabaseButton.text"));
681 importDatabaseButton.setToolTipText(
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.importDatabaseButton.toolTipText"));
682 importDatabaseButton.setMaximumSize(
new java.awt.Dimension(140, 25));
683 importDatabaseButton.setMinimumSize(
new java.awt.Dimension(140, 25));
684 importDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
685 public void actionPerformed(java.awt.event.ActionEvent evt) {
686 importDatabaseButtonActionPerformed(evt);
690 deleteDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png")));
691 org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.deleteDatabaseButton.text"));
692 deleteDatabaseButton.setMaximumSize(
new java.awt.Dimension(140, 25));
693 deleteDatabaseButton.setMinimumSize(
new java.awt.Dimension(140, 25));
694 deleteDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
695 public void actionPerformed(java.awt.event.ActionEvent evt) {
696 deleteDatabaseButtonActionPerformed(evt);
700 org.openide.awt.Mnemonics.setLocalizedText(informationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.informationLabel.text"));
702 informationScrollPanel.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
704 org.openide.awt.Mnemonics.setLocalizedText(nameLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.nameLabel.text"));
706 org.openide.awt.Mnemonics.setLocalizedText(hashDbNameLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbNameLabel.text"));
708 org.openide.awt.Mnemonics.setLocalizedText(typeLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.typeLabel.text"));
710 org.openide.awt.Mnemonics.setLocalizedText(hashDbTypeLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbTypeLabel.text"));
712 org.openide.awt.Mnemonics.setLocalizedText(locationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.locationLabel.text"));
714 org.openide.awt.Mnemonics.setLocalizedText(hashDbLocationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbLocationLabel.text"));
716 org.openide.awt.Mnemonics.setLocalizedText(versionLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.versionLabel.text_1"));
718 org.openide.awt.Mnemonics.setLocalizedText(hashDbVersionLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbVersionLabel.text_1"));
720 org.openide.awt.Mnemonics.setLocalizedText(orgLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.orgLabel.text_1"));
722 org.openide.awt.Mnemonics.setLocalizedText(hashDbOrgLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbOrgLabel.text_1"));
724 org.openide.awt.Mnemonics.setLocalizedText(readOnlyLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.readOnlyLabel.text_1"));
726 org.openide.awt.Mnemonics.setLocalizedText(hashDbReadOnlyLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1"));
728 org.openide.awt.Mnemonics.setLocalizedText(indexPathLabelLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexPathLabelLabel.text"));
730 org.openide.awt.Mnemonics.setLocalizedText(indexPathLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexPathLabel.text"));
732 org.openide.awt.Mnemonics.setLocalizedText(indexLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexLabel.text"));
734 org.openide.awt.Mnemonics.setLocalizedText(hashDbIndexStatusLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbIndexStatusLabel.text"));
736 javax.swing.GroupLayout informationPanelLayout =
new javax.swing.GroupLayout(informationPanel);
737 informationPanel.setLayout(informationPanelLayout);
738 informationPanelLayout.setHorizontalGroup(
739 informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
740 .addGroup(informationPanelLayout.createSequentialGroup()
742 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
743 .addGroup(informationPanelLayout.createSequentialGroup()
744 .addComponent(locationLabel)
746 .addComponent(hashDbLocationLabel))
747 .addGroup(informationPanelLayout.createSequentialGroup()
748 .addComponent(nameLabel)
750 .addComponent(hashDbNameLabel))
751 .addGroup(informationPanelLayout.createSequentialGroup()
752 .addComponent(typeLabel)
754 .addComponent(hashDbTypeLabel))
755 .addGroup(informationPanelLayout.createSequentialGroup()
756 .addComponent(versionLabel)
758 .addComponent(hashDbVersionLabel))
759 .addGroup(informationPanelLayout.createSequentialGroup()
760 .addComponent(orgLabel)
762 .addComponent(hashDbOrgLabel))
763 .addGroup(informationPanelLayout.createSequentialGroup()
764 .addComponent(readOnlyLabel)
766 .addComponent(hashDbReadOnlyLabel))
767 .addGroup(informationPanelLayout.createSequentialGroup()
768 .addComponent(indexLabel)
770 .addComponent(hashDbIndexStatusLabel))
771 .addGroup(informationPanelLayout.createSequentialGroup()
772 .addComponent(indexPathLabelLabel)
774 .addComponent(indexPathLabel)))
775 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
778 informationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel});
780 informationPanelLayout.setVerticalGroup(
781 informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
782 .addGroup(informationPanelLayout.createSequentialGroup()
783 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
784 .addComponent(nameLabel)
785 .addComponent(hashDbNameLabel))
786 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
787 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
788 .addComponent(typeLabel)
789 .addComponent(hashDbTypeLabel))
790 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
791 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
792 .addComponent(locationLabel)
793 .addComponent(hashDbLocationLabel))
794 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
795 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
796 .addComponent(versionLabel)
797 .addComponent(hashDbVersionLabel))
798 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
799 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
800 .addComponent(orgLabel)
801 .addComponent(hashDbOrgLabel))
802 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
803 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
804 .addComponent(readOnlyLabel)
805 .addComponent(hashDbReadOnlyLabel))
806 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
807 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
808 .addComponent(indexPathLabelLabel)
809 .addComponent(indexPathLabel))
810 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
811 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
812 .addComponent(indexLabel)
813 .addComponent(hashDbIndexStatusLabel))
814 .addGap(0, 49, Short.MAX_VALUE))
817 informationScrollPanel.setViewportView(informationPanel);
819 org.openide.awt.Mnemonics.setLocalizedText(indexButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexButton.text"));
820 indexButton.setEnabled(
false);
821 indexButton.addActionListener(
new java.awt.event.ActionListener() {
822 public void actionPerformed(java.awt.event.ActionEvent evt) {
823 indexButtonActionPerformed(evt);
827 org.openide.awt.Mnemonics.setLocalizedText(addHashesToDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.addHashesToDatabaseButton.text"));
828 addHashesToDatabaseButton.setEnabled(
false);
829 addHashesToDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
830 public void actionPerformed(java.awt.event.ActionEvent evt) {
831 addHashesToDatabaseButtonActionPerformed(evt);
835 org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckBox,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.sendIngestMessagesCheckBox.text"));
836 sendIngestMessagesCheckBox.addActionListener(
new java.awt.event.ActionListener() {
837 public void actionPerformed(java.awt.event.ActionEvent evt) {
838 sendIngestMessagesCheckBoxActionPerformed(evt);
842 ingestWarningLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png")));
843 org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.ingestWarningLabel.text"));
845 javax.swing.GroupLayout jPanel1Layout =
new javax.swing.GroupLayout(jPanel1);
846 jPanel1.setLayout(jPanel1Layout);
847 jPanel1Layout.setHorizontalGroup(
848 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
849 .addGroup(jPanel1Layout.createSequentialGroup()
851 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
852 .addGroup(jPanel1Layout.createSequentialGroup()
854 .addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
855 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
856 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
857 .addComponent(informationScrollPanel)
858 .addGroup(jPanel1Layout.createSequentialGroup()
859 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
860 .addGroup(jPanel1Layout.createSequentialGroup()
861 .addComponent(indexButton)
862 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
863 .addComponent(addHashesToDatabaseButton))
864 .addComponent(sendIngestMessagesCheckBox)
865 .addComponent(ingestWarningLabel)
866 .addComponent(informationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 197, javax.swing.GroupLayout.PREFERRED_SIZE))
867 .addGap(0, 0, Short.MAX_VALUE)))
869 .addGroup(jPanel1Layout.createSequentialGroup()
870 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
871 .addComponent(hashDatabasesLabel)
872 .addGroup(jPanel1Layout.createSequentialGroup()
873 .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
874 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
875 .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
876 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
877 .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
878 .addGap(0, 0, Short.MAX_VALUE))))
880 jPanel1Layout.setVerticalGroup(
881 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
882 .addGroup(jPanel1Layout.createSequentialGroup()
884 .addComponent(hashDatabasesLabel)
886 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
887 .addGroup(jPanel1Layout.createSequentialGroup()
888 .addComponent(informationLabel)
889 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
890 .addComponent(informationScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
891 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
892 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
893 .addComponent(indexButton)
894 .addComponent(addHashesToDatabaseButton))
896 .addComponent(sendIngestMessagesCheckBox)
898 .addComponent(ingestWarningLabel)
899 .addGap(0, 0, Short.MAX_VALUE))
900 .addComponent(jScrollPane1))
901 .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
902 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
903 .addComponent(createDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
904 .addComponent(importDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
905 .addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
909 jScrollPane2.setViewportView(jPanel1);
911 javax.swing.GroupLayout layout =
new javax.swing.GroupLayout(
this);
912 this.setLayout(layout);
913 layout.setHorizontalGroup(
914 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
915 .addComponent(jScrollPane2)
917 layout.setVerticalGroup(
918 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
919 .addComponent(jScrollPane2)
930 HashDb hashDb =
new HashDbCreateDatabaseDialog().getHashDatabase();
931 if (null != hashDb) {
932 if (hashDb instanceof CentralRepoHashSet) {
933 int newDbIndex = ((CentralRepoHashSet) hashDb).getReferenceSetID();
934 newReferenceSetIDs.add(newDbIndex);
937 hashSetTableModel.refreshModel();
938 ((
HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
939 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
945 if (hashDb != null) {
946 hashDb.setSendIngestMessages(sendIngestMessagesCheckBox.isSelected());
947 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
960 @NbBundle.Messages({
"HashLookupSettingsPanel.indexNsrl.text=This hash set appears to be the NSRL, it will be removed from the list.\n",
961 "HashLookupSettingsPanel.indexNsrl.title=NSRL will not be indexed"})
964 assert hashDatabase != null;
965 assert hashDatabase instanceof SleuthkitHashSet;
969 SleuthkitHashSet hashDb = (SleuthkitHashSet) hashDatabase;
970 if (isWindows() && hashDb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
971 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_indexNsrl_text() + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL), Bundle.HashLookupSettingsPanel_indexNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
974 hashSetTableModel.refreshModel();
975 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
977 logger.log(Level.WARNING,
"Unable to remove unindexed NSRL from hash set list", ex);
980 hashDb.addPropertyChangeListener(
new PropertyChangeListener() {
982 public void propertyChange(PropertyChangeEvent evt) {
983 if (evt.getPropertyName().equals(SleuthkitHashSet.Event.INDEXING_DONE.toString())) {
985 if (selectedHashDb != null && hashDb != null && hashDb.equals(selectedHashDb)) {
988 hashSetTableModel.refreshDisplay();
998 ModalNoButtons indexDialog =
new ModalNoButtons(
this,
new Frame(), hashDb);
999 indexDialog.setLocationRelativeTo(null);
1000 indexDialog.setVisible(
true);
1001 indexDialog.setModal(
true);
1006 HashDb hashDb =
new HashDbImportDatabaseDialog().getHashDatabase();
1007 if (null != hashDb) {
1008 if (hashDb instanceof CentralRepoHashSet) {
1009 int newReferenceSetID = ((CentralRepoHashSet) hashDb).getReferenceSetID();
1010 newReferenceSetIDs.add(newReferenceSetID);
1013 hashSetTableModel.refreshModel();
1014 ((
HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
1015 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1020 "HashLookupSettingsPanel.promptTitle.deleteHashDb=Delete Hash Database from Configuration",
1021 "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."
1024 if (JOptionPane.showConfirmDialog(
this,
1025 Bundle.HashLookupSettingsPanel_promptMessage_deleteHashDb(),
1026 Bundle.HashLookupSettingsPanel_promptTitle_deleteHashDb(),
1027 JOptionPane.YES_NO_OPTION,
1028 JOptionPane.WARNING_MESSAGE) == JOptionPane.YES_OPTION) {
1030 if (hashDb != null) {
1034 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.
getHashSetName()));
1036 hashSetTableModel.refreshModel();
1037 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1043 if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
1045 if (hashDb != null) {
1049 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.
getHashSetName()));
1051 hashSetTableModel.refreshModel();
1052 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)