added NO_CHANGE KnownFileType

This commit is contained in:
Greg DiCristofaro 2020-04-29 16:22:33 -04:00
parent 60068ec93a
commit 72ef5267e1
10 changed files with 127 additions and 86 deletions

View File

@ -239,7 +239,7 @@ AddHashValuesToDatabaseDialog.okButton.text_2=OK
HashDbImportDatabaseDialog.saveInUserConfigFolderCheckbox.text=Copy hash set into user configuration folder
HashDbImportDatabaseDialog.saveInUserConfigFolderCheckbox.toolTipText=In Live Triage situations, this option ensures that path to the hash set will be valid
HashLookupSettingsPanel.indexPathLabel.text=
HashDbImportDatabaseDialog.unspecifiedRadioButton.text=Unspecified
HashDbImportDatabaseDialog.unspecifiedRadioButton.toolTipText=
HashDbCreateDatabaseDialog.unspecifiedRadioButton.text=Unspecified
HashLookupModuleSettingsPanel.hashDbsLabel.text=Select hash sets to use:
HashDbCreateDatabaseDialog.noChangeRadioButton.text=No Change
HashDbImportDatabaseDialog.noChangeRadioButton.toolTipText=
HashDbImportDatabaseDialog.noChangeRadioButton.text=No Change

View File

@ -190,6 +190,7 @@ HashDbManager.hashDbAlreadyAddedExceptionMsg=The hash set at\n{0}\nhas already b
HashDbManager.illegalHashDbFileNameExtensionMsg=The hash set file name must have a .{0} extension.
HashDbManager.moduleErr=Module Error
HashDbManager.knownBad.text=Notable
HashDbManager.noChange.text=No Change
HashDbManager.known.text=Known
HashDbManager.fileNameExtensionFilter.title=Hash Set File
HashDbSearchAction.dlgMsg.title=File Search by MD5 Hash

View File

@ -293,6 +293,6 @@ AddHashValuesToDatabaseDialog.okButton.text_2=OK
HashDbImportDatabaseDialog.saveInUserConfigFolderCheckbox.text=\u30cf\u30c3\u30b7\u30e5\u30bb\u30c3\u30c8\u3092\u30e6\u30fc\u30b6\u30fc\u69cb\u6210\u30d5\u30a1\u30a4\u30eb\u306b\u30b3\u30d4\u30fc
HashDbImportDatabaseDialog.saveInUserConfigFolderCheckbox.toolTipText=\u30e9\u30a4\u30d6\u30c8\u30ea\u30a2\u30fc\u30b8\u306e\u72b6\u6cc1\u3067\u306f\u3001\u3053\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u306b\u3088\u3063\u3066\u30cf\u30c3\u30b7\u30e5\u30bb\u30c3\u30c8\u3078\u306e\u30d1\u30b9\u304c\u6709\u52b9\u3067\u3042\u308b\u3053\u3068\u304c\u4fdd\u8a3c\u3055\u308c\u307e\u3059\u3002
HashLookupSettingsPanel.indexPathLabel.text=
HashDbImportDatabaseDialog.unspecifiedRadioButton.text=\u9855\u8457
HashDbCreateDatabaseDialog.unspecifiedRadioButton.text=\u9855\u8457
HashLookupModuleSettingsPanel.hashDbsLabel.text=\u4f7f\u7528\u3059\u308b\u65e2\u77e5\u30cf\u30c3\u30b7\u30e5\u30bb\u30c3\u30c8\u3092\u9078\u629e:
HashDbCreateDatabaseDialog.noChangeRadioButton.text=\u9855\u8457
HashDbImportDatabaseDialog.noChangeRadioButton.text=\u9855\u8457

View File

@ -78,7 +78,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="knownRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="knownBadRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="unspecifiedRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="noChangeRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" attributes="0">
@ -136,7 +136,7 @@
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="unspecifiedRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="noChangeRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="24" max="-2" attributes="0"/>
<Component id="sendIngestMessagesCheckbox" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
@ -315,18 +315,18 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="orgButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JRadioButton" name="unspecifiedRadioButton">
<Component class="javax.swing.JRadioButton" name="noChangeRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="selected" type="boolean" value="true"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashDbCreateDatabaseDialog.unspecifiedRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashDbCreateDatabaseDialog.noChangeRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="unspecifiedRadioButtonActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="noChangeRadioButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>

View File

