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;
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;
64 @SuppressWarnings(
"PMD.SingularField")
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
71 private static final String ERROR_GETTING_PATH_TEXT = NbBundle
73 private static final String ERROR_GETTING_INDEX_STATUS_TEXT = NbBundle
78 private final List<Integer> newReferenceSetIDs =
new ArrayList<>();
82 customizeComponents();
83 updateComponentsForNoSelection();
89 public void propertyChange(PropertyChangeEvent evt) {
90 if (isLocalIngestJobEvent(evt)) {
91 EventQueue.invokeLater(
new Runnable() {
103 public void propertyChange(PropertyChangeEvent evt) {
104 String propName = evt.getPropertyName();
107 hashSetTableModel.refreshModel();
113 @NbBundle.Messages({
"HashLookupSettingsPanel.Title=Global Hash Lookup Settings"})
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() {
123 public void valueChanged(ListSelectionEvent e) {
124 if (!e.getValueIsAdjusting()) {
134 updateComponentsForSelection(db);
136 updateComponentsForNoSelection();
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);
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);
160 sendIngestMessagesCheckBox.setSelected(
false);
161 sendIngestMessagesCheckBox.setEnabled(
false);
164 createDatabaseButton.setEnabled(
true);
165 importDatabaseButton.setEnabled(
true);
166 deleteDatabaseButton.setEnabled(
false);
169 ingestWarningLabel.setVisible(ingestIsRunning);
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"
186 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_editable());
188 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_readOnly());
190 }
catch (TskCoreException ex) {
191 hashDbReadOnlyLabel.setText(Bundle.HashLookupSettingsPanel_updateStatusError());
195 addHashesToDatabaseButton.setEnabled(!ingestIsRunning && db.
isUpdateable());
196 }
catch (TskCoreException ex) {
198 addHashesToDatabaseButton.setEnabled(
false);
201 if (db instanceof SleuthkitHashSet) {
202 SleuthkitHashSet hashDb = (SleuthkitHashSet) db;
203 updateForSleuthkitHashSet(ingestIsRunning, hashDb);
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);
213 CentralRepoHashSet crDb = (CentralRepoHashSet) db;
215 hashDbVersionLabel.setText(crDb.getVersion());
216 hashDbOrgLabel.setText(crDb.getOrgName());
220 if (ingestIsRunning) {
221 indexButton.setEnabled(
false);
226 sendIngestMessagesCheckBox.setEnabled(!ingestIsRunning && db.
getKnownFilesType().isInboxMessagesAllowed());
229 createDatabaseButton.setEnabled(
true);
230 importDatabaseButton.setEnabled(
true);
233 ingestWarningLabel.setVisible(ingestIsRunning);
237 if (StringUtils.isBlank(path)) {
245 return new File(path).getName();
259 hashDbVersionLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
260 hashDbOrgLabel.setText(Bundle.HashLookupSettingsPanel_notApplicable());
263 deleteDatabaseButton.setEnabled(!ingestIsRunning && !hashDb.isOfficialSet());
266 String dbPath = getPathString(hashDb.getDatabasePath(), hashDb.isOfficialSet());
267 hashDbLocationLabel.setText(dbPath);
268 }
catch (TskCoreException ex) {
270 hashDbLocationLabel.setText(ERROR_GETTING_PATH_TEXT);
274 String indexPath = getPathString(hashDb.getIndexPath(), hashDb.isOfficialSet());
275 indexPathLabel.setText(indexPath);
276 }
catch (TskCoreException ex) {
278 indexPathLabel.setText(ERROR_GETTING_PATH_TEXT);
283 if (hashDb.isIndexing()) {
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"));
295 hashDbIndexStatusLabel.setText(
296 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexStatusText.indexed"));
298 hashDbIndexStatusLabel.setForeground(Color.black);
299 if (hashDb.canBeReIndexed()) {
301 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.reIndex"));
302 indexButton.setEnabled(
true);
304 indexButton.setText(NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.indexButtonText.index"));
305 indexButton.setEnabled(
false);
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);
314 }
catch (TskCoreException ex) {
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);
325 AutopsyEvent
event = (AutopsyEvent) evt;
326 if (event.getSourceType() == AutopsyEvent.SourceType.LOCAL) {
327 String eventType =
event.getPropertyName();
337 @Messages({
"HashLookupSettingsPanel.saveFail.message=Couldn't save hash set settings.",
338 "HashLookupSettingsPanel.saveFail.title=Save Fail"})
342 newReferenceSetIDs.clear();
345 List<SleuthkitHashSet> unindexed =
new ArrayList<>();
347 if (db instanceof SleuthkitHashSet) {
349 SleuthkitHashSet hashDatabase = (SleuthkitHashSet) db;
350 if (!hashDatabase.hasIndex()) {
351 unindexed.add(hashDatabase);
353 }
catch (TskCoreException ex) {
361 if (!unindexed.isEmpty()) {
362 SwingUtilities.invokeLater(
new Runnable() {
366 if (!unindexed.isEmpty()) {
367 showInvalidIndex(unindexed);
373 hashSetManager.save();
375 SwingUtilities.invokeLater(() -> {
376 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
384 hashSetTable.clearSelection();
385 hashSetTableModel.refreshModel();
401 for (
int refID : newReferenceSetIDs) {
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) {
423 }
catch (HashDbManager.HashDbManagerException ex) {
424 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.getHashSetName()));
427 hashSetTableModel.refreshModel();
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"})
446 String nsrlTotal =
"";
448 List<SleuthkitHashSet> nsrlHashsets =
new ArrayList<>();
449 for (SleuthkitHashSet hdb : unindexed) {
451 if (isWindows() && hdb.getHashSetName().toLowerCase().contains(NSRL_NAME_STRING)) {
452 nsrlHashsets.add(hdb);
453 nsrlTotal +=
"\n" + hdb.getHashSetName();
455 total +=
"\n" + hdb.getHashSetName();
458 if (!nsrlHashsets.isEmpty()) {
460 if (nsrlHashsets.size() > 1) {
461 message = Bundle.HashLookupSettingsPanel_unindexedNsrls_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
463 message = Bundle.HashLookupSettingsPanel_unindexedNsrl_base(nsrlTotal) + Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_text(NSRL_URL);
465 JOptionPane.showMessageDialog(
this, message, Bundle.HashLookupSettingsPanel_removeUnindexedNsrl_title(), JOptionPane.INFORMATION_MESSAGE);
466 for (SleuthkitHashSet hdb : nsrlHashsets) {
467 unindexed.remove(hdb);
469 removeThese(nsrlHashsets);
471 String message = NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.dbNotIndexedMsg", total);
472 if (unindexed.isEmpty()) {
474 }
else if (unindexed.size() > 1) {
475 message = NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.dbsNotIndexedMsg", total);
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();
488 if (res == JOptionPane.NO_OPTION) {
489 JOptionPane.showMessageDialog(
this, NbBundle.getMessage(
this.getClass(),
490 "HashDbConfigPanel.allUnindexedDbsRmFromListMsg"));
491 removeThese(unindexed);
494 hashSetManager.save();
496 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_saveFail_message(), Bundle.HashLookupSettingsPanel_saveFail_title(), JOptionPane.ERROR_MESSAGE);
512 JComponent cellRenderer = (JComponent) super.prepareRenderer(renderer, row, column);
513 cellRenderer.setToolTipText((String) getValueAt(row, column));
518 if (hashSetTableModel.
isValid(row)) {
519 cellRenderer.setForeground(Color.black);
521 cellRenderer.setForeground(Color.red);
528 return hashSetTableModel.getHashSetAt(getSelectionModel().getMinSelectionIndex());
532 if (index >= 0 && index < hashSetTable.getRowCount()) {
533 getSelectionModel().setSelectionInterval(index, index);
538 setSelection(hashSetTableModel.getIndexByDatabase(db));
543 setSelection(hashSetTableModel.getIndexByName(name));
562 return hashSets.size();
567 return NbBundle.getMessage(this.getClass(),
"HashDbConfigPanel.nameColLbl");
572 return hashSets.get(rowIndex).getDisplayName();
577 return hashSets.get(rowIndex).isValid();
578 }
catch (TskCoreException ex) {
590 public void setValueAt(Object aValue,
int rowIndex,
int columnIndex) {
591 throw new UnsupportedOperationException(
592 NbBundle.getMessage(
this.getClass(),
"HashDbConfigPanel.editingCellsNotSupportedMsg"));
597 return getValueAt(0, c).getClass();
600 HashDb getHashSetAt(
int index) {
601 if (!hashSets.isEmpty() && index >= 0 && index < hashSets.size()) {
602 return hashSets.get(index);
608 int getIndexByDatabase(HashDb db) {
609 for (
int i = 0; i < hashSets.size(); ++i) {
610 if (hashSets.get(i).equals(db)) {
618 int getIndexByName(String name) {
619 for (
int i = 0; i < hashSets.size(); ++i) {
620 if (hashSets.get(i).getHashSetName().equals(name)) {
627 void refreshModel() {
628 hashSets = HashDbManager.getInstance().getAllHashSets();
632 void refreshDisplay() {
633 fireTableDataChanged();
645 jScrollPane2 =
new javax.swing.JScrollPane();
646 jPanel1 =
new javax.swing.JPanel();
647 hashDatabasesLabel =
new javax.swing.JLabel();
648 jScrollPane1 =
new javax.swing.JScrollPane();
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();
677 org.openide.awt.Mnemonics.setLocalizedText(hashDatabasesLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDatabasesLabel.text"));
679 hashSetTable.setModel(
new javax.swing.table.DefaultTableModel(
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);
694 jScrollPane1.setViewportView(hashSetTable);
696 createDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/new16.png")));
697 org.openide.awt.Mnemonics.setLocalizedText(createDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.createDatabaseButton.text"));
698 createDatabaseButton.setToolTipText(
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.createDatabaseButton.toolTipText"));
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);
707 importDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/import16.png")));
708 org.openide.awt.Mnemonics.setLocalizedText(importDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.importDatabaseButton.text"));
709 importDatabaseButton.setToolTipText(
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.importDatabaseButton.toolTipText"));
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);
718 deleteDatabaseButton.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png")));
719 org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.deleteDatabaseButton.text"));
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);
728 org.openide.awt.Mnemonics.setLocalizedText(informationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.informationLabel.text"));
730 informationScrollPanel.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
732 org.openide.awt.Mnemonics.setLocalizedText(nameLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.nameLabel.text"));
734 org.openide.awt.Mnemonics.setLocalizedText(hashDbNameLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbNameLabel.text"));
736 org.openide.awt.Mnemonics.setLocalizedText(typeLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.typeLabel.text"));
738 org.openide.awt.Mnemonics.setLocalizedText(hashDbTypeLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbTypeLabel.text"));
740 org.openide.awt.Mnemonics.setLocalizedText(locationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.locationLabel.text"));
742 org.openide.awt.Mnemonics.setLocalizedText(hashDbLocationLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbLocationLabel.text"));
744 org.openide.awt.Mnemonics.setLocalizedText(versionLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.versionLabel.text_1"));
746 org.openide.awt.Mnemonics.setLocalizedText(hashDbVersionLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbVersionLabel.text_1"));
748 org.openide.awt.Mnemonics.setLocalizedText(orgLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.orgLabel.text_1"));
750 org.openide.awt.Mnemonics.setLocalizedText(hashDbOrgLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbOrgLabel.text_1"));
752 org.openide.awt.Mnemonics.setLocalizedText(readOnlyLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.readOnlyLabel.text_1"));
754 org.openide.awt.Mnemonics.setLocalizedText(hashDbReadOnlyLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1"));
756 org.openide.awt.Mnemonics.setLocalizedText(indexPathLabelLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexPathLabelLabel.text"));
758 org.openide.awt.Mnemonics.setLocalizedText(indexPathLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexPathLabel.text"));
760 org.openide.awt.Mnemonics.setLocalizedText(indexLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexLabel.text"));
762 org.openide.awt.Mnemonics.setLocalizedText(hashDbIndexStatusLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.hashDbIndexStatusLabel.text"));
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()
770 .addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
771 .addGroup(informationPanelLayout.createSequentialGroup()
772 .addComponent(locationLabel)
774 .addComponent(hashDbLocationLabel))
775 .addGroup(informationPanelLayout.createSequentialGroup()
776 .addComponent(nameLabel)
778 .addComponent(hashDbNameLabel))
779 .addGroup(informationPanelLayout.createSequentialGroup()
780 .addComponent(typeLabel)
782 .addComponent(hashDbTypeLabel))
783 .addGroup(informationPanelLayout.createSequentialGroup()
784 .addComponent(versionLabel)
786 .addComponent(hashDbVersionLabel))
787 .addGroup(informationPanelLayout.createSequentialGroup()
788 .addComponent(orgLabel)
790 .addComponent(hashDbOrgLabel))
791 .addGroup(informationPanelLayout.createSequentialGroup()
792 .addComponent(readOnlyLabel)
794 .addComponent(hashDbReadOnlyLabel))
795 .addGroup(informationPanelLayout.createSequentialGroup()
796 .addComponent(indexLabel)
798 .addComponent(hashDbIndexStatusLabel))
799 .addGroup(informationPanelLayout.createSequentialGroup()
800 .addComponent(indexPathLabelLabel)
802 .addComponent(indexPathLabel)))
803 .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
806 informationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL,
new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel});
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))
845 informationScrollPanel.setViewportView(informationPanel);
847 org.openide.awt.Mnemonics.setLocalizedText(indexButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.indexButton.text"));
848 indexButton.setEnabled(
false);
849 indexButton.addActionListener(
new java.awt.event.ActionListener() {
850 public void actionPerformed(java.awt.event.ActionEvent evt) {
851 indexButtonActionPerformed(evt);
855 org.openide.awt.Mnemonics.setLocalizedText(addHashesToDatabaseButton,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.addHashesToDatabaseButton.text"));
856 addHashesToDatabaseButton.setEnabled(
false);
857 addHashesToDatabaseButton.addActionListener(
new java.awt.event.ActionListener() {
858 public void actionPerformed(java.awt.event.ActionEvent evt) {
859 addHashesToDatabaseButtonActionPerformed(evt);
863 org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckBox,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.sendIngestMessagesCheckBox.text"));
864 sendIngestMessagesCheckBox.addActionListener(
new java.awt.event.ActionListener() {
865 public void actionPerformed(java.awt.event.ActionEvent evt) {
866 sendIngestMessagesCheckBoxActionPerformed(evt);
870 ingestWarningLabel.setIcon(
new javax.swing.ImageIcon(getClass().getResource(
"/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png")));
871 org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel,
org.openide.util.NbBundle.getMessage(
HashLookupSettingsPanel.class,
"HashLookupSettingsPanel.ingestWarningLabel.text"));
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()
879 .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
880 .addGroup(jPanel1Layout.createSequentialGroup()
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)))
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))))
908 jPanel1Layout.setVerticalGroup(
909 jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
910 .addGroup(jPanel1Layout.createSequentialGroup()
912 .addComponent(hashDatabasesLabel)
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))
924 .addComponent(sendIngestMessagesCheckBox)
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))
937 jScrollPane2.setViewportView(jPanel1);
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)
945 layout.setVerticalGroup(
946 layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
947 .addComponent(jScrollPane2)
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);
965 hashSetTableModel.refreshModel();
966 ((
HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
967 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
973 if (hashDb != null) {
974 hashDb.setSendIngestMessages(sendIngestMessagesCheckBox.isSelected());
975 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
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"})
992 assert hashDatabase != null;
993 assert hashDatabase instanceof SleuthkitHashSet;
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);
1002 hashSetTableModel.refreshModel();
1003 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1005 logger.log(Level.WARNING,
"Unable to remove unindexed NSRL from hash set list", ex);
1008 hashDb.addPropertyChangeListener(
new PropertyChangeListener() {
1010 public void propertyChange(PropertyChangeEvent evt) {
1011 if (evt.getPropertyName().equals(SleuthkitHashSet.Event.INDEXING_DONE.toString())) {
1013 if (selectedHashDb != null && hashDb != null && hashDb.equals(selectedHashDb)) {
1016 hashSetTableModel.refreshDisplay();
1026 ModalNoButtons indexDialog =
new ModalNoButtons(
this,
new Frame(), hashDb);
1027 indexDialog.setLocationRelativeTo(null);
1028 indexDialog.setVisible(
true);
1029 indexDialog.setModal(
true);
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);
1041 hashSetTableModel.refreshModel();
1042 ((
HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
1043 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
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."
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) {
1058 if (hashDb != null) {
1062 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.
getHashSetName()));
1064 hashSetTableModel.refreshModel();
1065 firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
1071 if (evt.getKeyCode() == KeyEvent.VK_DELETE) {
1073 if (hashDb != null) {
1077 JOptionPane.showMessageDialog(
this, Bundle.HashLookupSettingsPanel_removeDatabaseFailure_message(hashDb.
getHashSetName()));
1079 hashSetTableModel.refreshModel();
1080 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()
void updateForSleuthkitHashSet(boolean ingestIsRunning, SleuthkitHashSet hashDb)
HashLookupSettingsPanel()
static String getPathString(String path, boolean justFilename)
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
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)