Merge pull request #4435 from millmanorama/timeline-event-mgr

Merge develop branch into Timeline event mgr branch
This commit is contained in:
Richard Cordovano 2018-12-31 09:02:03 -05:00 committed by GitHub
commit f0a90403ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
195 changed files with 2992 additions and 378456 deletions

View File

@ -2,7 +2,7 @@ Manifest-Version: 1.0
OpenIDE-Module: org.sleuthkit.autopsy.core/10
OpenIDE-Module-Localizing-Bundle: org/sleuthkit/autopsy/core/Bundle.properties
OpenIDE-Module-Layer: org/sleuthkit/autopsy/core/layer.xml
OpenIDE-Module-Implementation-Version: 25
OpenIDE-Module-Implementation-Version: 26
OpenIDE-Module-Requires: org.openide.windows.WindowManager
AutoUpdate-Show-In-Client: true
AutoUpdate-Essential-Module: true

View File

@ -63,7 +63,7 @@ file.reference.cxf-rt-transports-http-3.0.16.jar=release/modules/ext/cxf-rt-tran
file.reference.fontbox-2.0.8.jar=release/modules/ext/fontbox-2.0.8.jar
file.reference.pdfbox-2.0.8.jar=release/modules/ext/pdfbox-2.0.8.jar
file.reference.pdfbox-tools-2.0.8.jar=release/modules/ext/pdfbox-tools-2.0.8.jar
file.reference.sleuthkit-postgresql-4.6.4.jar=release/modules/ext/sleuthkit-postgresql-4.6.4.jar
file.reference.sleuthkit-postgresql-4.6.5.jar=release/modules/ext/sleuthkit-postgresql-4.6.5.jar
file.reference.tagsoup-1.2.1.jar=release/modules/ext/tagsoup-1.2.1.jar
file.reference.tika-core-1.17.jar=release/modules/ext/tika-core-1.17.jar
file.reference.tika-parsers-1.17.jar=release/modules/ext/tika-parsers-1.17.jar
@ -84,5 +84,5 @@ nbm.homepage=http://www.sleuthkit.org/
nbm.module.author=Brian Carrier
nbm.needs.restart=true
source.reference.curator-recipes-2.8.0.jar=release/modules/ext/curator-recipes-2.8.0-sources.jar
spec.version.base=10.13
spec.version.base=10.14

View File