@ -198,7 +198,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
lbOrg = new javax.swing.JLabel();
orgComboBox = new javax.swing.JComboBox<>();
orgButton = new javax.swing.JButton();
unspecifiedRadioButton = new javax.swing.JRadioButton();
noChangeRadioButton = new javax.swing.JRadioButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@ -292,12 +292,12 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
}
});
buttonGroup1.add(unspecifiedRadioButton);
unspecifiedRadioButton.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(unspecifiedRadioButton, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.unspecifiedRadioButton.text")); // NOI18N
unspecifiedRadioButton.addActionListener(new java.awt.event.ActionListener() {
buttonGroup1.add(noChangeRadioButton);
noChangeRadioButton.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(noChangeRadioButton, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.noChangeRadioButton.text")); // NOI18N
noChangeRadioButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
unspecifiedRadioButtonActionPerformed(evt);
noChangeRadioButtonActionPerformed(evt);
}
});
@ -344,7 +344,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(knownRadioButton)
.addComponent(knownBadRadioButton)
.addComponent(unspecifiedRadioButton)))
.addComponent(noChangeRadioButton)))
.addGroup(layout.createSequentialGroup()
.addGap(12, 12, 12)
.addComponent(jLabel2))
@ -392,7 +392,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
.addComponent(cancelButton)
.addComponent(okButton)))
.addGroup(layout.createSequentialGroup()
.addComponent(unspecifiedRadioButton)
.addComponent(noChangeRadioButton)
.addGap(24, 24, 24)
.addComponent(sendIngestMessagesCheckbox)
.addGap(0, 0, Short.MAX_VALUE)))
@ -403,13 +403,13 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
}// </editor-fold>//GEN-END:initComponents
private void knownRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownRadioButtonActionPerformed
sendIngestMessagesCheckbox.setSelected(false);
sendIngestMessagesCheckbox.setEnabled(false);
sendIngestMessagesCheckbox.setSelected(KnownFilesType.KNOWN.isDefaultInboxMessages());
sendIngestMessagesCheckbox.setEnabled(KnownFilesType.KNOWN.isInboxMessagesAllowed());
}//GEN-LAST:event_knownRadioButtonActionPerformed
private void knownBadRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownBadRadioButtonActionPerformed
sendIngestMessagesCheckbox.setSelected(true);
sendIngestMessagesCheckbox.setEnabled(true);
sendIngestMessagesCheckbox.setSelected(KnownFilesType.KNOWN_BAD.isDefaultInboxMessages());
sendIngestMessagesCheckbox.setEnabled(KnownFilesType.KNOWN_BAD.isInboxMessagesAllowed());
}//GEN-LAST:event_knownBadRadioButtonActionPerformed
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
@ -488,14 +488,18 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
}
KnownFilesType type;
TskData.FileKnown fileKnown;
if (knownRadioButton.isSelected()) {
type = KnownFilesType.KNOWN;
fileKnown = TskData.FileKnown.KNOWN;
} else {
type = KnownFilesType.KNOWN_BAD;
fileKnown = TskData.FileKnown.BAD;
type = KnownFilesType.KNOWN;
}
else if (noChangeRadioButton.isSelected()) {
type = KnownFilesType.NO_CHANGE;
}
else {
type = KnownFilesType.KNOWN_BAD;
}
TskData.FileKnown fileKnown = type.getFileKnown();
String errorMessage = NbBundle
.getMessage(this.getClass(), "HashDbCreateDatabaseDialog.errMsg.hashDbCreationErr");
@ -598,9 +602,10 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
enableComponents();
}//GEN-LAST:event_centralRepoRadioButtonActionPerformed
private void unspecifiedRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unspecifiedRadioButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_unspecifiedRadioButtonActionPerformed
private void noChangeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noChangeRadioButtonActionPerformed
sendIngestMessagesCheckbox.setSelected(KnownFilesType.NO_CHANGE.isDefaultInboxMessages());
sendIngestMessagesCheckbox.setEnabled(KnownFilesType.NO_CHANGE.isInboxMessagesAllowed());
}//GEN-LAST:event_noChangeRadioButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
@ -616,12 +621,12 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
private javax.swing.JRadioButton knownBadRadioButton;
private javax.swing.JRadioButton knownRadioButton;
private javax.swing.JLabel lbOrg;
private javax.swing.JRadioButton noChangeRadioButton;
private javax.swing.JButton okButton;
private javax.swing.JButton orgButton;
private javax.swing.JComboBox<String> orgComboBox;
private javax.swing.JButton saveAsButton;
private javax.swing.JCheckBox sendIngestMessagesCheckbox;
private javax.swing.ButtonGroup storageTypeButtonGroup;
private javax.swing.JRadioButton unspecifiedRadioButton;
// End of variables declaration//GEN-END:variables
}

View File