@ -339,7 +339,7 @@
<package>org.sleuthkit.autopsy.progress</package>
<package>org.sleuthkit.autopsy.report</package>
<package>org.sleuthkit.autopsy.textextractors</package>
<package>org.sleuthkit.autopsy.textextractors.extractionconfigs</package>
<package>org.sleuthkit.autopsy.textextractors.configs</package>
<package>org.sleuthkit.autopsy.texttranslation</package>
<package>org.sleuthkit.datamodel</package>
</public-packages>
@ -500,8 +500,8 @@
<binary-origin>release/modules/ext/isoparser-1.1.18.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/sleuthkit-postgresql-4.6.4.jar</runtime-relative-path>
<binary-origin>release/modules/ext/sleuthkit-postgresql-4.6.4.jar</binary-origin>
<runtime-relative-path>ext/sleuthkit-postgresql-4.6.5.jar</runtime-relative-path>
<binary-origin>release/modules/ext/sleuthkit-postgresql-4.6.5.jar</binary-origin>
</class-path-extension>
<class-path-extension>
<runtime-relative-path>ext/vorbis-java-core-0.8.jar</runtime-relative-path>

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.othercasessearch;
package org.sleuthkit.autopsy.allcasessearch;
import org.openide.nodes.Children;
import org.openide.nodes.FilterNode;
@ -27,7 +27,7 @@ import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
* A <code>Children</code> implementation for a
* <code>CorrelationPropertyFilterNode</code>.
*/
final class OtherCasesFilterChildren extends FilterNode.Children {
final class AllCasesFilterChildren extends FilterNode.Children {
/**
* Create a new Children instance.
@ -41,7 +41,7 @@ final class OtherCasesFilterChildren extends FilterNode.Children {
static Children createInstance(Node wrappedNode, boolean createChildren) {
if (createChildren) {
return new OtherCasesFilterChildren(wrappedNode);
return new AllCasesFilterChildren(wrappedNode);
} else {
return Children.LEAF;
}
@ -53,7 +53,7 @@ final class OtherCasesFilterChildren extends FilterNode.Children {
*
* @param wrappedNode The node wrapped by CorrelationPropertyFilterNode.
*/
OtherCasesFilterChildren(Node wrappedNode) {
AllCasesFilterChildren(Node wrappedNode) {
super(wrappedNode);
}

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.othercasessearch;
package org.sleuthkit.autopsy.allcasessearch;
import java.awt.event.ActionEvent;
import org.openide.awt.ActionID;
@ -27,16 +27,15 @@ import org.openide.util.NbBundle;
import org.openide.util.actions.CallableSystemAction;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.othercasessearch.Bundle;
/**
* Action for accessing the Search Other Cases dialog.
*/
@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.othercasessearch.OtherCasesSearchAction")
@ActionRegistration(displayName = "#CTL_OtherCasesSearchAction=Search Other Cases", lazy = false)
@ActionID(category = "Tools", id = "org.sleuthkit.autopsy.allcasessearch.AllCasesSearchAction")
@ActionRegistration(displayName = "#CTL_OtherCasesSearchAction=Search All Cases", lazy = false)
@ActionReference(path = "Menu/Tools", position = 201)
@NbBundle.Messages({"CTL_OtherCasesSearchAction=Search Other Cases"})
public class OtherCasesSearchAction extends CallableSystemAction {
@NbBundle.Messages({"CTL_AllCasesSearchAction=Search All Cases"})
public class AllCasesSearchAction extends CallableSystemAction {
@Override
public boolean isEnabled() {
@ -50,15 +49,15 @@ public class OtherCasesSearchAction extends CallableSystemAction {
@Override
public void performAction() {
OtherCasesSearchDialog dialog = new OtherCasesSearchDialog();
AllCasesSearchDialog dialog = new AllCasesSearchDialog();
dialog.display();
}
@NbBundle.Messages({
"OtherCasesSearchAction.getName.text=Search Other Cases"})
"AllCasesSearchAction.getName.text=Search All Cases"})
@Override
public String getName() {
return Bundle.OtherCasesSearchAction_getName_text();
return Bundle.AllCasesSearchAction_getName_text();
}
@Override

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.othercasessearch;
package org.sleuthkit.autopsy.allcasessearch;
import java.util.List;
import org.openide.nodes.Children;
@ -27,15 +27,15 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeIns
* Creates CorrelationAttributeInstanceNodes from a collection of
* CorrelationAttributeInstances.
*/
class OtherCasesSearchChildren extends Children.Keys<CorrelationAttributeInstance> {
class AllCasesSearchChildren extends Children.Keys<CorrelationAttributeInstance> {
/**
* Create an instance of OtherCasesSearchChildren.
* Create an instance of AllCasesSearchChildren.
*
* @param lazy Lazy load?
* @param fileList List of CorrelationAttributeInstances.
*/
OtherCasesSearchChildren(boolean lazy, List<CorrelationAttributeInstance> instances) {
AllCasesSearchChildren(boolean lazy, List<CorrelationAttributeInstance> instances) {
super(lazy);
this.setKeys(instances);
}

View File

@ -81,14 +81,14 @@
<Component class="javax.swing.JLabel" name="correlationValueLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.correlationValueLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.correlationValueLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="correlationValueTextField">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.correlationValueTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.correlationValueTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<Events>
@ -98,15 +98,15 @@
<Component class="javax.swing.JButton" name="searchButton">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.searchButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.searchButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
<AccessibilityProperties>
<Property name="AccessibleContext.accessibleName" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.searchButton.AccessibleContext.accessibleName" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="AccessibleContext.accessibleDescription" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.searchButton.AccessibleContext.accessibleDescription" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</AccessibilityProperties>
<Events>
@ -129,7 +129,7 @@
<Component class="javax.swing.JLabel" name="correlationTypeLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.correlationTypeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.correlationTypeLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
@ -139,14 +139,14 @@
<Color blue="0" green="0" red="ff" type="rgb"/>
</Property>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.errorLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.errorLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="descriptionLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.descriptionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.descriptionLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
@ -154,7 +154,7 @@
<Properties>
<Property name="horizontalAlignment" type="int" value="2"/>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/othercasessearch/Bundle.properties" key="OtherCasesSearchDialog.casesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/allcasessearch/Bundle.properties" key="AllCasesSearchDialog.casesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.othercasessearch;
package org.sleuthkit.autopsy.allcasessearch;
import java.awt.Color;
import java.awt.event.ItemEvent;
@ -48,31 +48,31 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.EmptyNode;
@Messages({
"OtherCasesSearchDialog.dialogTitle.text=Search Other Cases",
"OtherCasesSearchDialog.resultsTitle.text=Other Cases",
"OtherCasesSearchDialog.resultsDescription.text=Other Cases Search",
"OtherCasesSearchDialog.emptyNode.text=No results found.",
"OtherCasesSearchDialog.validation.invalidHash=The supplied value is not a valid MD5 hash.",
"OtherCasesSearchDialog.validation.invalidEmail=The supplied value is not a valid e-mail address.",
"OtherCasesSearchDialog.validation.invalidDomain=The supplied value is not a valid domain.",
"OtherCasesSearchDialog.validation.invalidPhone=The supplied value is not a valid phone number.",
"OtherCasesSearchDialog.validation.invalidSsid=The supplied value is not a valid wireless network.",
"OtherCasesSearchDialog.validation.invalidMac=The supplied value is not a valid MAC address.",
"OtherCasesSearchDialog.validation.invalidImei=The supplied value is not a valid IMEI number.",
"OtherCasesSearchDialog.validation.invalidImsi=The supplied value is not a valid IMSI number.",
"OtherCasesSearchDialog.validation.invalidIccid=The supplied value is not a valid ICCID number.",
"OtherCasesSearchDialog.validation.genericMessage=The supplied value is not valid.",
"AllCasesSearchDialog.dialogTitle.text=Search All Cases",
"AllCasesSearchDialog.resultsTitle.text=All Cases",
"AllCasesSearchDialog.resultsDescription.text=All Cases Search",
"AllCasesSearchDialog.emptyNode.text=No results found.",
"AllCasesSearchDialog.validation.invalidHash=The supplied value is not a valid MD5 hash.",
"AllCasesSearchDialog.validation.invalidEmail=The supplied value is not a valid e-mail address.",
"AllCasesSearchDialog.validation.invalidDomain=The supplied value is not a valid domain.",
"AllCasesSearchDialog.validation.invalidPhone=The supplied value is not a valid phone number.",
"AllCasesSearchDialog.validation.invalidSsid=The supplied value is not a valid wireless network.",
"AllCasesSearchDialog.validation.invalidMac=The supplied value is not a valid MAC address.",
"AllCasesSearchDialog.validation.invalidImei=The supplied value is not a valid IMEI number.",
"AllCasesSearchDialog.validation.invalidImsi=The supplied value is not a valid IMSI number.",
"AllCasesSearchDialog.validation.invalidIccid=The supplied value is not a valid ICCID number.",
"AllCasesSearchDialog.validation.genericMessage=The supplied value is not valid.",
"# {0} - number of cases",
"OtherCasesSearchDialog.caseLabel.text=The current Central Repository contains {0} case(s)."
"AllCasesSearchDialog.caseLabel.text=The current Central Repository contains {0} case(s)."
})
/**
* The Search Other Cases dialog allows users to search for specific types of
* The Search All Cases dialog allows users to search for specific types of
* correlation properties in the Central Repository.
*/
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
final class OtherCasesSearchDialog extends javax.swing.JDialog {
final class AllCasesSearchDialog extends javax.swing.JDialog {
private static final Logger logger = Logger.getLogger(OtherCasesSearchDialog.class.getName());
private static final Logger logger = Logger.getLogger(AllCasesSearchDialog.class.getName());
private static final long serialVersionUID = 1L;
private final List<CorrelationAttributeInstance.Type> correlationTypes;
@ -82,8 +82,8 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
/**
* Creates a new instance of the Search Other Cases dialog.
*/
OtherCasesSearchDialog() {
super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.OtherCasesSearchDialog_dialogTitle_text(), true);
AllCasesSearchDialog() {
super((JFrame) WindowManager.getDefault().getMainWindow(), Bundle.AllCasesSearchDialog_dialogTitle_text(), true);
this.correlationTypes = new ArrayList<>();
initComponents();
customizeComponents();
@ -122,20 +122,20 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
Collection<DataResultViewer> viewers = new ArrayList<>(1);
viewers.add(table);
OtherCasesSearchNode searchNode = new OtherCasesSearchNode(correlationInstances);
AllCasesSearchNode searchNode = new AllCasesSearchNode(correlationInstances);
TableFilterNode tableFilterNode = new TableFilterNode(searchNode, true, searchNode.getName());
String resultsText = String.format("%s (%s; \"%s\")",
Bundle.OtherCasesSearchDialog_resultsTitle_text(), type.getDisplayName(), value);
Bundle.AllCasesSearchDialog_resultsTitle_text(), type.getDisplayName(), value);
final TopComponent searchResultWin;
if (correlationInstances.isEmpty()) {
Node emptyNode = new TableFilterNode(
new EmptyNode(Bundle.OtherCasesSearchDialog_emptyNode_text()), true);
new EmptyNode(Bundle.AllCasesSearchDialog_emptyNode_text()), true);
searchResultWin = DataResultTopComponent.createInstance(
resultsText, Bundle.OtherCasesSearchDialog_resultsDescription_text(), emptyNode, 0);
resultsText, Bundle.AllCasesSearchDialog_resultsDescription_text(), emptyNode, 0);
} else {
searchResultWin = DataResultTopComponent.createInstance(
resultsText, Bundle.OtherCasesSearchDialog_resultsDescription_text(), tableFilterNode, correlationInstances.size(), viewers);
resultsText, Bundle.AllCasesSearchDialog_resultsDescription_text(), tableFilterNode, correlationInstances.size(), viewers);
}
searchResultWin.requestActive(); // make it the active top component
} catch (ExecutionException | InterruptedException ex) {
@ -166,16 +166,16 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
setResizable(false);
org.openide.awt.Mnemonics.setLocalizedText(correlationValueLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.correlationValueLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(correlationValueLabel, org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.correlationValueLabel.text")); // NOI18N
correlationValueTextField.setText(org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.correlationValueTextField.text")); // NOI18N
correlationValueTextField.setText(org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.correlationValueTextField.text")); // NOI18N
correlationValueTextField.addKeyListener(new java.awt.event.KeyAdapter() {
public void keyReleased(java.awt.event.KeyEvent evt) {
valueFieldKeyReleaseListener(evt);
}
});
org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.searchButton.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(searchButton, org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.searchButton.text")); // NOI18N
searchButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
searchButtonActionPerformed(evt);
@ -188,15 +188,15 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
}
});
org.openide.awt.Mnemonics.setLocalizedText(correlationTypeLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.correlationTypeLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(correlationTypeLabel, org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.correlationTypeLabel.text")); // NOI18N
errorLabel.setForeground(new java.awt.Color(255, 0, 0));
org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.errorLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(errorLabel, org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.errorLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(descriptionLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.descriptionLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(descriptionLabel, org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.descriptionLabel.text")); // NOI18N
casesLabel.setHorizontalAlignment(javax.swing.SwingConstants.LEFT);
org.openide.awt.Mnemonics.setLocalizedText(casesLabel, org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.casesLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(casesLabel, org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.casesLabel.text")); // NOI18N
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
@ -243,8 +243,8 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
.addContainerGap())
);
searchButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleName")); // NOI18N
searchButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(OtherCasesSearchDialog.class, "OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleDescription")); // NOI18N
searchButton.getAccessibleContext().setAccessibleName(org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.searchButton.AccessibleContext.accessibleName")); // NOI18N
searchButton.getAccessibleContext().setAccessibleDescription(org.openide.util.NbBundle.getMessage(AllCasesSearchDialog.class, "AllCasesSearchDialog.searchButton.AccessibleContext.accessibleDescription")); // NOI18N
pack();
}// </editor-fold>//GEN-END:initComponents
@ -260,34 +260,34 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
String validationMessage;
switch (correlationType.getId()) {
case CorrelationAttributeInstance.FILES_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidHash();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidHash();
break;
case CorrelationAttributeInstance.DOMAIN_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidDomain();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidDomain();
break;
case CorrelationAttributeInstance.EMAIL_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidEmail();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidEmail();
break;
case CorrelationAttributeInstance.PHONE_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidPhone();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidPhone();
break;
case CorrelationAttributeInstance.SSID_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidSsid();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidSsid();
break;
case CorrelationAttributeInstance.MAC_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidMac();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidMac();
break;
case CorrelationAttributeInstance.IMEI_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidImei();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidImei();
break;
case CorrelationAttributeInstance.IMSI_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidImsi();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidImsi();
break;
case CorrelationAttributeInstance.ICCID_TYPE_ID:
validationMessage = Bundle.OtherCasesSearchDialog_validation_invalidIccid();
validationMessage = Bundle.AllCasesSearchDialog_validation_invalidIccid();
break;
default:
validationMessage = Bundle.OtherCasesSearchDialog_validation_genericMessage();
validationMessage = Bundle.AllCasesSearchDialog_validation_genericMessage();
break;
}
@ -340,7 +340,7 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
correlationTypes.clear();
correlationTypes.addAll(dbManager.getDefinedCorrelationTypes());
int numberOfCases = dbManager.getCases().size();
casesLabel.setText(Bundle.OtherCasesSearchDialog_caseLabel_text(numberOfCases));
casesLabel.setText(Bundle.AllCasesSearchDialog_caseLabel_text(numberOfCases));
} catch (EamDbException ex) {
logger.log(Level.SEVERE, "Unable to connect to the Central Repository database.", ex);
}
@ -385,16 +385,16 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
}
@Messages({
"OtherCasesSearchDialog.correlationValueTextField.filesExample=Example: \"f0e1d2c3b4a5968778695a4b3c2d1e0f\"",
"OtherCasesSearchDialog.correlationValueTextField.domainExample=Example: \"domain.com\"",
"OtherCasesSearchDialog.correlationValueTextField.emailExample=Example: \"user@host.com\"",
"OtherCasesSearchDialog.correlationValueTextField.phoneExample=Example: \"(800)123-4567\"",
"OtherCasesSearchDialog.correlationValueTextField.usbExample=Example: \"4&1234567&0\"",
"OtherCasesSearchDialog.correlationValueTextField.ssidExample=Example: \"WirelessNetwork-5G\"",
"OtherCasesSearchDialog.correlationValueTextField.macExample=Example: \"0C-14-F2-01-AF-45\"",
"OtherCasesSearchDialog.correlationValueTextField.imeiExample=Example: \"351756061523999\"",
"OtherCasesSearchDialog.correlationValueTextField.imsiExample=Example: \"310150123456789\"",
"OtherCasesSearchDialog.correlationValueTextField.iccidExample=Example: \"89 91 19 1299 99 329451 0\""
"AllCasesSearchDialog.correlationValueTextField.filesExample=Example: \"f0e1d2c3b4a5968778695a4b3c2d1e0f\"",
"AllCasesSearchDialog.correlationValueTextField.domainExample=Example: \"domain.com\"",
"AllCasesSearchDialog.correlationValueTextField.emailExample=Example: \"user@host.com\"",
"AllCasesSearchDialog.correlationValueTextField.phoneExample=Example: \"(800)123-4567\"",
"AllCasesSearchDialog.correlationValueTextField.usbExample=Example: \"4&1234567&0\"",
"AllCasesSearchDialog.correlationValueTextField.ssidExample=Example: \"WirelessNetwork-5G\"",
"AllCasesSearchDialog.correlationValueTextField.macExample=Example: \"0C-14-F2-01-AF-45\"",
"AllCasesSearchDialog.correlationValueTextField.imeiExample=Example: \"351756061523999\"",
"AllCasesSearchDialog.correlationValueTextField.imsiExample=Example: \"310150123456789\"",
"AllCasesSearchDialog.correlationValueTextField.iccidExample=Example: \"89 91 19 1299 99 329451 0\""
})
/**
* Update the text prompt of the name text field based on the input type
@ -407,34 +407,34 @@ final class OtherCasesSearchDialog extends javax.swing.JDialog {
String text;
switch (selectedCorrelationType.getId()) {
case CorrelationAttributeInstance.FILES_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_filesExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_filesExample();
break;
case CorrelationAttributeInstance.DOMAIN_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_domainExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_domainExample();
break;
case CorrelationAttributeInstance.EMAIL_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_emailExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_emailExample();
break;
case CorrelationAttributeInstance.PHONE_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_phoneExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_phoneExample();
break;
case CorrelationAttributeInstance.USBID_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_usbExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_usbExample();
break;
case CorrelationAttributeInstance.SSID_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_ssidExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_ssidExample();
break;
case CorrelationAttributeInstance.MAC_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_macExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_macExample();
break;
case CorrelationAttributeInstance.IMEI_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_imeiExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_imeiExample();
break;
case CorrelationAttributeInstance.IMSI_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_imsiExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_imsiExample();
break;
case CorrelationAttributeInstance.ICCID_TYPE_ID:
text = Bundle.OtherCasesSearchDialog_correlationValueTextField_iccidExample();
text = Bundle.AllCasesSearchDialog_correlationValueTextField_iccidExample();
break;
default:
text = "";

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.othercasessearch;
package org.sleuthkit.autopsy.allcasessearch;
import java.util.List;
import org.openide.nodes.AbstractNode;
@ -24,24 +24,24 @@ import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
/**
* Parent node to OtherCasesSearchChildren.
* Parent node to AllCasesSearchChildren.
*/
class OtherCasesSearchNode extends AbstractNode {
class AllCasesSearchNode extends AbstractNode {
/**
* Create an instance of OtherCasesSearchNode.
* Create an instance of AllCasesSearchNode.
*
* @param keys The list of CorrelationAttributeInstances.
*/
OtherCasesSearchNode(List<CorrelationAttributeInstance> keys) {
super(new OtherCasesSearchChildren(true, keys));
AllCasesSearchNode(List<CorrelationAttributeInstance> keys) {
super(new AllCasesSearchChildren(true, keys));
}
@Messages({
"OtherCasesSearchNode.getName.text=Other Cases Search"
"AllCasesSearchNode.getName.text=Other Cases Search"
})
@Override
public String getName() {
return Bundle.OtherCasesSearchNode_getName_text();
return Bundle.AllCasesSearchNode_getName_text();
}
}

View File

@ -0,0 +1,10 @@
AllCasesSearchDialog.descriptionLabel.text=<html>Search the Central Repository for correlation properties with a specified value. The search is case insensitive.</html>
AllCasesSearchDialog.errorLabel.text=\
AllCasesSearchDialog.correlationTypeLabel.text=Correlation Property Type:
AllCasesSearchDialog.searchButton.AccessibleContext.accessibleDescription=
AllCasesSearchDialog.searchButton.AccessibleContext.accessibleName=Search
AllCasesSearchDialog.searchButton.text=Search
AllCasesSearchDialog.correlationValueTextField.text=
AllCasesSearchDialog.correlationValueLabel.text=Correlation Property Value:
AllCasesSearchDialog.casesLabel.text=\

View File

@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.othercasessearch;
package org.sleuthkit.autopsy.allcasessearch;
import java.io.File;
import java.util.ArrayList;
@ -29,13 +29,12 @@ import org.openide.util.NbBundle;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationDataSource;
import org.sleuthkit.autopsy.othercasessearch.Bundle;
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;
import org.sleuthkit.autopsy.datamodel.DisplayableItemNodeVisitor;
import org.sleuthkit.autopsy.datamodel.NodeProperty;
/**
* Used by the Other Cases Search feature to encapsulate instances of a given
* Used by the All Cases Search feature to encapsulate instances of a given
* search match.
*/
public final class CorrelationAttributeInstanceNode extends DisplayableItemNode {

View File

@ -232,10 +232,12 @@ LocalDiskSelectionDialog.okButton.text=OK
LocalDiskPanel.localDiskLabel.text=Local Disk:
LocalDiskPanel.imageWriterErrorLabel.text=Error Label
LocalDiskSelectionDialog.title=Select Local Disk
ImageFilePanel.md5HashLabel.text=MD5 hash:
ImageFilePanel.sha1HashLabel.text=SHA-1 hash:
ImageFilePanel.sha256HashLabel.text=SHA-256 hash:
ImageFilePanel.md5HashLabel.text=MD5:
ImageFilePanel.sha1HashLabel.text=SHA-1:
ImageFilePanel.sha256HashLabel.text=SHA-256:
ImageFilePanel.sha256HashTextField.text=
ImageFilePanel.sha1HashTextField.text=
ImageFilePanel.md5HashTextField.text=
ImageFilePanel.errorLabel.text=Error Label
ImageFilePanel.hashValuesNoteLabel.text=NOTE: These values will not be validated when the data source is added.
ImageFilePanel.hashValuesLabel.text=Hash Values (optional):

View File

@ -1157,12 +1157,7 @@ public class Case {
/*
* Enable the case-specific actions.
*/
//Deny ability to add a data source if the special admin access file is present.
File denyAddDataSourcePermissions = new File(PlatformUtil.getUserConfigDirectory(), "_ndsp");
if(!denyAddDataSourcePermissions.exists()) {
CallableSystemAction.get(AddImageAction.class).setEnabled(true);
}
CallableSystemAction.get(CaseCloseAction.class).setEnabled(true);
CallableSystemAction.get(CasePropertiesAction.class).setEnabled(true);
CallableSystemAction.get(CaseDeleteAction.class).setEnabled(true);

View File

@ -46,6 +46,7 @@ import org.sleuthkit.autopsy.events.AutopsyEventPublisher;
import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.autopsy.ingest.events.DataSourceAnalysisCompletedEvent;
import org.sleuthkit.autopsy.ingest.events.DataSourceAnalysisStartedEvent;
import org.sleuthkit.datamodel.Content;
/**
* A collaboration monitor listens to local events and translates them into
@ -231,10 +232,13 @@ final class CollaborationMonitor {
* @param event A data source analysis started event.
*/
synchronized void addDataSourceAnalysisTask(DataSourceAnalysisStartedEvent event) {
String status = NbBundle.getMessage(CollaborationMonitor.class, "CollaborationMonitor.analyzingDataSourceStatus.msg", hostName, event.getDataSource().getName());
Content dataSource = event.getDataSource();
if (dataSource != null) {
String status = NbBundle.getMessage(CollaborationMonitor.class, "CollaborationMonitor.analyzingDataSourceStatus.msg", hostName, dataSource.getName());
jobIdsTodataSourceAnalysisTasks.put(event.getDataSourceIngestJobId(), new Task(++nextTaskId, status));
eventPublisher.publishRemotely(new CollaborationEvent(hostName, getCurrentTasks()));
}
}
/**
* Removes a data source analysis task from the collection of local

View File

@ -32,29 +32,45 @@
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="sha256HashLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="sha1HashLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="md5HashLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="sectorSizeLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="timeZoneLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="pathLabel" min="-2" max="-2" attributes="0"/>
<Component id="noFatOrphansCheckbox" alignment="0" min="-2" pref="262" max="-2" attributes="0"/>
</Group>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" max="-2" attributes="0">
<Component id="sha256HashTextField" pref="455" max="32767" attributes="0"/>
<Component id="sha1HashTextField" alignment="0" max="32767" attributes="0"/>
<Component id="md5HashTextField" alignment="0" max="32767" attributes="0"/>
<Component id="sectorSizeComboBox" alignment="0" max="32767" attributes="0"/>
<Component id="timeZoneComboBox" alignment="0" max="32767" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
<EmptySpace min="0" pref="368" max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="pathLabel" min="-2" max="-2" attributes="0"/>
<Component id="errorLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="noFatOrphansCheckbox" alignment="0" min="-2" pref="262" max="-2" attributes="0"/>
<Group type="103" alignment="0" groupAlignment="1" max="-2" attributes="0">
<Group type="102" attributes="0">
<Component id="timeZoneLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="timeZoneComboBox" min="-2" pref="455" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="325" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Component id="sectorSizeLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="sectorSizeComboBox" min="-2" pref="455" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="md5HashLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="md5HashTextField" min="-2" pref="455" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="sha1HashLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="sha1HashTextField" min="-2" pref="455" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="1" attributes="0">
<Component id="sha256HashLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
<Component id="sha256HashTextField" min="-2" pref="455" max="-2" attributes="0"/>
</Group>
</Group>
<Component id="hashValuesNoteLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="hashValuesLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -79,6 +95,8 @@
<Component id="sectorSizeComboBox" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="sectorSizeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="39" max="-2" attributes="0"/>
<Component id="hashValuesLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="md5HashTextField" alignment="3" min="-2" max="-2" attributes="0"/>
@ -95,8 +113,10 @@
<Component id="sha256HashLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hashValuesNoteLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="errorLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace pref="23" max="32767" attributes="0"/>
<EmptySpace pref="51" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@ -186,6 +206,7 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.sha256HashLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="sha256HashTextField">
@ -193,6 +214,7 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.sha256HashTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="sha1HashTextField">
@ -200,6 +222,7 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.sha1HashTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JTextField" name="md5HashTextField">
@ -207,6 +230,7 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.md5HashTextField.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="sha1HashLabel">
@ -214,6 +238,7 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.sha1HashLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="md5HashLabel">
@ -221,6 +246,23 @@
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.md5HashLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="hashValuesLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.hashValuesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="hashValuesNoteLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/casemodule/Bundle.properties" key="ImageFilePanel.hashValuesNoteLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
</Component>
</SubComponents>

View File

@ -156,6 +156,8 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
md5HashTextField = new javax.swing.JTextField();
sha1HashLabel = new javax.swing.JLabel();
md5HashLabel = new javax.swing.JLabel();
hashValuesLabel = new javax.swing.JLabel();
hashValuesNoteLabel = new javax.swing.JLabel();
setMinimumSize(new java.awt.Dimension(0, 65));
setPreferredSize(new java.awt.Dimension(403, 65));
@ -184,16 +186,28 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
org.openide.awt.Mnemonics.setLocalizedText(sectorSizeLabel, org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.sectorSizeLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(sha256HashLabel, org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.sha256HashLabel.text")); // NOI18N
sha256HashLabel.setEnabled(false);
sha256HashTextField.setText(org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.sha256HashTextField.text")); // NOI18N
sha256HashTextField.setEnabled(false);
sha1HashTextField.setText(org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.sha1HashTextField.text")); // NOI18N
sha1HashTextField.setEnabled(false);
md5HashTextField.setText(org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.md5HashTextField.text")); // NOI18N
md5HashTextField.setEnabled(false);
org.openide.awt.Mnemonics.setLocalizedText(sha1HashLabel, org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.sha1HashLabel.text")); // NOI18N
sha1HashLabel.setEnabled(false);
org.openide.awt.Mnemonics.setLocalizedText(md5HashLabel, org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.md5HashLabel.text")); // NOI18N
md5HashLabel.setEnabled(false);
org.openide.awt.Mnemonics.setLocalizedText(hashValuesLabel, org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.hashValuesLabel.text")); // NOI18N
hashValuesLabel.setEnabled(false);
org.openide.awt.Mnemonics.setLocalizedText(hashValuesNoteLabel, org.openide.util.NbBundle.getMessage(ImageFilePanel.class, "ImageFilePanel.hashValuesNoteLabel.text")); // NOI18N
hashValuesNoteLabel.setEnabled(false);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
@ -206,25 +220,36 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
.addGap(2, 2, 2))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sha256HashLabel)
.addComponent(sha1HashLabel)
.addComponent(md5HashLabel)
.addComponent(sectorSizeLabel)
.addComponent(timeZoneLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
.addComponent(sha256HashTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 455, Short.MAX_VALUE)
.addComponent(sha1HashTextField)
.addComponent(md5HashTextField)
.addComponent(sectorSizeComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(timeZoneComboBox, 0, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addComponent(pathLabel)
.addComponent(noFatOrphansCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 368, Short.MAX_VALUE))
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(pathLabel)
.addComponent(errorLabel)
.addComponent(noFatOrphansCheckbox, javax.swing.GroupLayout.PREFERRED_SIZE, 262, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(0, 325, Short.MAX_VALUE))
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
.addComponent(timeZoneLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(timeZoneComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 455, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(sectorSizeLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(sectorSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 455, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(md5HashLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(md5HashTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 455, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(sha1HashLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(sha1HashTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 455, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(layout.createSequentialGroup()
.addComponent(sha256HashLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(sha256HashTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 455, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addComponent(hashValuesNoteLabel)
.addComponent(hashValuesLabel))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -244,6 +269,8 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(sectorSizeComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sectorSizeLabel))
.addGap(39, 39, 39)
.addComponent(hashValuesLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(md5HashTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@ -257,8 +284,10 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
.addComponent(sha256HashTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(sha256HashLabel))
.addGap(18, 18, 18)
.addComponent(hashValuesNoteLabel)
.addGap(18, 18, 18)
.addComponent(errorLabel)
.addContainerGap(23, Short.MAX_VALUE))
.addContainerGap(51, Short.MAX_VALUE))
);
}// </editor-fold>//GEN-END:initComponents
@ -286,6 +315,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
}
}
}
setContentPath(path);
}
@ -295,6 +325,8 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton browseButton;
private javax.swing.JLabel errorLabel;
private javax.swing.JLabel hashValuesLabel;
private javax.swing.JLabel hashValuesNoteLabel;
private javax.swing.JLabel md5HashLabel;
private javax.swing.JTextField md5HashTextField;
private javax.swing.JCheckBox noFatOrphansCheckbox;
@ -310,6 +342,25 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
private javax.swing.JLabel timeZoneLabel;
// End of variables declaration//GEN-END:variables
/**
* Enable or disable all of the hash values components.
*
* @param enabled Enable components if true; otherwise disable.
*/
private void setHashValuesComponentsEnabled(boolean enabled) {
hashValuesLabel.setEnabled(enabled);
hashValuesNoteLabel.setEnabled(enabled);
md5HashLabel.setEnabled(enabled);
md5HashTextField.setEnabled(enabled);
sha1HashLabel.setEnabled(enabled);
sha1HashTextField.setEnabled(enabled);
sha256HashLabel.setEnabled(enabled);
sha256HashTextField.setEnabled(enabled);
}
/**
* Get the path of the user selected image.
*
@ -383,7 +434,7 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
errorLabel.setVisible(false);
String path = getContentPaths();
if (StringUtils.isBlank(path) || (!(new File(path).isFile() || DriveUtils.isPhysicalDrive(path) || DriveUtils.isPartition(path)))) {
if (!isImagePathValid()) {
return false;
}
@ -413,6 +464,16 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
return true;
}
private boolean isImagePathValid() {
String path = getContentPaths();
if (StringUtils.isBlank(path) || (!(new File(path).isFile() || DriveUtils.isPhysicalDrive(path) || DriveUtils.isPartition(path)))) {
return false;
}
return true;
}
public void storeSettings() {
String imagePathName = getContentPaths();
if (null != imagePathName) {
@ -446,13 +507,19 @@ public class ImageFilePanel extends JPanel implements DocumentListener {
/**
* Update functions are called by the pathTextField which has this set as
* it's DocumentEventListener. Each update function fires a property change
* to be caught by the parent panel.
*
* to be caught by the parent panel. Additionally, the hash values will be
* enabled or disabled depending on the pathTextField input.
*/
@NbBundle.Messages({"ImageFilePanel.moduleErr=Module Error",
"ImageFilePanel.moduleErr.msg=A module caused an error listening to ImageFilePanel updates."
+ " See log to determine which module. Some data could be incomplete.\n"})
private void updateHelper() {
if (isImagePathValid() && !getContentPaths().toLowerCase().endsWith(".e01")) {
setHashValuesComponentsEnabled(true);
} else {
setHashValuesComponentsEnabled(false);
}
firePropertyChange(DataSourceProcessor.DSP_PANEL_EVENT.UPDATE_UI.toString(), false, true);
}

View File

@ -22,7 +22,6 @@ import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.util.Arrays;
import java.util.List;
import java.util.ArrayList;
import java.util.logging.Level;
import java.io.File;
import javax.swing.JFileChooser;
@ -261,7 +260,7 @@ class MissingImageDialog extends javax.swing.JDialog {
this.dispose();
} catch (TskCoreException ex) {
lbWarning.setText(NbBundle.getMessage(this.getClass(), "MissingImageDialog.ErrorSettingImage"));
logger.log(Level.WARNING, "Error setting image paths", ex); //NON-NLS
logger.log(Level.SEVERE, "Error setting image paths", ex); //NON-NLS
}
}//GEN-LAST:event_selectButtonActionPerformed

View File

@ -54,6 +54,9 @@ public class Services implements Closeable {
tagsManager = new TagsManager(caseDb);
servicesList.add(tagsManager);
//This lookup fails in the functional test code. See JIRA-4571 for details.
//For the time being, the closing of this service at line 108 will be made
//null safe so that the functional tests run with no issues.
keywordSearchService = Lookup.getDefault().lookup(KeywordSearchService.class);
servicesList.add(keywordSearchService);
@ -108,8 +111,10 @@ public class Services implements Closeable {
@Override
public void close() throws IOException {
for (Closeable service : servicesList) {
if(service != null) {
service.close();
}
}
}
}

View File

@ -25,7 +25,7 @@ import javax.swing.Action;
import org.openide.util.Utilities;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.corecomponentinterfaces.ContextMenuActionsProvider;
import org.sleuthkit.datamodel.AbstractFile;
@ -46,7 +46,7 @@ public class CentralRepoContextMenuActionsProvider implements ContextMenuActions
}
for (AbstractFile file : selectedFiles) {
if (EamDbUtil.useCentralRepo() && EamArtifactUtil.isSupportedAbstractFileType(file) && file.isFile()) {
if (EamDb.isEnabled() && EamArtifactUtil.isSupportedAbstractFileType(file) && file.isFile()) {
AddEditCentralRepoCommentAction action = new AddEditCentralRepoCommentAction(file);
if (action.getCorrelationAttribute() == null) {
action.setEnabled(false);

View File

@ -71,7 +71,6 @@ import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskData;
@ -891,7 +890,7 @@ public class DataContentViewerOtherCases extends JPanel implements DataContentVi
private void rightClickPopupMenuPopupMenuWillBecomeVisible(javax.swing.event.PopupMenuEvent evt) {//GEN-FIRST:event_rightClickPopupMenuPopupMenuWillBecomeVisible
boolean enableCentralRepoActions = false;
if (EamDbUtil.useCentralRepo() && otherCasesTable.getSelectedRowCount() == 1) {
if (EamDb.isEnabled() && otherCasesTable.getSelectedRowCount() == 1) {
int rowIndex = otherCasesTable.getSelectedRow();
OtherOccurrenceNodeData selectedNode = (OtherOccurrenceNodeData) tableModel.getRow(rowIndex);
if (selectedNode instanceof OtherOccurrenceNodeInstanceData) {

View File

@ -49,7 +49,7 @@ public class DataContentViewerOtherCasesTableCellRenderer implements TableCellRe
foreground = Color.WHITE;
background = Color.BLUE;
} else {
String known_status = (String) table.getModel().getValueAt(row,
String known_status = (String) table.getModel().getValueAt(table.convertRowIndexToModel(row),
table.getColumn(DataContentViewerOtherCasesTableModel.TableColumns.KNOWN.columnName()).getModelIndex());
if (known_status.equals(TskData.FileKnown.BAD.getName())) {
foreground = Color.WHITE;

View File

@ -40,6 +40,7 @@ import java.util.Set;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.TimeUnit;
import java.util.logging.Level;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
import static org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil.updateSchemaVersion;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -60,7 +61,7 @@ abstract class AbstractSqlEamDb implements EamDb {
static final String SCHEMA_MINOR_VERSION_KEY = "SCHEMA_MINOR_VERSION";
static final String CREATION_SCHEMA_MAJOR_VERSION_KEY = "CREATION_SCHEMA_MAJOR_VERSION";
static final String CREATION_SCHEMA_MINOR_VERSION_KEY = "CREATION_SCHEMA_MINOR_VERSION";
static final CaseDbSchemaVersionNumber CURRENT_DB_SCHEMA_VERSION = new CaseDbSchemaVersionNumber(1, 2);
static final CaseDbSchemaVersionNumber SOFTWARE_CR_DB_SCHEMA_VERSION = new CaseDbSchemaVersionNumber(1, 2);
protected final List<CorrelationAttributeInstance.Type> defaultCorrelationTypes;
@ -3170,8 +3171,9 @@ abstract class AbstractSqlEamDb implements EamDb {
*
* @throws EamDbException
*/
@Messages({"AbstractSqlEamDb.upgradeSchema.incompatible=The selected Central Repository is not compatible with the current version of the application, please upgrade the application if you wish to use this Central Repository."})
@Override
public void upgradeSchema() throws EamDbException, SQLException {
public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException {
ResultSet resultSet = null;
Statement statement = null;
@ -3220,11 +3222,18 @@ abstract class AbstractSqlEamDb implements EamDb {
* schema updates that may already have been done once.
*/
CaseDbSchemaVersionNumber dbSchemaVersion = new CaseDbSchemaVersionNumber(majorVersion, minorVersion);
if (dbSchemaVersion.equals(CURRENT_DB_SCHEMA_VERSION)) {
//compare the major versions for compatability
//we can not use the CaseDbSchemaVersionNumber.isCompatible method
//because it is specific to case db schema versions only supporting major versions greater than 1
if (SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() < dbSchemaVersion.getMajor()) {
throw new IncompatibleCentralRepoException(Bundle.AbstractSqlEamDb_upgradeSchema_incompatible());
}
if (dbSchemaVersion.equals(SOFTWARE_CR_DB_SCHEMA_VERSION)) {
logger.log(Level.INFO, "Central Repository is up to date");
return;
}
if (dbSchemaVersion.compareTo(CURRENT_DB_SCHEMA_VERSION) > 0) {
if (dbSchemaVersion.compareTo(SOFTWARE_CR_DB_SCHEMA_VERSION) > 0) {
logger.log(Level.INFO, "Central Repository is of newer version than software creates");
return;
}
@ -3386,8 +3395,8 @@ abstract class AbstractSqlEamDb implements EamDb {
* column having a UNIQUE constraint. The name column could now
* be used as the primary key, but the essentially useless id
* column is retained for the sake of backwards compatibility.
* Note that the creation schema version number is set to 0.0
* to indicate that it is unknown.
* Note that the creation schema version number is set to 0.0 to
* indicate that it is unknown.
*/
String creationMajorVer;
resultSet = statement.executeQuery("SELECT value FROM db_info WHERE name = '" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "'");
@ -3417,7 +3426,7 @@ abstract class AbstractSqlEamDb implements EamDb {
updateSchemaVersion(conn);
conn.commit();
logger.log(Level.INFO, String.format("Central Repository schema updated to version %s", CURRENT_DB_SCHEMA_VERSION));
logger.log(Level.INFO, String.format("Central Repository schema updated to version %s", SOFTWARE_CR_DB_SCHEMA_VERSION));
} catch (SQLException | EamDbException ex) {
try {
@ -3425,7 +3434,7 @@ abstract class AbstractSqlEamDb implements EamDb {
conn.rollback();
}
} catch (SQLException ex2) {
logger.log(Level.SEVERE, String.format("Central Repository rollback of failed schema update to %s failed", CURRENT_DB_SCHEMA_VERSION), ex2);
logger.log(Level.SEVERE, String.format("Central Repository rollback of failed schema update to %s failed", SOFTWARE_CR_DB_SCHEMA_VERSION), ex2);
}
throw ex;
} finally {

View File

@ -98,7 +98,7 @@ public class CorrelationDataSource implements Serializable {
}
CorrelationDataSource correlationDataSource = null;
boolean useCR = EamDbUtil.useCentralRepo();
boolean useCR = EamDb.isEnabled();
if (useCR) {
correlationDataSource = EamDb.getInstance().getDataSource(correlationCase, dataSource.getId());
}

View File

@ -51,7 +51,7 @@ public class DataSourceUpdateService implements AutopsyService {
//ResultSet.getLong has a value of 0 when the value is null
if (correlationDataSource.getCaseID() == correlationCase.getID() && correlationDataSource.getDataSourceObjectID() == 0) {
for (Content dataSource : context.getCase().getDataSources()) {
if (((DataSource) dataSource).getDeviceId().equals(correlationDataSource.getDeviceID())) {
if (((DataSource) dataSource).getDeviceId().equals(correlationDataSource.getDeviceID()) && dataSource.getName().equals(correlationDataSource.getName())) {
centralRepository.addDataSourceObjectId(correlationDataSource.getID(), dataSource.getId());
break;
}

View File

@ -27,6 +27,7 @@ import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardArtifact.ARTIFACT_TYPE;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
import org.sleuthkit.datamodel.Content;
@ -76,32 +77,22 @@ public class EamArtifactUtil {
artifactForInstance = artifact;
}
if (artifactForInstance != null) {
switch (BlackboardArtifact.ARTIFACT_TYPE.fromID(artifactForInstance.getArtifactTypeID())) {
case TSK_KEYWORD_HIT: {
int artifactTypeID = artifactForInstance.getArtifactTypeID();
if (artifactTypeID == ARTIFACT_TYPE.TSK_KEYWORD_HIT.getTypeID()) {
BlackboardAttribute setNameAttr = artifactForInstance.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME));
if (setNameAttr != null
&& EamArtifactUtil.getEmailAddressAttrString().equals(setNameAttr.getValueString())) {
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD, CorrelationAttributeInstance.EMAIL_TYPE_ID);
}
break;
}
case TSK_WEB_BOOKMARK:
} else if (artifactTypeID == ARTIFACT_TYPE.TSK_WEB_BOOKMARK.getTypeID()
|| artifactTypeID == ARTIFACT_TYPE.TSK_WEB_COOKIE.getTypeID()
|| artifactTypeID == ARTIFACT_TYPE.TSK_WEB_DOWNLOAD.getTypeID()
|| artifactTypeID == ARTIFACT_TYPE.TSK_WEB_HISTORY.getTypeID()) {
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN, CorrelationAttributeInstance.DOMAIN_TYPE_ID);
break;
case TSK_WEB_COOKIE:
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN, CorrelationAttributeInstance.DOMAIN_TYPE_ID);
break;
case TSK_WEB_DOWNLOAD:
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN, CorrelationAttributeInstance.DOMAIN_TYPE_ID);
break;
case TSK_WEB_HISTORY:
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DOMAIN, CorrelationAttributeInstance.DOMAIN_TYPE_ID);
break;
case TSK_CONTACT:
//generates the same correlation attrs as tsk_message
case TSK_CALLLOG:
//generates the same correlation attrs as tsk_message
case TSK_MESSAGE: {
} else if (artifactTypeID == ARTIFACT_TYPE.TSK_CONTACT.getTypeID()
|| artifactTypeID == ARTIFACT_TYPE.TSK_CALLLOG.getTypeID()
|| artifactTypeID == ARTIFACT_TYPE.TSK_MESSAGE.getTypeID()) {
String value = null;
if (null != artifactForInstance.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER))) {
value = artifactForInstance.getAttribute(new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER)).getValueString();
@ -126,35 +117,22 @@ public class EamArtifactUtil {
}
}
}
break;
}
case TSK_DEVICE_ATTACHED:
} else if (artifactTypeID == ARTIFACT_TYPE.TSK_DEVICE_ATTACHED.getTypeID()) {
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DEVICE_ID, CorrelationAttributeInstance.USBID_TYPE_ID);
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MAC_ADDRESS, CorrelationAttributeInstance.MAC_TYPE_ID);
break;
case TSK_WIFI_NETWORK:
} else if (artifactTypeID == ARTIFACT_TYPE.TSK_WIFI_NETWORK.getTypeID()) {
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SSID, CorrelationAttributeInstance.SSID_TYPE_ID);
break;
case TSK_WIFI_NETWORK_ADAPTER:
} else if (artifactTypeID == ARTIFACT_TYPE.TSK_WIFI_NETWORK_ADAPTER.getTypeID()
|| artifactTypeID == ARTIFACT_TYPE.TSK_BLUETOOTH_PAIRING.getTypeID()
|| artifactTypeID == ARTIFACT_TYPE.TSK_BLUETOOTH_ADAPTER.getTypeID()) {
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MAC_ADDRESS, CorrelationAttributeInstance.MAC_TYPE_ID);
break;
case TSK_BLUETOOTH_PAIRING:
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MAC_ADDRESS, CorrelationAttributeInstance.MAC_TYPE_ID);
break;
case TSK_BLUETOOTH_ADAPTER:
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MAC_ADDRESS, CorrelationAttributeInstance.MAC_TYPE_ID);
break;
case TSK_DEVICE_INFO:
} else if (artifactTypeID == ARTIFACT_TYPE.TSK_DEVICE_INFO.getTypeID()) {
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IMEI, CorrelationAttributeInstance.IMEI_TYPE_ID);
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IMSI, CorrelationAttributeInstance.IMSI_TYPE_ID);
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ICCID, CorrelationAttributeInstance.ICCID_TYPE_ID);
break;
case TSK_SIM_ATTACHED:
} else if (artifactTypeID == ARTIFACT_TYPE.TSK_SIM_ATTACHED.getTypeID()) {
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_IMSI, CorrelationAttributeInstance.IMSI_TYPE_ID);
addCorrelationAttributeToList(eamArtifacts, artifactForInstance, BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ICCID, CorrelationAttributeInstance.ICCID_TYPE_ID);
break;
default:
break;
}
}
} catch (EamDbException ex) {

View File

@ -41,7 +41,7 @@ public interface EamDb {
static EamDb getInstance() throws EamDbException {
EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.DISABLED;
if (EamDbUtil.useCentralRepo()) {
if (EamDbUtil.allowUseOfCentralRepository()) {
selectedPlatform = EamDbPlatformEnum.getSelectedPlatform();
}
switch (selectedPlatform) {
@ -92,7 +92,7 @@ public interface EamDb {
* @return Is the database enabled
*/
static boolean isEnabled() {
return EamDbUtil.useCentralRepo()
return EamDbUtil.allowUseOfCentralRepository()
&& EamDbPlatformEnum.getSelectedPlatform() != EamDbPlatformEnum.DISABLED;
}
@ -710,7 +710,7 @@ public interface EamDb {
*
* @throws EamDbException
*/
public void upgradeSchema() throws EamDbException, SQLException;
public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException;
/**
* Gets an exclusive lock (if applicable). Will return the lock if

View File

@ -25,11 +25,12 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.List;
import java.util.logging.Level;
import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.CURRENT_DB_SCHEMA_VERSION;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.coordinationservice.CoordinationService;
import org.sleuthkit.autopsy.coordinationservice.CoordinationService.CoordinationServiceException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.SOFTWARE_CR_DB_SCHEMA_VERSION;
/**
*
@ -134,8 +135,8 @@ public class EamDbUtil {
*/
static void updateSchemaVersion(Connection conn) throws SQLException {
try (Statement statement = conn.createStatement()) {
statement.execute("UPDATE db_info SET value = '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "'");
statement.execute("UPDATE db_info SET value = '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "'");
statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "'");
statement.execute("UPDATE db_info SET value = '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "' WHERE name = '" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "'");
}
}
@ -169,12 +170,11 @@ public class EamDbUtil {
* Upgrade the current Central Reposity schema to the newest version. If the
* upgrade fails, the Central Repository will be disabled and the current
* settings will be cleared.
*
* @return true if the upgrade succeeds, false otherwise.
*/
public static boolean upgradeDatabase() {
@Messages({"EamDbUtil.centralRepoUpgradeFailed.message=Failed to upgrade central repository. It has been disabled."})
public static void upgradeDatabase() throws EamDbException {
if (!EamDb.isEnabled()) {
return true;
return;
}
CoordinationService.Lock lock = null;
@ -188,7 +188,7 @@ public class EamDbUtil {
db.upgradeSchema();
} catch (EamDbException | SQLException ex) {
} catch (EamDbException | SQLException | IncompatibleCentralRepoException ex) {
LOGGER.log(Level.SEVERE, "Error updating central repository", ex);
// Disable the central repo and clear the current settings.
@ -197,13 +197,15 @@ public class EamDbUtil {
EamDb.getInstance().shutdownConnections();
}
} catch (EamDbException ex2) {
LOGGER.log(Level.SEVERE, "Error shutting down central repo connection pool", ex);
LOGGER.log(Level.SEVERE, "Error shutting down central repo connection pool", ex2);
}
setUseCentralRepo(false);
EamDbPlatformEnum.setSelectedPlatform(EamDbPlatformEnum.DISABLED.name());
EamDbPlatformEnum.saveSelectedPlatform();
return false;
String messageForDialog = Bundle.EamDbUtil_centralRepoUpgradeFailed_message();
if (ex instanceof IncompatibleCentralRepoException) {
messageForDialog = ex.getMessage() + "\n\n" + messageForDialog;
}
throw new EamDbException(messageForDialog);
} finally {
if (lock != null) {
try {
@ -213,7 +215,6 @@ public class EamDbUtil {
}
}
}
return true;
}
/**
@ -268,12 +269,16 @@ public class EamDbUtil {
}
/**
* If the Central Repos use has been enabled.
* If the option to use a central repository has been selected, does not
* indicate the central repository is configured for use simply that the
* checkbox allowing configuration is checked on the options panel.
*
* @return true if the Central Repo may be configured, false if it should
* not be able to be
*/
public static boolean useCentralRepo() {
public static boolean allowUseOfCentralRepository() {
//In almost all situations EamDb.isEnabled() should be used instead of this method
//as EamDb.isEnabled() will call this method as well as checking that the selected type of central repository is not DISABLED
return Boolean.parseBoolean(ModuleSettings.getConfigSetting(CENTRAL_REPO_NAME, CENTRAL_REPO_USE_KEY));
}

View File

@ -0,0 +1,53 @@
/*
*
* Autopsy Forensic Browser
*
* Copyright 2018 Basis Technology Corp.
* Contact: carrier <at> sleuthkit <dot> org
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.centralrepository.datamodel;
/**
* Exception to denote that the Central Repo is not compatable with the current version of the software.
*/
public class IncompatibleCentralRepoException extends Exception {
private static final long serialVersionUID = 1L;
/**
* Construct an exception with the given message.
* @param message error message
*/
public IncompatibleCentralRepoException(String message){
super(message);
}
/**
* Construct an exception with the given message and inner exception.
* @param message error message
* @param cause inner exception
*/
public IncompatibleCentralRepoException(String message, Throwable cause){
super(message, cause);
}
/**
* Construct an exception with the given inner exception.
* @param cause inner exception
*/
public IncompatibleCentralRepoException(Throwable cause){
super(cause);
}
}

View File

@ -28,11 +28,11 @@ import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
import java.util.regex.Pattern;
import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.CURRENT_DB_SCHEMA_VERSION;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.TextConverter;
import org.sleuthkit.autopsy.coreutils.TextConverterException;
import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.SOFTWARE_CR_DB_SCHEMA_VERSION;
/**
* Settings for the Postgres implementation of the Central Repository database
@ -437,10 +437,10 @@ public final class PostgresEamDbSettings {
* name column could be the primary key.
*/
stmt.execute("CREATE TABLE db_info (id SERIAL, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
// Create a separate instance and reference table for each correlation type
List<CorrelationAttributeInstance.Type> DEFAULT_CORRELATION_TYPES = CorrelationAttributeInstance.getDefaultCorrelationTypes();

View File

@ -1118,7 +1118,7 @@ final class SqliteEamDb extends AbstractSqlEamDb {
* @throws EamDbException
*/
@Override
public void upgradeSchema() throws EamDbException, SQLException {
public void upgradeSchema() throws EamDbException, SQLException, IncompatibleCentralRepoException {
try {
acquireExclusiveLock();
super.upgradeSchema();

View File

@ -29,10 +29,10 @@ import java.sql.Statement;
import java.util.List;
import java.util.logging.Level;
import java.util.regex.Pattern;
import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.CURRENT_DB_SCHEMA_VERSION;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import static org.sleuthkit.autopsy.centralrepository.datamodel.AbstractSqlEamDb.SOFTWARE_CR_DB_SCHEMA_VERSION;
/**
* Settings for the sqlite implementation of the Central Repository database
@ -386,10 +386,10 @@ public final class SqliteEamDbSettings {
* name column could be the primary key.
*/
stmt.execute("CREATE TABLE db_info (id INTEGER PRIMARY KEY, name TEXT UNIQUE NOT NULL, value TEXT NOT NULL)");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + CURRENT_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MAJOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMajor() + "')");
stmt.execute("INSERT INTO db_info (name, value) VALUES ('" + AbstractSqlEamDb.CREATION_SCHEMA_MINOR_VERSION_KEY + "', '" + SOFTWARE_CR_DB_SCHEMA_VERSION.getMinor() + "')");
// Create a separate instance and reference table for each artifact type
List<CorrelationAttributeInstance.Type> DEFAULT_CORRELATION_TYPES = CorrelationAttributeInstance.getDefaultCorrelationTypes();

View File

@ -23,6 +23,7 @@ import org.openide.modules.ModuleInstall;
import org.openide.util.NbBundle;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
import org.sleuthkit.autopsy.core.RuntimeProperties;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -50,21 +51,20 @@ public class Installer extends ModuleInstall {
super();
}
@NbBundle.Messages({"Installer.centralRepoUpgradeFailed.title=Central repository upgrade failed",
"Installer.centralRepoUpgradeFailed.message=Failed to upgrade central repository. It has been disabled."
})
@NbBundle.Messages({"Installer.centralRepoUpgradeFailed.title=Central repository upgrade failed"})
@Override
public void restored() {
Case.addPropertyChangeListener(pcl);
ieListener.installListeners();
// Perform the database upgrade and inform the user if it fails
if (!EamDbUtil.upgradeDatabase()) {
try {
EamDbUtil.upgradeDatabase();
} catch (EamDbException ex) {
if (RuntimeProperties.runningWithGUI()) {
WindowManager.getDefault().invokeWhenUIReady(() -> {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(this.getClass(),
"Installer.centralRepoUpgradeFailed.message"),
ex.getMessage(),
NbBundle.getMessage(this.getClass(),
"Installer.centralRepoUpgradeFailed.title"),
JOptionPane.ERROR_MESSAGE);

View File

@ -455,10 +455,13 @@ public class EamDbSettingsDialog extends JDialog {
testingStatus = DatabaseTestResult.TESTEDOK;
valid();
}
/**
* Returns if changes to the central repository configuration were successfully applied
* Returns if changes to the central repository configuration were
* successfully applied
*
* @return true if the database configuration was successfully changed false if it was not
* @return true if the database configuration was successfully changed false
* if it was not
*/
boolean wasConfigurationChanged() {
return configurationChanged;

View File

@ -30,6 +30,7 @@ import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.autopsy.events.AutopsyEvent;
import org.sleuthkit.autopsy.ingest.IngestManager;
@ -75,9 +76,7 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
ingestStateUpdated(Case.isCaseOpen());
}
@Messages({"GlobalSettingsPanel.updateFailed.title=Update failed",
"GlobalSettingsPanel.updateFailed.message=Failed to update database. Central repository has been disabled."
})
@Messages({"GlobalSettingsPanel.updateFailed.title=Central repository upgrade failed"})
private void updateDatabase() {
if (EamDbPlatformEnum.getSelectedPlatform().equals(DISABLED)) {
@ -86,16 +85,15 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
try {
boolean result = EamDbUtil.upgradeDatabase();
EamDbUtil.upgradeDatabase();
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
} catch (EamDbException ex) {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
if (!result) {
JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(),
"GlobalSettingsPanel.updateFailed.message"),
ex.getMessage(),
NbBundle.getMessage(this.getClass(),
"GlobalSettingsPanel.updateFailed.title"),
JOptionPane.WARNING_MESSAGE);
}
} finally {
setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
}
@ -426,22 +424,13 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
private void bnDbConfigureActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnDbConfigureActionPerformed
store();
EamDbSettingsDialog dialog = new EamDbSettingsDialog();
if (dialog.wasConfigurationChanged()) {
updateDatabase();
load(); // reload db settings content and update buttons
if (dialog.wasConfigurationChanged()) {
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}
}//GEN-LAST:event_bnDbConfigureActionPerformed
private void cbUseCentralRepoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbUseCentralRepoActionPerformed
//if saved setting is disabled checkbox should be disabled already
store();
updateDatabase();
load();
this.ingestStateUpdated(Case.isCaseOpen());
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_cbUseCentralRepoActionPerformed
private void manageOrganizationButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_manageOrganizationButtonActionPerformed
store();
ManageOrganizationsDialog manageOrganizationsDialog = new ManageOrganizationsDialog();
@ -452,13 +441,22 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
ManageCasesDialog.displayManageCasesDialog();
}//GEN-LAST:event_showCasesButtonActionPerformed
private void cbUseCentralRepoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cbUseCentralRepoActionPerformed
//if saved setting is disabled checkbox should be disabled already
store();
updateDatabase();
load();
this.ingestStateUpdated(Case.isCaseOpen());
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}//GEN-LAST:event_cbUseCentralRepoActionPerformed
@Override
@Messages({"GlobalSettingsPanel.validationerrMsg.mustConfigure=Configure the database to enable this module."})
public void load() {
tbOops.setText("");
enableButtonSubComponents(false);
EamDbPlatformEnum selectedPlatform = EamDbPlatformEnum.getSelectedPlatform();
cbUseCentralRepo.setSelected(EamDbUtil.useCentralRepo()); // NON-NLS
cbUseCentralRepo.setSelected(EamDbUtil.allowUseOfCentralRepository()); // NON-NLS
switch (selectedPlatform) {
case POSTGRESQL:
PostgresEamDbSettings dbSettingsPg = new PostgresEamDbSettings();

View File

@ -81,7 +81,7 @@ final public class CentralRepoCommonAttributeInstance extends AbstractCommonAttr
// Find the correct data source
Optional<DataSource> dataSource = tskDb.getDataSources().stream()
.filter(p -> p.getDeviceId().equals(currentAttribute.getCorrelationDataSource().getDeviceID()))
.filter(p -> p.getId() == currentAttribute.getCorrelationDataSource().getDataSourceObjectID())
.findFirst();
if (!dataSource.isPresent()) {
LOGGER.log(Level.WARNING, String.format("Unable to find data source with device ID %s in the current case", currentAttribute.getCorrelationDataSource().getDeviceID()));

View File

@ -19,7 +19,7 @@
package org.sleuthkit.autopsy.commonfilesearch;
import org.sleuthkit.autopsy.guiutils.DataSourceComboBoxModel;
import org.sleuthkit.autopsy.guiutils.DataSourceLoader;
import org.sleuthkit.autopsy.datamodel.utils.DataSourceLoader;
import java.awt.Dimension;
import java.sql.SQLException;
import java.util.ArrayList;

View File

@ -331,8 +331,8 @@ final class InterCaseSearchResultsProcessor {
CorrelationCase correlationCase = EamDb.getInstance().getCaseById(InstanceTableCallback.getCaseId(resultSet));
String caseName = correlationCase.getDisplayName();
CorrelationDataSource correlationDatasource = EamDb.getInstance().getDataSourceById(correlationCase, InstanceTableCallback.getDataSourceId(resultSet));
// String dataSourceName = correlationDatasource.getName();
String dataSourceNameKey = correlationDatasource.getName() + correlationDatasource.getDataSourceObjectID();
//label datasource with it's id for uniqueness done in same manner as ImageGallery does in the DataSourceCell class
String dataSourceNameKey = correlationDatasource.getName() + " (Id: " + correlationDatasource.getDataSourceObjectID() + ")";
if (!caseCollatedDataSourceCollections.containsKey(caseName)) {
caseCollatedDataSourceCollections.put(caseName, new HashMap<String, CommonAttributeValueList>());
}

View File

@ -24,7 +24,6 @@ import java.util.logging.Level;
import org.apache.commons.lang3.StringUtils;
import org.openide.nodes.Sheet;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.BlackboardArtifactNode;
@ -74,12 +73,12 @@ final class RelationshipNode extends BlackboardArtifactNode {
addScoreProperty(sheetSet, tags);
CorrelationAttributeInstance correlationAttribute = null;
if (EamDbUtil.useCentralRepo() && UserPreferences.hideCentralRepoCommentsAndOccurrences()== false) {
if (UserPreferences.hideCentralRepoCommentsAndOccurrences()== false) {
correlationAttribute = getCorrelationAttributeInstance();
}
addCommentProperty(sheetSet, tags, correlationAttribute);
if (EamDbUtil.useCentralRepo() && UserPreferences.hideCentralRepoCommentsAndOccurrences()== false) {
if (UserPreferences.hideCentralRepoCommentsAndOccurrences()== false) {
addCountProperty(sheetSet, correlationAttribute);
}
final BlackboardArtifact artifact = getArtifact();

View File

@ -47,7 +47,7 @@ public class FileViewer extends javax.swing.JPanel implements DataContentViewer
private final Map<String, FileTypeViewer> mimeTypeToViewerMap = new HashMap<>();
// TBD: This hardcoded list of viewers should be replaced with a dynamic lookup
private static final FileTypeViewer[] KNOWN_VIEWERS = new FileTypeViewer[]{
private final FileTypeViewer[] KNOWN_VIEWERS = new FileTypeViewer[]{
new SQLiteViewer(),
new PListViewer(),
new MediaFileViewer()

View File

@ -38,16 +38,12 @@ import org.openide.nodes.Node;
import org.openide.nodes.Sheet;
import org.openide.util.NbBundle;
import org.openide.util.lookup.ServiceProvider;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.corecomponents.DataResultPanel;
import org.sleuthkit.autopsy.corecomponents.TableFilterNode;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.datamodel.AbstractAbstractFileNode;
import org.sleuthkit.autopsy.datamodel.FileNode;
import org.sleuthkit.autopsy.datamodel.NodeProperty;
import org.sleuthkit.autopsy.directorytree.DataResultFilterNode;
import org.sleuthkit.autopsy.directorytree.NewWindowViewAction;
import org.sleuthkit.datamodel.AbstractFile;
@ -71,7 +67,6 @@ import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHO
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO;
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT;
import static org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT;
import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TskCoreException;
/**

View File

@ -27,7 +27,6 @@ import org.sleuthkit.autopsy.corecomponentinterfaces.DataContentViewer;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Image;
import org.sleuthkit.datamodel.DataSource;
import org.sleuthkit.datamodel.FsContent;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData.TSK_DB_FILES_TYPE_ENUM;
@ -116,7 +115,7 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
}
private void addRow(StringBuilder sb, String key, String value) {
sb.append("<tr><td>"); //NON-NLS
sb.append("<tr><td valign=\"top\">"); //NON-NLS
sb.append(key);
sb.append("</td><td>"); //NON-NLS
sb.append(value);
@ -238,6 +237,18 @@ public class Metadata extends javax.swing.JPanel implements DataContentViewer {
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.timezone"), image.getTimeZone());
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.deviceId"), image.getDeviceId());
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.internalid"), Long.toString(image.getId()));
// Add all the data source paths to the "Local Path" value cell.
String[] imagePaths = image.getPaths();
StringBuilder pathValues = new StringBuilder("<div>");
pathValues.append(imagePaths[0]);
pathValues.append("</div>");
for (int i=1; i < imagePaths.length; i++) {
pathValues.append("<div>");
pathValues.append(imagePaths[i]);
pathValues.append("</div>");
}
addRow(sb, NbBundle.getMessage(this.getClass(), "Metadata.tableRowTitle.localPath"), pathValues.toString());
}
setText(sb.toString());

View File

@ -457,10 +457,10 @@ class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer {
*/
private void initReader() {
viewReader = new SQLiteTableReader.Builder(sqliteDbFile)
.onColumnNames((columnName) -> {
.forAllColumnNames((columnName) -> {
currentTableHeader.add(columnName);
})
.forAll(getForAllStrategy()).build();
.forAllTableValues(getForAllStrategy()).build();
}
/**
@ -510,8 +510,8 @@ class SQLiteViewer extends javax.swing.JPanel implements FileTypeViewer {
String tableName = (String) this.tablesDropdownList.getSelectedItem();
try (FileOutputStream out = new FileOutputStream(csvFile, false)) {
try (SQLiteTableReader sqliteStream = new SQLiteTableReader.Builder(sqliteDbFile)
.onColumnNames(getColumnNameCSVStrategy(out))
.forAll(getForAllCSVStrategy(out)).build()) {
.forAllColumnNames(getColumnNameCSVStrategy(out))
.forAllTableValues(getForAllCSVStrategy(out)).build()) {
totalColumnCount = sqliteStream.getColumnCount(tableName);
sqliteStream.read(tableName);
}

View File

@ -357,6 +357,24 @@ public final class CoordinationService {
}
}
/**
* Deletes a specified node.
*
* @param category The desired category in the namespace.
* @param nodePath The node to be deleted.
*
* @throws CoordinationServiceException If there is an error deleting the
* node.
*/
void deleteNode(CategoryNode category, String nodePath) throws CoordinationServiceException {
String fullNodePath = getFullyQualifiedNodePath(category, nodePath);
try {
curator.delete().forPath(fullNodePath);
} catch (Exception ex) {
throw new CoordinationServiceException(String.format("Failed to delete node %s", fullNodePath), ex);
}
}
/**
* Gets a list of the child nodes of a category in the namespace.
*

View File

@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.core;
import java.awt.Cursor;
import java.io.File;
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import java.util.concurrent.Callable;
@ -29,6 +30,8 @@ import java.util.logging.Handler;
import java.util.logging.Level;
import javafx.application.Platform;
import javafx.embed.swing.JFXPanel;
import org.apache.commons.io.FileUtils;
import org.openide.modules.InstalledFileLocator;
import org.openide.modules.ModuleInstall;
import org.openide.util.NbBundle;
import org.openide.windows.WindowManager;
@ -286,11 +289,33 @@ public class Installer extends ModuleInstall {
pythonModulesDir.mkdir();
}
/**
* Make a folder in the config directory for Ocr Language Packs if one does
* not exist.
*/
private static void ensureOcrLanguagePacksFolderExists() {
File ocrLanguagePacksDir = new File(PlatformUtil.getOcrLanguagePacksPath());
boolean createDirectory = ocrLanguagePacksDir.mkdir();
//If the directory did not exist, copy the tessdata folder over so we
//support english.
if(createDirectory) {
File tessdataDir = InstalledFileLocator.getDefault().locate(
"Tesseract-OCR/tessdata", Installer.class.getPackage().getName(), false);
try {
FileUtils.copyDirectory(tessdataDir, ocrLanguagePacksDir);
} catch (IOException ex) {
logger.log(Level.SEVERE, "Copying over default language packs for Tesseract failed.", ex);
}
}
}
@Override
public void restored() {
super.restored();
ensurePythonModulesFolderExists();
ensureClassifierFolderExists();
ensureOcrLanguagePacksFolderExists();
initJavaFx();
for (ModuleInstall mi : packageInstallers) {
try {

View File

@ -173,9 +173,8 @@ ViewPreferencesPanel.currentSessionSettingsPanel.border.title=Current Session Se
ViewPreferencesPanel.hideRejectedResultsCheckbox.text=Hide rejected results
ViewPreferencesPanel.selectFileLabel.text=When selecting a file:
ViewPreferencesPanel.globalSettingsPanel.border.title=Global Settings
ViewPreferencesPanel.translateNamesInTableRadioButton.text=Table
ViewPreferencesPanel.commentsOccurencesColumnWrapAroundText.text=to reduce loading times
ViewPreferencesPanel.translateTextLabel.text=Translate text in the:
ViewPreferencesPanel.translateTextLabel.text=Translate text:
ViewPreferencesPanel.commentsOccurencesColumnsCheckbox.text=C(omments) and O(ccurences) columns
ViewPreferencesPanel.centralRepoLabel.text=Do not use Central Repository for:
ViewPreferencesPanel.hideOtherUsersTagsLabel.text=Hide other users' tags in the:
@ -193,3 +192,4 @@ ViewPreferencesPanel.keepCurrentViewerRadioButton.toolTipText=For example, stay
ViewPreferencesPanel.keepCurrentViewerRadioButton.text=Stay on the same file viewer
ViewPreferencesPanel.useBestViewerRadioButton.toolTipText=For example, change from Hex to Media when a JPEG is selected.
ViewPreferencesPanel.useBestViewerRadioButton.text=Change to the most specific file viewer
ViewPreferencesPanel.fileNameTranslationColumnCheckbox.text=Add column in result viewer for file name translation

View File

@ -144,11 +144,11 @@
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="fileNameTranslationColumnCheckbox" min="-2" max="-2" attributes="0"/>
<Component id="keepCurrentViewerRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="useBestViewerRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="useLocalTimeRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="useAnotherTimeRadioButton" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="translateNamesInTableRadioButton" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
@ -203,7 +203,7 @@
<EmptySpace max="-2" attributes="0"/>
<Component id="translateTextLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="translateNamesInTableRadioButton" min="-2" max="-2" attributes="0"/>
<Component id="fileNameTranslationColumnCheckbox" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
@ -397,14 +397,14 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JRadioButton" name="translateNamesInTableRadioButton">
<Component class="javax.swing.JCheckBox" name="fileNameTranslationColumnCheckbox">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="ViewPreferencesPanel.translateNamesInTableRadioButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/corecomponents/Bundle.properties" key="ViewPreferencesPanel.fileNameTranslationColumnCheckbox.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="translateNamesInTableRadioButtonActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="fileNameTranslationColumnCheckboxActionPerformed"/>
</Events>
</Component>
</SubComponents>

View File

@ -26,7 +26,7 @@ import javax.swing.JPanel;
import org.netbeans.spi.options.OptionsPanelController;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.CasePreferences;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.coreutils.TimeZoneUtils;
import org.sleuthkit.autopsy.directorytree.DirectoryTreeTopComponent;
@ -75,15 +75,15 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
dataSourcesHideSlackCheckbox.setSelected(UserPreferences.hideSlackFilesInDataSourcesTree());
viewsHideSlackCheckbox.setSelected(UserPreferences.hideSlackFilesInViewsTree());
commentsOccurencesColumnsCheckbox.setEnabled(EamDbUtil.useCentralRepo());
commentsOccurencesColumnWrapAroundText.setEnabled(EamDbUtil.useCentralRepo());
commentsOccurencesColumnsCheckbox.setEnabled(EamDb.isEnabled());
commentsOccurencesColumnWrapAroundText.setEnabled(EamDb.isEnabled());
commentsOccurencesColumnsCheckbox.setSelected(UserPreferences.hideCentralRepoCommentsAndOccurrences());
hideOtherUsersTagsCheckbox.setSelected(UserPreferences.showOnlyCurrentUserTags());
translateNamesInTableRadioButton.setSelected(UserPreferences.displayTranslatedFileNames());
fileNameTranslationColumnCheckbox.setSelected(UserPreferences.displayTranslatedFileNames());
TextTranslationService tts = TextTranslationService.getInstance();
translateNamesInTableRadioButton.setEnabled(tts.hasProvider());
fileNameTranslationColumnCheckbox.setEnabled(tts.hasProvider());
// Current Case Settings
boolean caseIsOpen = Case.isCaseOpen();
@ -113,7 +113,7 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
UserPreferences.setHideSlackFilesInViewsTree(viewsHideSlackCheckbox.isSelected());
UserPreferences.setShowOnlyCurrentUserTags(hideOtherUsersTagsCheckbox.isSelected());
UserPreferences.setHideCentralRepoCommentsAndOccurrences(commentsOccurencesColumnsCheckbox.isSelected());
UserPreferences.setDisplayTranslatedFileNames(translateNamesInTableRadioButton.isSelected());
UserPreferences.setDisplayTranslatedFileNames(fileNameTranslationColumnCheckbox.isSelected());
storeGroupItemsInTreeByDataSource();
@ -166,7 +166,7 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
timeZoneList = new javax.swing.JList<>();
translateTextLabel = new javax.swing.JLabel();
commentsOccurencesColumnWrapAroundText = new javax.swing.JLabel();
translateNamesInTableRadioButton = new javax.swing.JRadioButton();
fileNameTranslationColumnCheckbox = new javax.swing.JCheckBox();
currentCaseSettingsPanel = new javax.swing.JPanel();
groupByDataSourceCheckbox = new javax.swing.JCheckBox();
currentSessionSettingsPanel = new javax.swing.JPanel();
@ -277,10 +277,10 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
org.openide.awt.Mnemonics.setLocalizedText(commentsOccurencesColumnWrapAroundText, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.commentsOccurencesColumnWrapAroundText.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(translateNamesInTableRadioButton, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.translateNamesInTableRadioButton.text")); // NOI18N
translateNamesInTableRadioButton.addActionListener(new java.awt.event.ActionListener() {
org.openide.awt.Mnemonics.setLocalizedText(fileNameTranslationColumnCheckbox, org.openide.util.NbBundle.getMessage(ViewPreferencesPanel.class, "ViewPreferencesPanel.fileNameTranslationColumnCheckbox.text")); // NOI18N
fileNameTranslationColumnCheckbox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
translateNamesInTableRadioButtonActionPerformed(evt);
fileNameTranslationColumnCheckboxActionPerformed(evt);
}
});
@ -329,11 +329,11 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
.addGroup(globalSettingsPanelLayout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(globalSettingsPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(fileNameTranslationColumnCheckbox)
.addComponent(keepCurrentViewerRadioButton)
.addComponent(useBestViewerRadioButton)
.addComponent(useLocalTimeRadioButton)
.addComponent(useAnotherTimeRadioButton)
.addComponent(translateNamesInTableRadioButton))))))
.addComponent(useAnotherTimeRadioButton))))))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
globalSettingsPanelLayout.setVerticalGroup(
@ -380,7 +380,7 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(translateTextLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(translateNamesInTableRadioButton)))
.addComponent(fileNameTranslationColumnCheckbox)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
@ -487,14 +487,6 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
}
}//GEN-LAST:event_hideRejectedResultsCheckboxActionPerformed
private void translateNamesInTableRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_translateNamesInTableRadioButtonActionPerformed
if (immediateUpdates) {
UserPreferences.setDisplayTranslatedFileNames(translateNamesInTableRadioButton.isSelected());
} else {
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}
}//GEN-LAST:event_translateNamesInTableRadioButtonActionPerformed
private void timeZoneListValueChanged(javax.swing.event.ListSelectionEvent evt) {//GEN-FIRST:event_timeZoneListValueChanged
if (immediateUpdates && useAnotherTimeRadioButton.isSelected()) {
UserPreferences.setTimeZoneForDisplays(timeZoneList.getSelectedValue().substring(11).trim());
@ -593,6 +585,14 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
}
}//GEN-LAST:event_useBestViewerRadioButtonActionPerformed
private void fileNameTranslationColumnCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileNameTranslationColumnCheckboxActionPerformed
if (immediateUpdates) {
UserPreferences.setDisplayTranslatedFileNames(fileNameTranslationColumnCheckbox.isSelected());
} else {
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
}
}//GEN-LAST:event_fileNameTranslationColumnCheckboxActionPerformed
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JLabel centralRepoLabel;
@ -603,6 +603,7 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
private javax.swing.JCheckBox dataSourcesHideKnownCheckbox;
private javax.swing.JCheckBox dataSourcesHideSlackCheckbox;
private javax.swing.JLabel displayTimeLabel;
private javax.swing.JCheckBox fileNameTranslationColumnCheckbox;
private javax.swing.JPanel globalSettingsPanel;
private javax.swing.JCheckBox groupByDataSourceCheckbox;
private javax.swing.JLabel hideKnownFilesLabel;
@ -614,7 +615,6 @@ public class ViewPreferencesPanel extends JPanel implements OptionsPanel {
private javax.swing.JRadioButton keepCurrentViewerRadioButton;
private javax.swing.JLabel selectFileLabel;
private javax.swing.JList<String> timeZoneList;
private javax.swing.JRadioButton translateNamesInTableRadioButton;
private javax.swing.JLabel translateTextLabel;
private javax.swing.JRadioButton useAnotherTimeRadioButton;
private javax.swing.JRadioButton useBestViewerRadioButton;

View File

@ -52,6 +52,7 @@ public class PlatformUtil {
private static final String PYTHON_MODULES_SUBDIRECTORY = "python_modules"; //NON-NLS
private static final String CLASSIFIERS_SUBDIRECTORY = "object_detection_classifiers"; //NON-NLS
private static final String OCR_LANGUAGE_SUBDIRECTORY = "ocr_language_packs"; //NON-NLS
private static String javaPath = null;
public static final String OS_NAME_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.nameUnknown");
public static final String OS_VERSION_UNKNOWN = NbBundle.getMessage(PlatformUtil.class, "PlatformUtil.verUnknown");
@ -117,6 +118,15 @@ public class PlatformUtil {
return getUserDirectory().getAbsolutePath() + File.separator + PYTHON_MODULES_SUBDIRECTORY;
}
/**
* Get root path where the user's Ocr language packs are stored.
*
* @return Absolute path to the Ocr language packs root directory.
*/
public static String getOcrLanguagePacksPath() {
return getUserDirectory().getAbsolutePath() + File.separator + OCR_LANGUAGE_SUBDIRECTORY;
}
/**
* Get root path where the user's object detection classifiers are stored.
*

View File

@ -42,30 +42,14 @@ import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
/**
* Reads row by row through SQLite tables and performs user-defined actions on
* the row values. Table values are processed by data type. Users configure
* these actions for certain data types in the Builder. Example usage:
* Reads through SQLite tables row by row. Functions performed on the
* data must be declared up front to the Builder. For example:
*
* SQLiteTableReader reader = new SQLiteTableReader.Builder(file)
* .onInteger((i)
* -> { System.out.println(i); })
* .build();
* tableReader = new SQLiteTableReader.Builder(file).forAllColumnNames(System.out::println);
* tableReader.read("Sample Table X");
*
* reader.read(tableName);
*
* or
*
* SQLiteTableReader reader = new SQLiteTableReader.Builder(file)
* .onInteger(new Consumer<Integer>() {
* (atSymbol)Override public void accept(Integer i) {
* System.out.println(i);
* }
* }).build();
*
* reader.reader(tableName);
*
* Invocation of read(String tableName) reads row by row. When an Integer is
* encountered, its value will be passed to the Consumer that was defined above.
* By declaring the functions up front, the SQLiteTableReader instance can stream the
* table contents in the most memory efficient manner.
*/
public class SQLiteTableReader implements AutoCloseable {
@ -76,13 +60,13 @@ public class SQLiteTableReader implements AutoCloseable {
private final AbstractFile file;
private Consumer<String> onColumnNameAction;
private Consumer<String> onStringAction;
private Consumer<Long> onLongAction;
private Consumer<Integer> onIntegerAction;
private Consumer<Double> onFloatAction;
private Consumer<byte[]> onBlobAction;
private Consumer<Object> forAllAction;
private Consumer<String> forAllColumnNamesConsumer;
private Consumer<String> forAllStringValuesConsumer;
private Consumer<Long> forAllLongValuesConsumer;
private Consumer<Integer> forAllIntegerValuesConsumer;
private Consumer<Double> forAllFloatValuesConsumer;
private Consumer<byte[]> forAllBlobValuesConsumer;
private Consumer<Object> forAllTableValuesConsumer;
static <T> Consumer<T> doNothing() {
return NOOP -> {};
@ -96,13 +80,13 @@ public class SQLiteTableReader implements AutoCloseable {
public Builder(AbstractFile file) {
this.file = file;
this.onColumnNameAction = Builder.doNothing();
this.onStringAction = Builder.doNothing();
this.onLongAction = Builder.doNothing();
this.onIntegerAction = Builder.doNothing();
this.onFloatAction = Builder.doNothing();
this.onBlobAction = Builder.doNothing();
this.forAllAction = Builder.doNothing();
this.forAllColumnNamesConsumer = Builder.doNothing();
this.forAllStringValuesConsumer = Builder.doNothing();
this.forAllLongValuesConsumer = Builder.doNothing();
this.forAllIntegerValuesConsumer = Builder.doNothing();
this.forAllFloatValuesConsumer = Builder.doNothing();
this.forAllBlobValuesConsumer = Builder.doNothing();
this.forAllTableValuesConsumer = Builder.doNothing();
}
/**
@ -113,8 +97,8 @@ public class SQLiteTableReader implements AutoCloseable {
*
* @return Builder reference
*/
public Builder onColumnNames(Consumer<String> action) {
this.onColumnNameAction = action;
public Builder forAllColumnNames(Consumer<String> action) {
this.forAllColumnNamesConsumer = action;
return this;
}
@ -126,8 +110,8 @@ public class SQLiteTableReader implements AutoCloseable {
*
* @return Builder reference
*/
public Builder onString(Consumer<String> action) {
this.onStringAction = action;
public Builder forAllStringValues(Consumer<String> action) {
this.forAllStringValuesConsumer = action;
return this;
}
@ -139,8 +123,8 @@ public class SQLiteTableReader implements AutoCloseable {
*
* @return Builder reference
*/
public Builder onInteger(Consumer<Integer> action) {
this.onIntegerAction = action;
public Builder forAllIntegerValues(Consumer<Integer> action) {
this.forAllIntegerValuesConsumer = action;
return this;
}
@ -152,8 +136,8 @@ public class SQLiteTableReader implements AutoCloseable {
*
* @return Builder reference
*/
public Builder onFloat(Consumer<Double> action) {
this.onFloatAction = action;
public Builder forAllFloatValues(Consumer<Double> action) {
this.forAllFloatValuesConsumer = action;
return this;
}
@ -165,8 +149,8 @@ public class SQLiteTableReader implements AutoCloseable {
*
* @return Builder reference
*/
public Builder onLong(Consumer<Long> action) {
this.onLongAction = action;
public Builder forAllLongValues(Consumer<Long> action) {
this.forAllLongValuesConsumer = action;
return this;
}
@ -178,8 +162,8 @@ public class SQLiteTableReader implements AutoCloseable {
*
* @return Builder reference
*/
public Builder onBlob(Consumer<byte[]> action) {
this.onBlobAction = action;
public Builder forAllBlobValues(Consumer<byte[]> action) {
this.forAllBlobValuesConsumer = action;
return this;
}
@ -192,8 +176,8 @@ public class SQLiteTableReader implements AutoCloseable {
*
* @return Builder reference
*/
public Builder forAll(Consumer<Object> action) {
this.forAllAction = action;
public Builder forAllTableValues(Consumer<Object> action) {
this.forAllTableValuesConsumer = action;
return this;
}
@ -366,7 +350,7 @@ public class SQLiteTableReader implements AutoCloseable {
if (condition.getAsBoolean()) {
return;
}
builder.onColumnNameAction.accept(currentMetadata
builder.forAllColumnNamesConsumer.accept(currentMetadata
.getColumnName(++columnNameIndex));
}
@ -379,18 +363,18 @@ public class SQLiteTableReader implements AutoCloseable {
Object item = queryResults.getObject(++currRowColumnIndex);
if (item instanceof String) {
builder.onStringAction.accept((String) item);
builder.forAllStringValuesConsumer.accept((String) item);
} else if (item instanceof Integer) {
builder.onIntegerAction.accept((Integer) item);
builder.forAllIntegerValuesConsumer.accept((Integer) item);
} else if (item instanceof Double) {
builder.onFloatAction.accept((Double) item);
builder.forAllFloatValuesConsumer.accept((Double) item);
} else if (item instanceof Long) {
builder.onLongAction.accept((Long) item);
builder.forAllLongValuesConsumer.accept((Long) item);
} else if (item instanceof byte[]) {
builder.onBlobAction.accept((byte[]) item);
builder.forAllBlobValuesConsumer.accept((byte[]) item);
}
builder.forAllAction.accept(item);
builder.forAllTableValuesConsumer.accept(item);
}
unfinishedRow = false;
//Wrap column index back around if we've reached the end of the row

View File

@ -48,7 +48,6 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNor
import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable;
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable.HasCommentStatus;
@ -572,7 +571,7 @@ public abstract class AbstractAbstractFileNode<T extends AbstractFile> extends A
CorrelationAttributeInstance getCorrelationAttributeInstance() {
CorrelationAttributeInstance attribute = null;
if (EamDbUtil.useCentralRepo() && !UserPreferences.hideCentralRepoCommentsAndOccurrences()) {
if (EamDb.isEnabled() && !UserPreferences.hideCentralRepoCommentsAndOccurrences()) {
attribute = EamArtifactUtil.getInstanceFromContent(content);
}
return attribute;

View File

@ -54,7 +54,6 @@ import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeNor
import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbUtil;
import org.sleuthkit.autopsy.core.UserPreferences;
import org.sleuthkit.autopsy.corecomponents.DataResultViewerTable.Score;
import org.sleuthkit.autopsy.coreutils.Logger;
@ -572,7 +571,7 @@ public class BlackboardArtifactNode extends AbstractContentNode<BlackboardArtifa
protected final CorrelationAttributeInstance getCorrelationAttributeInstance() {
CorrelationAttributeInstance correlationAttribute = null;
if (EamDbUtil.useCentralRepo()) {
if (EamDb.isEnabled()) {
correlationAttribute = EamArtifactUtil.getInstanceFromContent(associated);
}
return correlationAttribute;

View File

@ -31,7 +31,7 @@ import org.sleuthkit.autopsy.datamodel.FileSize.FileSizeRootChildren.FileSizeNod
import org.sleuthkit.autopsy.datamodel.FileSize.FileSizeRootNode;
import org.sleuthkit.autopsy.datamodel.FileTypes.FileTypesNode;
import org.sleuthkit.autopsy.datamodel.accounts.Accounts;
import org.sleuthkit.autopsy.othercasessearch.CorrelationAttributeInstanceNode;
import org.sleuthkit.autopsy.allcasessearch.CorrelationAttributeInstanceNode;
/**
* Visitor pattern that goes over all nodes in the directory tree. This includes

View File

@ -17,7 +17,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.guiutils;
package org.sleuthkit.autopsy.datamodel.utils;
import java.io.File;
import java.sql.ResultSet;

View File

@ -46,10 +46,10 @@ import java.awt.GridLayout;
import java.nio.file.Paths;
import java.util.logging.Level;
import java.util.stream.Collectors;
import org.openide.modules.Places;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
/**
* Dashboard for viewing metrics and controlling the health monitor.
@ -58,8 +58,8 @@ public class HealthMonitorDashboard {
private final static Logger logger = Logger.getLogger(HealthMonitorDashboard.class.getName());
private final static String ADMIN_ACCESS_FILE_NAME = "adminAccess"; // NON-NLS
private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(Places.getUserDirectory().getAbsolutePath(), ADMIN_ACCESS_FILE_NAME).toString();
private final static String ADMIN_ACCESS_FILE_NAME = "_aiaa"; // NON-NLS
private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_ACCESS_FILE_NAME).toString();
Map<String, List<HealthMonitor.DatabaseTimingResult>> timingData;
List<HealthMonitor.UserData> userData;

View File

@ -39,6 +39,7 @@ public abstract class DataSourceAnalysisEvent extends AutopsyEvent implements Se
private final long ingestJobId;
private final long dataSourceIngestJobId;
private transient Content dataSource;
private final long dataSourceObjectId;
/**
* Constructs an instance of the base class for events published in
@ -56,6 +57,7 @@ public abstract class DataSourceAnalysisEvent extends AutopsyEvent implements Se
this.ingestJobId = ingestJobId;
this.dataSourceIngestJobId = dataSourceIngestJobId;
this.dataSource = dataSource;
this.dataSourceObjectId = dataSource.getId();
}
/**
@ -81,7 +83,8 @@ public abstract class DataSourceAnalysisEvent extends AutopsyEvent implements Se
/**
* Gets the data source associated with this event.
*
* @return The data source.
* @return The data source or null if there is an error getting the data
* source from an event published by a remote node.
*/
public Content getDataSource() {
/**
@ -96,11 +99,10 @@ public abstract class DataSourceAnalysisEvent extends AutopsyEvent implements Se
return dataSource;
}
try {
long id = (Long) super.getNewValue();
dataSource = Case.getCurrentCaseThrows().getSleuthkitCase().getContentById(id);
dataSource = Case.getCurrentCaseThrows().getSleuthkitCase().getContentById(dataSourceObjectId);
return dataSource;
} catch (NoCurrentCaseException | TskCoreException ex) {
logger.log(Level.SEVERE, "Error doing lazy load for remote event", ex); //NON-NLS
logger.log(Level.SEVERE, String.format("Error doing lazy load of data source (objId=%d) for remote event", this.dataSourceObjectId), ex); //NON-NLS
return null;
}
}

View File

@ -244,11 +244,14 @@ class ReportCaseUco implements GeneralReportModule {
catalog.writeFieldName("propertyBundle");
catalog.writeStartArray();
catalog.writeStartObject();
// replace double slashes with single ones
caseDirPath = caseDirPath.replaceAll("\\\\", "/");
catalog.writeStringField("@type", "File");
if (dbType == TskData.DbType.SQLITE) {
catalog.writeStringField("filePath", caseDirPath + java.io.File.separator + dbFileName);
catalog.writeStringField("filePath", caseDirPath + "/" + dbFileName);
catalog.writeBooleanField("isDirectory", false);
} else {
catalog.writeStringField("filePath", caseDirPath);
@ -317,6 +320,10 @@ class ReportCaseUco implements GeneralReportModule {
catalog.writeStartObject();
catalog.writeStringField("@type", "File");
// replace double back slashes with single ones
imageName = imageName.replaceAll("\\\\", "/");
catalog.writeStringField("filePath", imageName);
catalog.writeEndObject();
@ -391,7 +398,7 @@ class ReportCaseUco implements GeneralReportModule {
catalog.writeStartArray();
catalog.writeStartObject();
catalog.writeStringField("@type", "Hash");
catalog.writeStringField("hashMethod", "SHA256");
catalog.writeStringField("hashMethod", "MD5");
catalog.writeStringField("hashValue", md5Hash);
catalog.writeEndObject();
catalog.writeEndArray();

View File

@ -24,7 +24,7 @@ import java.util.Map;
import java.util.Map.Entry;
import javax.swing.ComboBoxModel;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.guiutils.DataSourceLoader;
import org.sleuthkit.autopsy.datamodel.utils.DataSourceLoader;
import org.sleuthkit.autopsy.guiutils.DataSourceComboBoxModel;
import org.sleuthkit.datamodel.TskCoreException;

View File

@ -250,6 +250,7 @@ class SevenZipExtractor {
String msg = NbBundle.getMessage(SevenZipExtractor.class,
"EmbeddedFileExtractorIngestModule.ArchiveExtractor.isZipBombCheck.warnMsg", archiveFile.getName(), escapedFilePath);//NON-NLS
try {
Collection<BlackboardAttribute> attributes = Arrays.asList(
new BlackboardAttribute(
TSK_SET_NAME, MODULE_NAME,
@ -372,12 +373,8 @@ class SevenZipExtractor {
* @return the archiveFilePath to be used by the unpack method
*/
private String getArchiveFilePath(AbstractFile archiveFile) {
try {
return archiveFile.getUniquePath();
} catch (TskCoreException ex) {
return archiveFile.getParentPath() + archiveFile.getName();
}
}
/**
* Create the local directories if they do not exist for the archive
@ -710,6 +707,7 @@ class SevenZipExtractor {
parentAr.addChild(child);
depthMap.put(unpackedFile.getId(), child);
}
unpackedFile.close();
}
} catch (TskCoreException | NoCurrentCaseException e) {

View File

@ -215,11 +215,15 @@ final class CustomFileTypesManager {
signatureList.add(new Signature(byteArray, 522L));
fileType = new FileType("image/x-pict", signatureList); //NON-NLS
autopsyDefinedFileTypes.add(fileType);
/* NOTE: see JIRA-4269. This MIME type seems to match a lot of random file types,
including ZIP archives. As a result those files get assigned this MIME type instead
of having their MIME type detected by Tika.
byteArray = DatatypeConverter.parseHexBinary("1100"); //NON-NLS
signatureList.clear();
signatureList.add(new Signature(byteArray, 522L));
fileType = new FileType("image/x-pict", signatureList); //NON-NLS
autopsyDefinedFileTypes.add(fileType);
autopsyDefinedFileTypes.add(fileType);*/
/*
* Add type for pam.

View File

@ -194,12 +194,10 @@ AddHashValuesToDatabaseProgressDialog.addHashValuesToDatabase.errorAddingValidHa
AddHashValuesToDatabaseProgressDialog.addHashValuesToDatabase.errorAddingValidHash.msg=Error adding valid hashes to the hash set:
HashLookupSettingsPanel.ingestWarningLabel.text=Ingest is ongoing, some settings will be unavailable until it finishes.
HashLookupSettingsPanel.addHashesToDatabaseButton.text=Add Hashes to Hash Set
HashLookupSettingsPanel.indexPathLabel.text=
HashLookupSettingsPanel.indexPathLabelLabel.text=Index Path:
HashLookupSettingsPanel.createDatabaseButton.toolTipText=
HashLookupSettingsPanel.createDatabaseButton.text=New Hash Set
HashLookupSettingsPanel.optionsLabel.text=Options
HashLookupSettingsPanel.informationLabel.text=Information
HashLookupSettingsPanel.informationLabel.text=Hash Set Details
HashLookupSettingsPanel.sendIngestMessagesCheckBox.text=Send ingest inbox message for each hit
HashLookupSettingsPanel.indexButton.text=Index
HashLookupSettingsPanel.indexLabel.text=Index Status:
@ -246,3 +244,4 @@ HashDbCreateDatabaseDialog.databasePathLabel.text=Hash Set Path:
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=

View File

@ -187,10 +187,8 @@ AddHashValuesToDatabaseProgressDialog.addHashValuesToDatabase.errorAddingValidHa
HashLookupSettingsPanel.deleteDatabaseButton.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u524a\u9664
HashLookupSettingsPanel.ingestWarningLabel.text=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u4e2d\u3067\u3059\u3002\u5b8c\u4e86\u3059\u308b\u307e\u3067\u4e00\u90e8\u306e\u8a2d\u5b9a\u306f\u5229\u7528\u3067\u304d\u307e\u305b\u3093\u3002
HashLookupSettingsPanel.addHashesToDatabaseButton.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u306b\u30cf\u30c3\u30b7\u30e5\u3092\u8ffd\u52a0
HashLookupSettingsPanel.indexPathLabel.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u9078\u629e\u3055\u308c\u3066\u3044\u307e\u305b\u3093
HashLookupSettingsPanel.indexPathLabelLabel.text=\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u30d1\u30b9\uff1a
HashLookupSettingsPanel.createDatabaseButton.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u4f5c\u6210
HashLookupSettingsPanel.optionsLabel.text=\u30aa\u30d7\u30b7\u30e7\u30f3
HashLookupSettingsPanel.informationLabel.text=\u60c5\u5831
HashLookupSettingsPanel.sendIngestMessagesCheckBox.text=\u30d2\u30c3\u30c8\u6bce\u306b\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u30a4\u30f3\u30dc\u30c3\u30af\u30b9\u306b\u30e1\u30c3\u30bb\u30fc\u30b8\u3092\u9001\u308b
HashLookupSettingsPanel.indexButton.text=\u30a4\u30f3\u30c7\u30c3\u30af\u30b9
@ -206,3 +204,4 @@ HashLookupSettingsPanel.hashDatabasesLabel.text=\u30cf\u30c3\u30b7\u30e5\u30c7\u
HashLookupSettingsPanel.importDatabaseButton.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u3092\u30a4\u30f3\u30dd\u30fc\u30c8
HashDbCreateDatabaseDialog.databasePathLabel.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30d1\u30b9\uff1a
AddHashValuesToDatabaseDialog.okButton.text_2=OK
HashLookupSettingsPanel.indexPathLabel.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u304c\u9078\u629e\u3055\u308c\u3066\u3044\u307e\u305b\u3093

View File

@ -66,10 +66,7 @@
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="jScrollPane2" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
<Component id="jScrollPane2" alignment="0" max="32767" attributes="0"/>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
@ -89,80 +86,35 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="1" pref="1" max="-2" attributes="0"/>
<EmptySpace min="-2" pref="1" max="-2" attributes="0"/>
<Component id="jScrollPane1" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="informationLabel" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="309" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="indexLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="indexPathLabelLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="hashDbIndexStatusLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="indexPathLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="indexButton" min="-2" max="-2" attributes="0"/>
<EmptySpace min="10" pref="10" max="-2" attributes="0"/>
<Component id="addHashesToDatabaseButton" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="locationLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="typeLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="versionLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="orgLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="readOnlyLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="nameLabel" linkSize="1" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="55" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="hashDbNameLabel" min="-2" max="-2" attributes="0"/>
<Component id="hashDbTypeLabel" min="-2" max="-2" attributes="0"/>
<Component id="hashDbLocationLabel" alignment="0" min="-2" max="-2" attributes="0"/>
<Component id="hashDbVersionLabel" min="-2" max="-2" attributes="0"/>
<Component id="hashDbOrgLabel" min="-2" max="-2" attributes="0"/>
<Component id="hashDbReadOnlyLabel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
</Group>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="70" max="-2" attributes="0"/>
<Component id="informationSeparator" min="-2" pref="305" max="-2" attributes="0"/>
</Group>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
<Component id="optionsLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="optionsSeparator" min="-2" pref="334" max="-2" attributes="0"/>
<Component id="informationLabel" pref="0" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="356" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="25" max="-2" attributes="0"/>
<Group type="102" attributes="0">
<Component id="indexButton" min="-2" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="addHashesToDatabaseButton" min="-2" max="-2" attributes="0"/>
<EmptySpace max="32767" attributes="0"/>
</Group>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="informationScrollPanel" alignment="0" pref="420" max="32767" attributes="0"/>
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="sendIngestMessagesCheckBox" min="-2" max="-2" attributes="0"/>
<Component id="ingestWarningLabel" alignment="0" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="10" max="-2" attributes="0"/>
<Component id="ingestWarningLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="0" pref="0" max="32767" attributes="0"/>
</Group>
</Group>
</Group>
<EmptySpace pref="24" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
</Group>
@ -191,63 +143,14 @@
<EmptySpace min="-2" pref="6" max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<Group type="103" groupAlignment="0" attributes="0">
<Component id="informationLabel" min="-2" max="-2" attributes="0"/>
<Group type="102" alignment="0" attributes="0">
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
<Component id="informationSeparator" min="-2" pref="3" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="nameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="typeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbTypeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="locationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbLocationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="versionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbVersionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="orgLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbOrgLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="-2" pref="7" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="readOnlyLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbReadOnlyLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="indexPathLabelLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="indexPathLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="indexLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbIndexStatusLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="informationScrollPanel" min="-2" pref="185" max="-2" attributes="0"/>
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="indexButton" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="addHashesToDatabaseButton" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Component id="optionsLabel" min="-2" max="-2" attributes="0"/>
<Component id="optionsSeparator" alignment="1" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="sendIngestMessagesCheckBox" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
@ -268,18 +171,15 @@
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="ingestWarningLabel">
<Component class="javax.swing.JLabel" name="hashDatabasesLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="ingestWarningLabel" property="font" relativeSize="false" size="11"/>
<Font bold="false" component="hashDatabasesLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"/>
</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="HashLookupSettingsPanel.ingestWarningLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.hashDatabasesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
@ -318,18 +218,21 @@
</Component>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="deleteDatabaseButton">
<Component class="javax.swing.JButton" name="createDatabaseButton">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="deleteDatabaseButton" property="font" relativeSize="false" size="11"/>
<Font bold="false" component="createDatabaseButton" property="font" relativeSize="false" size="11"/>
</FontInfo>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png"/>
<Image iconType="3" name="/org/sleuthkit/autopsy/modules/hashdatabase/new16.png"/>
</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="HashLookupSettingsPanel.deleteDatabaseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.createDatabaseButton.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="HashLookupSettingsPanel.createDatabaseButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[140, 25]"/>
@ -339,7 +242,7 @@
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteDatabaseButtonActionPerformed"/>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createDatabaseButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="importDatabaseButton">
@ -369,18 +272,150 @@
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="importDatabaseButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="hashDatabasesLabel">
<Component class="javax.swing.JButton" name="deleteDatabaseButton">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="hashDatabasesLabel" property="font" relativeSize="false" size="11"/>
<Font bold="false" component="deleteDatabaseButton" property="font" relativeSize="false" size="11"/>
</FontInfo>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png"/>
</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="HashLookupSettingsPanel.deleteDatabaseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[140, 25]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[140, 25]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="deleteDatabaseButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="informationLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="informationLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.hashDatabasesLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.informationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Container class="javax.swing.JScrollPane" name="informationScrollPanel">
<Properties>
<Property name="verticalScrollBarPolicy" type="int" value="21"/>
</Properties>
<Layout class="org.netbeans.modules.form.compat2.layouts.support.JScrollPaneSupportLayout"/>
<SubComponents>
<Container class="javax.swing.JPanel" name="informationPanel">
<Layout>
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="locationLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hashDbLocationLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="nameLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hashDbNameLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="typeLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hashDbTypeLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="versionLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hashDbVersionLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="orgLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hashDbOrgLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="readOnlyLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hashDbReadOnlyLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="indexLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="hashDbIndexStatusLabel" min="-2" max="-2" attributes="0"/>
</Group>
<Group type="102" alignment="0" attributes="0">
<Component id="indexPathLabelLabel" linkSize="1" min="-2" max="-2" attributes="0"/>
<EmptySpace type="separate" max="-2" attributes="0"/>
<Component id="indexPathLabel" min="-2" max="-2" attributes="0"/>
</Group>
</Group>
<EmptySpace max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Group type="103" groupAlignment="3" attributes="0">
<Component id="nameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbNameLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="typeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbTypeLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="locationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbLocationLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="versionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbVersionLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="orgLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbOrgLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="readOnlyLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbReadOnlyLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="indexPathLabelLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="indexPathLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="indexLabel" alignment="3" min="-2" max="-2" attributes="0"/>
<Component id="hashDbIndexStatusLabel" alignment="3" min="-2" max="-2" attributes="0"/>
</Group>
<EmptySpace min="0" pref="49" max="32767" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
</Layout>
<SubComponents>
<Component class="javax.swing.JLabel" name="nameLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
@ -405,30 +440,6 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="hashDbLocationLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="hashDbLocationLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.hashDbLocationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="locationLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="locationLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.locationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="typeLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
@ -453,156 +464,30 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="hashDbIndexStatusLabel">
<Component class="javax.swing.JLabel" name="locationLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="hashDbIndexStatusLabel" property="font" relativeSize="false" size="11"/>
<Font bold="false" component="locationLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.hashDbIndexStatusLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.locationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="indexLabel">
<Component class="javax.swing.JLabel" name="hashDbLocationLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="indexLabel" property="font" relativeSize="false" size="11"/>
<Font bold="false" component="hashDbLocationLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.indexLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
<ResourceString bundle="org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties" key="HashLookupSettingsPanel.hashDbLocationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="indexButton">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="indexButton" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.indexButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="indexButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="sendIngestMessagesCheckBox">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="sendIngestMessagesCheckBox" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.sendIngestMessagesCheckBox.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="sendIngestMessagesCheckBoxActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="informationLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="informationLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.informationLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="optionsLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="optionsLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.optionsLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JSeparator" name="informationSeparator">
</Component>
<Component class="javax.swing.JSeparator" name="optionsSeparator">
</Component>
<Component class="javax.swing.JButton" name="createDatabaseButton">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="createDatabaseButton" property="font" relativeSize="false" size="11"/>
</FontInfo>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/modules/hashdatabase/new16.png"/>
</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="HashLookupSettingsPanel.createDatabaseButton.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="HashLookupSettingsPanel.createDatabaseButton.toolTipText" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="maximumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[140, 25]"/>
</Property>
<Property name="minimumSize" type="java.awt.Dimension" editor="org.netbeans.beaninfo.editors.DimensionEditor">
<Dimension value="[140, 25]"/>
</Property>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="createDatabaseButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="indexPathLabelLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="indexPathLabelLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.indexPathLabelLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="indexPathLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="indexPathLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.indexPathLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JButton" name="addHashesToDatabaseButton">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="addHashesToDatabaseButton" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.addHashesToDatabaseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addHashesToDatabaseButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="versionLabel">
<Properties>
<Property name="text" type="java.lang.String" editor="org.netbeans.modules.i18n.form.FormI18nStringEditor">
@ -645,6 +530,120 @@
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="indexPathLabelLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="indexPathLabelLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.indexPathLabelLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="indexPathLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="indexPathLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.indexPathLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="indexLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="indexLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.indexLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
<Component class="javax.swing.JLabel" name="hashDbIndexStatusLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="hashDbIndexStatusLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.hashDbIndexStatusLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>
</Container>
<Component class="javax.swing.JButton" name="indexButton">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="indexButton" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.indexButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="indexButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JButton" name="addHashesToDatabaseButton">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="addHashesToDatabaseButton" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.addHashesToDatabaseButton.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
<Property name="enabled" type="boolean" value="false"/>
</Properties>
<Events>
<EventHandler event="actionPerformed" listener="java.awt.event.ActionListener" parameters="java.awt.event.ActionEvent" handler="addHashesToDatabaseButtonActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JCheckBox" name="sendIngestMessagesCheckBox">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="sendIngestMessagesCheckBox" property="font" relativeSize="false" size="11"/>
</FontInfo>
</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="HashLookupSettingsPanel.sendIngestMessagesCheckBox.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="sendIngestMessagesCheckBoxActionPerformed"/>
</Events>
</Component>
<Component class="javax.swing.JLabel" name="ingestWarningLabel">
<Properties>
<Property name="font" type="java.awt.Font" editor="org.netbeans.modules.form.editors2.FontEditor">
<FontInfo relative="true">
<Font bold="false" component="ingestWarningLabel" property="font" relativeSize="false" size="11"/>
</FontInfo>
</Property>
<Property name="icon" type="javax.swing.Icon" editor="org.netbeans.modules.form.editors2.IconEditor">
<Image iconType="3" name="/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"/>
</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="HashLookupSettingsPanel.ingestWarningLabel.text" replaceFormat="org.openide.util.NbBundle.getMessage({sourceFileName}.class, &quot;{key}&quot;)"/>
</Property>
</Properties>
</Component>
</SubComponents>
</Container>
</SubComponents>

View File

@ -142,8 +142,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
// Update ingest options.
sendIngestMessagesCheckBox.setSelected(false);
sendIngestMessagesCheckBox.setEnabled(false);
optionsLabel.setEnabled(false);
optionsSeparator.setEnabled(false);
// Update database action buttons.
createDatabaseButton.setEnabled(true);
@ -194,14 +192,14 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
deleteDatabaseButton.setEnabled(!ingestIsRunning);
try {
hashDbLocationLabel.setText(shortenPath(db.getDatabasePath()));
hashDbLocationLabel.setText(db.getDatabasePath());
} catch (TskCoreException ex) {
Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting hash set path of " + db.getHashSetName() + " hash set", ex); //NON-NLS
hashDbLocationLabel.setText(ERROR_GETTING_PATH_TEXT);
}
try {
indexPathLabel.setText(shortenPath(hashDb.getIndexPath()));
indexPathLabel.setText(hashDb.getIndexPath());
} catch (TskCoreException ex) {
Logger.getLogger(HashLookupSettingsPanel.class.getName()).log(Level.SEVERE, "Error getting index path of " + db.getHashSetName() + " hash set", ex); //NON-NLS
indexPathLabel.setText(ERROR_GETTING_PATH_TEXT);
@ -270,8 +268,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
// Update ingest option components.
sendIngestMessagesCheckBox.setSelected(db.getSendIngestMessages());
sendIngestMessagesCheckBox.setEnabled(!ingestIsRunning && db.getKnownFilesType().equals(KnownFilesType.KNOWN_BAD));
optionsLabel.setEnabled(!ingestIsRunning);
optionsSeparator.setEnabled(!ingestIsRunning);
// Update database action buttons.
createDatabaseButton.setEnabled(true);
@ -281,14 +277,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
ingestWarningLabel.setVisible(ingestIsRunning);
}
private static String shortenPath(String path) {
String shortenedPath = path;
if (shortenedPath.length() > 50) {
shortenedPath = shortenedPath.substring(0, 10 + shortenedPath.substring(10).indexOf(File.separator) + 1) + "..." + shortenedPath.substring((shortenedPath.length() - 20) + shortenedPath.substring(shortenedPath.length() - 20).indexOf(File.separator));
}
return shortenedPath;
}
private boolean isLocalIngestJobEvent(PropertyChangeEvent evt) {
if (evt instanceof AutopsyEvent) {
AutopsyEvent event = (AutopsyEvent) evt;
@ -591,36 +579,35 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
jButton3 = new javax.swing.JButton();
jScrollPane2 = new javax.swing.JScrollPane();
jPanel1 = new javax.swing.JPanel();
ingestWarningLabel = new javax.swing.JLabel();
hashDatabasesLabel = new javax.swing.JLabel();
jScrollPane1 = new javax.swing.JScrollPane();
hashSetTable = new HashSetTable();
deleteDatabaseButton = new javax.swing.JButton();
createDatabaseButton = new javax.swing.JButton();
importDatabaseButton = new javax.swing.JButton();
hashDatabasesLabel = new javax.swing.JLabel();
deleteDatabaseButton = new javax.swing.JButton();
informationLabel = new javax.swing.JLabel();
informationScrollPanel = new javax.swing.JScrollPane();
informationPanel = new javax.swing.JPanel();
nameLabel = new javax.swing.JLabel();
hashDbNameLabel = new javax.swing.JLabel();
hashDbLocationLabel = new javax.swing.JLabel();
locationLabel = new javax.swing.JLabel();
typeLabel = new javax.swing.JLabel();
hashDbTypeLabel = new javax.swing.JLabel();
hashDbIndexStatusLabel = new javax.swing.JLabel();
indexLabel = new javax.swing.JLabel();
indexButton = new javax.swing.JButton();
sendIngestMessagesCheckBox = new javax.swing.JCheckBox();
informationLabel = new javax.swing.JLabel();
optionsLabel = new javax.swing.JLabel();
informationSeparator = new javax.swing.JSeparator();
optionsSeparator = new javax.swing.JSeparator();
createDatabaseButton = new javax.swing.JButton();
indexPathLabelLabel = new javax.swing.JLabel();
indexPathLabel = new javax.swing.JLabel();
addHashesToDatabaseButton = new javax.swing.JButton();
locationLabel = new javax.swing.JLabel();
hashDbLocationLabel = new javax.swing.JLabel();
versionLabel = new javax.swing.JLabel();
hashDbVersionLabel = new javax.swing.JLabel();
orgLabel = new javax.swing.JLabel();
hashDbOrgLabel = new javax.swing.JLabel();
readOnlyLabel = new javax.swing.JLabel();
hashDbReadOnlyLabel = new javax.swing.JLabel();
indexPathLabelLabel = new javax.swing.JLabel();
indexPathLabel = new javax.swing.JLabel();
indexLabel = new javax.swing.JLabel();
hashDbIndexStatusLabel = new javax.swing.JLabel();
indexButton = new javax.swing.JButton();
addHashesToDatabaseButton = new javax.swing.JButton();
sendIngestMessagesCheckBox = new javax.swing.JCheckBox();
ingestWarningLabel = new javax.swing.JLabel();
jLabel2.setFont(jLabel2.getFont().deriveFont(jLabel2.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(jLabel2, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jLabel2.text")); // NOI18N
@ -634,9 +621,8 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
jButton3.setFont(jButton3.getFont().deriveFont(jButton3.getFont().getStyle() & ~java.awt.Font.BOLD, 14));
org.openide.awt.Mnemonics.setLocalizedText(jButton3, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.jButton3.text")); // NOI18N
ingestWarningLabel.setFont(ingestWarningLabel.getFont().deriveFont(ingestWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.ingestWarningLabel.text")); // NOI18N
hashDatabasesLabel.setFont(hashDatabasesLabel.getFont().deriveFont(hashDatabasesLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(hashDatabasesLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDatabasesLabel.text")); // NOI18N
hashSetTable.setFont(hashSetTable.getFont().deriveFont(hashSetTable.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
hashSetTable.setModel(new javax.swing.table.DefaultTableModel(
@ -656,14 +642,15 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
});
jScrollPane1.setViewportView(hashSetTable);
deleteDatabaseButton.setFont(deleteDatabaseButton.getFont().deriveFont(deleteDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
deleteDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.deleteDatabaseButton.text")); // NOI18N
deleteDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
deleteDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
deleteDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
createDatabaseButton.setFont(createDatabaseButton.getFont().deriveFont(createDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
createDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/new16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(createDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.text")); // NOI18N
createDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.toolTipText")); // NOI18N
createDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
createDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
createDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
deleteDatabaseButtonActionPerformed(evt);
createDatabaseButtonActionPerformed(evt);
}
});
@ -679,8 +666,21 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
}
});
hashDatabasesLabel.setFont(hashDatabasesLabel.getFont().deriveFont(hashDatabasesLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(hashDatabasesLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDatabasesLabel.text")); // NOI18N
deleteDatabaseButton.setFont(deleteDatabaseButton.getFont().deriveFont(deleteDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
deleteDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/delete16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(deleteDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.deleteDatabaseButton.text")); // NOI18N
deleteDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
deleteDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
deleteDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
deleteDatabaseButtonActionPerformed(evt);
}
});
informationLabel.setFont(informationLabel.getFont().deriveFont(informationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(informationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.informationLabel.text")); // NOI18N
informationScrollPanel.setVerticalScrollBarPolicy(javax.swing.ScrollPaneConstants.VERTICAL_SCROLLBAR_NEVER);
nameLabel.setFont(nameLabel.getFont().deriveFont(nameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(nameLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.nameLabel.text")); // NOI18N
@ -688,73 +688,17 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
hashDbNameLabel.setFont(hashDbNameLabel.getFont().deriveFont(hashDbNameLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(hashDbNameLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbNameLabel.text")); // NOI18N
hashDbLocationLabel.setFont(hashDbLocationLabel.getFont().deriveFont(hashDbLocationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(hashDbLocationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbLocationLabel.text")); // NOI18N
locationLabel.setFont(locationLabel.getFont().deriveFont(locationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(locationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.locationLabel.text")); // NOI18N
typeLabel.setFont(typeLabel.getFont().deriveFont(typeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(typeLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.typeLabel.text")); // NOI18N
hashDbTypeLabel.setFont(hashDbTypeLabel.getFont().deriveFont(hashDbTypeLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(hashDbTypeLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbTypeLabel.text")); // NOI18N
hashDbIndexStatusLabel.setFont(hashDbIndexStatusLabel.getFont().deriveFont(hashDbIndexStatusLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(hashDbIndexStatusLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbIndexStatusLabel.text")); // NOI18N
locationLabel.setFont(locationLabel.getFont().deriveFont(locationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(locationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.locationLabel.text")); // NOI18N
indexLabel.setFont(indexLabel.getFont().deriveFont(indexLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(indexLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexLabel.text")); // NOI18N
indexButton.setFont(indexButton.getFont().deriveFont(indexButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(indexButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexButton.text")); // NOI18N
indexButton.setEnabled(false);
indexButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
indexButtonActionPerformed(evt);
}
});
sendIngestMessagesCheckBox.setFont(sendIngestMessagesCheckBox.getFont().deriveFont(sendIngestMessagesCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckBox, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.sendIngestMessagesCheckBox.text")); // NOI18N
sendIngestMessagesCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendIngestMessagesCheckBoxActionPerformed(evt);
}
});
informationLabel.setFont(informationLabel.getFont().deriveFont(informationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(informationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.informationLabel.text")); // NOI18N
optionsLabel.setFont(optionsLabel.getFont().deriveFont(optionsLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(optionsLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.optionsLabel.text")); // NOI18N
createDatabaseButton.setFont(createDatabaseButton.getFont().deriveFont(createDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
createDatabaseButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/new16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(createDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.text")); // NOI18N
createDatabaseButton.setToolTipText(org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.createDatabaseButton.toolTipText")); // NOI18N
createDatabaseButton.setMaximumSize(new java.awt.Dimension(140, 25));
createDatabaseButton.setMinimumSize(new java.awt.Dimension(140, 25));
createDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
createDatabaseButtonActionPerformed(evt);
}
});
indexPathLabelLabel.setFont(indexPathLabelLabel.getFont().deriveFont(indexPathLabelLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(indexPathLabelLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabelLabel.text")); // NOI18N
indexPathLabel.setFont(indexPathLabel.getFont().deriveFont(indexPathLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(indexPathLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabel.text")); // NOI18N
addHashesToDatabaseButton.setFont(addHashesToDatabaseButton.getFont().deriveFont(addHashesToDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(addHashesToDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.addHashesToDatabaseButton.text")); // NOI18N
addHashesToDatabaseButton.setEnabled(false);
addHashesToDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addHashesToDatabaseButtonActionPerformed(evt);
}
});
hashDbLocationLabel.setFont(hashDbLocationLabel.getFont().deriveFont(hashDbLocationLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(hashDbLocationLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbLocationLabel.text")); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(versionLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.versionLabel.text_1")); // NOI18N
@ -768,6 +712,131 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
org.openide.awt.Mnemonics.setLocalizedText(hashDbReadOnlyLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbReadOnlyLabel.text_1")); // NOI18N
indexPathLabelLabel.setFont(indexPathLabelLabel.getFont().deriveFont(indexPathLabelLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(indexPathLabelLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabelLabel.text")); // NOI18N
indexPathLabel.setFont(indexPathLabel.getFont().deriveFont(indexPathLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(indexPathLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexPathLabel.text")); // NOI18N
indexLabel.setFont(indexLabel.getFont().deriveFont(indexLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(indexLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexLabel.text")); // NOI18N
hashDbIndexStatusLabel.setFont(hashDbIndexStatusLabel.getFont().deriveFont(hashDbIndexStatusLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(hashDbIndexStatusLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.hashDbIndexStatusLabel.text")); // NOI18N
javax.swing.GroupLayout informationPanelLayout = new javax.swing.GroupLayout(informationPanel);
informationPanel.setLayout(informationPanelLayout);
informationPanelLayout.setHorizontalGroup(
informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(informationPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(informationPanelLayout.createSequentialGroup()
.addComponent(locationLabel)
.addGap(18, 18, 18)
.addComponent(hashDbLocationLabel))
.addGroup(informationPanelLayout.createSequentialGroup()
.addComponent(nameLabel)
.addGap(18, 18, 18)
.addComponent(hashDbNameLabel))
.addGroup(informationPanelLayout.createSequentialGroup()
.addComponent(typeLabel)
.addGap(18, 18, 18)
.addComponent(hashDbTypeLabel))
.addGroup(informationPanelLayout.createSequentialGroup()
.addComponent(versionLabel)
.addGap(18, 18, 18)
.addComponent(hashDbVersionLabel))
.addGroup(informationPanelLayout.createSequentialGroup()
.addComponent(orgLabel)
.addGap(18, 18, 18)
.addComponent(hashDbOrgLabel))
.addGroup(informationPanelLayout.createSequentialGroup()
.addComponent(readOnlyLabel)
.addGap(18, 18, 18)
.addComponent(hashDbReadOnlyLabel))
.addGroup(informationPanelLayout.createSequentialGroup()
.addComponent(indexLabel)
.addGap(18, 18, 18)
.addComponent(hashDbIndexStatusLabel))
.addGroup(informationPanelLayout.createSequentialGroup()
.addComponent(indexPathLabelLabel)
.addGap(18, 18, 18)
.addComponent(indexPathLabel)))
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
);
informationPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel});
informationPanelLayout.setVerticalGroup(
informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(informationPanelLayout.createSequentialGroup()
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nameLabel)
.addComponent(hashDbNameLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(typeLabel)
.addComponent(hashDbTypeLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(locationLabel)
.addComponent(hashDbLocationLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(versionLabel)
.addComponent(hashDbVersionLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(orgLabel)
.addComponent(hashDbOrgLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(readOnlyLabel)
.addComponent(hashDbReadOnlyLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(indexPathLabelLabel)
.addComponent(indexPathLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(informationPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(indexLabel)
.addComponent(hashDbIndexStatusLabel))
.addGap(0, 49, Short.MAX_VALUE))
);
informationScrollPanel.setViewportView(informationPanel);
indexButton.setFont(indexButton.getFont().deriveFont(indexButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(indexButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.indexButton.text")); // NOI18N
indexButton.setEnabled(false);
indexButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
indexButtonActionPerformed(evt);
}
});
addHashesToDatabaseButton.setFont(addHashesToDatabaseButton.getFont().deriveFont(addHashesToDatabaseButton.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(addHashesToDatabaseButton, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.addHashesToDatabaseButton.text")); // NOI18N
addHashesToDatabaseButton.setEnabled(false);
addHashesToDatabaseButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
addHashesToDatabaseButtonActionPerformed(evt);
}
});
sendIngestMessagesCheckBox.setFont(sendIngestMessagesCheckBox.getFont().deriveFont(sendIngestMessagesCheckBox.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
org.openide.awt.Mnemonics.setLocalizedText(sendIngestMessagesCheckBox, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.sendIngestMessagesCheckBox.text")); // NOI18N
sendIngestMessagesCheckBox.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
sendIngestMessagesCheckBoxActionPerformed(evt);
}
});
ingestWarningLabel.setFont(ingestWarningLabel.getFont().deriveFont(ingestWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
ingestWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/hashdatabase/warning16.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(ingestWarningLabel, org.openide.util.NbBundle.getMessage(HashLookupSettingsPanel.class, "HashLookupSettingsPanel.ingestWarningLabel.text")); // NOI18N
javax.swing.GroupLayout jPanel1Layout = new javax.swing.GroupLayout(jPanel1);
jPanel1.setLayout(jPanel1Layout);
jPanel1Layout.setHorizontalGroup(
@ -780,57 +849,23 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
.addComponent(jScrollPane1, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(informationLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGap(309, 309, 309))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(indexLabel)
.addComponent(indexPathLabelLabel))
.addGap(55, 55, 55)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hashDbIndexStatusLabel)
.addComponent(indexPathLabel)))
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(informationLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 0, Short.MAX_VALUE)
.addGap(356, 356, 356))
.addGroup(jPanel1Layout.createSequentialGroup()
.addComponent(indexButton)
.addGap(10, 10, 10)
.addComponent(addHashesToDatabaseButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(addHashesToDatabaseButton)
.addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(locationLabel)
.addComponent(typeLabel)
.addComponent(versionLabel)
.addComponent(orgLabel)
.addComponent(readOnlyLabel)
.addComponent(nameLabel))
.addGap(55, 55, 55)
.addComponent(informationScrollPanel, javax.swing.GroupLayout.DEFAULT_SIZE, 420, Short.MAX_VALUE)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hashDbNameLabel)
.addComponent(hashDbTypeLabel)
.addComponent(hashDbLocationLabel)
.addComponent(hashDbVersionLabel)
.addComponent(hashDbOrgLabel)
.addComponent(hashDbReadOnlyLabel)))))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(70, 70, 70)
.addComponent(informationSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 305, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, jPanel1Layout.createSequentialGroup()
.addComponent(optionsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(optionsSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 334, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(25, 25, 25)
.addComponent(sendIngestMessagesCheckBox))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(10, 10, 10)
.addComponent(ingestWarningLabel))))
.addContainerGap(24, Short.MAX_VALUE))))
.addComponent(sendIngestMessagesCheckBox)
.addComponent(ingestWarningLabel))
.addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())))
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(hashDatabasesLabel)
@ -842,9 +877,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
.addComponent(deleteDatabaseButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(0, 0, Short.MAX_VALUE))))
);
jPanel1Layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {indexLabel, indexPathLabelLabel, locationLabel, nameLabel, orgLabel, readOnlyLabel, typeLabel, versionLabel});
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
@ -853,51 +885,13 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
.addGap(6, 6, 6)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(informationLabel)
.addGroup(jPanel1Layout.createSequentialGroup()
.addGap(7, 7, 7)
.addComponent(informationSeparator, javax.swing.GroupLayout.PREFERRED_SIZE, 3, javax.swing.GroupLayout.PREFERRED_SIZE)))
.addGap(7, 7, 7)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(nameLabel)
.addComponent(hashDbNameLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(typeLabel)
.addComponent(hashDbTypeLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(locationLabel)
.addComponent(hashDbLocationLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(versionLabel)
.addComponent(hashDbVersionLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(orgLabel)
.addComponent(hashDbOrgLabel))
.addGap(7, 7, 7)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(readOnlyLabel)
.addComponent(hashDbReadOnlyLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(indexPathLabelLabel)
.addComponent(indexPathLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(indexLabel)
.addComponent(hashDbIndexStatusLabel))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addComponent(informationScrollPanel, javax.swing.GroupLayout.PREFERRED_SIZE, 185, javax.swing.GroupLayout.PREFERRED_SIZE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(indexButton)
.addComponent(addHashesToDatabaseButton))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(optionsLabel)
.addComponent(optionsSeparator, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addGap(18, 18, 18)
.addComponent(sendIngestMessagesCheckBox)
.addGap(18, 18, 18)
@ -918,9 +912,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
.addComponent(jScrollPane2)
.addContainerGap())
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@ -1059,7 +1051,8 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
private javax.swing.JLabel indexPathLabel;
private javax.swing.JLabel indexPathLabelLabel;
private javax.swing.JLabel informationLabel;
private javax.swing.JSeparator informationSeparator;
private javax.swing.JPanel informationPanel;
private javax.swing.JScrollPane informationScrollPanel;
private javax.swing.JLabel ingestWarningLabel;
private javax.swing.JButton jButton3;
private javax.swing.JLabel jLabel2;
@ -1070,8 +1063,6 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
private javax.swing.JScrollPane jScrollPane2;
private javax.swing.JLabel locationLabel;
private javax.swing.JLabel nameLabel;
private javax.swing.JLabel optionsLabel;
private javax.swing.JSeparator optionsSeparator;
private javax.swing.JLabel orgLabel;
private javax.swing.JLabel readOnlyLabel;
private javax.swing.JCheckBox sendIngestMessagesCheckBox;

View File

@ -1,10 +0,0 @@
OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleDescription=
OtherCasesSearchDialog.searchButton.AccessibleContext.accessibleName=Search
OtherCasesSearchDialog.searchButton.text=Search
OtherCasesSearchDialog.correlationValueTextField.text=
OtherCasesSearchDialog.correlationValueLabel.text=Correlation Property Value:
OtherCasesSearchDialog.descriptionLabel.text=<html>Search the Central Repository for correlation properties with a specified value. The search is case insensitive.</html>
OtherCasesSearchDialog.errorLabel.text=\
OtherCasesSearchDialog.correlationTypeLabel.text=Correlation Property Type:
OtherCasesSearchDialog.casesLabel.text=\

View File

@ -24,11 +24,13 @@ import java.util.logging.Level;
import org.sleuthkit.autopsy.coreutils.Logger;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import org.openide.util.NbBundle.Messages;
import org.openide.util.lookup.ServiceProvider;
import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.casemodule.services.TagsManager;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb;
import org.sleuthkit.autopsy.report.GeneralReportModule;
import org.sleuthkit.autopsy.report.ReportProgressPanel;
@ -45,6 +47,7 @@ import org.sleuthkit.datamodel.TskCoreException;
@ServiceProvider(service = GeneralReportModule.class)
public class AddTaggedHashesToHashDb implements GeneralReportModule {
private static final Logger logger = Logger.getLogger(AddTaggedHashesToHashDb.class.getName());
private AddTaggedHashesToHashDbConfigPanel configPanel;
public AddTaggedHashesToHashDb() {
@ -65,6 +68,10 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule {
return "";
}
@Messages({
"AddTaggedHashesToHashDb.error.noHashSetsSelected=No hash set selected for export.",
"AddTaggedHashesToHashDb.error.noTagsSelected=No tags selected for export."
})
@Override
public void generateReport(String reportPath, ReportProgressPanel progressPanel) {
Case openCase;
@ -80,11 +87,26 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule {
progressPanel.updateStatusLabel("Adding hashes...");
HashDb hashSet = configPanel.getSelectedHashDatabase();
if (hashSet != null) {
if (hashSet == null) {
logger.log(Level.WARNING, "No hash set selected for export."); //NON-NLS
MessageNotifyUtil.Message.error(Bundle.AddTaggedHashesToHashDb_error_noHashSetsSelected());
progressPanel.setIndeterminate(false);
progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR);
return;
}
progressPanel.updateStatusLabel("Adding hashes to " + hashSet.getHashSetName() + " hash set...");
TagsManager tagsManager = openCase.getServices().getTagsManager();
List<TagName> tagNames = configPanel.getSelectedTagNames();
if (tagNames.isEmpty()) {
logger.log(Level.WARNING, "No tags selected for export."); //NON-NLS
MessageNotifyUtil.Message.error(Bundle.AddTaggedHashesToHashDb_error_noTagsSelected());
progressPanel.setIndeterminate(false);
progressPanel.complete(ReportProgressPanel.ReportStatus.ERROR);
return;
}
ArrayList<String> failedExports = new ArrayList<>();
for (TagName tagName : tagNames) {
if (progressPanel.getStatus() == ReportProgressPanel.ReportStatus.CANCELED) {
@ -129,7 +151,7 @@ public class AddTaggedHashesToHashDb implements GeneralReportModule {
}
JOptionPane.showMessageDialog(WindowManager.getDefault().getMainWindow(), errorMessage.toString(), "Hash Export Error", JOptionPane.ERROR_MESSAGE);
}
}
progressPanel.setIndeterminate(false);
progressPanel.complete(ReportProgressPanel.ReportStatus.COMPLETE);
}

View File

@ -32,16 +32,16 @@ import org.sleuthkit.datamodel.TskCoreException;
* Extracts text from artifacts by concatenating the values of all of the
* artifact's attributes.
*/
class ArtifactTextExtractor extends TextExtractor {
class ArtifactTextExtractor implements TextExtractor {
private final BlackboardArtifact artifact;
public ArtifactTextExtractor(Content artifact) {
this.artifact = (BlackboardArtifact) artifact;
public ArtifactTextExtractor(BlackboardArtifact artifact) {
this.artifact = artifact;
}
@Override
public Reader getReader() throws ExtractionException {
public Reader getReader() throws InitReaderException {
// Concatenate the string values of all attributes into a single
// "content" string to be indexed.
StringBuilder artifactContents = new StringBuilder();
@ -50,10 +50,10 @@ class ArtifactTextExtractor extends TextExtractor {
try {
dataSource = artifact.getDataSource();
} catch (TskCoreException tskCoreException) {
throw new ExtractionException("Unable to get datasource for artifact: " + artifact.toString(), tskCoreException);
throw new InitReaderException("Unable to get datasource for artifact: " + artifact.toString(), tskCoreException);
}
if (dataSource == null) {
throw new ExtractionException("Datasource was null for artifact: " + artifact.toString());
throw new InitReaderException("Datasource was null for artifact: " + artifact.toString());
}
try {
@ -75,7 +75,7 @@ class ArtifactTextExtractor extends TextExtractor {
artifactContents.append(System.lineSeparator());
}
} catch (TskCoreException tskCoreException) {
throw new ExtractionException("Unable to get attributes for artifact: " + artifact.toString(), tskCoreException);
throw new InitReaderException("Unable to get attributes for artifact: " + artifact.toString(), tskCoreException);
}
return new InputStreamReader(IOUtils.toInputStream(artifactContents,
@ -83,7 +83,7 @@ class ArtifactTextExtractor extends TextExtractor {
}
@Override
public boolean isSupported(Content file, String detectedFormat) {
public boolean isSupported() {
return true;
}
}

View File

@ -32,17 +32,17 @@ import net.htmlparser.jericho.Source;
import net.htmlparser.jericho.StartTag;
import net.htmlparser.jericho.StartTagType;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.ReadContentInputStream;
/**
* Extracts text from HTML content.
*/
final class HtmlTextExtractor extends TextExtractor {
final class HtmlTextExtractor implements TextExtractor {
static final private Logger logger = Logger.getLogger(HtmlTextExtractor.class.getName());
private final int MAX_SIZE;
private final Content file;
private final AbstractFile file;
static final List<String> WEB_MIME_TYPES = Arrays.asList(
"application/javascript", //NON-NLS
@ -62,7 +62,7 @@ final class HtmlTextExtractor extends TextExtractor {
* Creates a default instance of the HtmlTextExtractor. Supported file size
* is 50MB.
*/
public HtmlTextExtractor(Content file) {
public HtmlTextExtractor(AbstractFile file) {
//Set default to be 50 MB.
MAX_SIZE = 50_000_000;
this.file = file;
@ -77,10 +77,10 @@ final class HtmlTextExtractor extends TextExtractor {
* @return flag indicating support
*/
@Override
public boolean isSupported(Content content, String detectedFormat) {
return detectedFormat != null
&& WEB_MIME_TYPES.contains(detectedFormat)
&& content.getSize() <= MAX_SIZE;
public boolean isSupported() {
return file.getMIMEType() != null
&& WEB_MIME_TYPES.contains(file.getMIMEType())
&& file.getSize() <= MAX_SIZE;
}
/**
@ -93,7 +93,7 @@ final class HtmlTextExtractor extends TextExtractor {
* @throws TextExtractorException
*/
@Override
public Reader getReader() throws ExtractionException {
public Reader getReader() throws InitReaderException {
//TODO JIRA-4467, there is only harm in excluding HTML documents greater
//than 50MB due to our troubled approach of extraction.
ReadContentInputStream stream = new ReadContentInputStream(file);
@ -190,7 +190,7 @@ final class HtmlTextExtractor extends TextExtractor {
return new StringReader(stringBuilder.toString());
} catch (IOException ex) {
logger.log(Level.WARNING, "Error extracting HTML from content.", ex);
throw new ExtractionException("Error extracting HTML from content.", ex);
throw new InitReaderException("Error extracting HTML from content.", ex);
}
}
}

View File

@ -28,7 +28,6 @@ import org.sleuthkit.autopsy.coreutils.SQLiteTableReaderException;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.SQLiteTableReader;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
/**
* Extracts text from SQLite database files.
@ -39,14 +38,14 @@ import org.sleuthkit.datamodel.Content;
* 2) Tables that contain spaces in their name are not extracted
* 3) Table names are not included in its output text
*/
final class SqliteTextExtractor extends TextExtractor {
final class SqliteTextExtractor implements TextExtractor {
private static final String SQLITE_MIMETYPE = "application/x-sqlite3";
private static final Logger logger = Logger.getLogger(SqliteTextExtractor.class.getName());
private final AbstractFile file;
public SqliteTextExtractor(Content file) {
this.file = (AbstractFile) file;
public SqliteTextExtractor(AbstractFile file) {
this.file = file;
}
/**
* Supports only the sqlite mimetypes
@ -57,8 +56,8 @@ final class SqliteTextExtractor extends TextExtractor {
* @return true if x-sqlite3
*/
@Override
public boolean isSupported(Content file, String detectedFormat) {
return SQLITE_MIMETYPE.equals(detectedFormat);
public boolean isSupported() {
return SQLITE_MIMETYPE.equals(file.getMIMEType());
}
/**
@ -71,7 +70,7 @@ final class SqliteTextExtractor extends TextExtractor {
* @throws TextExtractorException
*/
@Override
public Reader getReader() throws ExtractionException {
public Reader getReader() throws InitReaderException {
return new SQLiteStreamReader(file);
}
@ -105,8 +104,8 @@ final class SqliteTextExtractor extends TextExtractor {
public SQLiteStreamReader(AbstractFile file) {
this.file = file;
reader = new SQLiteTableReader.Builder(file)
.onColumnNames(getColumnNameStrategy())
.forAll(getForAllTableValuesStrategy()).build();
.forAllColumnNames(getColumnNameStrategy())
.forAllTableValues(getForAllTableValuesStrategy()).build();
}
/**

View File

@ -28,7 +28,7 @@ import java.util.Objects;
import org.openide.util.Lookup;
import org.sleuthkit.autopsy.coreutils.StringExtract;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
import org.sleuthkit.autopsy.textextractors.extractionconfigs.DefaultExtractionConfig;
import org.sleuthkit.autopsy.textextractors.configs.StringsConfig;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskException;
@ -36,7 +36,7 @@ import org.sleuthkit.datamodel.TskException;
/**
* Extracts raw strings from content.
*/
final class StringsTextExtractor extends TextExtractor {
final class StringsTextExtractor implements TextExtractor {
private boolean extractUTF8;
private boolean extractUTF16;
@ -78,8 +78,6 @@ final class StringsTextExtractor extends TextExtractor {
*
* @return A reader instance that content text can be obtained from
*
* @throws
* org.sleuthkit.autopsy.textextractors.TextExtractor.TextExtractorException
*/
@Override
public InputStreamReader getReader() {
@ -100,15 +98,15 @@ final class StringsTextExtractor extends TextExtractor {
* Determines how the extraction process will proceed given the settings
* stored in this context instance.
*
* See the DefaultExtractionConfig class in the extractionconfigs package
* for available settings.
* See the StringsConfig class in the extractionconfigs package for
* available settings.
*
* @param context Lookup instance containing config classes
*/
@Override
public void setExtractionSettings(Lookup context) {
if (context != null) {
DefaultExtractionConfig configInstance = context.lookup(DefaultExtractionConfig.class);
StringsConfig configInstance = context.lookup(StringsConfig.class);
if (configInstance == null) {
return;
}
@ -118,8 +116,8 @@ final class StringsTextExtractor extends TextExtractor {
if (Objects.nonNull(configInstance.getExtractUTF16())) {
extractUTF16 = configInstance.getExtractUTF16();
}
if (Objects.nonNull(configInstance.getExtractScripts())) {
setScripts(configInstance.getExtractScripts());
if (Objects.nonNull(configInstance.getLanguageScripts())) {
setScripts(configInstance.getLanguageScripts());
}
}
}
@ -129,15 +127,10 @@ final class StringsTextExtractor extends TextExtractor {
* @return
*/
@Override
public boolean isEnabled() {
public boolean isSupported() {
return extractUTF8 || extractUTF16;
}
@Override
boolean isSupported(Content file, String detectedFormat) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
/**
* Content input string stream reader/converter - given Content, extract
* strings from it and return encoded bytes via read()

View File

@ -20,55 +20,37 @@ package org.sleuthkit.autopsy.textextractors;
import java.io.Reader;
import org.openide.util.Lookup;
import org.sleuthkit.datamodel.Content;
/**
* Extracts the text out of {@link org.sleuthkit.datamodel.Content} instances
* and exposes them as a {@link java.io.Reader}. Concrete implementations can be
* obtained from
* {@link org.sleuthkit.autopsy.textextractors.TextExtractorFactory#getExtractor(org.sleuthkit.datamodel.Content)}
* or
* {@link org.sleuthkit.autopsy.textextractors.TextExtractorFactory#getExtractor(org.sleuthkit.datamodel.Content, org.openide.util.Lookup)}.
*
* @see org.sleuthkit.autopsy.textextractors.TextExtractorFactory
* Extracts the text out of Content instances and exposes them as a Reader.
* Concrete implementations can be obtained from
* {@link org.sleuthkit.autopsy.textextractors.TextExtractorFactory}
*/
public abstract class TextExtractor {
public interface TextExtractor {
/**
* Determines if the file content is supported by the extractor.
*
* @param file to test if its content should be supported
* @param detectedFormat mime-type with detected format (such as text/plain)
* or null if not detected
*
* @return true if the file content is supported, false otherwise
*/
abstract boolean isSupported(Content file, String detectedFormat);
/**
* Determines if the TextExtractor instance is enabled to read content.
*
* @return
*/
boolean isEnabled() {
return true;
}
/**
* Get a {@link java.io.Reader} that will iterate over the text extracted
* from the {@link org.sleuthkit.datamodel.Content} passed into
* Determines if this extractor supports the given Content and
* configurations passed into it in
* {@link org.sleuthkit.autopsy.textextractors.TextExtractorFactory}.
*
* @return {@link java.io.Reader} that contains the text of the underlying
* {@link org.sleuthkit.datamodel.Content}
* @return true if content is supported, false otherwise
*/
boolean isSupported();
/**
* Get a Reader that will iterate over the text extracted from the Content
* passed into
* {@link org.sleuthkit.autopsy.textextractors.TextExtractorFactory}.
*
* @return Reader that contains the text of the underlying Content
*
* @throws
* org.sleuthkit.autopsy.textextractors.TextExtractor.ExtractionException
* org.sleuthkit.autopsy.textextractors.TextExtractor.InitReaderException
*
* @see org.sleuthkit.autopsy.textextractors.TextExtractorFactory
*
*/
public abstract Reader getReader() throws ExtractionException;
Reader getReader() throws InitReaderException;
/**
* Determines how the extraction process will proceed given the settings
@ -76,27 +58,24 @@ public abstract class TextExtractor {
*
* @param context Instance containing file config classes
*/
void setExtractionSettings(Lookup context) {
default void setExtractionSettings(Lookup context) {
//no-op by default
}
/**
* Exception encountered during
* {@link org.sleuthkit.autopsy.textextractors.TextExtractor#getReader()}.
* This indicates that there was an internal parsing error that occurred
* during the reading of Content text.
* System level exception for reader initialization.
*/
public class ExtractionException extends Exception {
public class InitReaderException extends Exception {
public ExtractionException(String msg, Throwable ex) {
public InitReaderException(String msg, Throwable ex) {
super(msg, ex);
}
public ExtractionException(Throwable ex) {
public InitReaderException(Throwable ex) {
super(ex);
}
public ExtractionException(String msg) {
public InitReaderException(String msg) {
super(msg);
}
}

View File

@ -27,52 +27,37 @@ import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.Report;
/**
* Factory for creating
* {@link org.sleuthkit.autopsy.textextractors.TextExtractor}'s given a
* {@link org.sleuthkit.datamodel.Content} instance
* Factory for creating TextExtractors given a Content instance
*
* See {@link org.sleuthkit.autopsy.textextractors.extractionconfigs} for
* available {@link org.sleuthkit.autopsy.textextractors.TextExtractor}
* configuration options.
* See {@link org.sleuthkit.autopsy.textextractors.textextractorconfigs} for
* available extractor configuration options.
*
* @see org.openide.util.Lookup
*/
public class TextExtractorFactory {
/**
* Auto detects the correct
* {@link org.sleuthkit.autopsy.textextractors.TextExtractor} given the
* {@link org.sleuthkit.datamodel.Content}.
* Returns a TextExtractor containing the Content text. Configuration files
* can be added to the Lookup.
*
* See {@link org.sleuthkit.autopsy.textextractors.extractionconfigs} for
* available {@link org.sleuthkit.autopsy.textextractors.TextExtractor}
* configuration options.
* See {@link org.sleuthkit.autopsy.textextractors.textextractorconfigs} for
* available extractor configuration options.
*
* @param content Content source that will be read from
* @param context Contains extraction configurations for certain file types
*
* @return A TextExtractor that supports the given content. File text can be
* obtained from
* {@link org.sleuthkit.autopsy.textextractors.TextExtractor#getReader()}.
* @return TextExtractor containing file text
*
* @throws NoTextExtractorFound Encountered when there is no TextExtractor
* was found for the given content type. Use {@link
* TextExtractorFactory#getDefaultExtractor(org.sleuthkit.datamodel.Content,
* org.openide.util.Lookup)}
* @throws NoTextExtractorFound Encountered when there is no Reader found
* for the given content type or there was an
* error while creating the reader.
*
* @see org.openide.util.Lookup
*/
public static TextExtractor getExtractor(Content content,
Lookup context) throws NoTextExtractorFound {
public static TextExtractor getExtractor(Content content, Lookup context) throws NoTextExtractorFound {
if (content instanceof AbstractFile) {
String mimeType = ((AbstractFile) content).getMIMEType();
List<TextExtractor> extractors = Arrays.asList(
new HtmlTextExtractor(content),
new SqliteTextExtractor(content),
new TikaTextExtractor(content));
for (TextExtractor extractor : extractors) {
extractor.setExtractionSettings(context);
if (extractor.isEnabled() && extractor.isSupported(content, mimeType)) {
for (TextExtractor extractor : getFileExtractors((AbstractFile) content, context)) {
if (extractor.isSupported()) {
return extractor;
}
}
@ -87,49 +72,69 @@ public class TextExtractorFactory {
}
throw new NoTextExtractorFound(
String.format("Could not find a suitable extractor for "
+ "content with name [%s] and id=[%d]. Try using the default, "
+ "non content specific extractor as an alternative.",
String.format("Could not find a suitable reader for "
+ "content with name [%s] and id=[%d]. Try using "
+ "the strings extractor instead.",
content.getName(), content.getId())
);
}
/**
* Auto detects the correct
* {@link org.sleuthkit.autopsy.textextractors.TextExtractor} given the
* {@link org.sleuthkit.datamodel.Content}.
* Initializes, orders, and returns all file extractors that can read
* AbstractFile instances.
*
* @param content Content instance that will be read from
* @param content AbstractFile content
* @param context Lookup containing extractor configurations
*
* @return A TextExtractor that supports the given content. File text can be
* obtained from {@link TextExtractor#getReader()}.
*
* @throws NoTextExtractorFound Encountered when there is no TextExtractor
* was found for the given content type. Use {@link
* TextExtractorFactory#getDefaultExtractor(org.sleuthkit.datamodel.Content,
* org.openide.util.Lookup)}
* @return
*/
public static TextExtractor getExtractor(Content content)
throws NoTextExtractorFound {
return getExtractor(content, null);
private static List<TextExtractor> getFileExtractors(AbstractFile content, Lookup context) {
List<TextExtractor> fileExtractors = Arrays.asList(
new HtmlTextExtractor(content),
new SqliteTextExtractor(content),
new TikaTextExtractor(content));
fileExtractors.forEach((fileExtractor) -> {
fileExtractor.setExtractionSettings(context);
});
return fileExtractors;
}
/**
* Returns the default extractor that can be run on any content type. This
* extractor should be used as a backup in the event that no extractor was
* found using or {@link TextExtractorFactory#getDefaultExtractor(org.sleuthkit.datamodel.Content, org.openide.util.Lookup)}
* {@link TextExtractorFactory#getExtractor(org.sleuthkit.datamodel.Content)}.
* Returns a TextExtractor containing the Content text.
*
* @param content Content instance that will be read from
*
* @return TextExtractor containing file text
*
* @throws NoTextExtractorFound Encountered when there is no Reader was
* found for the given content type. Use
* getStringsExtractor(Content,Lookup) method
* instead.
*/
public static TextExtractor getExtractor(Content content) throws NoTextExtractorFound {
return TextExtractorFactory.getExtractor(content, null);
}
/**
* Returns a TextExtractor containing the Content strings. This method
* supports all content types. This method should be used as a backup in the
* event that no reader was found using getExtractor(Content) or
* getExtractor(Content, Lookup).
*
* Configure this extractor with the StringsConfig in
* {@link org.sleuthkit.autopsy.textextractors.textextractorconfigs}
*
* @param content Content source to read from
* @param context Contains extraction configurations for certain file types
*
* @return A DefaultExtractor instance. File text can be obtained from
* {@link TextExtractor#getReader()}.
* @return TextExtractor containing file text
*
* @see org.openide.util.Lookup
*/
public static TextExtractor getDefaultExtractor(Content content, Lookup context) {
TextExtractor stringsInstance = new StringsTextExtractor(content);
public static TextExtractor getStringsExtractor(Content content, Lookup context) {
StringsTextExtractor stringsInstance = new StringsTextExtractor(content);
stringsInstance.setExtractionSettings(context);
return stringsInstance;
}
@ -137,12 +142,6 @@ public class TextExtractorFactory {
/**
* System level exception for handling content types that have no specific
* strategy defined for extracting their text.
*
* @see
* org.sleuthkit.autopsy.textextractors.TextExtractorFactory#getExtractor(org.sleuthkit.datamodel.Content)
* @see
* org.sleuthkit.autopsy.textextractors.TextExtractorFactory#getDefaultExtractor(org.sleuthkit.datamodel.Content,
* org.openide.util.Lookup)}
*/
public static class NoTextExtractorFound extends Exception {
@ -153,5 +152,9 @@ public class TextExtractorFactory {
public NoTextExtractorFound(Throwable ex) {
super(ex);
}
private NoTextExtractorFound(String msg, Throwable ex) {
super(msg, ex);
}
}
}

View File

@ -20,18 +20,23 @@ package org.sleuthkit.autopsy.textextractors;
import com.google.common.collect.ImmutableList;
import com.google.common.io.CharSource;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.io.PushbackReader;
import java.io.Reader;
import java.nio.file.Paths;
import java.util.Arrays;
import java.util.HashSet;
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
import java.util.concurrent.Callable;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.Future;
import java.util.concurrent.ThreadFactory;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.TimeoutException;
import java.util.logging.Level;
@ -50,8 +55,15 @@ import org.apache.tika.parser.pdf.PDFParserConfig;
import org.openide.util.NbBundle;
import org.openide.modules.InstalledFileLocator;
import org.openide.util.Lookup;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.ExecUtil;
import org.sleuthkit.autopsy.coreutils.ExecUtil.ProcessTerminator;
import org.sleuthkit.autopsy.coreutils.FileUtil;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.textextractors.extractionconfigs.ImageFileExtractionConfig;
import org.sleuthkit.autopsy.textextractors.configs.ImageConfig;
import org.sleuthkit.autopsy.datamodel.ContentUtils;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.ReadContentInputStream;
@ -59,7 +71,7 @@ import org.sleuthkit.datamodel.ReadContentInputStream;
* Extracts text from Tika supported content. Protects against Tika parser hangs
* (for unexpected/corrupt content) using a timeout mechanism.
*/
final class TikaTextExtractor extends TextExtractor {
final class TikaTextExtractor implements TextExtractor {
//Mimetype groups to aassist extractor implementations in ignoring binary and
//archive files.
@ -110,7 +122,9 @@ final class TikaTextExtractor extends TextExtractor {
private static final java.util.logging.Logger tikaLogger = java.util.logging.Logger.getLogger("Tika"); //NON-NLS
private final ExecutorService tikaParseExecutor = Executors.newSingleThreadExecutor();
private final ThreadFactory tikaThreadFactory
= new ThreadFactoryBuilder().setNameFormat("tika-reader-%d").build();
private final ExecutorService executorService = Executors.newSingleThreadExecutor(tikaThreadFactory);
private static final String SQLITE_MIMETYPE = "application/x-sqlite3";
private final AutoDetectParser parser = new AutoDetectParser();
@ -121,6 +135,10 @@ final class TikaTextExtractor extends TextExtractor {
private static final String TESSERACT_EXECUTABLE = "tesseract.exe"; //NON-NLS
private static final File TESSERACT_PATH = locateTesseractExecutable();
private static final String LANGUAGE_PACKS = getLanguagePacks();
private static final String TESSERACT_LANGUAGE_PACK_EXT = "traineddata"; //NON-NLS
private static final String TESSERACT_OUTPUT_FILE_NAME = "tess_output"; //NON-NLS
private ProcessTerminator processTerminator;
private static final List<String> TIKA_SUPPORTED_TYPES
= new Tika().getParser().getSupportedTypes(new ParseContext())
@ -132,6 +150,18 @@ final class TikaTextExtractor extends TextExtractor {
this.content = content;
}
/**
* If Tesseract has been installed and is set to be used through
* configuration, then ocr is enabled. OCR can only currently be run on
* 64 bit Windows OS.
*
* @return Flag indicating if OCR is set to be used.
*/
private boolean ocrEnabled() {
return TESSERACT_PATH != null && tesseractOCREnabled
&& PlatformUtil.isWindowsOS() == true && PlatformUtil.is64BitOS();
}
/**
* Returns a reader that will iterate over the text extracted from Apache
* Tika.
@ -144,24 +174,20 @@ final class TikaTextExtractor extends TextExtractor {
* org.sleuthkit.autopsy.textextractors.TextExtractor.TextExtractorException
*/
@Override
public Reader getReader() throws ExtractionException {
ReadContentInputStream stream = new ReadContentInputStream(content);
public Reader getReader() throws InitReaderException {
InputStream stream = null;
Metadata metadata = new Metadata();
ParseContext parseContext = new ParseContext();
parseContext.set(Parser.class, parser);
// Use the more memory efficient Tika SAX parsers for DOCX and
// PPTX files (it already uses SAX for XLSX).
OfficeParserConfig officeParserConfig = new OfficeParserConfig();
officeParserConfig.setUseSAXPptxExtractor(true);
officeParserConfig.setUseSAXDocxExtractor(true);
parseContext.set(OfficeParserConfig.class, officeParserConfig);
// configure OCR if it is enabled in KWS settings and installed on the machine
if (TESSERACT_PATH != null && tesseractOCREnabled && PlatformUtil.isWindowsOS() == true) {
// configure PDFParser.
if (ocrEnabled() && content instanceof AbstractFile) {
AbstractFile file = ((AbstractFile) content);
//Run OCR on images with Tesseract directly.
if (file.getMIMEType().toLowerCase().startsWith("image/")) {
stream = performOCR(file);
} else {
//Otherwise, go through Tika for PDFs so that it can
//extract images and run Tesseract on them.
PDFParserConfig pdfConfig = new PDFParserConfig();
// Extracting the inline images and letting Tesseract run on each inline image.
@ -176,42 +202,182 @@ final class TikaTextExtractor extends TextExtractor {
TesseractOCRConfig ocrConfig = new TesseractOCRConfig();
String tesseractFolder = TESSERACT_PATH.getParent();
ocrConfig.setTesseractPath(tesseractFolder);
// Tesseract expects language data packs to be in a subdirectory of tesseractFolder, in a folder called "tessdata".
// If they are stored somewhere else, use ocrConfig.setTessdataPath(String tessdataPath) to point to them
ocrConfig.setLanguage(LANGUAGE_PACKS);
ocrConfig.setTessdataPath(PlatformUtil.getOcrLanguagePacksPath());
parseContext.set(TesseractOCRConfig.class, ocrConfig);
stream = new ReadContentInputStream(content);
}
} else {
stream = new ReadContentInputStream(content);
}
//Parse the file in a task, a convenient way to have a timeout...
final Future<Reader> future = tikaParseExecutor.submit(() -> new ParsingReader(parser, stream, metadata, parseContext));
Metadata metadata = new Metadata();
// Use the more memory efficient Tika SAX parsers for DOCX and
// PPTX files (it already uses SAX for XLSX).
OfficeParserConfig officeParserConfig = new OfficeParserConfig();
officeParserConfig.setUseSAXPptxExtractor(true);
officeParserConfig.setUseSAXDocxExtractor(true);
parseContext.set(OfficeParserConfig.class, officeParserConfig);
//Make the creation of a TikaReader a cancellable future in case it takes too long
Future<Reader> future = executorService.submit(
new GetTikaReader(parser, stream, metadata, parseContext));
try {
final Reader tikaReader = future.get(getTimeout(content.getSize()), TimeUnit.SECONDS);
//check if the reader is empty
PushbackReader pushbackReader = new PushbackReader(tikaReader);
int read = pushbackReader.read();
if (read == -1) {
throw new ExtractionException("Unable to extract text: Tika returned empty reader for " + content);
throw new InitReaderException("Unable to extract text: "
+ "Tika returned empty reader for " + content);
}
pushbackReader.unread(read);
//concatenate parsed content and meta data into a single reader.
CharSource metaDataCharSource = getMetaDataCharSource(metadata);
return CharSource.concat(new ReaderCharSource(pushbackReader), metaDataCharSource).openStream();
} catch (TimeoutException te) {
final String msg = NbBundle.getMessage(this.getClass(), "AbstractFileTikaTextExtract.index.tikaParseTimeout.text", content.getId(), content.getName());
throw new ExtractionException(msg, te);
} catch (ExtractionException ex) {
final String msg = NbBundle.getMessage(this.getClass(),
"AbstractFileTikaTextExtract.index.tikaParseTimeout.text",
content.getId(), content.getName());
throw new InitReaderException(msg, te);
} catch (InitReaderException ex) {
throw ex;
} catch (Exception ex) {
tikaLogger.log(Level.WARNING, "Exception: Unable to Tika parse the content" + content.getId() + ": " + content.getName(), ex.getCause()); //NON-NLS
final String msg = NbBundle.getMessage(this.getClass(), "AbstractFileTikaTextExtract.index.exception.tikaParse.msg", content.getId(), content.getName());
throw new ExtractionException(msg, ex);
tikaLogger.log(Level.WARNING, "Exception: Unable to Tika parse the "
+ "content" + content.getId() + ": " + content.getName(),
ex.getCause()); //NON-NLS
final String msg = NbBundle.getMessage(this.getClass(),
"AbstractFileTikaTextExtract.index.exception.tikaParse.msg",
content.getId(), content.getName());
throw new InitReaderException(msg, ex);
} finally {
future.cancel(true);
}
}
/**
* Run OCR and return the file stream produced by Tesseract.
*
* @param file Image file to run OCR on
*
* @return InputStream connected to the output file that Tesseract produced.
*
* @throws
* org.sleuthkit.autopsy.textextractors.TextExtractor.InitReaderException
*/
private InputStream performOCR(AbstractFile file) throws InitReaderException {
File inputFile = null;
File outputFile = null;
try {
String tempDirectory = Case.getCurrentCaseThrows().getTempDirectory();
//Appending file id makes the name unique
String tempFileName = FileUtil.escapeFileName(file.getId() + file.getName());
inputFile = Paths.get(tempDirectory, tempFileName).toFile();
ContentUtils.writeToFile(content, inputFile);
String tempOutputName = FileUtil.escapeFileName(file.getId() + TESSERACT_OUTPUT_FILE_NAME);
String outputFilePath = Paths.get(tempDirectory, tempOutputName).toString();
String executeablePath = TESSERACT_PATH.toString();
//Build tesseract commands
ProcessBuilder process = new ProcessBuilder();
process.command(executeablePath,
String.format("\"%s\"", inputFile.getAbsolutePath()),
String.format("\"%s\"", outputFilePath),
"--tessdata-dir", PlatformUtil.getOcrLanguagePacksPath(),
//language pack command flag
"-l", LANGUAGE_PACKS);
//If the ProcessTerminator was supplied during
//configuration apply it here.
if (processTerminator != null) {
ExecUtil.execute(process, 1, TimeUnit.SECONDS, processTerminator);
} else {
ExecUtil.execute(process);
}
outputFile = new File(outputFilePath + ".txt");
//Open a stream of the Tesseract text file and send this to Tika
return new CleanUpStream(outputFile);
} catch (NoCurrentCaseException | IOException ex) {
if (outputFile != null) {
outputFile.delete();
}
throw new InitReaderException("Could not successfully run Tesseract", ex);
} finally {
if (inputFile != null) {
inputFile.delete();
}
}
}
/**
* Wraps the creation of a TikaReader into a Future so that it can be
* cancelled.
*/
private class GetTikaReader implements Callable<Reader> {
private final AutoDetectParser parser;
private final InputStream stream;
private final Metadata metadata;
private final ParseContext parseContext;
public GetTikaReader(AutoDetectParser parser, InputStream stream,
Metadata metadata, ParseContext parseContext) {
this.parser = parser;
this.stream = stream;
this.metadata = metadata;
this.parseContext = parseContext;
}
@Override
public Reader call() throws Exception {
return new ParsingReader(parser, stream, metadata, parseContext);
}
}
/**
* Automatically deletes the underlying File when the close() method is
* called. This is used to delete the Output file produced from Tesseract
* once it has been read by Tika.
*/
private class CleanUpStream extends FileInputStream {
private File file;
/**
* Store a reference to file on construction
*
* @param file
*
* @throws FileNotFoundException
*/
public CleanUpStream(File file) throws FileNotFoundException {
super(file);
this.file = file;
}
/**
* Delete this underlying file when close is called.
*
* @throws IOException
*/
@Override
public void close() throws IOException {
try {
super.close();
} finally {
if (file != null) {
file.delete();
file = null;
}
}
}
}
/**
* Finds and returns the path to the Tesseract executable, if able.
*
@ -253,24 +419,27 @@ final class TikaTextExtractor extends TextExtractor {
}
/**
* Determines if Tika is supported for this content type and mimetype.
*
* @param content Source content to read
* @param detectedFormat Mimetype of content
* Determines if Tika is enabled for this content
*
* @return Flag indicating support for reading content type
*/
@Override
public boolean isSupported(Content content, String detectedFormat) {
if (detectedFormat == null
|| BINARY_MIME_TYPES.contains(detectedFormat) //any binary unstructured blobs (string extraction will be used)
|| ARCHIVE_MIME_TYPES.contains(detectedFormat)
|| (detectedFormat.startsWith("video/") && !detectedFormat.equals("video/x-flv")) //skip video other than flv (tika supports flv only) //NON-NLS
|| detectedFormat.equals(SQLITE_MIMETYPE) //Skip sqlite files, Tika cannot handle virtual tables and will fail with an exception. //NON-NLS
public boolean isSupported() {
if(!(content instanceof AbstractFile)) {
return false;
}
String detectedType = ((AbstractFile)content).getMIMEType();
if (detectedType == null
|| BINARY_MIME_TYPES.contains(detectedType) //any binary unstructured blobs (string extraction will be used)
|| ARCHIVE_MIME_TYPES.contains(detectedType)
|| (detectedType.startsWith("video/") && !detectedType.equals("video/x-flv")) //skip video other than flv (tika supports flv only) //NON-NLS
|| detectedType.equals(SQLITE_MIMETYPE) //Skip sqlite files, Tika cannot handle virtual tables and will fail with an exception. //NON-NLS
) {
return false;
}
return TIKA_SUPPORTED_TYPES.contains(detectedFormat);
return TIKA_SUPPORTED_TYPES.contains(detectedType);
}
/**
@ -280,26 +449,17 @@ final class TikaTextExtractor extends TextExtractor {
* @return String of all language packs available for Tesseract to use
*/
private static String getLanguagePacks() {
File languagePackRootDir = new File(TESSERACT_PATH.getParent(), "tessdata");
//Acceptable extensions for Tesseract-OCR version 3.05 language packs.
//All extensions other than traineddata are associated with cube files that
//have been made obsolete since version 4.0.
List<String> acceptableExtensions = Arrays.asList("traineddata", "params",
"lm", "fold", "bigrams", "nn", "word-freq", "size",
"user-patterns", "user-words");
//Pull out only unique languagePacks
HashSet<String> languagePacks = new HashSet<>();
if (languagePackRootDir.exists()) {
File languagePackRootDir = new File(PlatformUtil.getOcrLanguagePacksPath());
List<String> languagePacks = new ArrayList<>();
for (File languagePack : languagePackRootDir.listFiles()) {
if (languagePack.isDirectory() || !acceptableExtensions.contains(
FilenameUtils.getExtension(languagePack.getName()))) {
continue;
}
String threeLetterPackageName = languagePack.getName().substring(0, 3);
//Ignore the eng language pack if accidentally added
languagePacks.add(threeLetterPackageName);
String fileExt = FilenameUtils.getExtension(languagePack.getName());
if (!languagePack.isDirectory() && TESSERACT_LANGUAGE_PACK_EXT.equals(fileExt)) {
String packageName = FilenameUtils.getBaseName(languagePack.getName());
languagePacks.add(packageName);
}
}
return String.join("+", languagePacks);
}
@ -330,21 +490,23 @@ final class TikaTextExtractor extends TextExtractor {
* Determines how the extraction process will proceed given the settings
* stored in this context instance.
*
* See the ImageFileExtractionConfig class in the extractionconfigs package
* for available settings.
* See the ImageConfig class in the extractionconfigs package for available
* settings.
*
* @param context Instance containing config classes
*/
@Override
public void setExtractionSettings(Lookup context) {
if (context != null) {
ImageFileExtractionConfig configInstance = context.lookup(ImageFileExtractionConfig.class);
if (configInstance == null) {
return;
}
if (Objects.nonNull(configInstance.getOCREnabled())) {
ImageConfig configInstance = context.lookup(ImageConfig.class);
if (configInstance != null && Objects.nonNull(configInstance.getOCREnabled())) {
this.tesseractOCREnabled = configInstance.getOCREnabled();
}
ProcessTerminator terminatorInstance = context.lookup(ProcessTerminator.class);
if (terminatorInstance != null) {
this.processTerminator = terminatorInstance;
}
}
}

View File

@ -16,25 +16,20 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.textextractors.extractionconfigs;
package org.sleuthkit.autopsy.textextractors.configs;
/**
* Allows for configuration of OCR on image files.
* {@link org.sleuthkit.autopsy.textextractors.TextExtractor}'s that use
* ImageFileExtractionConfig can be obtained through
* {@link org.sleuthkit.autopsy.textextractors.TextExtractorFactory#getExtractor(org.sleuthkit.datamodel.Content)}
* or
* {@link org.sleuthkit.autopsy.textextractors.TextExtractorFactory#getDefaultExtractor(org.sleuthkit.datamodel.Content, org.openide.util.Lookup)}.
* Allows for configuration of OCR on image files. Extractors that use ImageConfig
* can be obtained through TextExtractoryFactory.getExtractor().
*
* @see org.sleuthkit.autopsy.textextractors.TextExtractorFactory
* @see org.openide.util.Lookup
*/
public class ImageFileExtractionConfig {
public class ImageConfig {
private Boolean OCREnabled;
/**
* Enables OCR to be run on the text extractor responsible for handling
* Enables OCR to be run on the text reader responsible for handling
* image files.
*
* @param enabled Flag indicating if OCR is enabled.

View File

@ -16,33 +16,32 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.sleuthkit.autopsy.textextractors.extractionconfigs;
package org.sleuthkit.autopsy.textextractors.configs;
import java.util.List;
import org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT;
/**
* Allows for configuration of the
* {@link org.sleuthkit.autopsy.textextractors.TextExtractor} obtained from
* {@link org.sleuthkit.autopsy.textextractors.TextExtractorFactory#getDefaultExtractor(org.sleuthkit.datamodel.Content, org.openide.util.Lookup)}.
* Allows for configuration of the TextExtractor obtained from
* TextExtractorFactory.getStringsExtractor().
*
* The default extractor will read strings from the Content instance. This class
* allows for the configuration of the encoding language script to use during
* extraction.
* The Strings extractor will extract strings from the Content instance. This
* class allows for the configuration of the encoding and language scripts that
* will be used.
*
* @see org.sleuthkit.autopsy.textextractors.TextExtractorFactory
* @see
* org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT
* @see org.openide.util.Lookup
*/
public class DefaultExtractionConfig {
public class StringsConfig {
private Boolean extractUTF8;
private Boolean extractUTF16;
private List<SCRIPT> extractScripts;
private List<SCRIPT> languageScripts;
/**
* Enables UTF-8 encoding to be used during extraction.
* Enables UTF-8 encoding to be used during reading.
*
* @param enabled Flag indicating if UTF-8 should be turned on
*/
@ -60,7 +59,7 @@ public class DefaultExtractionConfig {
}
/**
* Returns whether extracting with UTF-8 encoding should be done.
* Returns whether extraction with UTF-8 encoding should be done.
*
* @return Flag indicating if UTF-8 has been turned on/off
*/
@ -69,7 +68,7 @@ public class DefaultExtractionConfig {
}
/**
* Return whether extracting with UTF-16 encoding should be done.
* Return whether extraction with UTF-16 encoding should be done.
*
* @return Flag indicating if UTF-16 has been turned on/off
*/
@ -78,23 +77,23 @@ public class DefaultExtractionConfig {
}
/**
* Sets the type of extraction scripts that will be used during this
* extraction. See
* Sets the type of language scripts that will be used during extraction.
* See
* {@link org.sleuthkit.autopsy.coreutils.StringExtract.StringExtractUnicodeTable.SCRIPT}
* for more information about available scripts.
*
* @param scripts Desired set of scripts to be used during extraction
*/
public void setExtractScripts(List<SCRIPT> scripts) {
this.extractScripts = scripts;
public void setLanguageScripts(List<SCRIPT> scripts) {
this.languageScripts = scripts;
}
/**
* Gets the desired set of scripts to be used during extraction.
*
* @return Set of extraction scripts to be used
* @return Set of language scripts to be used
*/
public List<SCRIPT> getExtractScripts() {
return this.extractScripts;
public List<SCRIPT> getLanguageScripts() {
return this.languageScripts;
}
}

View File

@ -79,6 +79,7 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.LoggedTask;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.ingest.events.DataSourceAnalysisCompletedEvent;
import org.sleuthkit.autopsy.timeline.FXMLConstructor;
import org.sleuthkit.autopsy.timeline.FilteredEventsModel;
import org.sleuthkit.autopsy.timeline.TimeLineController;
@ -96,6 +97,7 @@ import org.sleuthkit.autopsy.timeline.ui.detailview.DetailViewPane;
import org.sleuthkit.autopsy.timeline.ui.detailview.tree.EventsTree;
import org.sleuthkit.autopsy.timeline.ui.listvew.ListViewPane;
import org.sleuthkit.autopsy.timeline.utils.RangeDivision;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;
/**
@ -515,8 +517,7 @@ final public class ViewFrame extends BorderPane {
*/
@Subscribe
@NbBundle.Messages({
"# {0} - datasource name",
"ViewFrame.notification.analysisComplete=The event data has changed, the visualization may be out of date."})
"ViewFrame.notification.cacheInvalidated=The event data has changed, the visualization may be out of date."})
public void handleCacheInvalidated(FilteredEventsModel.CacheInvalidatedEvent event) {
Platform.runLater(() -> {
if (hostedView.needsRefresh() == false) {
@ -525,12 +526,12 @@ final public class ViewFrame extends BorderPane {
case Paused:
break;
case Ready:
notificationPane.show(Bundle.ViewFrame_notification_analysisComplete("x"));
notificationPane.show(Bundle.ViewFrame_notification_cacheInvalidated());
notificationState = NotificationState.Showing;
notificationTimer.restart();
break;
case Showing:
notificationPane.setText(Bundle.ViewFrame_notification_analysisComplete("x"));
notificationPane.setText(Bundle.ViewFrame_notification_cacheInvalidated());
notificationTimer.restart();
break;
}
@ -538,12 +539,6 @@ final public class ViewFrame extends BorderPane {
});
}
/**
* Display the given message in the notificationPane and then autohide it
* after 30 seconds.
*
* @param message The message to display.
*/
/**
* Refresh the Histogram to represent the current state of the DB.
*/

View File

@ -42,274 +42,274 @@ public class CorrelationAttributeNormalizerTest extends NbTestCase {
}
public void testValidateMd5() {
// final String aValidHash = "e34a8899ef6468b74f8a1048419ccc8b"; //should pass
// final String anInValidHash = "e34asdfa8899ef6468b74f8a1048419ccc8b"; //should fail
// final String aValidHashWithCaps = "E34A8899EF6468B74F8A1048419CCC8B"; //should pass and be lowered
// final String emptyHash = ""; //should fail
// final String nullHash = null; //should fail
//
// final int FILES_TYPE_ID = CorrelationAttributeInstance.FILES_TYPE_ID;
//
// try {
// assertTrue("This hash should just work", CorrelationAttributeNormalizer.normalize(FILES_TYPE_ID, aValidHash).equals(aValidHash));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// assertTrue("This hash just needs to be converted to lower case", CorrelationAttributeNormalizer.normalize(CorrelationAttributeInstance.FILES_TYPE_ID, aValidHashWithCaps).equals(aValidHash));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// CorrelationAttributeNormalizer.normalize(FILES_TYPE_ID, anInValidHash);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(FILES_TYPE_ID, emptyHash);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(FILES_TYPE_ID, nullHash);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
final String aValidHash = "e34a8899ef6468b74f8a1048419ccc8b"; //should pass
final String anInValidHash = "e34asdfa8899ef6468b74f8a1048419ccc8b"; //should fail
final String aValidHashWithCaps = "E34A8899EF6468B74F8A1048419CCC8B"; //should pass and be lowered
final String emptyHash = ""; //should fail
final String nullHash = null; //should fail
final int FILES_TYPE_ID = CorrelationAttributeInstance.FILES_TYPE_ID;
try {
assertTrue("This hash should just work", CorrelationAttributeNormalizer.normalize(FILES_TYPE_ID, aValidHash).equals(aValidHash));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
assertTrue("This hash just needs to be converted to lower case", CorrelationAttributeNormalizer.normalize(CorrelationAttributeInstance.FILES_TYPE_ID, aValidHashWithCaps).equals(aValidHash));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
CorrelationAttributeNormalizer.normalize(FILES_TYPE_ID, anInValidHash);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(FILES_TYPE_ID, emptyHash);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(FILES_TYPE_ID, nullHash);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
}
private static final String WE_EXPECT_AN_EXCEPTION_HERE = "We expect an exception here.";
private static final String THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION = "This should have thrown an exception.";
public void testValidateDomain() {
// final String goodDomainOne = "www.test.com"; //should pass
// final String badDomainTwo = "http://www.test.com"; //should fail (includes protocol)
// final String goodDomainThree = "test.com"; //should pass
// final String badDomainFour = "http://1270.0.1"; //should fail
// final String badDomainFive = "?>\\/)(*&.com"; //should fail
// final String badDomainSix = null; //should fail
// final String badDomainSeven = ""; //should fail
// final String badDomainEight = "HTTP://tests.com"; //should fail
// final String badDomainNine = "http://www.test.com/aPage?aQuestion=aParam&anotherQuestion=anotherParam"; //should fail
// final String goodDomainTen = "WWW.TEST.COM"; //should pass but be lowered
// final String goodDomainEleven = "TEST.COM"; //should pass but be lowered
//
// final int DOMAIN_TYPE_ID = CorrelationAttributeInstance.DOMAIN_TYPE_ID;
//
// try {
// assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, goodDomainOne).equals(goodDomainOne));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainTwo);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, goodDomainThree).equals(goodDomainThree));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainFour).equals(badDomainFour));
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainFive);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainSix);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainSeven);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainEight);
// fail("This should have thrown an exception");
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainNine);
// fail("This should have thrown an exception");
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, goodDomainTen).equals(goodDomainTen.toLowerCase()));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, goodDomainEleven).equals(goodDomainEleven.toLowerCase()));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
final String goodDomainOne = "www.test.com"; //should pass
final String badDomainTwo = "http://www.test.com"; //should fail (includes protocol)
final String goodDomainThree = "test.com"; //should pass
final String badDomainFour = "http://1270.0.1"; //should fail
final String badDomainFive = "?>\\/)(*&.com"; //should fail
final String badDomainSix = null; //should fail
final String badDomainSeven = ""; //should fail
final String badDomainEight = "HTTP://tests.com"; //should fail
final String badDomainNine = "http://www.test.com/aPage?aQuestion=aParam&anotherQuestion=anotherParam"; //should fail
final String goodDomainTen = "WWW.TEST.COM"; //should pass but be lowered
final String goodDomainEleven = "TEST.COM"; //should pass but be lowered
final int DOMAIN_TYPE_ID = CorrelationAttributeInstance.DOMAIN_TYPE_ID;
try {
assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, goodDomainOne).equals(goodDomainOne));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainTwo);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, goodDomainThree).equals(goodDomainThree));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainFour).equals(badDomainFour));
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainFive);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainSix);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainSeven);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainEight);
fail("This should have thrown an exception");
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, badDomainNine);
fail("This should have thrown an exception");
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, goodDomainTen).equals(goodDomainTen.toLowerCase()));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
assertTrue(THIS_DOMAIN_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(DOMAIN_TYPE_ID, goodDomainEleven).equals(goodDomainEleven.toLowerCase()));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
}
private static final String THIS_DOMAIN_SHOULD_PASS = "This domain should pass.";
public void testValidateEmail() {
// final String goodEmailOne = "bsweeney@cipehrtechsolutions.com"; //should pass
// final String goodEmailTwo = "BSWEENEY@ciphertechsolutions.com"; //should pass and be lowered
// final String badEmailThree = ""; //should fail
// final String badEmailFour = null; //should fail
// final String badEmailFive = "asdf"; //should fail
// final String goodEmailSix = "asdf@asdf"; //TODO looks bad but the lib accepts it...
// final String badEmailSeven = "asdf.asdf"; //should
//
// final int EMAIL_TYPE_ID = CorrelationAttributeInstance.EMAIL_TYPE_ID;
//
// try {
// assertTrue("This email should pass.", CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, goodEmailOne).equals(goodEmailOne));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// assertTrue("This email should pass.", CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, goodEmailTwo).equals(goodEmailTwo.toLowerCase()));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, badEmailThree);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, badEmailFour);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, badEmailFive);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try { //TODO consider a better library?
// assertTrue("This email should pass", CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, goodEmailSix).equals(goodEmailSix));
// } catch (CorrelationAttributeNormalizationException ex) {
// fail(ex.getMessage());
// }
// try {
// CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, badEmailSeven);
// fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
final String goodEmailOne = "bsweeney@cipehrtechsolutions.com"; //should pass
final String goodEmailTwo = "BSWEENEY@ciphertechsolutions.com"; //should pass and be lowered
final String badEmailThree = ""; //should fail
final String badEmailFour = null; //should fail
final String badEmailFive = "asdf"; //should fail
final String goodEmailSix = "asdf@asdf"; //TODO looks bad but the lib accepts it...
final String badEmailSeven = "asdf.asdf"; //should
final int EMAIL_TYPE_ID = CorrelationAttributeInstance.EMAIL_TYPE_ID;
try {
assertTrue("This email should pass.", CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, goodEmailOne).equals(goodEmailOne));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
assertTrue("This email should pass.", CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, goodEmailTwo).equals(goodEmailTwo.toLowerCase()));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, badEmailThree);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, badEmailFour);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, badEmailFive);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try { //TODO consider a better library?
assertTrue("This email should pass", CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, goodEmailSix).equals(goodEmailSix));
} catch (CorrelationAttributeNormalizationException ex) {
fail(ex.getMessage());
}
try {
CorrelationAttributeNormalizer.normalize(EMAIL_TYPE_ID, badEmailSeven);
fail(THIS_SHOULD_HAVE_THROWN_AN_EXCEPTION);
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
}
public void testValidatePhone() {
// final String goodPnOne = "19784740486";
// final String goodPnTwo = "1(978) 474-0486";
// final String goodPnThree = "+19784740486";
// final String goodPnFour = "1 978-474-0486";
// final String badPnFive = "9879879819784740486";
// final String goodPnSix = "+1(978) 474-0486";
// final String goodPnSeven = "+1(978) 474-0486";
// final String badPnEight = "asdfasdfasdf";
// final String badPnNine = "asdf19784740486adsf";
//
// final int PHONE_TYPE_ID = CorrelationAttributeInstance.PHONE_TYPE_ID;
//
// try {
// assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnOne).equals(goodPnOne));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnTwo).equals(goodPnOne));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnThree).equals(goodPnThree));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnFour).equals(goodPnOne));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, badPnFive);
// //fail("This should have thrown an exception."); //this will eventually pass when we do a better job at this
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnSix).equals(goodPnThree));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnSeven).equals(goodPnThree));
// } catch (CorrelationAttributeNormalizationException ex) {
// Exceptions.printStackTrace(ex);
// fail(ex.getMessage());
// }
// try {
// CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, badPnEight);
// fail("This should have thrown an exception.");
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
// try {
// CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, badPnNine);
// fail("This should have thrown an exception.");
// } catch (CorrelationAttributeNormalizationException ex) {
// assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
// }
final String goodPnOne = "19784740486";
final String goodPnTwo = "1(978) 474-0486";
final String goodPnThree = "+19784740486";
final String goodPnFour = "1 978-474-0486";
final String badPnFive = "9879879819784740486";
final String goodPnSix = "+1(978) 474-0486";
final String goodPnSeven = "+1(978) 474-0486";
final String badPnEight = "asdfasdfasdf";
final String badPnNine = "asdf19784740486adsf";
final int PHONE_TYPE_ID = CorrelationAttributeInstance.PHONE_TYPE_ID;
try {
assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnOne).equals(goodPnOne));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnTwo).equals(goodPnOne));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnThree).equals(goodPnThree));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnFour).equals(goodPnOne));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, badPnFive);
//fail("This should have thrown an exception."); //this will eventually pass when we do a better job at this
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnSix).equals(goodPnThree));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
assertTrue(THIS_PHONE_NUMBER_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, goodPnSeven).equals(goodPnThree));
} catch (CorrelationAttributeNormalizationException ex) {
Exceptions.printStackTrace(ex);
fail(ex.getMessage());
}
try {
CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, badPnEight);
fail("This should have thrown an exception.");
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
try {
CorrelationAttributeNormalizer.normalize(PHONE_TYPE_ID, badPnNine);
fail("This should have thrown an exception.");
} catch (CorrelationAttributeNormalizationException ex) {
assertTrue(WE_EXPECT_AN_EXCEPTION_HERE, true);
}
}
private static final String THIS_PHONE_NUMBER_SHOULD_PASS = "This phone number should pass.";
public void testValidateUsbId() {
// //TODO will need to be updated once usb validation does somethign interesting
// final String goodIdOne = "0202:AAFF"; //should pass
// /*final String goodIdTwo = "0202:aaff"; //should pass
// final String badIdThree = "0202:axxf"; //should fail
// final String badIdFour = ""; //should fail
// final String badIdFive = null; //should fail
// final String goodIdSix = "0202 AAFF"; //should pass
// final String goodIdSeven = "0202AAFF"; //should pass
// final String goodIdEight = "0202-AAFF"; //should pass*/
//
// final int USBID_TYPE_ID = CorrelationAttributeInstance.USBID_TYPE_ID;
//
// try {
// assertTrue(THIS_USB_ID_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(USBID_TYPE_ID, goodIdOne).equals(goodIdOne));
// } catch (CorrelationAttributeNormalizationException ex) {
// Assert.fail(ex.getMessage());
// }
//TODO will need to be updated once usb validation does something interesting
final String goodIdOne = "0202:AAFF"; //should pass
/*final String goodIdTwo = "0202:aaff"; //should pass
final String badIdThree = "0202:axxf"; //should fail
final String badIdFour = ""; //should fail
final String badIdFive = null; //should fail
final String goodIdSix = "0202 AAFF"; //should pass
final String goodIdSeven = "0202AAFF"; //should pass
final String goodIdEight = "0202-AAFF"; //should pass*/
final int USBID_TYPE_ID = CorrelationAttributeInstance.USBID_TYPE_ID;
try {
assertTrue(THIS_USB_ID_SHOULD_PASS, CorrelationAttributeNormalizer.normalize(USBID_TYPE_ID, goodIdOne).equals(goodIdOne));
} catch (CorrelationAttributeNormalizationException ex) {
Assert.fail(ex.getMessage());
}
}
private static final String THIS_USB_ID_SHOULD_PASS = "This USB ID should pass.";
}

View File

@ -56,7 +56,7 @@ import org.sleuthkit.autopsy.commonfilesearch.CaseDBCommonAttributeInstanceNode;
import org.sleuthkit.autopsy.commonfilesearch.CentralRepoCommonAttributeInstance;
import org.sleuthkit.autopsy.commonfilesearch.CentralRepoCommonAttributeInstanceNode;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeCountSearchResults;
import org.sleuthkit.autopsy.guiutils.DataSourceLoader;
import org.sleuthkit.autopsy.datamodel.utils.DataSourceLoader;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValue;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValueList;
import org.sleuthkit.autopsy.datamodel.DisplayableItemNode;

View File

@ -34,7 +34,7 @@ import org.sleuthkit.autopsy.casemodule.ImageDSProcessor;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.commonfilesearch.AbstractCommonAttributeInstance;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeCountSearchResults;
import org.sleuthkit.autopsy.guiutils.DataSourceLoader;
import org.sleuthkit.autopsy.datamodel.utils.DataSourceLoader;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValue;
import org.sleuthkit.autopsy.commonfilesearch.CommonAttributeValueList;
import org.sleuthkit.autopsy.coreutils.TimeStampUtils;

View File

@ -67,40 +67,34 @@ public class EmbeddedFileTest extends NbTestCase {
@Override
public void setUp() {
// testSucceeded = false;
//
// /*
// * TODO (JIRA-4241): Revisit this when the Image Gallery tool cleans up
// * its drawable database connection deterministically, instead of in a
// * finalizer. As it is now, case deletion can fail due to an open
// * drawable database file handles, and that makes the tests fail.
// */
// openCase = CaseUtils.createAsCurrentCase(CASE_NAME + "_" + System.currentTimeMillis());
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
//
// IngestModuleTemplate embeddedTemplate = IngestUtils.getIngestModuleTemplate(new EmbeddedFileExtractorModuleFactory());
// IngestModuleTemplate hashLookupTemplate = IngestUtils.getIngestModuleTemplate(new HashLookupModuleFactory());
//
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(embeddedTemplate);
// templates.add(hashLookupTemplate);
// IngestJobSettings ingestJobSettings = new IngestJobSettings(EmbeddedFileTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates);
//
// try {
// IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
testSucceeded = false;
openCase = CaseUtils.createAsCurrentCase(CASE_NAME + "_" + System.currentTimeMillis());
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
IngestModuleTemplate embeddedTemplate = IngestUtils.getIngestModuleTemplate(new EmbeddedFileExtractorModuleFactory());
IngestModuleTemplate hashLookupTemplate = IngestUtils.getIngestModuleTemplate(new HashLookupModuleFactory());
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(embeddedTemplate);
templates.add(hashLookupTemplate);
IngestJobSettings ingestJobSettings = new IngestJobSettings(EmbeddedFileTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates);
try {
IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
}
@Override
public void tearDown() {
// CaseUtils.closeCurrentCase(testSucceeded);
CaseUtils.closeCurrentCase(testSucceeded);
}
public void testEncryptionAndZipBomb() {
// public void testEncryptionAndZipBomb() {
// try {
// List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("name LIKE '%%'");
// final String zipBombSetName = "Possible Zip Bomb";
@ -146,122 +140,122 @@ public class EmbeddedFileTest extends NbTestCase {
// }
//
// testSucceeded = true;
}
// }
public void testBigFolder() {
// final int numOfFilesToTest = 1000;
// try {
// //Get all files under 'big folder' directory except '.' '..' 'slack' files
// List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("parent_path LIKE '%big folder/' and name != '.' and name != '..' and extension NOT LIKE '%slack'");
// assertEquals(numOfFilesToTest, results.size()); //There are 1000 files
// int numOfFilesTested = 0;
// for (AbstractFile file : results) {
// String fileName = file.getName();
// //File name should like file1.txt, file2.txt ... file1000.txt
// String errMsg = String.format("File name %s doesn't follow the expected naming convention: fileNaturalNumber.txt, eg. file234.txt.", fileName);
// assertTrue(errMsg, file.getName().matches("file[1-9]\\d*.txt"));
// String hashValue = file.getMd5Hash();
// //All files have the same hash value
// assertEquals(HASH_VALUE, hashValue);
// numOfFilesTested++;
// }
// //Make sure 1000 files have been tested
// assertEquals(numOfFilesToTest, numOfFilesTested);
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
final int numOfFilesToTest = 1000;
try {
//Get all files under 'big folder' directory except '.' '..' 'slack' files
List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("parent_path LIKE '%big folder/' and name != '.' and name != '..' and extension NOT LIKE '%slack'");
assertEquals(numOfFilesToTest, results.size()); //There are 1000 files
int numOfFilesTested = 0;
for (AbstractFile file : results) {
String fileName = file.getName();
//File name should like file1.txt, file2.txt ... file1000.txt
String errMsg = String.format("File name %s doesn't follow the expected naming convention: fileNaturalNumber.txt, eg. file234.txt.", fileName);
assertTrue(errMsg, file.getName().matches("file[1-9]\\d*.txt"));
String hashValue = file.getMd5Hash();
//All files have the same hash value
assertEquals(HASH_VALUE, hashValue);
numOfFilesTested++;
}
//Make sure 1000 files have been tested
assertEquals(numOfFilesToTest, numOfFilesTested);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testDeepFolder() {
// try {
// //Get all files under 'deep folder' directory except '.' '..'
// List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("parent_path LIKE '%deep folder/' and name != '.' and name != '..'");
// assertEquals(1, results.size());
// StringBuffer dirReached = new StringBuffer();
// ArrayList<String> fileReached = new ArrayList<>();
// checkEachFileInDeepFolder(results.get(0), dirReached, fileReached, 0);
// //Check that all 25 folders/files have been reached
// assertEquals(DEEP_FOLDER_COUNT, fileReached.size());
// //Make sure the test reached the last directory 'dir25'. The whole directory is dir1/dir2...dir24/dir25/
// assertTrue(dirReached.toString().startsWith("dir1/dir2/"));
// assertTrue(dirReached.toString().endsWith("dir24/dir25/"));
// //Make sure the test reached the last file.txt in dir1/dir2...dir24/dir25/
// assertTrue(fileReached.get(0).endsWith(dirReached.toString() + "file.txt"));
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
try {
//Get all files under 'deep folder' directory except '.' '..'
List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("parent_path LIKE '%deep folder/' and name != '.' and name != '..'");
assertEquals(1, results.size());
StringBuffer dirReached = new StringBuffer();
ArrayList<String> fileReached = new ArrayList<>();
checkEachFileInDeepFolder(results.get(0), dirReached, fileReached, 0);
//Check that all 25 folders/files have been reached
assertEquals(DEEP_FOLDER_COUNT, fileReached.size());
//Make sure the test reached the last directory 'dir25'. The whole directory is dir1/dir2...dir24/dir25/
assertTrue(dirReached.toString().startsWith("dir1/dir2/"));
assertTrue(dirReached.toString().endsWith("dir24/dir25/"));
//Make sure the test reached the last file.txt in dir1/dir2...dir24/dir25/
assertTrue(fileReached.get(0).endsWith(dirReached.toString() + "file.txt"));
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testEmbeddedFile() {
// try {
// //Query level3.txt under '/ZIP/embedded/level3.zip/'
// List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("name = 'level3.txt' and parent_path = '/ZIP/embedded/level3.zip/'");
// assertEquals(1, results.size());
//
// //Query level2.txt under '/ZIP/embedded/level3.zip/level2.zip/'
// results = openCase.getSleuthkitCase().findAllFilesWhere("name = 'level2.txt' and parent_path = '/ZIP/embedded/level3.zip/level2.zip/'");
// assertEquals(1, results.size());
//
// //Query level1.txt under '/ZIP/embedded/level3.zip/level2.zip/level1.zip/'
// results = openCase.getSleuthkitCase().findAllFilesWhere("name = 'level1.txt' and parent_path = '/ZIP/embedded/level3.zip/level2.zip/level1.zip/'");
// assertEquals(1, results.size());
//
// //Confirm that we can reach level1.txt from the embedded folder
// results = openCase.getSleuthkitCase().findAllFilesWhere("parent_path LIKE '%embedded/' and name != '.' and name != '..' and extension NOT LIKE '%slack%'");
// assertEquals(1, results.size());
// assertTrue(checkFileInEmbeddedFolder(results.get(0)));
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
try {
//Query level3.txt under '/ZIP/embedded/level3.zip/'
List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("name = 'level3.txt' and parent_path = '/ZIP/embedded/level3.zip/'");
assertEquals(1, results.size());
//Query level2.txt under '/ZIP/embedded/level3.zip/level2.zip/'
results = openCase.getSleuthkitCase().findAllFilesWhere("name = 'level2.txt' and parent_path = '/ZIP/embedded/level3.zip/level2.zip/'");
assertEquals(1, results.size());
//Query level1.txt under '/ZIP/embedded/level3.zip/level2.zip/level1.zip/'
results = openCase.getSleuthkitCase().findAllFilesWhere("name = 'level1.txt' and parent_path = '/ZIP/embedded/level3.zip/level2.zip/level1.zip/'");
assertEquals(1, results.size());
//Confirm that we can reach level1.txt from the embedded folder
results = openCase.getSleuthkitCase().findAllFilesWhere("parent_path LIKE '%embedded/' and name != '.' and name != '..' and extension NOT LIKE '%slack%'");
assertEquals(1, results.size());
assertTrue(checkFileInEmbeddedFolder(results.get(0)));
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testContent() {
// final int numOfFilesToTest = 1029;
// try {
// //All files with txt extension should have the same hash value,
// //except the zip file with txt extension and the .txt files extracted from password protected zip shouldn't have hash value
// List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere(
// "extension = 'txt' and name != 'zipFileWithTxtExtension.txt' and parent_path NOT LIKE '%_protected%'");
// assertEquals(numOfFilesToTest, results.size());
// int numOfHashTested = 0;
// for (AbstractFile file : results) {
// String fileName = file.getName();
// String errMsg = String.format("File name %s doesn't have the extected hash value %s.", fileName, HASH_VALUE);
// assertEquals(errMsg, HASH_VALUE, file.getMd5Hash());
// numOfHashTested++;
// }
// //Make sure the hash value of 1029 files have been tested
// assertEquals(numOfFilesToTest, numOfHashTested);
//
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
final int numOfFilesToTest = 1029;
try {
//All files with txt extension should have the same hash value,
//except the zip file with txt extension and the .txt files extracted from password protected zip shouldn't have hash value
List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere(
"extension = 'txt' and name != 'zipFileWithTxtExtension.txt' and parent_path NOT LIKE '%_protected%'");
assertEquals(numOfFilesToTest, results.size());
int numOfHashTested = 0;
for (AbstractFile file : results) {
String fileName = file.getName();
String errMsg = String.format("File name %s doesn't have the extected hash value %s.", fileName, HASH_VALUE);
assertEquals(errMsg, HASH_VALUE, file.getMd5Hash());
numOfHashTested++;
}
//Make sure the hash value of 1029 files have been tested
assertEquals(numOfFilesToTest, numOfHashTested);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testExtension() {
// try {
// //Query zipFileWithTxtExtension.txt at extension folder
// List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("extension = 'txt' and parent_path = '/ZIP/extension/zipFileWithTxtExtension.txt/'");
// assertEquals(1, results.size());
// assertEquals("file.txt wasn't extracted from the file: zipFileWithTxtExtension.txt", "file.txt", results.get(0).getName());
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
try {
//Query zipFileWithTxtExtension.txt at extension folder
List<AbstractFile> results = openCase.getSleuthkitCase().findAllFilesWhere("extension = 'txt' and parent_path = '/ZIP/extension/zipFileWithTxtExtension.txt/'");
assertEquals(1, results.size());
assertEquals("file.txt wasn't extracted from the file: zipFileWithTxtExtension.txt", "file.txt", results.get(0).getName());
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
private void checkEachFileInDeepFolder(AbstractFile file, StringBuffer dirReached, ArrayList<String> fileReached, int numOfDir) {

View File

@ -78,295 +78,295 @@ public class IngestFileFiltersTest extends NbTestCase {
@Override
public void tearDown() {
// CaseUtils.closeCurrentCase(testSucceeded);
CaseUtils.closeCurrentCase(testSucceeded);
}
public void testBasicDir() {
// Case currentCase = CaseUtils.createAsCurrentCase("testBasicDir");
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
//
// HashMap<String, Rule> rule = new HashMap<>();
// rule.put("Rule", new Rule("testFileType", null, new MetaTypeCondition(MetaTypeCondition.Type.FILES), new ParentPathCondition("dir1"), null, null, null));
// //Filter for dir1 and no unallocated space
// FilesSet dirFilter = new FilesSet("Filter", "Filter to find all files in dir1.", false, true, rule);
//
// try {
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, dirFilter);
// IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
// FileManager fileManager = currentCase.getServices().getFileManager();
// List<AbstractFile> results = fileManager.findFiles("file.jpg", "dir1");
// String mimeType = results.get(0).getMIMEType();
// assertEquals("image/jpeg", mimeType);
//
// results = fileManager.findFiles("%%");
//
// for (AbstractFile file : results) {
// //All files in dir1 should have MIME type, except '.' '..' and slack files
// if (file.getParentPath().equalsIgnoreCase("/dir1/")) {
// if (!(file.getName().equals(".") || file.getName().equals("..") || file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
// String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
// }
// } else { //All files not in dir1 shouldn't have MIME type
// String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() == null);
// }
// }
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
// }
//
// public void testExtAndDirWithOneRule() {
// Case currentCase = CaseUtils.createAsCurrentCase("testExtAndDirWithOneRule");
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
//
// HashMap<String, Rule> rules = new HashMap<>();
// rules.put("Rule", new Rule("testExtAndDirWithOneRule", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), new ParentPathCondition("dir1"), null, null, null));
// //Build the filter that ignore unallocated space and with one rule
// FilesSet filesExtDirsFilter = new FilesSet("Filter", "Filter to find all jpg files in dir1.", false, true, rules);
//
// try {
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, filesExtDirsFilter);
// IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
// FileManager fileManager = currentCase.getServices().getFileManager();
// List<AbstractFile> results = fileManager.findFiles("%%");
// assertEquals(62, results.size());
// for (AbstractFile file : results) {
// //Files with jpg extension in dir1 should have MIME Type
// if (file.getParentPath().equalsIgnoreCase("/dir1/") && file.getNameExtension().equalsIgnoreCase("jpg")) {
// String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
// } else { //All others shouldn't have MIME Type
// String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() == null);
// }
// }
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
// }
//
// public void testExtAndDirWithTwoRules() {
// Case currentCase = CaseUtils.createAsCurrentCase("testExtAndDirWithTwoRules");
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
//
// HashMap<String, Rule> rules = new HashMap<>();
// rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
// rules.put("rule2", new Rule("FindDir1Directory", null, new MetaTypeCondition(MetaTypeCondition.Type.FILES), new ParentPathCondition("dir1"), null, null, null));
// //Build the filter that ingnore unallocated space and with 2 rules
// FilesSet filesExtDirsFilter = new FilesSet("Filter", "Filter to find all files in dir1 and all files with jpg extention.", false, true, rules);
//
// try {
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, filesExtDirsFilter);
// IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
// FileManager fileManager = currentCase.getServices().getFileManager();
// List<AbstractFile> results = fileManager.findFiles("%%");
// assertEquals(62, results.size());
// for (AbstractFile file : results) {
// if (file.getNameExtension().equalsIgnoreCase("jpg")) { //All files with .jpg extension should have MIME type
// String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
// } else if (file.getParentPath().equalsIgnoreCase("/dir1/")) {
// //All files in dir1 should have MIME type except '.' '..' slack files
// if (file.getName().equals(".") || file.getName().equals("..") || file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) {
// String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() == null);
// } else {
// String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
// }
// } else { //All files that are not in dir1 or not with .jpg extension should not have MIME type
// String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() == null);
// }
// }
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
Case currentCase = CaseUtils.createAsCurrentCase("testBasicDir");
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
HashMap<String, Rule> rule = new HashMap<>();
rule.put("Rule", new Rule("testFileType", null, new MetaTypeCondition(MetaTypeCondition.Type.FILES), new ParentPathCondition("dir1"), null, null, null));
//Filter for dir1 and no unallocated space
FilesSet dirFilter = new FilesSet("Filter", "Filter to find all files in dir1.", false, true, rule);
try {
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, dirFilter);
IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
FileManager fileManager = currentCase.getServices().getFileManager();
List<AbstractFile> results = fileManager.findFiles("file.jpg", "dir1");
String mimeType = results.get(0).getMIMEType();
assertEquals("image/jpeg", mimeType);
results = fileManager.findFiles("%%");
for (AbstractFile file : results) {
//All files in dir1 should have MIME type, except '.' '..' and slack files
if (file.getParentPath().equalsIgnoreCase("/dir1/")) {
if (!(file.getName().equals(".") || file.getName().equals("..") || file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
}
} else { //All files not in dir1 shouldn't have MIME type
String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() == null);
}
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testExtAndDirWithOneRule() {
Case currentCase = CaseUtils.createAsCurrentCase("testExtAndDirWithOneRule");
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
HashMap<String, Rule> rules = new HashMap<>();
rules.put("Rule", new Rule("testExtAndDirWithOneRule", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), new ParentPathCondition("dir1"), null, null, null));
//Build the filter that ignore unallocated space and with one rule
FilesSet filesExtDirsFilter = new FilesSet("Filter", "Filter to find all jpg files in dir1.", false, true, rules);
try {
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, filesExtDirsFilter);
IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
FileManager fileManager = currentCase.getServices().getFileManager();
List<AbstractFile> results = fileManager.findFiles("%%");
assertEquals(62, results.size());
for (AbstractFile file : results) {
//Files with jpg extension in dir1 should have MIME Type
if (file.getParentPath().equalsIgnoreCase("/dir1/") && file.getNameExtension().equalsIgnoreCase("jpg")) {
String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
} else { //All others shouldn't have MIME Type
String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() == null);
}
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testExtAndDirWithTwoRules() {
Case currentCase = CaseUtils.createAsCurrentCase("testExtAndDirWithTwoRules");
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
HashMap<String, Rule> rules = new HashMap<>();
rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
rules.put("rule2", new Rule("FindDir1Directory", null, new MetaTypeCondition(MetaTypeCondition.Type.FILES), new ParentPathCondition("dir1"), null, null, null));
//Build the filter that ingnore unallocated space and with 2 rules
FilesSet filesExtDirsFilter = new FilesSet("Filter", "Filter to find all files in dir1 and all files with jpg extention.", false, true, rules);
try {
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, filesExtDirsFilter);
IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
FileManager fileManager = currentCase.getServices().getFileManager();
List<AbstractFile> results = fileManager.findFiles("%%");
assertEquals(62, results.size());
for (AbstractFile file : results) {
if (file.getNameExtension().equalsIgnoreCase("jpg")) { //All files with .jpg extension should have MIME type
String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
} else if (file.getParentPath().equalsIgnoreCase("/dir1/")) {
//All files in dir1 should have MIME type except '.' '..' slack files
if (file.getName().equals(".") || file.getName().equals("..") || file.getType() == TskData.TSK_DB_FILES_TYPE_ENUM.SLACK) {
String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() == null);
} else {
String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
}
} else { //All files that are not in dir1 or not with .jpg extension should not have MIME type
String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() == null);
}
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testFullFileNameRule() {
// Case currentCase = CaseUtils.createAsCurrentCase("testFullFileNameRule");
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
//
// HashMap<String, Rule> rules = new HashMap<>();
// rules.put("rule", new Rule("FindFileWithFullName", new FullNameCondition("file.docx"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
// //Build the filter to find file: file.docx
// FilesSet fullNameFilter = new FilesSet("Filter", "Filter to find file.docx.", false, true, rules);
//
// try {
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, fullNameFilter);
// IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
// FileManager fileManager = currentCase.getServices().getFileManager();
// List<AbstractFile> results = fileManager.findFiles("%%");
// assertEquals(62, results.size());
// for (AbstractFile file : results) {
// //Only file.docx has MIME Type
// if (file.getName().equalsIgnoreCase("file.docx")) {
// String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
// } else {
// String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() == null);
// }
// }
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
// }
//
// public void testCarvingWithExtRuleAndUnallocSpace() {
// Case currentCase = CaseUtils.createAsCurrentCase("testCarvingWithExtRuleAndUnallocSpace");
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
//
// HashMap<String, Rule> rules = new HashMap<>();
// rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
// rules.put("rule2", new Rule("FindGifExtention", new ExtensionCondition("gif"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
//
// //Build the filter to find files with .jpg and .gif extension and unallocated space
// FilesSet extensionFilter = new FilesSet("Filter", "Filter to files with .jpg and .gif extension.", false, false, rules);
//
// try {
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
// templates.add(IngestUtils.getIngestModuleTemplate(new PhotoRecCarverIngestModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, extensionFilter);
// IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
// FileManager fileManager = currentCase.getServices().getFileManager();
// List<AbstractFile> results = fileManager.findFiles("%%");
// assertEquals(70, results.size());
// int carvedJpgGifFiles = 0;
// for (AbstractFile file : results) {
// if (file.getNameExtension().equalsIgnoreCase("jpg") || file.getNameExtension().equalsIgnoreCase("gif")) { //Unalloc file and .jpg files in dir1, dir2, $CarvedFiles, root directory should have MIME type
// String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
//
// if (file.getParentPath().equalsIgnoreCase("/$CarvedFiles/")) {
// carvedJpgGifFiles++;
// }
// } else if (file.getName().startsWith("Unalloc_")) {
// String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
// } else { //All other files should not have MIME type.
// String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() == null);
// }
// }
// //Make sure we have carved jpg/gif files
// assertEquals(2, carvedJpgGifFiles);
//
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
Case currentCase = CaseUtils.createAsCurrentCase("testFullFileNameRule");
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
HashMap<String, Rule> rules = new HashMap<>();
rules.put("rule", new Rule("FindFileWithFullName", new FullNameCondition("file.docx"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
//Build the filter to find file: file.docx
FilesSet fullNameFilter = new FilesSet("Filter", "Filter to find file.docx.", false, true, rules);
try {
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, fullNameFilter);
IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
FileManager fileManager = currentCase.getServices().getFileManager();
List<AbstractFile> results = fileManager.findFiles("%%");
assertEquals(62, results.size());
for (AbstractFile file : results) {
//Only file.docx has MIME Type
if (file.getName().equalsIgnoreCase("file.docx")) {
String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
} else {
String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() == null);
}
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testCarvingWithExtRuleAndUnallocSpace() {
Case currentCase = CaseUtils.createAsCurrentCase("testCarvingWithExtRuleAndUnallocSpace");
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
HashMap<String, Rule> rules = new HashMap<>();
rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
rules.put("rule2", new Rule("FindGifExtention", new ExtensionCondition("gif"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
//Build the filter to find files with .jpg and .gif extension and unallocated space
FilesSet extensionFilter = new FilesSet("Filter", "Filter to files with .jpg and .gif extension.", false, false, rules);
try {
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
templates.add(IngestUtils.getIngestModuleTemplate(new PhotoRecCarverIngestModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, extensionFilter);
IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
FileManager fileManager = currentCase.getServices().getFileManager();
List<AbstractFile> results = fileManager.findFiles("%%");
assertEquals(70, results.size());
int carvedJpgGifFiles = 0;
for (AbstractFile file : results) {
if (file.getNameExtension().equalsIgnoreCase("jpg") || file.getNameExtension().equalsIgnoreCase("gif")) { //Unalloc file and .jpg files in dir1, dir2, $CarvedFiles, root directory should have MIME type
String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
if (file.getParentPath().equalsIgnoreCase("/$CarvedFiles/")) {
carvedJpgGifFiles++;
}
} else if (file.getName().startsWith("Unalloc_")) {
String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
} else { //All other files should not have MIME type.
String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() == null);
}
}
//Make sure we have carved jpg/gif files
assertEquals(2, carvedJpgGifFiles);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testCarvingNoUnallocatedSpace() {
// Case currentCase = CaseUtils.createAsCurrentCase("testCarvingNoUnallocatedSpace");
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
//
// HashMap<String, Rule> rules = new HashMap<>();
// rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
// rules.put("rule2", new Rule("FindGifExtention", new ExtensionCondition("gif"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
//
// //Build the filter to find files with .jpg and .gif extension
// FilesSet extensionFilter = new FilesSet("Filter", "Filter to files with .jpg and .gif extension.", false, true, rules);
//
// try {
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
// templates.add(IngestUtils.getIngestModuleTemplate(new PhotoRecCarverIngestModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates, extensionFilter);
// try {
// List<IngestModuleError> errs = IngestJobRunner.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
// //Ingest fails because Carving wants unallocated space
// assertEquals(1, errs.size());
// assertEquals("PhotoRec Carver", errs.get(0).getModuleDisplayName());
// } catch (InterruptedException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
Case currentCase = CaseUtils.createAsCurrentCase("testCarvingNoUnallocatedSpace");
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, IMAGE_PATH);
HashMap<String, Rule> rules = new HashMap<>();
rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
rules.put("rule2", new Rule("FindGifExtention", new ExtensionCondition("gif"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
//Build the filter to find files with .jpg and .gif extension
FilesSet extensionFilter = new FilesSet("Filter", "Filter to files with .jpg and .gif extension.", false, true, rules);
try {
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
templates.add(IngestUtils.getIngestModuleTemplate(new PhotoRecCarverIngestModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates, extensionFilter);
try {
List<IngestModuleError> errs = IngestJobRunner.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
//Ingest fails because Carving wants unallocated space
assertEquals(1, errs.size());
assertEquals("PhotoRec Carver", errs.get(0).getModuleDisplayName());
} catch (InterruptedException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
public void testEmbeddedModule() {
// Case currentCase = CaseUtils.createAsCurrentCase("testEmbeddedModule");
// LocalFilesDSProcessor dataSourceProcessor = new LocalFilesDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, ZIPFILE_PATH);
//
// //Build the filter to find jpg files
// HashMap<String, Rule> rules = new HashMap<>();
// //Extension condition for jpg files
// rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
// //Extension condition for zip files, because we want test jpg extension filter for extracted files from a zip file
// rules.put("rule2", new Rule("ZipExtention", new ExtensionCondition("zip"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
// FilesSet embeddedFilter = new FilesSet("Filter", "Filter to files with .jpg extension.", false, false, rules);
//
// try {
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
// templates.add(IngestUtils.getIngestModuleTemplate(new EmbeddedFileExtractorModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, embeddedFilter);
// IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
// FileManager fileManager = currentCase.getServices().getFileManager();
// //get all .jpg files in zip file
// List<AbstractFile> results = fileManager.findFiles("%%");
// assertEquals(39, results.size());
// int numTypeJpgFiles = 0;
// for (AbstractFile file : results) {
// if (file.getNameExtension().equalsIgnoreCase("jpg") || file.getNameExtension().equalsIgnoreCase("zip")) {
// String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
// numTypeJpgFiles++;
// } else if (file.isDir() && (file.getType() == TSK_DB_FILES_TYPE_ENUM.DERIVED || file.getType() == TSK_DB_FILES_TYPE_ENUM.LOCAL)) {
// String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
// } else {
// String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
// assertTrue(errMsg, file.getMIMEType() == null);
// }
// }
// //Make sure 10 jpg files and 1 zip file have been typed
// assertEquals(11, numTypeJpgFiles);
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
Case currentCase = CaseUtils.createAsCurrentCase("testEmbeddedModule");
LocalFilesDSProcessor dataSourceProcessor = new LocalFilesDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, ZIPFILE_PATH);
//Build the filter to find jpg files
HashMap<String, Rule> rules = new HashMap<>();
//Extension condition for jpg files
rules.put("rule1", new Rule("FindJpgExtention", new ExtensionCondition("jpg"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
//Extension condition for zip files, because we want test jpg extension filter for extracted files from a zip file
rules.put("rule2", new Rule("ZipExtention", new ExtensionCondition("zip"), new MetaTypeCondition(MetaTypeCondition.Type.FILES), null, null, null, null));
FilesSet embeddedFilter = new FilesSet("Filter", "Filter to files with .jpg extension.", false, false, rules);
try {
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new FileTypeIdModuleFactory()));
templates.add(IngestUtils.getIngestModuleTemplate(new EmbeddedFileExtractorModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(IngestFileFiltersTest.class.getCanonicalName(), IngestJobSettings.IngestType.FILES_ONLY, templates, embeddedFilter);
IngestUtils.runIngestJob(currentCase.getDataSources(), ingestJobSettings);
FileManager fileManager = currentCase.getServices().getFileManager();
//get all .jpg files in zip file
List<AbstractFile> results = fileManager.findFiles("%%");
assertEquals(39, results.size());
int numTypeJpgFiles = 0;
for (AbstractFile file : results) {
if (file.getNameExtension().equalsIgnoreCase("jpg") || file.getNameExtension().equalsIgnoreCase("zip")) {
String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
numTypeJpgFiles++;
} else if (file.isDir() && (file.getType() == TSK_DB_FILES_TYPE_ENUM.DERIVED || file.getType() == TSK_DB_FILES_TYPE_ENUM.LOCAL)) {
String errMsg = String.format("File %s (objId=%d) unexpectedly blocked by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() != null && !file.getMIMEType().isEmpty());
} else {
String errMsg = String.format("File %s (objId=%d) unexpectedly passed by the file filter.", file.getName(), file.getId());
assertTrue(errMsg, file.getMIMEType() == null);
}
}
//Make sure 10 jpg files and 1 zip file have been typed
assertEquals(11, numTypeJpgFiles);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
}

View File

@ -82,166 +82,166 @@ public class EncryptionDetectionTest extends NbTestCase {
@Override
public void tearDown() {
// CaseUtils.closeCurrentCase(testSucceeded);
CaseUtils.closeCurrentCase(testSucceeded);
}
/**
* Test the Encryption Detection module's password protection detection.
*/
public void testBitlockerEncryption() {
// try {
// Case openCase = CaseUtils.createAsCurrentCase(BITLOCKER_DETECTION_CASE_NAME);
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, BITLOCKER_DETECTION_IMAGE_PATH);
//
// /*
// * Create ingest job settings and run ingest job.
// */
// IngestModuleFactory ingestModuleFactory = new EncryptionDetectionModuleFactory();
// IngestModuleIngestJobSettings settings = ingestModuleFactory.getDefaultIngestJobSettings();
// IngestModuleTemplate template = new IngestModuleTemplate(ingestModuleFactory, settings);
// template.setEnabled(true);
// List<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(template);
// IngestJobSettings ingestJobSettings = new IngestJobSettings(EncryptionDetectionTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates);
// IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
//
// /*
// * Process each volume.
// */
// boolean vol2Found = false;
//
// String errorMessage;
//
// Image dataSource = (Image) openCase.getDataSources().get(0);
// List<VolumeSystem> volumeSystems = dataSource.getVolumeSystems();
// for (VolumeSystem volumeSystem : volumeSystems) {
// for (Volume volume : volumeSystem.getVolumes()) {
// List<BlackboardArtifact> artifactsList = volume.getAllArtifacts();
//
// if (volume.getName().equals("vol2")) {
// vol2Found = true;
//
// errorMessage = String.format("Expected one artifact for '%s', but found %d.",
// volume.getName(), artifactsList.size());
// assertEquals(errorMessage, 1, artifactsList.size());
//
// String artifactTypeName = artifactsList.get(0).getArtifactTypeName();
// errorMessage = String.format("Unexpected '%s' artifact for '%s'.",
// artifactTypeName, volume.getName());
// assertEquals(errorMessage, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.toString(), artifactTypeName);
//
// BlackboardAttribute attribute = artifactsList.get(0).getAttribute(
// new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT));
// errorMessage = String.format("Expected a TSK_COMMENT attribute for '%s', but found none.",
// volume.getName());
// assertNotNull(errorMessage, attribute);
//
// errorMessage = String.format("Unexpected attribute value: \"%s\"", attribute.getValueString());
// assertEquals(errorMessage, "Bitlocker encryption detected.", attribute.getValueString());
// } else {
// errorMessage = String.format("Expected no artifacts for '%s', but found %d.",
// volume.getName(), artifactsList.size());
// assertEquals(errorMessage, 0, artifactsList.size());
// }
// }
// }
//
// errorMessage = "Expected to find 'vol2', but no such volume exists.";
// assertEquals(errorMessage, true, vol2Found);
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
try {
Case openCase = CaseUtils.createAsCurrentCase(BITLOCKER_DETECTION_CASE_NAME);
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, BITLOCKER_DETECTION_IMAGE_PATH);
/*
* Create ingest job settings and run ingest job.
*/
IngestModuleFactory ingestModuleFactory = new EncryptionDetectionModuleFactory();
IngestModuleIngestJobSettings settings = ingestModuleFactory.getDefaultIngestJobSettings();
IngestModuleTemplate template = new IngestModuleTemplate(ingestModuleFactory, settings);
template.setEnabled(true);
List<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(template);
IngestJobSettings ingestJobSettings = new IngestJobSettings(EncryptionDetectionTest.class.getCanonicalName(), IngestType.FILES_ONLY, templates);
IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
/*
* Process each volume.
*/
boolean vol2Found = false;
String errorMessage;
Image dataSource = (Image) openCase.getDataSources().get(0);
List<VolumeSystem> volumeSystems = dataSource.getVolumeSystems();
for (VolumeSystem volumeSystem : volumeSystems) {
for (Volume volume : volumeSystem.getVolumes()) {
List<BlackboardArtifact> artifactsList = volume.getAllArtifacts();
if (volume.getName().equals("vol2")) {
vol2Found = true;
errorMessage = String.format("Expected one artifact for '%s', but found %d.",
volume.getName(), artifactsList.size());
assertEquals(errorMessage, 1, artifactsList.size());
String artifactTypeName = artifactsList.get(0).getArtifactTypeName();
errorMessage = String.format("Unexpected '%s' artifact for '%s'.",
artifactTypeName, volume.getName());
assertEquals(errorMessage, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.toString(), artifactTypeName);
BlackboardAttribute attribute = artifactsList.get(0).getAttribute(
new BlackboardAttribute.Type(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT));
errorMessage = String.format("Expected a TSK_COMMENT attribute for '%s', but found none.",
volume.getName());
assertNotNull(errorMessage, attribute);
errorMessage = String.format("Unexpected attribute value: \"%s\"", attribute.getValueString());
assertEquals(errorMessage, "Bitlocker encryption detected.", attribute.getValueString());
} else {
errorMessage = String.format("Expected no artifacts for '%s', but found %d.",
volume.getName(), artifactsList.size());
assertEquals(errorMessage, 0, artifactsList.size());
}
}
}
errorMessage = "Expected to find 'vol2', but no such volume exists.";
assertEquals(errorMessage, true, vol2Found);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
/**
* Test the Encryption Detection module's password protection detection.
*/
public void testPasswordProtection() {
// try {
// Case openCase = CaseUtils.createAsCurrentCase(PASSWORD_DETECTION_CASE_NAME);
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, PASSWORD_DETECTION_IMAGE_PATH);
//
// /*
// * Create ingest job settings.
// */
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new EncryptionDetectionModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(PASSWORD_DETECTION_CASE_NAME, IngestType.FILES_ONLY, templates);
// IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
//
// /*
// * Purge specific files to be tested.
// */
// FileManager fileManager = openCase.getServices().getFileManager();
// List<List<AbstractFile>> allResults = new ArrayList<>(0);
//
// List<AbstractFile> ole2Results = fileManager.findFiles("%%", "ole2");
// assertEquals("Unexpected number of OLE2 results.", 11, ole2Results.size());
//
// List<AbstractFile> ooxmlResults = fileManager.findFiles("%%", "ooxml");
// assertEquals("Unexpected number of OOXML results.", 13, ooxmlResults.size());
//
// List<AbstractFile> pdfResults = fileManager.findFiles("%%", "pdf");
// assertEquals("Unexpected number of PDF results.", 6, pdfResults.size());
//
// List<AbstractFile> mdbResults = fileManager.findFiles("%%", "mdb");
// assertEquals("Unexpected number of MDB results.", 25, mdbResults.size());
//
// List<AbstractFile> accdbResults = fileManager.findFiles("%%", "accdb");
// assertEquals("Unexpected number of ACCDB results.", 10, accdbResults.size());
//
// allResults.add(ole2Results);
// allResults.add(ooxmlResults);
// allResults.add(pdfResults);
// allResults.add(mdbResults);
// allResults.add(accdbResults);
//
// for (List<AbstractFile> results : allResults) {
// for (AbstractFile file : results) {
// /*
// * Process only non-slack files.
// */
// if (file.isFile() && !file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
// /*
// * Determine which assertions to use for the file based
// * on its name.
// */
// boolean fileProtected = file.getName().split("\\.")[0].endsWith("-protected");
// List<BlackboardArtifact> artifactsList = file.getAllArtifacts();
// if (fileProtected) {
// /*
// * Check that the protected file has one
// * TSK_ENCRYPTION_DETECTED artifact.
// */
// int artifactsListSize = artifactsList.size();
// String errorMessage = String.format("File '%s' (objId=%d) has %d artifacts, but 1 was expected.", file.getName(), file.getId(), artifactsListSize);
// assertEquals(errorMessage, 1, artifactsListSize);
//
// String artifactTypeName = artifactsList.get(0).getArtifactTypeName();
// errorMessage = String.format("File '%s' (objId=%d) has an unexpected '%s' artifact.", file.getName(), file.getId(), artifactTypeName);
// assertEquals(errorMessage, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.toString(), artifactTypeName);
// } else {
// /*
// * Check that the unprotected file has no artifacts.
// */
// int artifactsListSize = artifactsList.size();
// String errorMessage = String.format("File '%s' (objId=%d) has %d artifacts, but none were expected.", file.getName(), file.getId(), artifactsListSize);
// assertEquals(errorMessage, 0, artifactsListSize);
// }
// }
// }
// }
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
try {
Case openCase = CaseUtils.createAsCurrentCase(PASSWORD_DETECTION_CASE_NAME);
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, PASSWORD_DETECTION_IMAGE_PATH);
/*
* Create ingest job settings.
*/
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new EncryptionDetectionModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(PASSWORD_DETECTION_CASE_NAME, IngestType.FILES_ONLY, templates);
IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
/*
* Purge specific files to be tested.
*/
FileManager fileManager = openCase.getServices().getFileManager();
List<List<AbstractFile>> allResults = new ArrayList<>(0);
List<AbstractFile> ole2Results = fileManager.findFiles("%%", "ole2");
assertEquals("Unexpected number of OLE2 results.", 11, ole2Results.size());
List<AbstractFile> ooxmlResults = fileManager.findFiles("%%", "ooxml");
assertEquals("Unexpected number of OOXML results.", 13, ooxmlResults.size());
List<AbstractFile> pdfResults = fileManager.findFiles("%%", "pdf");
assertEquals("Unexpected number of PDF results.", 6, pdfResults.size());
List<AbstractFile> mdbResults = fileManager.findFiles("%%", "mdb");
assertEquals("Unexpected number of MDB results.", 25, mdbResults.size());
List<AbstractFile> accdbResults = fileManager.findFiles("%%", "accdb");
assertEquals("Unexpected number of ACCDB results.", 10, accdbResults.size());
allResults.add(ole2Results);
allResults.add(ooxmlResults);
allResults.add(pdfResults);
allResults.add(mdbResults);
allResults.add(accdbResults);
for (List<AbstractFile> results : allResults) {
for (AbstractFile file : results) {
/*
* Process only non-slack files.
*/
if (file.isFile() && !file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
/*
* Determine which assertions to use for the file based
* on its name.
*/
boolean fileProtected = file.getName().split("\\.")[0].endsWith("-protected");
List<BlackboardArtifact> artifactsList = file.getAllArtifacts();
if (fileProtected) {
/*
* Check that the protected file has one
* TSK_ENCRYPTION_DETECTED artifact.
*/
int artifactsListSize = artifactsList.size();
String errorMessage = String.format("File '%s' (objId=%d) has %d artifacts, but 1 was expected.", file.getName(), file.getId(), artifactsListSize);
assertEquals(errorMessage, 1, artifactsListSize);
String artifactTypeName = artifactsList.get(0).getArtifactTypeName();
errorMessage = String.format("File '%s' (objId=%d) has an unexpected '%s' artifact.", file.getName(), file.getId(), artifactTypeName);
assertEquals(errorMessage, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_DETECTED.toString(), artifactTypeName);
} else {
/*
* Check that the unprotected file has no artifacts.
*/
int artifactsListSize = artifactsList.size();
String errorMessage = String.format("File '%s' (objId=%d) has %d artifacts, but none were expected.", file.getName(), file.getId(), artifactsListSize);
assertEquals(errorMessage, 0, artifactsListSize);
}
}
}
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
/**
@ -258,110 +258,110 @@ public class EncryptionDetectionTest extends NbTestCase {
* artifact associated with it.
*/
public void testVeraCryptSupport() {
// try {
// Case openCase = CaseUtils.createAsCurrentCase(VERACRYPT_DETECTION_CASE_NAME);
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, VERACRYPT_DETECTION_IMAGE_PATH);
//
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new EncryptionDetectionModuleFactory()));
// //image includes an encrypted container file with size greater than 5 mb so default settings detect it
// IngestJobSettings ingestJobSettings = new IngestJobSettings(VERACRYPT_DETECTION_CASE_NAME, IngestType.ALL_MODULES, templates);
//
// assertEquals("Expected only one data source to exist in the Case", 1, openCase.getDataSources().size());
// IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
//
// //check that one of the partitions has an encrypted volume
// int numberOfEncryptedVolumes = 0;
// for (Content datasource : openCase.getDataSources()) { //data source
// for (Content volumeSystem : datasource.getChildren()) { //volume system
// for (Content volume : volumeSystem.getChildren()) { //volumes
// numberOfEncryptedVolumes += volume.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED).size();
// }
// }
// }
// assertEquals("One volume should exist with an encryption suspsected artifact", 1, numberOfEncryptedVolumes);
//
// //ensure the encrypyted container file was also detected correctly
// FileManager fileManager = openCase.getServices().getFileManager();
// List<AbstractFile> results = fileManager.findFiles("veracryptContainerFile");
// assertEquals("Expected 1 file named veracryptContainerFile to exist in test image", 1, results.size());
// int numberOfEncryptedContainers = 0;
// for (AbstractFile file : results) {
// numberOfEncryptedContainers += file.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED).size();
// }
// assertEquals("Encrypted Container file should have one encyption suspected artifact", 1, numberOfEncryptedContainers);
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
try {
Case openCase = CaseUtils.createAsCurrentCase(VERACRYPT_DETECTION_CASE_NAME);
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, VERACRYPT_DETECTION_IMAGE_PATH);
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new EncryptionDetectionModuleFactory()));
//image includes an encrypted container file with size greater than 5 mb so default settings detect it
IngestJobSettings ingestJobSettings = new IngestJobSettings(VERACRYPT_DETECTION_CASE_NAME, IngestType.ALL_MODULES, templates);
assertEquals("Expected only one data source to exist in the Case", 1, openCase.getDataSources().size());
IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
//check that one of the partitions has an encrypted volume
int numberOfEncryptedVolumes = 0;
for (Content datasource : openCase.getDataSources()) { //data source
for (Content volumeSystem : datasource.getChildren()) { //volume system
for (Content volume : volumeSystem.getChildren()) { //volumes
numberOfEncryptedVolumes += volume.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED).size();
}
}
}
assertEquals("One volume should exist with an encryption suspsected artifact", 1, numberOfEncryptedVolumes);
//ensure the encrypyted container file was also detected correctly
FileManager fileManager = openCase.getServices().getFileManager();
List<AbstractFile> results = fileManager.findFiles("veracryptContainerFile");
assertEquals("Expected 1 file named veracryptContainerFile to exist in test image", 1, results.size());
int numberOfEncryptedContainers = 0;
for (AbstractFile file : results) {
numberOfEncryptedContainers += file.getArtifacts(BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED).size();
}
assertEquals("Encrypted Container file should have one encyption suspected artifact", 1, numberOfEncryptedContainers);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
/**
* Test the Encryption Detection module's SQLCipher encryption detection.
*/
public void testSqlCipherEncryption() {
// try {
// Case openCase = CaseUtils.createAsCurrentCase(SQLCIPHER_DETECTION_CASE_NAME);
// ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
// IngestUtils.addDataSource(dataSourceProcessor, SQLCIPHER_DETECTION_IMAGE_PATH);
//
// /*
// * Create ingest job settings.
// */
// ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
// templates.add(IngestUtils.getIngestModuleTemplate(new EncryptionDetectionModuleFactory()));
// IngestJobSettings ingestJobSettings = new IngestJobSettings(SQLCIPHER_DETECTION_CASE_NAME, IngestType.FILES_ONLY, templates);
// IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
//
// /*
// * Purge specific files to be tested.
// */
// FileManager fileManager = openCase.getServices().getFileManager();
// List<AbstractFile> results = fileManager.findFiles("%%", "sqlcipher");
// assertEquals("Unexpected number of SQLCipher results.", 15, results.size());
//
// for (AbstractFile file : results) {
// /*
// * Process only non-slack files.
// */
// if (file.isFile() && !file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
// /*
// * Determine which assertions to use for the file based on
// * its name.
// */
// List<BlackboardArtifact> artifactsList = file.getAllArtifacts();
// String[] splitNameArray = file.getName().split("\\.");
// if (splitNameArray[0].startsWith("sqlcipher-") && splitNameArray[splitNameArray.length - 1].equals("db")) {
// /*
// * Check that the SQLCipher database file has one
// * TSK_ENCRYPTION_SUSPECTED artifact.
// */
// int artifactsListSize = artifactsList.size();
// String errorMessage = String.format("File '%s' (objId=%d) has %d artifacts, but 1 was expected.", file.getName(), file.getId(), artifactsListSize);
// assertEquals(errorMessage, 1, artifactsListSize);
//
// String artifactTypeName = artifactsList.get(0).getArtifactTypeName();
// errorMessage = String.format("File '%s' (objId=%d) has an unexpected '%s' artifact.", file.getName(), file.getId(), artifactTypeName);
// assertEquals(errorMessage, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED.toString(), artifactTypeName);
// } else {
// /*
// * Check that the file has no artifacts.
// */
// int artifactsListSize = artifactsList.size();
// String errorMessage = String.format("File '%s' (objId=%d) has %d artifacts, but none were expected.", file.getName(), file.getId(), artifactsListSize);
// assertEquals(errorMessage, 0, artifactsListSize);
// }
// }
// }
// } catch (TskCoreException ex) {
// Exceptions.printStackTrace(ex);
// Assert.fail(ex.getMessage());
// }
//
// testSucceeded = true;
try {
Case openCase = CaseUtils.createAsCurrentCase(SQLCIPHER_DETECTION_CASE_NAME);
ImageDSProcessor dataSourceProcessor = new ImageDSProcessor();
IngestUtils.addDataSource(dataSourceProcessor, SQLCIPHER_DETECTION_IMAGE_PATH);
/*
* Create ingest job settings.
*/
ArrayList<IngestModuleTemplate> templates = new ArrayList<>();
templates.add(IngestUtils.getIngestModuleTemplate(new EncryptionDetectionModuleFactory()));
IngestJobSettings ingestJobSettings = new IngestJobSettings(SQLCIPHER_DETECTION_CASE_NAME, IngestType.FILES_ONLY, templates);
IngestUtils.runIngestJob(openCase.getDataSources(), ingestJobSettings);
/*
* Purge specific files to be tested.
*/
FileManager fileManager = openCase.getServices().getFileManager();
List<AbstractFile> results = fileManager.findFiles("%%", "sqlcipher");
assertEquals("Unexpected number of SQLCipher results.", 15, results.size());
for (AbstractFile file : results) {
/*
* Process only non-slack files.
*/
if (file.isFile() && !file.getType().equals(TskData.TSK_DB_FILES_TYPE_ENUM.SLACK)) {
/*
* Determine which assertions to use for the file based on
* its name.
*/
List<BlackboardArtifact> artifactsList = file.getAllArtifacts();
String[] splitNameArray = file.getName().split("\\.");
if (splitNameArray[0].startsWith("sqlcipher-") && splitNameArray[splitNameArray.length - 1].equals("db")) {
/*
* Check that the SQLCipher database file has one
* TSK_ENCRYPTION_SUSPECTED artifact.
*/
int artifactsListSize = artifactsList.size();
String errorMessage = String.format("File '%s' (objId=%d) has %d artifacts, but 1 was expected.", file.getName(), file.getId(), artifactsListSize);
assertEquals(errorMessage, 1, artifactsListSize);
String artifactTypeName = artifactsList.get(0).getArtifactTypeName();
errorMessage = String.format("File '%s' (objId=%d) has an unexpected '%s' artifact.", file.getName(), file.getId(), artifactTypeName);
assertEquals(errorMessage, BlackboardArtifact.ARTIFACT_TYPE.TSK_ENCRYPTION_SUSPECTED.toString(), artifactTypeName);
} else {
/*
* Check that the file has no artifacts.
*/
int artifactsListSize = artifactsList.size();
String errorMessage = String.format("File '%s' (objId=%d) has %d artifacts, but none were expected.", file.getName(), file.getId(), artifactsListSize);
assertEquals(errorMessage, 0, artifactsListSize);
}
}
}
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}
testSucceeded = true;
}
}

View File

@ -29,6 +29,7 @@ import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.CaseActionException;
import org.sleuthkit.autopsy.casemodule.CaseDetails;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.FileUtil;
/**
* Class with utility methods for opening and closing cases for functional
@ -52,13 +53,8 @@ public final class CaseUtils {
*/
Path caseDirectoryPath = Paths.get(System.getProperty("java.io.tmpdir"), caseName);
File caseDirectory = caseDirectoryPath.toFile();
if (caseDirectory.exists()) {
try {
FileUtils.deleteDirectory(caseDirectory);
} catch (IOException ex) {
Assert.fail(String.format("Failed to delete existing case %s at %s: %s", caseName, caseDirectoryPath, ex.getMessage()));
Exceptions.printStackTrace(ex);
}
if(caseDirectory.exists() && !FileUtil.deleteDir(caseDirectory)){
Assert.fail(String.format("Failed to delete existing case %s at %s", caseName, caseDirectoryPath));
}
/*
@ -96,15 +92,8 @@ public final class CaseUtils {
String caseDirectory = currentCase.getCaseDirectory();
try {
Case.closeCurrentCase();
if (deleteCase) {
/*
* TODO (JIRA-4241): Restore the code to delete the case
* directory when the Image Gallery tool cleans up its drawable
* database connection deterministically, instead of in a
* finalizer. As it is now, case deletion can fail due to an
* open drawable database file handles.
*/
//FileUtils.deleteDirectory(caseDirectory);
if(deleteCase && !FileUtil.deleteDir(new File(caseDirectory))){
Assert.fail(String.format("Failed to delete case directory for case %s at %s", caseName, caseDirectory));
}
} catch (CaseActionException ex) {
Exceptions.printStackTrace(ex);

View File

@ -20,9 +20,12 @@ package org.sleuthkit.autopsy.testutils;
import java.nio.file.Path;
import java.util.List;
import java.util.UUID;
import static junit.framework.Assert.assertEquals;
import org.openide.util.Exceptions;
import junit.framework.Assert;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.corecomponentinterfaces.DataSourceProcessorCallback;
import org.sleuthkit.autopsy.datasourceprocessors.AutoIngestDataSourceProcessor;
import org.sleuthkit.autopsy.ingest.IngestJobSettings;
@ -60,14 +63,18 @@ public final class IngestUtils {
if (!dataSourcePath.toFile().exists()) {
Assert.fail("Data source not found: " + dataSourcePath.toString());
}
UUID taskId = UUID.randomUUID();
Case.getCurrentCaseThrows().notifyAddingDataSource(taskId);
DataSourceProcessorRunner.ProcessorCallback callBack = DataSourceProcessorRunner.runDataSourceProcessor(dataSourceProcessor, dataSourcePath);
result = callBack.getResult();
if (result.equals(DataSourceProcessorCallback.DataSourceProcessorResult.CRITICAL_ERRORS)) {
String joinedErrors = String.join(System.lineSeparator(), callBack.getErrorMessages());
Assert.fail(String.format("Error(s) occurred while running the data source processor: %s", joinedErrors));
}
} catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException | InterruptedException ex) {
for (Content c:callBack.getDataSourceContent()) {
Case.getCurrentCaseThrows().notifyDataSourceAdded(c, taskId);
}
} catch (AutoIngestDataSourceProcessor.AutoIngestDataSourceProcessorException | NoCurrentCaseException | InterruptedException ex) {
Exceptions.printStackTrace(ex);
Assert.fail(ex.getMessage());
}

View File

@ -135,7 +135,7 @@
<compile-dependency/>
<run-dependency>
<release-version>10</release-version>
<specification-version>10.13</specification-version>
<specification-version>10.14</specification-version>
</run-dependency>
</dependency>
<dependency>

View File

@ -18,11 +18,14 @@
*/
package org.sleuthkit.autopsy.experimental.autoingest;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.awt.Cursor;
import java.awt.EventQueue;
import java.util.Observable;
import java.util.Observer;
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestMonitor.AutoIngestNodeState;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import org.sleuthkit.autopsy.healthmonitor.HealthMonitorDashboard;
/**
@ -33,12 +36,18 @@ final class AinStatusDashboard extends javax.swing.JPanel implements Observer {
private final AutoIngestMonitor autoIngestMonitor;
private final AinStatusPanel nodesPanel;
private final static String AIN_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d";
private final static int AIN_REFRESH_INTERVAL_SECS = 30;
private final static int AIN_DELAY_BEFORE_FIRST_REFRESH = 0;
private final ScheduledThreadPoolExecutor scheduledRefreshThreadPoolExecutor;
private AtomicBoolean scheduledRefreshStarted = new AtomicBoolean(false);
/**
* Creates new form AutoIngestNodeStatus
*/
AinStatusDashboard(AutoIngestMonitor monitor) {
initComponents();
scheduledRefreshThreadPoolExecutor = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(AIN_REFRESH_THREAD_NAME).build());
autoIngestMonitor = monitor;
nodesPanel = new AinStatusPanel();
nodesPanel.setSize(nodesPanel.getSize());
@ -172,10 +181,12 @@ final class AinStatusDashboard extends javax.swing.JPanel implements Observer {
@Override
public void update(Observable o, Object arg) {
if (arg instanceof AutoIngestNodeState) {
if (!scheduledRefreshStarted.getAndSet(true)) {
scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> {
EventQueue.invokeLater(() -> {
refreshTables();
});
}, AIN_DELAY_BEFORE_FIRST_REFRESH, AIN_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS);
}
}
}

View File

@ -39,6 +39,7 @@ import net.sf.sevenzipjbinding.simple.ISimpleInArchive;
import net.sf.sevenzipjbinding.simple.ISimpleInArchiveItem;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.GeneralFilter;
import org.sleuthkit.autopsy.coreutils.FileUtil;
/**
* Set of utilities that handles archive file extraction. Uses 7zip library.
@ -235,7 +236,7 @@ final class ArchiveUtil {
for (ISimpleInArchiveItem entry : simpleInArchive.getArchiveItems()) {
String entryPathInArchive = entry.getPath();
Path fullPath = Paths.get(destinationFolder, entryPathInArchive);
Path fullPath = Paths.get(destinationFolder, FileUtil.escapeFileName(entryPathInArchive)); // remove illegal characters from file name
File destFile = new File(fullPath.toString());
File destinationParent = destFile.getParentFile();
destinationParent.mkdirs();

View File

@ -18,26 +18,31 @@
*/
package org.sleuthkit.autopsy.experimental.autoingest;
import com.google.common.util.concurrent.ThreadFactoryBuilder;
import java.awt.Cursor;
import java.util.Observable;
import java.util.Observer;
import java.util.logging.Level;
import java.awt.Color;
import java.awt.EventQueue;
import java.beans.PropertyChangeEvent;
import java.beans.PropertyChangeListener;
import java.io.File;
import java.nio.file.Paths;
import java.util.HashSet;
import java.util.Observable;
import java.util.Observer;
import java.util.Set;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.ScheduledThreadPoolExecutor;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicBoolean;
import javax.swing.JPanel;
import javax.swing.SwingWorker;
import javax.swing.UIManager;
import org.openide.modules.Places;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.core.ServicesMonitor;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNodeRefreshEvents.RefreshChildrenEvent;
/**
@ -46,14 +51,19 @@ import org.sleuthkit.autopsy.experimental.autoingest.AutoIngestNodeRefreshEvents
@SuppressWarnings("PMD.SingularField") // UI widgets cause lots of false positives
final class AutoIngestDashboard extends JPanel implements Observer {
private final static String ADMIN_ACCESS_FILE_NAME = "adminAccess";
private final static String ADMIN_ACCESS_FILE_PATH = Places.getUserDirectory().getAbsolutePath() + File.separator + ADMIN_ACCESS_FILE_NAME;
private final static String ADMIN_ACCESS_FILE_NAME = "_aiaa"; // NON-NLS
private final static String ADMIN_ACCESS_FILE_PATH = Paths.get(PlatformUtil.getUserConfigDirectory(), ADMIN_ACCESS_FILE_NAME).toString();
private final static String AID_REFRESH_THREAD_NAME = "AID-refresh-jobs-%d";
private final static int AID_REFRESH_INTERVAL_SECS = 30;
private final static int AID_DELAY_BEFORE_FIRST_REFRESH = 0;
private static final long serialVersionUID = 1L;
private static final Logger LOGGER = Logger.getLogger(AutoIngestDashboard.class.getName());
private AutoIngestMonitor autoIngestMonitor;
private AutoIngestJobsPanel pendingJobsPanel;
private AutoIngestJobsPanel runningJobsPanel;
private AutoIngestJobsPanel completedJobsPanel;
private final ScheduledThreadPoolExecutor scheduledRefreshThreadPoolExecutor;
private AtomicBoolean scheduledRefreshStarted = new AtomicBoolean(false);
/**
* Maintain a mapping of each service to it's last status update.
@ -87,7 +97,7 @@ final class AutoIngestDashboard extends JPanel implements Observer {
private AutoIngestDashboard() {
this.statusByService = new ConcurrentHashMap<>();
scheduledRefreshThreadPoolExecutor = new ScheduledThreadPoolExecutor(1, new ThreadFactoryBuilder().setNameFormat(AID_REFRESH_THREAD_NAME).build());
initComponents();
statusByService.put(ServicesMonitor.Service.REMOTE_CASE_DATABASE.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
statusByService.put(ServicesMonitor.Service.REMOTE_KEYWORD_SEARCH.toString(), NbBundle.getMessage(AutoIngestDashboard.class, "AutoIngestDashboard.tbServicesStatusMessage.Message.Down"));
@ -239,6 +249,7 @@ final class AutoIngestDashboard extends JPanel implements Observer {
new Thread(() -> {
try {
autoIngestMonitor.startUp();
} catch (AutoIngestMonitor.AutoIngestMonitorException ex) {
LOGGER.log(Level.SEVERE, "Unable to start up Auto Ingest Monitor", ex);
}
@ -256,18 +267,19 @@ final class AutoIngestDashboard extends JPanel implements Observer {
@Override
public void update(Observable observable, Object arg) {
if (arg == null ) {
if (!scheduledRefreshStarted.getAndSet(true)) {
scheduledRefreshThreadPoolExecutor.scheduleWithFixedDelay(() -> {
EventQueue.invokeLater(() -> {
refreshTables();
});
}, AID_DELAY_BEFORE_FIRST_REFRESH, AID_REFRESH_INTERVAL_SECS, TimeUnit.SECONDS);
}
}
/**
* Reloads the table models using a jobs snapshot and refreshes the JTables
* Reloads the table models using a RefreshChildrenEvent and refreshes the JTables
* that use the models.
*
* @param nodeStateSnapshot The jobs snapshot.
*/
void refreshTables() {
pendingJobsPanel.refresh(new RefreshChildrenEvent(autoIngestMonitor));

View File

@ -164,7 +164,7 @@ final class AutoIngestJobsPanel extends javax.swing.JPanel implements ExplorerMa
* Update the contents of this AutoIngestJobsPanel while retaining currently
* selected node.
*
* @param jobsSnapshot - the JobsSnapshot which will provide the new
* @param refreshEvent - the AutoIngestRefreshEvent which will provide the new
* contents
*/
void refresh(AutoIngestRefreshEvent refreshEvent) {

View File

@ -198,6 +198,7 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen
runningJob.setModuleRuntimesSnapshot(job.getModuleRunTimes());
runningJob.setProcessingStage(job.getProcessingStage(), job.getProcessingStageStartDate());
runningJob.setProcessingStatus(job.getProcessingStatus());
break;
}
}
setChanged();
@ -365,8 +366,9 @@ final class AutoIngestMonitor extends Observable implements PropertyChangeListen
LOGGER.log(Level.SEVERE, "Unknown AutoIngestJobData.ProcessingStatus");
break;
}
} catch (InterruptedException ex) {
LOGGER.log(Level.SEVERE, String.format("Unexpected interrupt while retrieving coordination service node data for '%s'", node), ex);
} catch (InterruptedException ignore) {
LOGGER.log(Level.WARNING, "Interrupt while retrieving coordination service node data");
return newJobsSnapshot;
} catch (AutoIngestJobNodeData.InvalidDataException ex) {
LOGGER.log(Level.SEVERE, String.format("Unable to use node data for '%s'", node), ex);
} catch (AutoIngestJob.AutoIngestJobException ex) {

View File

@ -127,7 +127,7 @@
<compile-dependency/>
<run-dependency>
<release-version>10</release-version>
<specification-version>10.13</specification-version>
<specification-version>10.14</specification-version>
</run-dependency>
</dependency>
<dependency>

View File

@ -553,14 +553,12 @@ public final class ImageGalleryController {
return dbTaskQueueSize.getReadOnlyProperty();
}
public synchronized SleuthkitCase getSleuthKitCase() {
public SleuthkitCase getSleuthKitCase() {
return sleuthKitCase;
}
public ThumbnailCache getThumbsCache() {
return thumbnailCache;
}
/**

View File

@ -354,6 +354,11 @@ public class ImageGalleryModule {
DataSourceAnalysisEvent dataSourceEvent = (DataSourceAnalysisEvent) event;
Content dataSource = dataSourceEvent.getDataSource();
if (dataSource == null) {
logger.log(Level.SEVERE, String.format("Failed to handle %s event", event.getPropertyName())); //NON-NLS
return;
}
long dataSourceObjId = dataSource.getId();
String eventType = dataSourceEvent.getPropertyName();
try {

View File

@ -767,7 +767,7 @@ public final class DrawableDB {
}
}
} catch (SQLException ex) {
logger.log(Level.SEVERE, "Failed to get group seen", ex); //NON-NLS
completeExceptionally(ex);
}
}
}
@ -784,7 +784,7 @@ public final class DrawableDB {
return queryResultProcessor.get();
} catch (ExecutionException | InterruptedException | TskCoreException ex) {
String msg = String.format("Failed to get is group seen for group key %s", groupKey.getValueDisplayName()); //NON-NLS
logger.log(Level.WARNING, msg, ex);
logger.log(Level.SEVERE, msg, ex);
}
return false;

View File

@ -119,7 +119,7 @@
<compile-dependency/>
<run-dependency>
<release-version>10</release-version>
<specification-version>10.13</specification-version>
<specification-version>10.14</specification-version>
</run-dependency>
</dependency>
<dependency>

View File

@ -53,7 +53,7 @@
<EmptySpace min="-2" pref="22" max="-2" attributes="0"/>
<Component id="keywordListsLabel" min="-2" max="-2" attributes="0"/>
<EmptySpace min="-2" max="-2" attributes="0"/>
<Component id="jScrollPane1" max="32767" attributes="0"/>
<Component id="jScrollPane1" pref="354" max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Group type="103" groupAlignment="3" attributes="0">
<Component id="newListButton" linkSize="5" alignment="3" min="-2" max="-2" attributes="0"/>

View File

@ -318,7 +318,7 @@ class GlobalListsManagementPanel extends javax.swing.JPanel implements OptionsPa
.addGap(22, 22, 22)
.addComponent(keywordListsLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jScrollPane1)
.addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 354, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(newListButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)

View File

@ -68,13 +68,15 @@ class KeywordSearchGlobalLanguageSettingsPanel extends javax.swing.JPanel implem
}
};
if (!PlatformUtil.isWindowsOS()) {
enableOcrCheckbox.setVisible(false);
}
initScriptsCheckBoxes();
reloadScriptsCheckBoxes();
if (!PlatformUtil.isWindowsOS() || !PlatformUtil.is64BitOS()) {
enableOcrCheckbox.setText("Enable Optical Character Recognition (OCR) (Requires Windows 64-bit)");
enableOcrCheckbox.setSelected(false);
enableOcrCheckbox.setEnabled(false);
}
//allow panel to toggle its enabled status while it is open based on ingest events
IngestManager.getInstance().addIngestJobEventListener(new PropertyChangeListener() {
@Override

View File

@ -17,7 +17,7 @@
<DimensionLayout dim="0">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="0" attributes="0">
<Component id="tabbedPane" pref="824" max="32767" attributes="0"/>
<Component id="tabbedPane" pref="926" max="32767" attributes="0"/>
<EmptySpace min="-2" pref="0" max="-2" attributes="0"/>
</Group>
</Group>

View File

@ -106,7 +106,7 @@ final class KeywordSearchGlobalSettingsPanel extends IngestModuleGlobalSettingsP
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(layout.createSequentialGroup()
.addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 824, Short.MAX_VALUE)
.addComponent(tabbedPane, javax.swing.GroupLayout.DEFAULT_SIZE, 926, Short.MAX_VALUE)
.addGap(0, 0, 0))
);
layout.setVerticalGroup(

View File

@ -32,6 +32,7 @@ import org.openide.util.NbBundle.Messages;
import org.openide.util.lookup.Lookups;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.casemodule.NoCurrentCaseException;
import org.sleuthkit.autopsy.coreutils.ExecUtil.ProcessTerminator;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.MessageNotifyUtil;
import org.sleuthkit.autopsy.ingest.FileIngestModule;
@ -46,10 +47,9 @@ import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchService;
import org.sleuthkit.autopsy.keywordsearchservice.KeywordSearchServiceException;
import org.sleuthkit.autopsy.modules.filetypeid.FileTypeDetector;
import org.sleuthkit.autopsy.textextractors.TextExtractor;
import org.sleuthkit.autopsy.textextractors.TextExtractor.ExtractionException;
import org.sleuthkit.autopsy.textextractors.TextExtractorFactory;
import org.sleuthkit.autopsy.textextractors.extractionconfigs.ImageFileExtractionConfig;
import org.sleuthkit.autopsy.textextractors.extractionconfigs.DefaultExtractionConfig;
import org.sleuthkit.autopsy.textextractors.configs.ImageConfig;
import org.sleuthkit.autopsy.textextractors.configs.StringsConfig;
import org.sleuthkit.datamodel.AbstractFile;
import org.sleuthkit.datamodel.TskData;
import org.sleuthkit.datamodel.TskData.FileKnown;
@ -74,7 +74,7 @@ public final class KeywordSearchIngestModule implements FileIngestModule {
/** generally text extractors should ignore archives and let unpacking
* modules take care of them */
public static final List<String> ARCHIVE_MIME_TYPES
private static final List<String> ARCHIVE_MIME_TYPES
= ImmutableList.of(
//ignore unstructured binary and compressed data, for which string extraction or unzipper works better
"application/x-7z-compressed", //NON-NLS
@ -291,11 +291,11 @@ public final class KeywordSearchIngestModule implements FileIngestModule {
}
}
DefaultExtractionConfig stringsConfig = new DefaultExtractionConfig();
StringsConfig stringsConfig = new StringsConfig();
Map<String, String> stringsOptions = KeywordSearchSettings.getStringExtractOptions();
stringsConfig.setExtractUTF8(Boolean.parseBoolean(stringsOptions.get(StringsExtractOptions.EXTRACT_UTF8.toString())));
stringsConfig.setExtractUTF16(Boolean.parseBoolean(stringsOptions.get(StringsExtractOptions.EXTRACT_UTF16.toString())));
stringsConfig.setExtractScripts(KeywordSearchSettings.getStringExtractScripts());
stringsConfig.setLanguageScripts(KeywordSearchSettings.getStringExtractScripts());
stringsExtractionContext = Lookups.fixed(stringsConfig);
@ -478,15 +478,17 @@ public final class KeywordSearchIngestModule implements FileIngestModule {
* @throws IngesterException exception thrown if indexing failed
*/
private boolean extractTextAndIndex(AbstractFile aFile, String detectedFormat) throws IngesterException {
ImageFileExtractionConfig imageConfig = new ImageFileExtractionConfig();
ImageConfig imageConfig = new ImageConfig();
imageConfig.setOCREnabled(KeywordSearchSettings.getOcrOption());
Lookup extractionContext = Lookups.fixed(imageConfig);
ProcessTerminator terminator = () -> context.fileIngestIsCancelled();
Lookup extractionContext = Lookups.fixed(imageConfig, terminator);
try {
Reader specializedReader = TextExtractorFactory.getExtractor(aFile,extractionContext).getReader();
TextExtractor extractor = TextExtractorFactory.getExtractor(aFile,extractionContext);
Reader extractedTextReader = extractor.getReader();
//divide into chunks and index
return Ingester.getDefault().indexText(specializedReader,aFile.getId(),aFile.getName(), aFile, context);
} catch (TextExtractorFactory.NoTextExtractorFound | ExtractionException ex) {
return Ingester.getDefault().indexText(extractedTextReader,aFile.getId(),aFile.getName(), aFile, context);
} catch (TextExtractorFactory.NoTextExtractorFound | TextExtractor.InitReaderException ex) {
//No text extractor found... run the default instead
return false;
}
@ -505,8 +507,9 @@ public final class KeywordSearchIngestModule implements FileIngestModule {
if (context.fileIngestIsCancelled()) {
return true;
}
Reader stringsReader = TextExtractorFactory.getDefaultExtractor(aFile, stringsExtractionContext).getReader();
if (Ingester.getDefault().indexText(stringsReader,aFile.getId(),aFile.getName(), aFile, KeywordSearchIngestModule.this.context)) {
TextExtractor stringsExtractor = TextExtractorFactory.getStringsExtractor(aFile, stringsExtractionContext);
Reader extractedTextReader = stringsExtractor.getReader();
if (Ingester.getDefault().indexText(extractedTextReader,aFile.getId(),aFile.getName(), aFile, KeywordSearchIngestModule.this.context)) {
putIngestStatus(jobId, aFile.getId(), IngestStatus.STRINGS_INGESTED);
return true;
} else {
@ -514,7 +517,7 @@ public final class KeywordSearchIngestModule implements FileIngestModule {
putIngestStatus(jobId, aFile.getId(), IngestStatus.SKIPPED_ERROR_TEXTEXTRACT);
return false;
}
} catch (IngesterException | ExtractionException ex) {
} catch (IngesterException | TextExtractor.InitReaderException ex) {
logger.log(Level.WARNING, "Failed to extract strings and ingest, file '" + aFile.getName() + "' (id: " + aFile.getId() + ").", ex); //NON-NLS
putIngestStatus(jobId, aFile.getId(), IngestStatus.SKIPPED_ERROR_INDEXING);
return false;

Some files were not shown because too many files have changed in this diff Show More