@ -97,7 +97,7 @@
<Group type="103" groupAlignment="0" attributes="0">
<Component id="knownRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="knownBadRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="unspecifiedRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="noChangeRadioButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="saveInUserConfigFolderCheckbox" min="-2" max="-2" attributes="0"/>
@ -147,7 +147,7 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="knownBadRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="unspecifiedRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="noChangeRadioButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="5" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
@ -374,20 +374,20 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="unspecifiedRadioButton">
<Component class="javax.swing.JRadioButton" name="noChangeRadioButton">
<Properties>
<Property name="buttonGroup" type="javax.swing.ButtonGroup" editor="org.netbeans.modules.form.RADComponent$ButtonGroupPropertyEditor">
<ComponentRef name="buttonGroup1"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashDbImportDatabaseDialog.unspecifiedRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashDbImportDatabaseDialog.noChangeRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="toolTipText" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashDbImportDatabaseDialog.unspecifiedRadioButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashDbImportDatabaseDialog.noChangeRadioButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="unspecifiedRadioButtonActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="noChangeRadioButtonActionPerformed"/>
</Events>
</Component>
</SubComponents>

View File

@ -182,7 +182,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
centralRepoRadioButton = new javax.swing.JRadioButton();
jLabel4 = new javax.swing.JLabel();
saveInUserConfigFolderCheckbox = new javax.swing.JCheckBox();
unspecifiedRadioButton = new javax.swing.JRadioButton();
noChangeRadioButton = new javax.swing.JRadioButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@ -291,12 +291,12 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
org.openide.awt.Mnemonics.setLocalizedText(saveInUserConfigFolderCheckbox, org.openide.util.NbBundle.getMessage(HashDbImportDatabaseDialog.class, "HashDbImportDatabaseDialog.saveInUserConfigFolderCheckbox.text")); // NOI18N
saveInUserConfigFolderCheckbox.setToolTipText(org.openide.util.NbBundle.getMessage(HashDbImportDatabaseDialog.class, "HashDbImportDatabaseDialog.saveInUserConfigFolderCheckbox.toolTipText")); // NOI18N
buttonGroup1.add(unspecifiedRadioButton);
org.openide.awt.Mnemonics.setLocalizedText(unspecifiedRadioButton, org.openide.util.NbBundle.getMessage(HashDbImportDatabaseDialog.class, "HashDbImportDatabaseDialog.unspecifiedRadioButton.text")); // NOI18N
unspecifiedRadioButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashDbImportDatabaseDialog.class, "HashDbImportDatabaseDialog.unspecifiedRadioButton.toolTipText")); // NOI18N
unspecifiedRadioButton.addActionListener(new java.awt.event.ActionListener() {
buttonGroup1.add(noChangeRadioButton);
org.openide.awt.Mnemonics.setLocalizedText(noChangeRadioButton, org.openide.util.NbBundle.getMessage(HashDbImportDatabaseDialog.class, "HashDbImportDatabaseDialog.noChangeRadioButton.text")); // NOI18N
noChangeRadioButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashDbImportDatabaseDialog.class, "HashDbImportDatabaseDialog.noChangeRadioButton.toolTipText")); // NOI18N
noChangeRadioButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
unspecifiedRadioButtonActionPerformed(evt);
noChangeRadioButtonActionPerformed(evt);
}
});
@ -357,7 +357,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(knownRadioButton)
.addComponent(knownBadRadioButton)
.addComponent(unspecifiedRadioButton)))
.addComponent(noChangeRadioButton)))
.addComponent(saveInUserConfigFolderCheckbox)
.addComponent(readOnlyCheckbox))
.addGap(0, 0, Short.MAX_VALUE)))
@ -398,7 +398,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(knownBadRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(unspecifiedRadioButton)
.addComponent(noChangeRadioButton)
.addGap(5, 5, 5)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
@ -451,13 +451,13 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
}//GEN-LAST:event_openButtonActionPerformed
private void knownRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownRadioButtonActionPerformed
sendIngestMessagesCheckbox.setSelected(false);
sendIngestMessagesCheckbox.setEnabled(false);
sendIngestMessagesCheckbox.setSelected(KnownFilesType.KNOWN.isDefaultInboxMessages());
sendIngestMessagesCheckbox.setEnabled(KnownFilesType.KNOWN.isInboxMessagesAllowed());
}//GEN-LAST:event_knownRadioButtonActionPerformed
private void knownBadRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_knownBadRadioButtonActionPerformed
sendIngestMessagesCheckbox.setSelected(true);
sendIngestMessagesCheckbox.setEnabled(true);
sendIngestMessagesCheckbox.setSelected(KnownFilesType.KNOWN_BAD.isDefaultInboxMessages());
sendIngestMessagesCheckbox.setEnabled(KnownFilesType.KNOWN_BAD.isInboxMessagesAllowed());
}//GEN-LAST:event_knownBadRadioButtonActionPerformed
private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
@ -546,7 +546,11 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
KnownFilesType type;
if (knownRadioButton.isSelected()) {
type = KnownFilesType.KNOWN;
} else {
}
else if (noChangeRadioButton.isSelected()) {
type = KnownFilesType.NO_CHANGE;
}
else {
type = KnownFilesType.KNOWN_BAD;
}
@ -644,9 +648,10 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
enableComponents();
}//GEN-LAST:event_readOnlyCheckboxActionPerformed
private void unspecifiedRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_unspecifiedRadioButtonActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_unspecifiedRadioButtonActionPerformed
private void noChangeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_noChangeRadioButtonActionPerformed
sendIngestMessagesCheckbox.setSelected(KnownFilesType.NO_CHANGE.isDefaultInboxMessages());
sendIngestMessagesCheckbox.setEnabled(KnownFilesType.NO_CHANGE.isInboxMessagesAllowed());
}//GEN-LAST:event_noChangeRadioButtonActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
@ -663,6 +668,7 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
private javax.swing.JRadioButton knownRadioButton;
private javax.swing.JLabel lbOrg;
private javax.swing.JLabel lbVersion;
private javax.swing.JRadioButton noChangeRadioButton;
private javax.swing.JButton okButton;
private javax.swing.JButton openButton;
private javax.swing.JButton orgButton;
@ -671,7 +677,6 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
private javax.swing.JCheckBox saveInUserConfigFolderCheckbox;
private javax.swing.JCheckBox sendIngestMessagesCheckbox;
private javax.swing.ButtonGroup storageTypeButtonGroup;
private javax.swing.JRadioButton unspecifiedRadioButton;
private javax.swing.JTextField versionTextField;
// End of variables declaration//GEN-END:variables
}

View File

@ -28,9 +28,11 @@ import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.logging.Level;
import java.util.stream.Stream;
import javax.swing.JFileChooser;
import javax.swing.JOptionPane;
import javax.swing.SwingWorker;
@ -58,6 +60,7 @@ import org.sleuthkit.datamodel.SleuthkitJNI;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.autopsy.centralrepository.datamodel.CentralRepository;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.KnownFilesType;
/**
* This class implements a singleton that manages the set of hash databases used
@ -499,9 +502,9 @@ public class HashDbManager implements PropertyChangeListener {
// Defaults for fields not stored in the central repository:
// searchDuringIngest: false
// sendIngestMessages: true if the hash set is notable
boolean sendIngestMessages = convertFileKnown(globalSet.getFileKnownStatus()).equals(HashDb.KnownFilesType.KNOWN_BAD);
boolean sendIngestMessages = KnownFilesType.fromFileKnown(globalSet.getFileKnownStatus()).equals(HashDb.KnownFilesType.KNOWN_BAD);
crHashSets.add(new HashDbInfo(globalSet.getSetName(), globalSet.getVersion(),
globalSet.getGlobalSetID(), convertFileKnown(globalSet.getFileKnownStatus()), globalSet.isReadOnly(), false, sendIngestMessages));
globalSet.getGlobalSetID(), KnownFilesType.fromFileKnown(globalSet.getFileKnownStatus()), globalSet.isReadOnly(), false, sendIngestMessages));
}
} catch (CentralRepoException ex){
Logger.getLogger(HashDbManager.class.getName()).log(Level.SEVERE, "Error loading central repository hash sets", ex); //NON-NLS
@ -509,13 +512,6 @@ public class HashDbManager implements PropertyChangeListener {
}
return crHashSets;
}
private static HashDb.KnownFilesType convertFileKnown(TskData.FileKnown fileKnown){
if(fileKnown.equals(TskData.FileKnown.BAD)){
return HashDb.KnownFilesType.KNOWN_BAD;
}
return HashDb.KnownFilesType.KNOWN;
}
/**
* Restores the last saved hash sets configuration. This supports
@ -701,17 +697,65 @@ public class HashDbManager implements PropertyChangeListener {
*/
public enum KnownFilesType {
KNOWN(NbBundle.getMessage(HashDbManager.class, "HashDbManager.known.text")),
KNOWN_BAD(NbBundle.getMessage(HashDbManager.class, "HashDbManager.knownBad.text"));
KNOWN(NbBundle.getMessage(HashDbManager.class, "HashDbManager.known.text"), TskData.FileKnown.KNOWN, false, false),
KNOWN_BAD(NbBundle.getMessage(HashDbManager.class, "HashDbManager.knownBad.text"), TskData.FileKnown.BAD, true, true),
NO_CHANGE(NbBundle.getMessage(HashDbManager.class, "HashDbManager.noChange.text"), TskData.FileKnown.UNKNOWN, true , false);
private final String displayName;
private final TskData.FileKnown fileKnown;
private final boolean allowSendInboxMessages;
private final boolean defaultSendInboxMessages;
private KnownFilesType(String displayName) {
private KnownFilesType(String displayName, TskData.FileKnown fileKnown, boolean allowSendInboxMessages, boolean defaultSendInboxMessages) {
this.displayName = displayName;
this.fileKnown = fileKnown;
this.allowSendInboxMessages = allowSendInboxMessages;
this.defaultSendInboxMessages = defaultSendInboxMessages;
}
/**
* Returns whether or not it is allowable to send inbox messages with this known files type.
* @return Whether or not it is allowable to send inbox messages with this known files type.
*/
boolean isInboxMessagesAllowed() {
return allowSendInboxMessages;
}
/**
* Returns whether or not by default for this type is to send inbox messages.
* @return Whether or not by default for this type is to send inbox messages.
*/
boolean isDefaultInboxMessages() {
return defaultSendInboxMessages;
}
public String getDisplayName() {
return this.displayName;
}
/**
* Retrieves the corresponding TskData.FileKnown enum type that relates to this.
* @return The corresponding TskData.FileKnown.
*/
TskData.FileKnown getFileKnown() {
return this.fileKnown;
}
/**
* Converts a TskData.FileKnown to the corresponding KnownFilesType.
* @param fileKnown The TskData.FileKnown type.
* @return The corresponding KnownFilesType.
*/
static KnownFilesType fromFileKnown(TskData.FileKnown fileKnown) {
if (fileKnown == null)
return null;
return Stream.of(KnownFilesType.values())
.filter((type) -> type.getFileKnown() == fileKnown)
.findFirst()
.orElseThrow(() -> new IllegalArgumentException("Unknown TskData.FileKnown type: " + fileKnown));
}
}
/**
@ -1229,12 +1273,7 @@ public class HashDbManager implements PropertyChangeListener {
if (content instanceof AbstractFile) {
AbstractFile file = (AbstractFile) content;
if (null != file.getMd5Hash()) {
TskData.FileKnown type;
if(knownFilesType.equals(HashDb.KnownFilesType.KNOWN_BAD)){
type = TskData.FileKnown.BAD;
} else {
type = TskData.FileKnown.KNOWN;
}
TskData.FileKnown type = knownFilesType.getFileKnown();
try{
CentralRepoFileInstance fileInstance = new CentralRepoFileInstance(referenceSetID, file.getMd5Hash(),
@ -1258,12 +1297,8 @@ public class HashDbManager implements PropertyChangeListener {
public void addHashes(List<HashEntry> hashes) throws TskCoreException {
Set<CentralRepoFileInstance> globalFileInstances = new HashSet<>();
for(HashEntry hashEntry:hashes){
TskData.FileKnown type;
if(knownFilesType.equals(HashDb.KnownFilesType.KNOWN_BAD)){
type = TskData.FileKnown.BAD;
} else {
type = TskData.FileKnown.KNOWN;
}
TskData.FileKnown type = knownFilesType.getFileKnown();
try {
globalFileInstances.add(new CentralRepoFileInstance(referenceSetID, hashEntry.getMd5Hash(), type, hashEntry.getComment()));
} catch (CentralRepoException | CorrelationAttributeNormalizationException ex){

View File

@ -282,7 +282,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
// Update ingest option components.
sendIngestMessagesCheckBox.setSelected(db.getSendIngestMessages());
sendIngestMessagesCheckBox.setEnabled(!ingestIsRunning && db.getKnownFilesType().equals(KnownFilesType.KNOWN_BAD));
sendIngestMessagesCheckBox.setEnabled(!ingestIsRunning && db.getKnownFilesType().isInboxMessagesAllowed());
// Update database action buttons.
createDatabaseButton.setEnabled(true);

View File

@ -231,12 +231,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
try {
// Conver to the FileKnown enum used by EamGlobalSet
TskData.FileKnown knownStatus;
if (knownFilesType.equals(HashDbManager.HashDb.KnownFilesType.KNOWN)) {
knownStatus = TskData.FileKnown.KNOWN;
} else {
knownStatus = TskData.FileKnown.BAD;
}
TskData.FileKnown knownStatus = knownFilesType.getFileKnown();
// Create an empty hashset in the central repository
CentralRepository dbManager = CentralRepository.getInstance();