From a7b256d5af0b5ddd856bd2e0d8d8911a81187638 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Thu, 2 Nov 2017 15:58:37 -0400
Subject: [PATCH 01/51] 3198 moved notable status for tag from CR
---
.../casemodule/services/TagNameDefiniton.java | 42 ++++++++++++++--
.../casemodule/services/TagOptionsPanel.form | 2 +-
.../casemodule/services/TagOptionsPanel.java | 2 +-
.../casemodule/services/TagsManager.java | 49 ++++++++++++++++---
.../datamodel/AbstractSqlEamDb.java | 28 -----------
.../centralrepository/datamodel/EamDb.java | 14 ------
.../datamodel/PostgresEamDb.java | 11 -----
.../datamodel/PostgresEamDbSettings.java | 30 ------------
.../datamodel/SqliteEamDb.java | 11 +----
.../datamodel/SqliteEamDbSettings.java | 27 +---------
.../eventlisteners/CaseEventListener.java | 38 +++++++-------
.../optionspanel/ManageTagsDialog.java | 9 +---
12 files changed, 106 insertions(+), 157 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index 101d68fa4c..e980d7b96c 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.casemodule.services;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashSet;
import java.util.List;
@@ -35,9 +36,13 @@ final class TagNameDefiniton implements Comparable {
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
+ private static final String DEFAULT_BAD_TAGS = "Evidence,Notable Item,"
+ + "CAT-1: Child Exploitation (Illegal),CAT-2: Child Exploitation (Non-Illegal/Age Difficult),CAT-3: Child Exploitive"; // NON-NLS
+ static final String NOTABLE = "(Notable)";
private final String displayName;
private final String description;
private final TagName.HTML_COLOR color;
+ private final String knownStatus;
/**
* Constructs a tag name definition consisting of a display name,
@@ -47,10 +52,11 @@ final class TagNameDefiniton implements Comparable {
* @param description The description for the tag name.
* @param color The color for the tag name.
*/
- TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color) {
+ TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String notable) {
this.displayName = displayName;
this.description = description;
this.color = color;
+ this.knownStatus = notable;
}
/**
@@ -79,7 +85,13 @@ final class TagNameDefiniton implements Comparable {
TagName.HTML_COLOR getColor() {
return color;
}
-
+
+ /**
+ *
+ */
+ boolean isNotable(){
+ return knownStatus.equals(NOTABLE);
+ }
/**
* Compares this tag name definition with the specified tag name definition
* for order.
@@ -140,7 +152,7 @@ final class TagNameDefiniton implements Comparable {
* that is used by the tags settings file.
*/
private String toSettingsFormat() {
- return displayName + "," + description + "," + color.name();
+ return displayName + "," + description + "," + color.name() + "," + knownStatus;
}
/**
@@ -152,15 +164,37 @@ final class TagNameDefiniton implements Comparable {
Set tagNames = new HashSet<>();
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
if (null != setting && !setting.isEmpty()) {
+ List badTags = null;
List tagNameTuples = Arrays.asList(setting.split(";"));
for (String tagNameTuple : tagNameTuples) {
String[] tagNameAttributes = tagNameTuple.split(",");
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2])));
+ if (tagNameAttributes.length == 3) {
+ if (badTags == null) {
+ String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
+ if (badTagsStr == null) {
+ badTagsStr = DEFAULT_BAD_TAGS;
+ }
+ if (badTagsStr.isEmpty()) {
+ badTags = new ArrayList<>();
+ } else {
+ badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(",")));
+ }
+ }
+ if (badTags.contains(tagNameAttributes[0])) {
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), NOTABLE));
+ } else {
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), "")); //add the default value for that tag
+ }
+ } else if (tagNameAttributes.length == 4) {
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), tagNameAttributes[3]));
+ }
+
}
}
return tagNames;
}
+
/**
* Sets the tag name definitions in the tag settings file.
*
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
index 3f33f848c0..c58201621a 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
@@ -52,7 +52,7 @@
-
+
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
index c1c9beb5b2..8fc6a5ff4d 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
@@ -190,7 +190,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
NewTagNameDialog.BUTTON_PRESSED result = dialog.getResult();
if (result == NewTagNameDialog.BUTTON_PRESSED.OK) {
String newTagDisplayName = dialog.getTagName();
- TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR);
+ TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR, "");
/*
* If tag name already exists, don't add the tag name.
*/
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index c592e463cb..f66b195073 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.casemodule.services;
import java.io.Closeable;
import java.io.IOException;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
@@ -87,7 +88,7 @@ public class TagsManager implements Closeable {
Set customNames = TagNameDefiniton.getTagNameDefinitions();
customNames.forEach((tagType) -> {
tagDisplayNames.add(tagType.getDisplayName());
- });
+ });
try {
TagsManager tagsManager = Case.getCurrentCase().getServices().getTagsManager();
for (TagName tagName : tagsManager.getAllTagNames()) {
@@ -97,7 +98,17 @@ public class TagsManager implements Closeable {
/*
* No current case, nothing more to add to the set.
*/
- }
+ }
+ return tagDisplayNames;
+ }
+
+ public static List getNotableTagDisplayNames() {
+ List tagDisplayNames = new ArrayList<>();
+ for (TagNameDefiniton tagDef : TagNameDefiniton.getTagNameDefinitions()) {
+ if (tagDef.isNotable()) {
+ tagDisplayNames.add(tagDef.getDisplayName());
+ }
+ }
return tagDisplayNames;
}
@@ -107,7 +118,8 @@ public class TagsManager implements Closeable {
*
* @param caseDb The case database.
*/
- TagsManager(SleuthkitCase caseDb) {
+ TagsManager(SleuthkitCase caseDb
+ ) {
this.caseDb = caseDb;
}
@@ -186,7 +198,7 @@ public class TagsManager implements Closeable {
* name to the case database.
*/
public synchronized TagName addTagName(String displayName) throws TagNameAlreadyExistsException, TskCoreException {
- return addTagName(displayName, "", TagName.HTML_COLOR.NONE);
+ return addTagName(displayName, "", TagName.HTML_COLOR.NONE, "");
}
/**
@@ -205,7 +217,7 @@ public class TagsManager implements Closeable {
* name to the case database.
*/
public synchronized TagName addTagName(String displayName, String description) throws TagNameAlreadyExistsException, TskCoreException {
- return addTagName(displayName, description, TagName.HTML_COLOR.NONE);
+ return addTagName(displayName, description, TagName.HTML_COLOR.NONE, "");
}
/**
@@ -224,11 +236,36 @@ public class TagsManager implements Closeable {
* name to the case database.
*/
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException {
+ String knownStatus = "";
+ if (getNotableTagDisplayNames().contains(displayName)) {
+ knownStatus = TagNameDefiniton.NOTABLE;
+ }
+ return addTagName(displayName, description, color, knownStatus);
+ }
+
+ /**
+ * Adds a tag name entry to the case database and adds a corresponding tag
+ * type to the current user's custom tag types.
+ *
+ * @param displayName The display name for the new tag type.
+ * @param description The description for the new tag type.
+ * @param color The color to associate with the new tag type.
+ * @param knownStatus The knownStatus to be used for the tag when
+ * correlating on the tagged item
+ *
+ * @return A TagName object that can be used to add instances of the tag
+ * type to the case database.
+ *
+ * @throws TagNameAlreadyExistsException If the tag name already exists.
+ * @throws TskCoreException If there is an error adding the tag
+ * name to the case database.
+ */
+ public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) throws TagNameAlreadyExistsException, TskCoreException {
try {
TagName tagName = caseDb.addTagName(displayName, description, color);
if (!STANDARD_TAG_DISPLAY_NAMES.contains(displayName)) {
Set customTypes = TagNameDefiniton.getTagNameDefinitions();
- customTypes.add(new TagNameDefiniton(displayName, description, color));
+ customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus));
TagNameDefiniton.setTagNameDefinitions(customTypes);
}
return tagName;
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java
index b16589c3dd..0094dbb98e 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/AbstractSqlEamDb.java
@@ -34,7 +34,6 @@ import java.time.LocalDate;
import java.util.HashMap;
import java.util.Map;
import java.util.Set;
-import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
@@ -55,7 +54,6 @@ public abstract class AbstractSqlEamDb implements EamDb {
private int bulkArtifactsCount;
protected int bulkArtifactsThreshold;
private final Map> bulkArtifacts;
- private final List badTags;
/**
* Connect to the DB and initialize it.
@@ -63,7 +61,6 @@ public abstract class AbstractSqlEamDb implements EamDb {
* @throws UnknownHostException, EamDbException
*/
protected AbstractSqlEamDb() throws EamDbException {
- badTags = new ArrayList<>();
bulkArtifactsCount = 0;
bulkArtifacts = new HashMap<>();
@@ -78,31 +75,6 @@ public abstract class AbstractSqlEamDb implements EamDb {
*/
protected abstract Connection connect() throws EamDbException;
- /**
- * Get the list of tags recognized as "Bad"
- *
- * @return The list of bad tags
- */
- @Override
- public List getBadTags() {
- synchronized (badTags) {
- return new ArrayList<>(badTags);
- }
- }
-
- /**
- * Set the tags recognized as "Bad"
- *
- * @param tags The tags to consider bad
- */
- @Override
- public void setBadTags(List tags) {
- synchronized (badTags) {
- badTags.clear();
- badTags.addAll(tags);
- }
- }
-
/**
* Add a new name/value pair in the db_info table.
*
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java
index 70ab104fa4..173dd6cdad 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java
@@ -95,20 +95,6 @@ public interface EamDb {
&& EamDbPlatformEnum.getSelectedPlatform() != EamDbPlatformEnum.DISABLED;
}
- /**
- * Get the list of tags recognized as "Bad"
- *
- * @return The list of bad tags
- */
- List getBadTags();
-
- /**
- * Set the tags recognized as "Bad"
- *
- * @param tags The tags to consider bad
- */
- void setBadTags(List tags);
-
/**
* Add a new name/value pair in the db_info table.
*
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java
index cecba78f4e..c139554c9c 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDb.java
@@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.centralrepository.datamodel;
import java.sql.Connection;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.List;
import java.util.logging.Level;
import org.apache.commons.dbcp2.BasicDataSource;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -187,14 +186,4 @@ public class PostgresEamDb extends AbstractSqlEamDb {
return CONFLICT_CLAUSE;
}
- @Override
- public List getBadTags() {
- return dbSettings.getBadTags();
- }
-
- @Override
- public void setBadTags(List badTags) {
- dbSettings.setBadTags(badTags);
- }
-
}
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java
index 461a499663..e2558ab0a0 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/PostgresEamDbSettings.java
@@ -24,8 +24,6 @@ import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.Properties;
import java.util.logging.Level;
@@ -47,7 +45,6 @@ public final class PostgresEamDbSettings {
private final int DEFAULT_BULK_THRESHHOLD = 1000;
private final String DEFAULT_USERNAME = "";
private final String DEFAULT_PASSWORD = "";
- private final String DEFAULT_BAD_TAGS = "Evidence"; // NON-NLS
private final String VALIDATION_QUERY = "SELECT version()"; // NON-NLS
private final String JDBC_BASE_URI = "jdbc:postgresql://"; // NON-NLS
private final String JDBC_DRIVER = "org.postgresql.Driver"; // NON-NLS
@@ -59,7 +56,6 @@ public final class PostgresEamDbSettings {
private int bulkThreshold;
private String userName;
private String password;
- private List badTags;
public PostgresEamDbSettings() {
loadSettings();
@@ -120,16 +116,6 @@ public final class PostgresEamDbSettings {
password = DEFAULT_PASSWORD;
}
}
-
- String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
- if (badTagsStr == null) {
- badTagsStr = DEFAULT_BAD_TAGS;
- }
- if(badTagsStr.isEmpty()){
- badTags = new ArrayList<>();
- } else {
- badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(",")));
- }
}
public void saveSettings() {
@@ -143,8 +129,6 @@ public final class PostgresEamDbSettings {
} catch (TextConverterException ex) {
LOGGER.log(Level.SEVERE, "Failed to convert password from text to hex text.", ex);
}
-
- ModuleSettings.setConfigSetting("CentralRepository", "db.badTags", String.join(",", badTags)); // NON-NLS
}
/**
@@ -631,20 +615,6 @@ public final class PostgresEamDbSettings {
this.password = password;
}
- /**
- * @return the badTags
- */
- public List getBadTags() {
- return badTags;
- }
-
- /**
- * @param badTags the badTags to set
- */
- public void setBadTags(List badTags) {
- this.badTags = badTags;
- }
-
/**
* @return the VALIDATION_QUERY
*/
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java
index 5890dd2a67..068093de46 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDb.java
@@ -200,16 +200,7 @@ public class SqliteEamDb extends AbstractSqlEamDb {
return "";
}
- @Override
- public List getBadTags() {
- return dbSettings.getBadTags();
- }
-
- @Override
- public void setBadTags(List badTags) {
- dbSettings.setBadTags(badTags);
- }
-
+
/**
* Add a new name/value pair in the db_info table.
*
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java
index 6deb5145e8..56c1b7694e 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/SqliteEamDbSettings.java
@@ -26,8 +26,6 @@ import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
import java.sql.Statement;
-import java.util.ArrayList;
-import java.util.Arrays;
import java.util.List;
import java.util.logging.Level;
import java.util.regex.Pattern;
@@ -44,7 +42,6 @@ public final class SqliteEamDbSettings {
private final String DEFAULT_DBNAME = "central_repository.db"; // NON-NLS
private final String DEFAULT_DBDIRECTORY = PlatformUtil.getUserDirectory() + File.separator + "central_repository"; // NON-NLS
private final int DEFAULT_BULK_THRESHHOLD = 1000;
- private final String DEFAULT_BAD_TAGS = "Evidence"; // NON-NLS
private final String JDBC_DRIVER = "org.sqlite.JDBC"; // NON-NLS
private final String JDBC_BASE_URI = "jdbc:sqlite:"; // NON-NLS
private final String VALIDATION_QUERY = "SELECT count(*) from sqlite_master"; // NON-NLS
@@ -59,7 +56,6 @@ public final class SqliteEamDbSettings {
private String dbName;
private String dbDirectory;
private int bulkThreshold;
- private List badTags;
public SqliteEamDbSettings() {
loadSettings();
@@ -90,15 +86,7 @@ public final class SqliteEamDbSettings {
this.bulkThreshold = DEFAULT_BULK_THRESHHOLD;
}
- String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
- if (badTagsStr == null) {
- badTagsStr = DEFAULT_BAD_TAGS;
- }
- if (badTagsStr.isEmpty()) {
- badTags = new ArrayList<>();
- } else {
- badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(",")));
- }
+
}
public void saveSettings() {
@@ -107,7 +95,6 @@ public final class SqliteEamDbSettings {
ModuleSettings.setConfigSetting("CentralRepository", "db.sqlite.dbName", getDbName()); // NON-NLS
ModuleSettings.setConfigSetting("CentralRepository", "db.sqlite.dbDirectory", getDbDirectory()); // NON-NLS
ModuleSettings.setConfigSetting("CentralRepository", "db.sqlite.bulkThreshold", Integer.toString(getBulkThreshold())); // NON-NLS
- ModuleSettings.setConfigSetting("CentralRepository", "db.badTags", String.join(",", badTags)); // NON-NLS
}
/**
@@ -500,19 +487,7 @@ public final class SqliteEamDbSettings {
}
}
- /**
- * @return the badTags
- */
- public List getBadTags() {
- return badTags;
- }
- /**
- * @param badTags the badTags to set
- */
- public void setBadTags(List badTags) {
- this.badTags = badTags;
- }
/**
* @return the dbDirectory
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java
index a68b0cba8d..3f9dffc2fb 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java
@@ -130,7 +130,7 @@ final class CaseEventListener implements PropertyChangeListener {
final ContentTagAddedEvent tagAddedEvent = (ContentTagAddedEvent) event;
final ContentTag tagAdded = tagAddedEvent.getAddedTag();
- if (dbManager.getBadTags().contains(tagAdded.getName().getDisplayName())) {
+ if (TagsManager.getNotableTagDisplayNames().contains(tagAdded.getName().getDisplayName())) {
if (tagAdded.getContent() instanceof AbstractFile) {
af = (AbstractFile) tagAdded.getContent();
knownStatus = TskData.FileKnown.BAD;
@@ -151,7 +151,7 @@ final class CaseEventListener implements PropertyChangeListener {
long contentID = tagDeletedEvent.getDeletedTagInfo().getContentID();
String tagName = tagDeletedEvent.getDeletedTagInfo().getName().getDisplayName();
- if (!dbManager.getBadTags().contains(tagName)) {
+ if (!TagsManager.getNotableTagDisplayNames().contains(tagName)) {
// If the tag that got removed isn't on the list of central repo tags, do nothing
return;
}
@@ -164,7 +164,7 @@ final class CaseEventListener implements PropertyChangeListener {
if (tags.stream()
.map(tag -> tag.getName().getDisplayName())
- .filter(dbManager.getBadTags()::contains)
+ .filter(TagsManager.getNotableTagDisplayNames()::contains)
.collect(Collectors.toList())
.isEmpty()) {
@@ -227,7 +227,7 @@ final class CaseEventListener implements PropertyChangeListener {
final BlackBoardArtifactTagAddedEvent tagAddedEvent = (BlackBoardArtifactTagAddedEvent) event;
final BlackboardArtifactTag tagAdded = tagAddedEvent.getAddedTag();
- if (dbManager.getBadTags().contains(tagAdded.getName().getDisplayName())) {
+ if (TagsManager.getNotableTagDisplayNames().contains(tagAdded.getName().getDisplayName())) {
content = tagAdded.getContent();
bbArtifact = tagAdded.getArtifact();
knownStatus = TskData.FileKnown.BAD;
@@ -245,7 +245,7 @@ final class CaseEventListener implements PropertyChangeListener {
long artifactID = tagDeletedEvent.getDeletedTagInfo().getArtifactID();
String tagName = tagDeletedEvent.getDeletedTagInfo().getName().getDisplayName();
- if (!dbManager.getBadTags().contains(tagName)) {
+ if (!TagsManager.getNotableTagDisplayNames().contains(tagName)) {
// If the tag that got removed isn't on the list of central repo tags, do nothing
return;
}
@@ -259,7 +259,7 @@ final class CaseEventListener implements PropertyChangeListener {
if (tags.stream()
.map(tag -> tag.getName().getDisplayName())
- .filter(dbManager.getBadTags()::contains)
+ .filter(TagsManager.getNotableTagDisplayNames()::contains)
.collect(Collectors.toList())
.isEmpty()) {
@@ -367,20 +367,20 @@ final class CaseEventListener implements PropertyChangeListener {
}
CorrelationCase curCeCase = new CorrelationCase(
- -1,
- curCase.getName(), // unique case ID
- EamOrganization.getDefault(),
- curCase.getDisplayName(),
- curCase.getCreatedDate(),
- curCase.getNumber(),
- curCase.getExaminer(),
- curCase.getExaminerEmail(),
- curCase.getExaminerPhone(),
- curCase.getCaseNotes());
+ -1,
+ curCase.getName(), // unique case ID
+ EamOrganization.getDefault(),
+ curCase.getDisplayName(),
+ curCase.getCreatedDate(),
+ curCase.getNumber(),
+ curCase.getExaminer(),
+ curCase.getExaminerEmail(),
+ curCase.getExaminerPhone(),
+ curCase.getCaseNotes());
- if (!EamDb.isEnabled()) {
- return;
- }
+ if (!EamDb.isEnabled()) {
+ return;
+ }
try {
// NOTE: Cannot determine if the opened case is a new case or a reopened case,
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
index 1960ee3df4..037c86edf8 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
@@ -91,15 +91,11 @@ final class ManageTagsDialog extends javax.swing.JDialog {
lbWarnings.setText(Bundle.ManageTagsDialog_init_failedConnection_msg());
return;
}
- List badTags = dbManager.getBadTags();
+ List badTags = TagsManager.getNotableTagDisplayNames();
List tagNames = new ArrayList<>(badTags);
try {
- tagNames.addAll(
- TagsManager.getTagDisplayNames()
- .stream()
- .filter(tagName -> !badTags.contains(tagName))
- .collect(Collectors.toList()));
+ tagNames.addAll(TagsManager.getTagDisplayNames());
} catch (TskCoreException ex) {
LOGGER.log(Level.WARNING, "Could not get list of tags in case", ex);
lbWarnings.setText(Bundle.ManageTagsDialog_init_failedGettingTags_msg());
@@ -262,7 +258,6 @@ final class ManageTagsDialog extends javax.swing.JDialog {
}
try {
EamDb dbManager = EamDb.getInstance();
- dbManager.setBadTags(badTags);
dbManager.saveSettings();
} catch (EamDbException ex) {
LOGGER.log(Level.SEVERE, "Failed to connect to central repository database."); // NON-NLS
From 7278b5b97a0150fa39f2a168c67bd98392d6d3f5 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 3 Nov 2017 10:11:54 -0400
Subject: [PATCH 02/51] 3198 fix issue causing duplicate bad tags in list
---
.../centralrepository/optionspanel/ManageTagsDialog.java | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
index 037c86edf8..ff179c3032 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
@@ -25,7 +25,6 @@ import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.logging.Level;
-import java.util.stream.Collectors;
import javax.swing.JFrame;
import javax.swing.table.DefaultTableModel;
import javax.swing.event.TableModelEvent;
@@ -93,7 +92,7 @@ final class ManageTagsDialog extends javax.swing.JDialog {
}
List badTags = TagsManager.getNotableTagDisplayNames();
- List tagNames = new ArrayList<>(badTags);
+ List tagNames = new ArrayList<>();
try {
tagNames.addAll(TagsManager.getTagDisplayNames());
} catch (TskCoreException ex) {
From 556f38eb88b8022db96da149d8d69da40df70519 Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Fri, 3 Nov 2017 10:21:12 -0400
Subject: [PATCH 03/51] Implement addHashes
---
.../modules/hashdatabase/HashDbManager.java | 44 +++++++++++++++++--
1 file changed, 40 insertions(+), 4 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
index 562fc8b605..9c8b009ecd 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
@@ -38,8 +38,10 @@ import org.apache.commons.io.FilenameUtils;
import org.netbeans.api.progress.ProgressHandle;
import org.openide.util.NbBundle;
import org.openide.util.NbBundle.Messages;
+import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
+import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalFileInstance;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamGlobalSet;
import org.sleuthkit.autopsy.core.RuntimeProperties;
import org.sleuthkit.autopsy.coreutils.Logger;
@@ -52,6 +54,7 @@ import org.sleuthkit.datamodel.HashEntry;
import org.sleuthkit.datamodel.HashHitInfo;
import org.sleuthkit.datamodel.SleuthkitJNI;
import org.sleuthkit.datamodel.TskCoreException;
+import org.sleuthkit.datamodel.TskData;
/**
* This class implements a singleton that manages the set of hash databases used
@@ -1279,9 +1282,7 @@ public class HashDbManager implements PropertyChangeListener {
*/
@Override
public boolean isUpdateable() throws TskCoreException {
- return false;
- // TEMP this will change as soon as adding to the database is supported
- // return (! readOnly);
+ return (! readOnly);
}
/**
@@ -1309,7 +1310,26 @@ public class HashDbManager implements PropertyChangeListener {
*/
@Override
public void addHashes(Content content, String comment) throws TskCoreException {
-
+ // This only works for AbstractFiles and MD5 hashes at present.
+ assert content instanceof AbstractFile;
+ if (content instanceof AbstractFile) {
+ AbstractFile file = (AbstractFile) content;
+ if (null != file.getMd5Hash()) {
+ TskData.FileKnown type;
+ if(knownFilesType.equals(HashDb.KnownFilesType.KNOWN_BAD)){
+ type = TskData.FileKnown.BAD;
+ } else {
+ type = TskData.FileKnown.KNOWN;
+ }
+ EamGlobalFileInstance fileInstance = new EamGlobalFileInstance(centralRepoIndex, file.getMd5Hash(),
+ type, comment);
+ try{
+ EamDb.getInstance().addReferenceInstance(fileInstance,EamDb.getInstance().getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID));
+ } catch (EamDbException ex){
+ throw new TskCoreException("Error adding hashes to " + getDisplayName(), ex);
+ }
+ }
+ }
}
/**
@@ -1321,7 +1341,23 @@ public class HashDbManager implements PropertyChangeListener {
*/
@Override
public void addHashes(List hashes) throws TskCoreException {
+ Set globalFileInstances = new HashSet<>();
+ for(HashEntry hashEntry:hashes){
+ TskData.FileKnown type;
+ if(knownFilesType.equals(HashDb.KnownFilesType.KNOWN_BAD)){
+ type = TskData.FileKnown.BAD;
+ } else {
+ type = TskData.FileKnown.KNOWN;
+ }
+ globalFileInstances.add(new EamGlobalFileInstance(centralRepoIndex, hashEntry.getMd5Hash(), type, hashEntry.getComment()));
+ }
+ try{
+ EamDb.getInstance().bulkInsertReferenceTypeEntries(globalFileInstances,
+ EamDb.getInstance().getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID));
+ } catch (EamDbException ex){
+ throw new TskCoreException("Error adding hashes", ex);
+ }
}
/**
From 978a81b29ca9670da35693eab4effa5893115a37 Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Fri, 3 Nov 2017 15:11:20 -0400
Subject: [PATCH 04/51] Use display name for hash sets
---
.../modules/hashdatabase/AddContentToHashDbAction.java | 2 +-
.../modules/hashdatabase/AddHashValuesToDatabaseDialog.java | 2 +-
.../autopsy/modules/hashdatabase/HashDbIngestModule.java | 6 +++---
.../autopsy/modules/hashdatabase/HashDbManager.java | 2 +-
4 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java
index 6c58402fd6..3e78db6daa 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddContentToHashDbAction.java
@@ -109,7 +109,7 @@ final class AddContentToHashDbAction extends AbstractAction implements Presenter
final List hashDatabases = HashDbManager.getInstance().getUpdateableHashDatabases();
if (!hashDatabases.isEmpty()) {
for (final HashDatabase database : hashDatabases) {
- JMenuItem databaseItem = add(database.getHashSetName());
+ JMenuItem databaseItem = add(database.getDisplayName());
databaseItem.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java
index debe46f47c..d403da1def 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/AddHashValuesToDatabaseDialog.java
@@ -51,7 +51,7 @@ public class AddHashValuesToDatabaseDialog extends javax.swing.JDialog {
*/
AddHashValuesToDatabaseDialog(HashDatabase hashDb) {
super((JFrame) WindowManager.getDefault().getMainWindow(),
- NbBundle.getMessage(AddHashValuesToDatabaseDialog.class, "AddHashValuesToDatabaseDialog.JDialog.Title", hashDb.getHashSetName()),
+ NbBundle.getMessage(AddHashValuesToDatabaseDialog.class, "AddHashValuesToDatabaseDialog.JDialog.Title", hashDb.getDisplayName()),
true);
this.hashDb = hashDb;
initComponents();
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java
index 55d91b5fbd..bfef98036f 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java
@@ -135,7 +135,7 @@ public class HashDbIngestModule implements FileIngestModule {
enabledHashSets.add(db);
}
} catch (TskCoreException ex) {
- logger.log(Level.WARNING, "Error getting index status for " + db.getHashSetName() + " hash database", ex); //NON-NLS
+ logger.log(Level.WARNING, "Error getting index status for " + db.getDisplayName()+ " hash database", ex); //NON-NLS
}
}
}
@@ -218,7 +218,7 @@ public class HashDbIngestModule implements FileIngestModule {
name)));
ret = ProcessResult.ERROR;
}
- String hashSetName = db.getHashSetName();
+ String hashSetName = db.getDisplayName();
String comment = "";
ArrayList comments = hashInfo.getComments();
@@ -385,7 +385,7 @@ public class HashDbIngestModule implements FileIngestModule {
.append(NbBundle.getMessage(HashDbIngestModule.class, "HashDbIngestModule.complete.databasesUsed"))
.append("
\n"); //NON-NLS
for (HashDatabase db : knownBadHashSets) {
- detailsSb.append("- ").append(db.getHashSetName()).append("
\n"); //NON-NLS
+ detailsSb.append("- ").append(db.getDisplayName()).append("
\n"); //NON-NLS
}
detailsSb.append("
"); //NON-NLS
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
index 9c8b009ecd..bd5f5b4d1b 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
@@ -1449,7 +1449,7 @@ public class HashDbManager implements PropertyChangeListener {
@Override
public String toString(){
- return getHashSetName();
+ return getDisplayName();
}
From ad7d504d27c30d351cbf0f08580a31f22a4b3029 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Mon, 6 Nov 2017 15:00:05 -0500
Subject: [PATCH 05/51] 3199 Category class moved to Aut Core, tags created one
place
---
Core/nbproject/project.xml | 1 +
.../casemodule/services/TagNameDefiniton.java | 57 +++++++++++--------
.../casemodule/services/TagsManager.java | 17 +++---
.../autopsy/datamodel/tags}/Category.java | 2 +-
.../actions/CategorizeAction.java | 2 +-
.../actions/CategorizeGroupAction.java | 2 +-
.../CategorizeSelectedFilesAction.java | 2 +-
.../datamodel/CategoryManager.java | 2 +
.../datamodel/DrawableAttribute.java | 1 +
.../imagegallery/datamodel/DrawableDB.java | 1 +
.../imagegallery/datamodel/DrawableFile.java | 1 +
.../datamodel/DrawableTagsManager.java | 4 +-
.../datamodel/grouping/GroupManager.java | 2 +-
.../imagegallery/gui/SummaryTablePane.java | 2 +-
.../autopsy/imagegallery/gui/Toolbar.java | 2 +-
.../gui/drawableviews/DrawableView.java | 2 +-
.../gui/drawableviews/GroupPane.java | 2 +-
.../gui/drawableviews/MetaDataPane.java | 2 +-
.../gui/drawableviews/SlideShowView.java | 2 +-
19 files changed, 64 insertions(+), 42 deletions(-)
rename {ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel => Core/src/org/sleuthkit/autopsy/datamodel/tags}/Category.java (98%)
mode change 100755 => 100644
diff --git a/Core/nbproject/project.xml b/Core/nbproject/project.xml
index 25e17dd3eb..553a2378d4 100755
--- a/Core/nbproject/project.xml
+++ b/Core/nbproject/project.xml
@@ -264,6 +264,7 @@
org.sleuthkit.autopsy.corecomponents
org.sleuthkit.autopsy.coreutils
org.sleuthkit.autopsy.datamodel
+ org.sleuthkit.autopsy.datamodel.tags
org.sleuthkit.autopsy.datasourceprocessors
org.sleuthkit.autopsy.directorytree
org.sleuthkit.autopsy.events
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index e980d7b96c..f1437f3c11 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.casemodule.services;
import java.util.ArrayList;
import java.util.Arrays;
+import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@@ -27,6 +28,7 @@ import java.util.Set;
import javax.annotation.concurrent.Immutable;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.TagName;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
/**
* A tag name definition consisting of a display name, description and color.
@@ -36,8 +38,11 @@ final class TagNameDefiniton implements Comparable {
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
- private static final String DEFAULT_BAD_TAGS = "Evidence,Notable Item,"
- + "CAT-1: Child Exploitation (Illegal),CAT-2: Child Exploitation (Non-Illegal/Age Difficult),CAT-3: Child Exploitive"; // NON-NLS
+ private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList("Evidence", "Notable Item", Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
+ private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text(), "Follow Up",
+ "Notable Item", Category.ONE.getDisplayName(),
+ Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
+ Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
static final String NOTABLE = "(Notable)";
private final String displayName;
private final String description;
@@ -46,17 +51,18 @@ final class TagNameDefiniton implements Comparable {
/**
* Constructs a tag name definition consisting of a display name,
- * description and color.
+ * description, color and knownStatus.
*
* @param displayName The display name for the tag name.
* @param description The description for the tag name.
* @param color The color for the tag name.
+ * @param knownStatus The status denoted by the tag.
*/
- TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String notable) {
+ TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) {
this.displayName = displayName;
this.description = description;
this.color = color;
- this.knownStatus = notable;
+ this.knownStatus = knownStatus;
}
/**
@@ -85,13 +91,14 @@ final class TagNameDefiniton implements Comparable {
TagName.HTML_COLOR getColor() {
return color;
}
-
+
/**
- *
+ *
*/
- boolean isNotable(){
+ boolean isNotable() {
return knownStatus.equals(NOTABLE);
}
+
/**
* Compares this tag name definition with the specified tag name definition
* for order.
@@ -156,45 +163,49 @@ final class TagNameDefiniton implements Comparable {
}
/**
- * Gets tag name definitions from the tag settings file.
+ * Gets tag name definitions from the tag settings file as well as the
+ * default tag name definitions.
*
* @return A set of tag name definition objects.
*/
static synchronized Set getTagNameDefinitions() {
Set tagNames = new HashSet<>();
+ List standardTags = new ArrayList<>(STANDARD_TAG_DISPLAY_NAMES);
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
if (null != setting && !setting.isEmpty()) {
- List badTags = null;
List tagNameTuples = Arrays.asList(setting.split(";"));
+ List badTags = new ArrayList<>();
+ String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
+ if (badTagsStr == null || badTagsStr.isEmpty()) {
+ badTags.addAll(STANDARD_NOTABLE_TAG_DISPLAY_NAMES);
+ } else {
+ badTags.addAll(Arrays.asList(badTagsStr.split(",")));
+ }
for (String tagNameTuple : tagNameTuples) {
String[] tagNameAttributes = tagNameTuple.split(",");
if (tagNameAttributes.length == 3) {
- if (badTags == null) {
- String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
- if (badTagsStr == null) {
- badTagsStr = DEFAULT_BAD_TAGS;
- }
- if (badTagsStr.isEmpty()) {
- badTags = new ArrayList<>();
- } else {
- badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(",")));
- }
- }
+ standardTags.remove(tagNameAttributes[0]); //Use standard tag's saved settings instead of default settings
if (badTags.contains(tagNameAttributes[0])) {
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), NOTABLE));
} else {
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), "")); //add the default value for that tag
}
} else if (tagNameAttributes.length == 4) {
+ standardTags.remove(tagNameAttributes[0]); //Use standard tag's saved settings instead of default settings
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), tagNameAttributes[3]));
}
-
+ }
+ }
+ for (String standardTagName : standardTags) {
+ if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) {
+ tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, NOTABLE));
+ } else {
+ tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, "")); //add the default value for that tag
}
}
return tagNames;
}
-
/**
* Sets the tag name definitions in the tag settings file.
*
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index f66b195073..cf2bcf8ba2 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -31,6 +31,7 @@ import java.util.logging.Level;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardArtifactTag;
import org.sleuthkit.datamodel.Content;
@@ -47,7 +48,11 @@ public class TagsManager implements Closeable {
private static final Logger LOGGER = Logger.getLogger(TagsManager.class.getName());
@NbBundle.Messages("TagsManager.predefTagNames.bookmark.text=Bookmark")
- private static final Set STANDARD_TAG_DISPLAY_NAMES = new HashSet<>(Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text()));
+ private static final Set STANDARD_TAG_DISPLAY_NAMES = new HashSet<>(
+ Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text(), "Follow Up",
+ "Notable Item", Category.ONE.getDisplayName(),
+ Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
+ Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName()));
private final SleuthkitCase caseDb;
/**
@@ -84,7 +89,7 @@ public class TagsManager implements Closeable {
* querying the case database for tag types.
*/
public static Set getTagDisplayNames() throws TskCoreException {
- Set tagDisplayNames = new HashSet<>(STANDARD_TAG_DISPLAY_NAMES);
+ Set tagDisplayNames = new HashSet<>();
Set customNames = TagNameDefiniton.getTagNameDefinitions();
customNames.forEach((tagType) -> {
tagDisplayNames.add(tagType.getDisplayName());
@@ -263,11 +268,9 @@ public class TagsManager implements Closeable {
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) throws TagNameAlreadyExistsException, TskCoreException {
try {
TagName tagName = caseDb.addTagName(displayName, description, color);
- if (!STANDARD_TAG_DISPLAY_NAMES.contains(displayName)) {
- Set customTypes = TagNameDefiniton.getTagNameDefinitions();
- customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus));
- TagNameDefiniton.setTagNameDefinitions(customTypes);
- }
+ Set customTypes = TagNameDefiniton.getTagNameDefinitions();
+ customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus));
+ TagNameDefiniton.setTagNameDefinitions(customTypes);
return tagName;
} catch (TskCoreException ex) {
List existingTagNames = caseDb.getAllTagNames();
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java b/Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java
old mode 100755
new mode 100644
similarity index 98%
rename from ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java
rename to Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java
index 1b2bd604b0..39d624110f
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/Category.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.imagegallery.datamodel;
+package org.sleuthkit.autopsy.datamodel.tags;
import com.google.common.collect.ImmutableList;
import java.util.Map;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
index 0cbef7e5d1..e55078018e 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
@@ -40,7 +40,7 @@ import org.controlsfx.control.action.ActionUtils;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
index cc2ede2ce5..439bb59512 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
@@ -38,7 +38,7 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryPreferences;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.datamodel.TskCoreException;
/**
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
index ef70b0f1f6..be8c3644bb 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
@@ -19,7 +19,7 @@
package org.sleuthkit.autopsy.imagegallery.actions;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
/**
*
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
index f18e96795b..33bc9a58d4 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
@@ -35,10 +35,12 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
+
/**
* Provides a cached view of the number of files per category, and fires
* {@link CategoryChangeEvent}s when files are categorized.
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
index 96e37d0a83..0ac5142f3c 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
@@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.imagegallery.datamodel;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
index 9f8a6c924e..5426ac205a 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
@@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.imagegallery.datamodel;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
index 2f86c47ad6..5b40c9240c 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
@@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.imagegallery.datamodel;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import java.lang.ref.SoftReference;
import java.text.MessageFormat;
import java.util.ArrayList;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
index 2172aacf51..491baa0d5d 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
@@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.imagegallery.datamodel;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;
import java.util.Collections;
@@ -55,7 +56,7 @@ public class DrawableTagsManager {
private static final String BOOKMARK = Bundle.DrawableTagsManager_bookMark();
private static Image FOLLOW_UP_IMAGE;
private static Image BOOKMARK_IMAGE;
-
+
public static String getFollowUpText() {
return FOLLOW_UP;
}
@@ -162,6 +163,7 @@ public class DrawableTagsManager {
}
}
+
/**
* get all the TagNames that are not categories
*
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
index 5c02f5abd1..e62c2b6541 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
@@ -71,7 +71,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
index 708568fe41..2841eb5325 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
@@ -36,7 +36,7 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
/**
* Displays summary statistics (counts) for each group
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
index bdc43c1c06..6cb29d46d1 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
@@ -49,7 +49,7 @@ import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.actions.CategorizeGroupAction;
import org.sleuthkit.autopsy.imagegallery.actions.TagGroupAction;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableView.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableView.java
index 6668657619..e6d7bf06f2 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableView.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/DrawableView.java
@@ -17,7 +17,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java
index 6fc8074248..bd84611b93 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/GroupPane.java
@@ -122,7 +122,7 @@ import org.sleuthkit.autopsy.imagegallery.actions.RedoAction;
import org.sleuthkit.autopsy.imagegallery.actions.SwingMenuItemAdapter;
import org.sleuthkit.autopsy.imagegallery.actions.TagSelectedFilesAction;
import org.sleuthkit.autopsy.imagegallery.actions.UndoAction;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupViewMode;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java
index bf6597ecb5..881925a098 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/MetaDataPane.java
@@ -57,7 +57,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/SlideShowView.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/SlideShowView.java
index 94e56cf93c..b40e121102 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/SlideShowView.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/drawableviews/SlideShowView.java
@@ -50,7 +50,7 @@ import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.imagegallery.datamodel.Category;
+import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
import org.sleuthkit.autopsy.imagegallery.datamodel.VideoFile;
import org.sleuthkit.autopsy.imagegallery.gui.VideoPlayer;
From 21a74a4f6bc104b9fdc2f01e006a4bb4145ad9d4 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Mon, 6 Nov 2017 16:03:03 -0500
Subject: [PATCH 06/51] 3199 remove remaining creation of Evidence Tag
---
.../casemodule/services/TagNameDefiniton.java | 7 ++--
.../casemodule/services/TagsManager.java | 41 +++++++++++++++----
.../eventlisteners/CaseEventListener.java | 17 +-------
.../datamodel/DrawableTagsManager.java | 14 +------
4 files changed, 39 insertions(+), 40 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index f1437f3c11..676590bd38 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -20,7 +20,6 @@ package org.sleuthkit.autopsy.casemodule.services;
import java.util.ArrayList;
import java.util.Arrays;
-import java.util.Collection;
import java.util.HashSet;
import java.util.List;
import java.util.Objects;
@@ -38,9 +37,9 @@ final class TagNameDefiniton implements Comparable {
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
- private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList("Evidence", "Notable Item", Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
- private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text(), "Follow Up",
- "Notable Item", Category.ONE.getDisplayName(),
+ private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getNotableItemText(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
+ private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getBookmarkText(), TagsManager.getFollowUpText(),
+ TagsManager.getNotableItemText(), Category.ONE.getDisplayName(),
Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
static final String NOTABLE = "(Notable)";
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index cf2bcf8ba2..b9f63983fa 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -21,7 +21,6 @@ package org.sleuthkit.autopsy.casemodule.services;
import java.io.Closeable;
import java.io.IOException;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
@@ -31,7 +30,6 @@ import java.util.logging.Level;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardArtifactTag;
import org.sleuthkit.datamodel.Content;
@@ -47,14 +45,41 @@ import org.sleuthkit.datamodel.TskCoreException;
public class TagsManager implements Closeable {
private static final Logger LOGGER = Logger.getLogger(TagsManager.class.getName());
- @NbBundle.Messages("TagsManager.predefTagNames.bookmark.text=Bookmark")
- private static final Set STANDARD_TAG_DISPLAY_NAMES = new HashSet<>(
- Arrays.asList(Bundle.TagsManager_predefTagNames_bookmark_text(), "Follow Up",
- "Notable Item", Category.ONE.getDisplayName(),
- Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
- Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName()));
+ @NbBundle.Messages({"TagsManager.predefTagNames.bookmark.text=Bookmark",
+ "TagsManager.predefTagNames.followUp.text=Follow Up",
+ "TagsManager.predefTagNames.notableItem.text=Notable Item"})
+ private static final String FOLLOW_UP = Bundle.TagsManager_predefTagNames_followUp_text();
+ private static final String BOOKMARK = Bundle.TagsManager_predefTagNames_bookmark_text();
+ private static final String NOTABLE_ITEM = Bundle.TagsManager_predefTagNames_notableItem_text();
private final SleuthkitCase caseDb;
+ /**
+ * Get the text for the Follow Up tag.
+ *
+ * @return FOLLOW_UP
+ */
+ public static String getFollowUpText() {
+ return FOLLOW_UP;
+ }
+
+ /**
+ * Get the text for the Bookmark tag.
+ *
+ * @return BOOKMARK
+ */
+ public static String getBookmarkText() {
+ return BOOKMARK;
+ }
+
+ /**
+ * Get the text for the Notable Item tag.
+ *
+ * @return NOTABLE_ITEM
+ */
+ static String getNotableItemText() {
+ return NOTABLE_ITEM;
+ }
+
/**
* Tests whether or not a given tag display name contains an illegal
* character.
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java
index 3f9dffc2fb..dbe17d6e6d 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/CaseEventListener.java
@@ -350,22 +350,7 @@ final class CaseEventListener implements PropertyChangeListener {
if ((null == event.getOldValue()) && (event.getNewValue() instanceof Case)) {
Case curCase = (Case) event.getNewValue();
IngestEventsListener.resetCeModuleInstanceCount();
- try {
- // only add default evidence tag if case is open and it doesn't already exist in the tags list.
- if (Case.isCaseOpen()
- && Case.getCurrentCase().getServices().getTagsManager().getAllTagNames().stream()
- .map(tag -> tag.getDisplayName())
- .filter(tagName -> Bundle.caseeventlistener_evidencetag().equals(tagName))
- .collect(Collectors.toList())
- .isEmpty()) {
- curCase.getServices().getTagsManager().addTagName(Bundle.caseeventlistener_evidencetag());
- }
- } catch (TagsManager.TagNameAlreadyExistsException ex) {
- LOGGER.info("Evidence tag already exists"); // NON-NLS
- } catch (TskCoreException ex) {
- LOGGER.log(Level.SEVERE, "Error adding tag.", ex); // NON-NLS
- }
-
+
CorrelationCase curCeCase = new CorrelationCase(
-1,
curCase.getName(), // unique case ID
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
index 491baa0d5d..6859a12830 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
@@ -52,18 +52,8 @@ public class DrawableTagsManager {
private static final Logger LOGGER = Logger.getLogger(DrawableTagsManager.class.getName());
- private static final String FOLLOW_UP = Bundle.DrawableTagsManager_followUp();
- private static final String BOOKMARK = Bundle.DrawableTagsManager_bookMark();
private static Image FOLLOW_UP_IMAGE;
private static Image BOOKMARK_IMAGE;
-
- public static String getFollowUpText() {
- return FOLLOW_UP;
- }
-
- public static String getBookmarkText() {
- return BOOKMARK;
- }
final private Object autopsyTagsManagerLock = new Object();
private TagsManager autopsyTagsManager;
@@ -148,7 +138,7 @@ public class DrawableTagsManager {
public TagName getFollowUpTagName() throws TskCoreException {
synchronized (autopsyTagsManagerLock) {
if (Objects.isNull(followUpTagName)) {
- followUpTagName = getTagName(FOLLOW_UP);
+ followUpTagName = getTagName(TagsManager.getFollowUpText());
}
return followUpTagName;
}
@@ -157,7 +147,7 @@ public class DrawableTagsManager {
private Object getBookmarkTagName() throws TskCoreException {
synchronized (autopsyTagsManagerLock) {
if (Objects.isNull(bookmarkTagName)) {
- bookmarkTagName = getTagName(BOOKMARK);
+ bookmarkTagName = getTagName(TagsManager.getBookmarkText());
}
return bookmarkTagName;
}
From 0d66351f6c7e6dfdec99d5262bb4ab2b55d6c5af Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Mon, 6 Nov 2017 16:06:01 -0500
Subject: [PATCH 07/51] 3198 changed TagNameDefinition knownStatus to
knownStatusDenoted
---
.../autopsy/casemodule/services/TagNameDefiniton.java | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index e980d7b96c..171d673cb6 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -42,7 +42,7 @@ final class TagNameDefiniton implements Comparable {
private final String displayName;
private final String description;
private final TagName.HTML_COLOR color;
- private final String knownStatus;
+ private final String knownStatusDenoted;
/**
* Constructs a tag name definition consisting of a display name,
@@ -56,7 +56,7 @@ final class TagNameDefiniton implements Comparable {
this.displayName = displayName;
this.description = description;
this.color = color;
- this.knownStatus = notable;
+ this.knownStatusDenoted = notable;
}
/**
@@ -90,7 +90,7 @@ final class TagNameDefiniton implements Comparable {
*
*/
boolean isNotable(){
- return knownStatus.equals(NOTABLE);
+ return knownStatusDenoted.equals(NOTABLE);
}
/**
* Compares this tag name definition with the specified tag name definition
@@ -152,7 +152,7 @@ final class TagNameDefiniton implements Comparable {
* that is used by the tags settings file.
*/
private String toSettingsFormat() {
- return displayName + "," + description + "," + color.name() + "," + knownStatus;
+ return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted;
}
/**
From ad4e02ed064d25c2652879103a064bb5653da930 Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Tue, 7 Nov 2017 09:27:38 -0500
Subject: [PATCH 08/51] Add ability to create empty central repo hash sets.
---
.../centralrepository/datamodel/EamDb.java | 10 +-
.../modules/hashdatabase/Bundle.properties | 11 +-
.../modules/hashdatabase/Bundle_ja.properties | 2 +-
.../HashDbCreateDatabaseDialog.form | 152 +++++++--
.../HashDbCreateDatabaseDialog.java | 310 +++++++++++++++---
.../HashDbImportDatabaseDialog.form | 3 +
.../HashDbImportDatabaseDialog.java | 30 +-
.../modules/hashdatabase/HashDbManager.java | 6 +-
.../hashdatabase/HashLookupSettingsPanel.java | 7 +-
9 files changed, 440 insertions(+), 91 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java
index b87ad47e3c..5759da94ba 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/datamodel/EamDb.java
@@ -96,6 +96,14 @@ public interface EamDb {
return EamDbUtil.useCentralRepo()
&& EamDbPlatformEnum.getSelectedPlatform() != EamDbPlatformEnum.DISABLED;
}
+
+ /**
+ * Placeholder version to use for non-read only databases
+ * @return The version that will be stored in the database
+ */
+ static String getDefaultVersion() {
+ return "";
+ }
/**
* Get the list of tags recognized as "Bad"
@@ -510,7 +518,7 @@ public interface EamDb {
* @throws EamDbException
*/
void addReferenceInstance(EamGlobalFileInstance eamGlobalFileInstance, CorrelationAttribute.Type correlationType) throws EamDbException;
-
+
/**
* Insert the bulk collection of Global File Instances
*
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties
index e802f9f9f5..3ec2961927 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle.properties
@@ -32,7 +32,6 @@ ModalNoButtons.GO_GET_COFFEE_LABEL.text=Hash databases are currently being index
ModalNoButtons.CANCEL_BUTTON.text=Cancel
HashDbImportDatabaseDialog.knownRadioButton.text=Known (NSRL or other)
HashDbCreateDatabaseDialog.knownRadioButton.text=Known
-HashDbCreateDatabaseDialog.jLabel1.text=Database Path:
HashDbCreateDatabaseDialog.saveAsButton.text=Save As...
HashDbCreateDatabaseDialog.hashSetNameTextField.text=
HashDbImportDatabaseDialog.jLabel3.text=Database Path:
@@ -231,6 +230,12 @@ HashDbImportDatabaseDialog.lbOrg.text=Source Organization:
HashDbImportDatabaseDialog.readOnlyCheckbox.text=Make database read-only
HashDbImportDatabaseDialog.orgButton.text=Manage Organizations
HashDbImportDatabaseDialog.versionTextField.text=
-HashDbImportDatabaseDialog.fileTypeRadioButton.text=File Type
+HashDbImportDatabaseDialog.fileTypeRadioButton.text=File
HashDbImportDatabaseDialog.centralRepoRadioButton.text=Central Repository
-HashDbImportDatabaseDialog.jLabel4.text=Type:
+HashDbImportDatabaseDialog.jLabel4.text=Location:
+HashDbCreateDatabaseDialog.jLabel4.text=Location:
+HashDbCreateDatabaseDialog.fileTypeRadioButton.text=File
+HashDbCreateDatabaseDialog.centralRepoRadioButton.text=Central Repository
+HashDbCreateDatabaseDialog.lbOrg.text=Source Organization:
+HashDbCreateDatabaseDialog.orgButton.text=Manage Organizations
+HashDbCreateDatabaseDialog.databasePathLabel.text=Database Path:
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle_ja.properties
index 3a1eac32f4..983b48e2a7 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle_ja.properties
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/Bundle_ja.properties
@@ -27,7 +27,6 @@ ModalNoButtons.GO_GET_COFFEE_LABEL.text=\u30cf\u30c3\u30b7\u30e5\u30c7\u30fc\u30
ModalNoButtons.CANCEL_BUTTON.text=\u30ad\u30e3\u30f3\u30bb\u30eb
HashDbImportDatabaseDialog.knownRadioButton.text=\u65e2\u77e5\uff08NSRL\u307e\u305f\u306f\u305d\u306e\u4ed6\uff09
HashDbCreateDatabaseDialog.knownRadioButton.text=\u65e2\u77e5
-HashDbCreateDatabaseDialog.jLabel1.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30d1\u30b9\uff1a
HashDbCreateDatabaseDialog.saveAsButton.text=\u540d\u524d\u3092\u3064\u3051\u3066\u4fdd\u5b58\u2026
HashDbImportDatabaseDialog.jLabel3.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\u30d1\u30b9\uff1a
HashDbCreateDatabaseDialog.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
@@ -209,3 +208,4 @@ HashLookupSettingsPanel.hashDbNameLabel.text=\u30c7\u30fc\u30bf\u30d9\u30fc\u30b
HashLookupSettingsPanel.nameLabel.text=\u30cf\u30c3\u30b7\u30e5\u30bb\u30c3\u30c8\u540d\uff1a
HashLookupSettingsPanel.hashDatabasesLabel.text=\u30cf\u30c3\u30b7\u30e5\u30c7\u30fc\u30bf\u30d9\u30fc\u30b9\uff1a
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
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.form
index 3e40c1861d..368903a9d6 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.form
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.form
@@ -4,6 +4,8 @@
+
+
@@ -27,16 +29,10 @@
-
+
-
-
-
-
-
-
@@ -48,52 +44,92 @@
-
-
-
+
+
+
+
+
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -146,10 +182,10 @@
-
+
-
+
@@ -203,5 +239,69 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java
index ab3efb8afb..9360e45aed 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbCreateDatabaseDialog.java
@@ -23,6 +23,7 @@ import java.awt.Toolkit;
import java.io.File;
import java.io.IOException;
import java.nio.file.Paths;
+import java.util.List;
import java.util.logging.Level;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
@@ -30,12 +31,18 @@ import javax.swing.JOptionPane;
import org.apache.commons.io.FilenameUtils;
import org.openide.util.NbBundle;
import org.openide.windows.WindowManager;
+import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
+import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
+import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
+import org.sleuthkit.autopsy.centralrepository.optionspanel.ManageOrganizationsDialog;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.autopsy.coreutils.PlatformUtil;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDb.KnownFilesType;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDbManagerException;
import org.sleuthkit.autopsy.modules.hashdatabase.HashDbManager.HashDatabase;
+import org.sleuthkit.datamodel.TskData;
+import org.sleuthkit.datamodel.TskCoreException;
/**
* Instances of this class allow a user to create a new hash database and add it
@@ -49,6 +56,8 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
private JFileChooser fileChooser = null;
private HashDatabase newHashDb = null;
private final static String LAST_FILE_PATH_KEY = "HashDbCreate_Path";
+ private EamOrganization selectedOrg = null;
+ private List orgs = null;
/**
* Displays a dialog that allows a user to create a new hash database and
@@ -59,6 +68,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
super((JFrame) WindowManager.getDefault().getMainWindow(), NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.createHashDbMsg"), true);
initFileChooser();
initComponents();
+ enableComponents();
display();
}
@@ -112,6 +122,46 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
setLocation((screenDimension.width - getSize().width) / 2, (screenDimension.height - getSize().height) / 2);
setVisible(true);
}
+
+ private void enableComponents(){
+
+ if(! EamDb.isEnabled()){
+ centralRepoRadioButton.setEnabled(false);
+ fileTypeRadioButton.setSelected(true);
+ } else {
+ populateCombobox();
+ }
+
+ boolean isFileType = fileTypeRadioButton.isSelected();
+
+ // Type type only
+ databasePathLabel.setEnabled(isFileType);
+ databasePathTextField.setEnabled(isFileType);
+ saveAsButton.setEnabled(isFileType);
+
+ // Central repo only
+ lbOrg.setEnabled(! isFileType);
+ orgButton.setEnabled(! isFileType);
+ orgComboBox.setEnabled(! isFileType);
+ }
+
+ @NbBundle.Messages({"HashDbCreateDatabaseDialog.populateOrgsError.message=Failure loading organizations."})
+ private void populateCombobox() {
+ orgComboBox.removeAllItems();
+ try {
+ EamDb dbManager = EamDb.getInstance();
+ orgs = dbManager.getOrganizations();
+ orgs.forEach((org) -> {
+ orgComboBox.addItem(org.getName());
+ });
+ if (!orgs.isEmpty()) {
+ selectedOrg = orgs.get(0);
+ }
+ } catch (EamDbException ex) {
+ JOptionPane.showMessageDialog(null, Bundle.HashDbCreateDatabaseDialog_populateOrgsError_message());
+ Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Failure loading organizations", ex);
+ }
+ }
/**
* This method is called from within the constructor to initialize the form.
@@ -123,17 +173,24 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
private void initComponents() {
buttonGroup1 = new javax.swing.ButtonGroup();
+ storageTypeButtonGroup = new javax.swing.ButtonGroup();
saveAsButton = new javax.swing.JButton();
cancelButton = new javax.swing.JButton();
knownRadioButton = new javax.swing.JRadioButton();
knownBadRadioButton = new javax.swing.JRadioButton();
- jLabel1 = new javax.swing.JLabel();
+ databasePathLabel = new javax.swing.JLabel();
hashSetNameTextField = new javax.swing.JTextField();
jLabel2 = new javax.swing.JLabel();
sendIngestMessagesCheckbox = new javax.swing.JCheckBox();
jLabel3 = new javax.swing.JLabel();
databasePathTextField = new javax.swing.JTextField();
okButton = new javax.swing.JButton();
+ jLabel4 = new javax.swing.JLabel();
+ fileTypeRadioButton = new javax.swing.JRadioButton();
+ centralRepoRadioButton = new javax.swing.JRadioButton();
+ lbOrg = new javax.swing.JLabel();
+ orgComboBox = new javax.swing.JComboBox<>();
+ orgButton = new javax.swing.JButton();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
@@ -168,7 +225,7 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
}
});
- org.openide.awt.Mnemonics.setLocalizedText(jLabel1, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.jLabel1.text")); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(databasePathLabel, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.databasePathLabel.text")); // NOI18N
hashSetNameTextField.setText(org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.hashSetNameTextField.text")); // NOI18N
@@ -194,6 +251,40 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
}
});
+ org.openide.awt.Mnemonics.setLocalizedText(jLabel4, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.jLabel4.text")); // NOI18N
+
+ storageTypeButtonGroup.add(fileTypeRadioButton);
+ fileTypeRadioButton.setSelected(true);
+ org.openide.awt.Mnemonics.setLocalizedText(fileTypeRadioButton, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.fileTypeRadioButton.text")); // NOI18N
+ fileTypeRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ fileTypeRadioButtonActionPerformed(evt);
+ }
+ });
+
+ storageTypeButtonGroup.add(centralRepoRadioButton);
+ org.openide.awt.Mnemonics.setLocalizedText(centralRepoRadioButton, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.centralRepoRadioButton.text")); // NOI18N
+ centralRepoRadioButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ centralRepoRadioButtonActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(lbOrg, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.lbOrg.text")); // NOI18N
+
+ orgComboBox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ orgComboBoxActionPerformed(evt);
+ }
+ });
+
+ org.openide.awt.Mnemonics.setLocalizedText(orgButton, org.openide.util.NbBundle.getMessage(HashDbCreateDatabaseDialog.class, "HashDbCreateDatabaseDialog.orgButton.text")); // NOI18N
+ orgButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ orgButtonActionPerformed(evt);
+ }
+ });
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@@ -202,11 +293,6 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(sendIngestMessagesCheckbox)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(okButton)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cancelButton))
.addComponent(jLabel2)
.addGroup(layout.createSequentialGroup()
.addGap(20, 20, 20)
@@ -216,15 +302,32 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
.addGroup(layout.createSequentialGroup()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
.addGroup(layout.createSequentialGroup()
- .addComponent(jLabel1)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(databasePathTextField))
+ .addComponent(lbOrg)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, 130, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(orgButton, javax.swing.GroupLayout.DEFAULT_SIZE, 145, Short.MAX_VALUE))
.addGroup(javax.swing.GroupLayout.Alignment.LEADING, layout.createSequentialGroup()
- .addComponent(jLabel3)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(hashSetNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, 272, javax.swing.GroupLayout.PREFERRED_SIZE)))
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(jLabel3)
+ .addComponent(jLabel4)
+ .addComponent(databasePathLabel))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(fileTypeRadioButton)
+ .addGap(22, 22, 22)
+ .addComponent(centralRepoRadioButton))
+ .addComponent(hashSetNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 305, Short.MAX_VALUE)
+ .addComponent(databasePathTextField))))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(saveAsButton)))
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(okButton)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(cancelButton)
.addContainerGap())
);
@@ -232,29 +335,43 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGap(2, 2, 2)
+ .addGroup(layout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(jLabel4)
+ .addComponent(fileTypeRadioButton)
+ .addComponent(centralRepoRadioButton))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(jLabel3)
.addComponent(hashSetNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(databasePathLabel)
.addComponent(databasePathTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addComponent(saveAsButton)
- .addComponent(jLabel1))
- .addGap(7, 7, 7)
+ .addComponent(saveAsButton))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(lbOrg)
+ .addComponent(orgComboBox, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(orgButton))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel2)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(knownRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(knownBadRadioButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
- .addComponent(sendIngestMessagesCheckbox)
- .addGap(26, 26, 26)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(cancelButton)
- .addComponent(okButton))
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(layout.createSequentialGroup()
+ .addComponent(sendIngestMessagesCheckbox)
+ .addGap(0, 27, Short.MAX_VALUE))
+ .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
+ .addGap(0, 0, Short.MAX_VALUE)
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(cancelButton)
+ .addComponent(okButton))))
+ .addContainerGap())
);
pack();
@@ -304,6 +421,11 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
}
}//GEN-LAST:event_saveAsButtonActionPerformed
+ @NbBundle.Messages({"HashDbCreateDatabaseDialog.missingOrg=An organization must be selected",
+ "HashDbCreateDatabaseDialog.duplicateName=A hashset with this name and version already exists",
+ "HashDbCreateDatabaseDialog.databaseLookupError=Error accessing central repository",
+ "HashDbCreateDatabaseDialog.databaseCreationError=Error creating new hash set"
+ })
private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
// Note that the error handlers in this method call return without disposing of the
// dialog to allow the user to try again, if desired.
@@ -318,44 +440,100 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
return;
}
- if (databasePathTextField.getText().isEmpty()) {
- JOptionPane.showMessageDialog(this,
+ if(fileTypeRadioButton.isSelected()){
+ if (databasePathTextField.getText().isEmpty()) {
+ JOptionPane.showMessageDialog(this,
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.mustEnterHashDbPathMsg"),
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.createHashDbErr"),
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ } else {
+ if(selectedOrg == null){
+ JOptionPane.showMessageDialog(this,
NbBundle.getMessage(this.getClass(),
- "HashDbCreateDatabaseDialog.mustEnterHashDbPathMsg"),
+ "HashDbCreateDatabaseDialog.missingOrg"),
NbBundle.getMessage(this.getClass(),
"HashDbCreateDatabaseDialog.createHashDbErr"),
JOptionPane.ERROR_MESSAGE);
- return;
+ return;
+ }
}
KnownFilesType type;
+ TskData.FileKnown fileKnown;
if (knownRadioButton.isSelected()) {
type = KnownFilesType.KNOWN;
+ fileKnown = TskData.FileKnown.KNOWN;
} else {
type = KnownFilesType.KNOWN_BAD;
+ fileKnown = TskData.FileKnown.BAD;
}
String errorMessage = NbBundle
.getMessage(this.getClass(), "HashDbCreateDatabaseDialog.errMsg.hashDbCreationErr");
- try {
- newHashDb = HashDbManager.getInstance().addNewFileTypeHashDatabase(hashSetNameTextField.getText(), fileChooser.getSelectedFile().getCanonicalPath(), true, sendIngestMessagesCheckbox.isSelected(), type);
- } catch (IOException ex) {
- Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
- JOptionPane.showMessageDialog(this,
- NbBundle.getMessage(this.getClass(),
- "HashDbCreateDatabaseDialog.cannotCreateFileAtLocMsg"),
- NbBundle.getMessage(this.getClass(),
- "HashDbCreateDatabaseDialog.createHashDbErr"),
- JOptionPane.ERROR_MESSAGE);
- return;
- } catch (HashDbManagerException ex) {
- Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
- JOptionPane.showMessageDialog(this,
- ex.getMessage(),
- NbBundle.getMessage(this.getClass(),
- "HashDbCreateDatabaseDialog.createHashDbErr"),
- JOptionPane.ERROR_MESSAGE);
- return;
+ if(fileTypeRadioButton.isSelected()){
+ try {
+ newHashDb = HashDbManager.getInstance().addNewFileTypeHashDatabase(hashSetNameTextField.getText(), fileChooser.getSelectedFile().getCanonicalPath(), true, sendIngestMessagesCheckbox.isSelected(), type);
+ } catch (IOException ex) {
+ Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
+ JOptionPane.showMessageDialog(this,
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.cannotCreateFileAtLocMsg"),
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.createHashDbErr"),
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ } catch (HashDbManagerException ex) {
+ Logger.getLogger(HashDbCreateDatabaseDialog.class.getName()).log(Level.WARNING, errorMessage, ex);
+ JOptionPane.showMessageDialog(this,
+ ex.getMessage(),
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.createHashDbErr"),
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ } else {
+ // Check if a hash set with the same name/version already exists
+ try{
+ if(EamDb.getInstance().referenceSetExists(hashSetNameTextField.getText(), EamDb.getDefaultVersion())){
+ JOptionPane.showMessageDialog(this,
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.duplicateName"),
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.createHashDbErr"),
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+ } catch (EamDbException ex){
+ Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error looking up reference set", ex);
+ JOptionPane.showMessageDialog(this,
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.databaseLookupError"),
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.createHashDbErr"),
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
+
+ try{
+ int crIndex = EamDb.getInstance().newReferenceSet(selectedOrg.getOrgID(), hashSetNameTextField.getText(),
+ EamDb.getDefaultVersion(), fileKnown, false);
+ newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetNameTextField.getText(),
+ EamDb.getDefaultVersion(), crIndex,
+ true, sendIngestMessagesCheckbox.isSelected(), type, false);
+ } catch (EamDbException | TskCoreException ex){
+ Logger.getLogger(HashDbImportDatabaseDialog.class.getName()).log(Level.SEVERE, "Error creating new reference set", ex);
+ JOptionPane.showMessageDialog(this,
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.databaseCreationError"),
+ NbBundle.getMessage(this.getClass(),
+ "HashDbCreateDatabaseDialog.createHashDbErr"),
+ JOptionPane.ERROR_MESSAGE);
+ return;
+ }
}
dispose();
@@ -365,18 +543,52 @@ final class HashDbCreateDatabaseDialog extends javax.swing.JDialog {
// TODO add your handling code here:
}//GEN-LAST:event_sendIngestMessagesCheckboxActionPerformed
+ private void orgButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgButtonActionPerformed
+ ManageOrganizationsDialog dialog = new ManageOrganizationsDialog();
+ // update the combobox options
+ if (dialog.isChanged()) {
+ populateCombobox();
+ }
+ }//GEN-LAST:event_orgButtonActionPerformed
+
+ private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgComboBoxActionPerformed
+ if (null == orgComboBox.getSelectedItem()) return;
+ String orgName = this.orgComboBox.getSelectedItem().toString();
+ for (EamOrganization org : orgs) {
+ if (org.getName().equals(orgName)) {
+ selectedOrg = org;
+ return;
+ }
+ }
+ }//GEN-LAST:event_orgComboBoxActionPerformed
+
+ private void fileTypeRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_fileTypeRadioButtonActionPerformed
+ enableComponents();
+ }//GEN-LAST:event_fileTypeRadioButtonActionPerformed
+
+ private void centralRepoRadioButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_centralRepoRadioButtonActionPerformed
+ enableComponents();
+ }//GEN-LAST:event_centralRepoRadioButtonActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton cancelButton;
+ private javax.swing.JRadioButton centralRepoRadioButton;
+ private javax.swing.JLabel databasePathLabel;
private javax.swing.JTextField databasePathTextField;
+ private javax.swing.JRadioButton fileTypeRadioButton;
private javax.swing.JTextField hashSetNameTextField;
- private javax.swing.JLabel jLabel1;
private javax.swing.JLabel jLabel2;
private javax.swing.JLabel jLabel3;
+ private javax.swing.JLabel jLabel4;
private javax.swing.JRadioButton knownBadRadioButton;
private javax.swing.JRadioButton knownRadioButton;
+ private javax.swing.JLabel lbOrg;
private javax.swing.JButton okButton;
+ private javax.swing.JButton orgButton;
+ private javax.swing.JComboBox orgComboBox;
private javax.swing.JButton saveAsButton;
private javax.swing.JCheckBox sendIngestMessagesCheckbox;
+ private javax.swing.ButtonGroup storageTypeButtonGroup;
// End of variables declaration//GEN-END:variables
}
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.form b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.form
index 9a3c6acf89..682ec13c34 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.form
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.form
@@ -304,6 +304,9 @@
+
+
+
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java
index 7977360d40..6e05c372b8 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java
@@ -25,7 +25,6 @@ import java.io.IOException;
import java.nio.file.Paths;
import java.util.List;
import java.util.logging.Level;
-import javax.swing.JComboBox;
import javax.swing.JFileChooser;
import javax.swing.JFrame;
import javax.swing.JOptionPane;
@@ -36,7 +35,6 @@ import org.openide.windows.WindowManager;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
import org.sleuthkit.autopsy.centralrepository.datamodel.EamOrganization;
-import org.sleuthkit.autopsy.centralrepository.optionspanel.AddNewOrganizationDialog;
import org.sleuthkit.autopsy.centralrepository.optionspanel.ManageOrganizationsDialog;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
@@ -120,8 +118,9 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
boolean isFileType = fileTypeRadioButton.isSelected();
// Central repo only
- lbVersion.setEnabled(! isFileType);
- versionTextField.setEnabled(! isFileType);
+ lbVersion.setEnabled((! isFileType) && (readOnlyCheckbox.isSelected()));
+ versionTextField.setEnabled((! isFileType) && (readOnlyCheckbox.isSelected()));
+
lbOrg.setEnabled(! isFileType);
orgButton.setEnabled(! isFileType);
orgComboBox.setEnabled(! isFileType);
@@ -258,6 +257,11 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
readOnlyCheckbox.setSelected(true);
org.openide.awt.Mnemonics.setLocalizedText(readOnlyCheckbox, org.openide.util.NbBundle.getMessage(HashDbImportDatabaseDialog.class, "HashDbImportDatabaseDialog.readOnlyCheckbox.text")); // NOI18N
+ readOnlyCheckbox.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ readOnlyCheckboxActionPerformed(evt);
+ }
+ });
storageTypeButtonGroup.add(fileTypeRadioButton);
fileTypeRadioButton.setSelected(true);
@@ -534,10 +538,17 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
return;
}
+ String version;
+ if(readOnlyCheckbox.isSelected()){
+ version = versionTextField.getText();
+ } else {
+ // Editable databases don't have a version
+ version = EamDb.getDefaultVersion();
+ }
ImportCentralRepoDbProgressDialog progressDialog = new ImportCentralRepoDbProgressDialog();
- progressDialog.importFile(hashSetNameTextField.getText(), versionTextField.getText(),
+ progressDialog.importFile(hashSetNameTextField.getText(), version,
selectedOrg.getOrgID(), true, sendIngestMessagesCheckbox.isSelected(), type,
- this.readOnlyCheckbox.isSelected(), selectedFilePath);
+ readOnlyCheckbox.isSelected(), selectedFilePath);
selectedHashDb = progressDialog.getDatabase();
}
@@ -565,9 +576,6 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
}//GEN-LAST:event_orgButtonActionPerformed
private void orgComboBoxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_orgComboBoxActionPerformed
- //JComboBox cb = (JComboBox)evt.getSource();
- //String orgName = (String)cb.getSelectedItem();
-
if (null == orgComboBox.getSelectedItem()) return;
String orgName = this.orgComboBox.getSelectedItem().toString();
for (EamOrganization org : orgs) {
@@ -578,6 +586,10 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
}
}//GEN-LAST:event_orgComboBoxActionPerformed
+ private void readOnlyCheckboxActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_readOnlyCheckboxActionPerformed
+ enableComponents();
+ }//GEN-LAST:event_readOnlyCheckboxActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.ButtonGroup buttonGroup1;
private javax.swing.JButton cancelButton;
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
index bd5f5b4d1b..c1dd2418ff 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
@@ -1213,7 +1213,11 @@ public class HashDbManager implements PropertyChangeListener {
@Override
public String getDisplayName(){
- return getHashSetName() + " " + getVersion();
+ if(! getVersion().isEmpty()){
+ return getHashSetName() + " " + getVersion() + " (remote)";
+ } else {
+ return getHashSetName() + " (remote)";
+ }
}
public String getVersion(){
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java
index fe2e4a5757..b4129e0004 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java
@@ -494,7 +494,7 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
@Override
public Object getValueAt(int rowIndex, int columnIndex) {
- return hashSets.get(rowIndex).getHashSetName();
+ return hashSets.get(rowIndex).getDisplayName();
}
private boolean isValid(int rowIndex) {
@@ -921,6 +921,11 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
private void createDatabaseButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_createDatabaseButtonActionPerformed
HashDatabase hashDb = new HashDbCreateDatabaseDialog().getHashDatabase();
if (null != hashDb) {
+ if(hashDb instanceof CentralRepoHashDb){
+ int newDbIndex = ((CentralRepoHashDb)hashDb).getCentralRepoIndex();
+ newCentralRepoIndices.add(newDbIndex);
+ }
+
hashSetTableModel.refreshModel();
((HashSetTable) hashSetTable).selectRowByDatabase(hashDb);
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
From 36b7a24ea10a824018fa5d98485400adfd6ab1a5 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Tue, 7 Nov 2017 13:52:13 -0500
Subject: [PATCH 09/51] 3201 initial revisions to Tag Options Panel to allow
editing
---
.../casemodule/services/Bundle.properties | 20 +-
...eDefiniton.java => TagNameDefinition.java} | 30 +-
...wTagNameDialog.form => TagNameDialog.form} | 66 +++-
...wTagNameDialog.java => TagNameDialog.java} | 145 ++++---
.../casemodule/services/TagOptionsPanel.form | 218 +++++++++--
.../casemodule/services/TagOptionsPanel.java | 234 ++++++++---
.../casemodule/services/TagsManager.java | 16 +-
.../optionspanel/Bundle.properties | 3 -
.../optionspanel/GlobalSettingsPanel.form | 108 +-----
.../optionspanel/GlobalSettingsPanel.java | 76 ----
.../optionspanel/ManageTagsDialog.form | 147 -------
.../optionspanel/ManageTagsDialog.java | 364 ------------------
12 files changed, 552 insertions(+), 875 deletions(-)
rename Core/src/org/sleuthkit/autopsy/casemodule/services/{TagNameDefiniton.java => TagNameDefinition.java} (83%)
rename Core/src/org/sleuthkit/autopsy/casemodule/services/{NewTagNameDialog.form => TagNameDialog.form} (57%)
rename Core/src/org/sleuthkit/autopsy/casemodule/services/{NewTagNameDialog.java => TagNameDialog.java} (58%)
delete mode 100755 Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.form
delete mode 100755 Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
index 0dd66e8c59..6242c6793d 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
@@ -7,10 +7,16 @@ NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in
NewTagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty
NewTagNameDialog.JOptionPane.tagNameEmpty.title=Empty tag name
TagOptionsPanel.tagTypesListLabel.text=Tag Names:
-TagOptionsPanel.panelDescriptionLabel.text=Autopsy keeps a list of the tag names you have created in the past. Add more or delete them here.
-NewTagNameDialog.okButton.text=OK
-NewTagNameDialog.cancelButton.text=Cancel
-NewTagNameDialog.tagNameTextField.text=
-NewTagNameDialog.newTagNameLabel.text=New Tag Name:
-TagOptionsPanel.deleteTagNameButton.text=Delete Tag Name
-TagOptionsPanel.newTagNameButton.text=New Tag Name
+TagOptionsPanel.deleteTagNameButton.text=Delete Tag
+TagOptionsPanel.newTagNameButton.text=New Tag
+TagOptionsPanel.editTagNameButton.text=Edit Tag
+TagNameDialog.descriptionLabel.text=Description:
+TagNameDialog.okButton.text=OK
+TagNameDialog.cancelButton.text=Cancel
+TagNameDialog.tagNameTextField.text=
+TagNameDialog.newTagNameLabel.text=New Tag Name:
+TagNameDialog.notableCheckbox.text=Tag indicates item is notable.
+TagOptionsPanel.isNotableLabel.text=Tag indicates item is notable:
+TagOptionsPanel.notableYesOrNoLabel.text=
+TagOptionsPanel.descriptionLabel.text=Tag Description:
+TagOptionsPanel.jTextArea1.text=Autopsy keeps a list of the tag names you have created in the past. Add more or delete them here.
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
similarity index 83%
rename from Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
rename to Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
index c22b380f96..84ae34c4f7 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
@@ -33,12 +33,12 @@ import org.sleuthkit.autopsy.datamodel.tags.Category;
* A tag name definition consisting of a display name, description and color.
*/
@Immutable
-final class TagNameDefiniton implements Comparable {
+final class TagNameDefinition implements Comparable {
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getNotableItemText(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
- private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getBookmarkText(), TagsManager.getFollowUpText(),
+ static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getBookmarkText(), TagsManager.getFollowUpText(),
TagsManager.getNotableItemText(), Category.ONE.getDisplayName(),
Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
@@ -57,7 +57,7 @@ final class TagNameDefiniton implements Comparable {
* @param color The color for the tag name.
* @param knownStatus The status denoted by the tag.
*/
- TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) {
+ TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) {
this.displayName = displayName;
this.description = description;
this.color = color;
@@ -114,7 +114,7 @@ final class TagNameDefiniton implements Comparable {
* the specified tag name definition.
*/
@Override
- public int compareTo(TagNameDefiniton other) {
+ public int compareTo(TagNameDefinition other) {
return this.getDisplayName().toLowerCase().compareTo(other.getDisplayName().toLowerCase());
}
@@ -140,10 +140,10 @@ final class TagNameDefiniton implements Comparable {
*/
@Override
public boolean equals(Object obj) {
- if (!(obj instanceof TagNameDefiniton)) {
+ if (!(obj instanceof TagNameDefinition)) {
return false;
}
- TagNameDefiniton thatTagName = (TagNameDefiniton) obj;
+ TagNameDefinition thatTagName = (TagNameDefinition) obj;
return this.getDisplayName().equals(thatTagName.getDisplayName());
}
@@ -171,8 +171,8 @@ final class TagNameDefiniton implements Comparable {
*
* @return A set of tag name definition objects.
*/
- static synchronized Set getTagNameDefinitions() {
- Set tagNames = new HashSet<>();
+ static synchronized Set getTagNameDefinitions() {
+ Set tagNames = new HashSet<>();
List standardTags = new ArrayList<>(STANDARD_TAG_DISPLAY_NAMES);
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
if (null != setting && !setting.isEmpty()) {
@@ -189,21 +189,21 @@ final class TagNameDefiniton implements Comparable {
if (tagNameAttributes.length == 3) {
standardTags.remove(tagNameAttributes[0]); //Use standard tag's saved settings instead of default settings
if (badTags.contains(tagNameAttributes[0])) {
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), NOTABLE));
+ tagNames.add(new TagNameDefinition(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), NOTABLE));
} else {
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), "")); //add the default value for that tag
+ tagNames.add(new TagNameDefinition(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), "")); //add the default value for that tag
}
} else if (tagNameAttributes.length == 4) {
standardTags.remove(tagNameAttributes[0]); //Use standard tag's saved settings instead of default settings
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), tagNameAttributes[3]));
+ tagNames.add(new TagNameDefinition(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), tagNameAttributes[3]));
}
}
}
for (String standardTagName : standardTags) {
if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) {
- tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, NOTABLE));
+ tagNames.add(new TagNameDefinition(standardTagName, "", TagName.HTML_COLOR.NONE, NOTABLE));
} else {
- tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, "")); //add the default value for that tag
+ tagNames.add(new TagNameDefinition(standardTagName, "", TagName.HTML_COLOR.NONE, "")); //add the default value for that tag
}
}
return tagNames;
@@ -214,9 +214,9 @@ final class TagNameDefiniton implements Comparable {
*
* @param tagNames A set of tag name definition objects.
*/
- static synchronized void setTagNameDefinitions(Set tagNames) {
+ static synchronized void setTagNameDefinitions(Set tagNames) {
StringBuilder setting = new StringBuilder();
- for (TagNameDefiniton tagName : tagNames) {
+ for (TagNameDefinition tagName : tagNames) {
if (setting.length() != 0) {
setting.append(";");
}
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.form b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.form
similarity index 57%
rename from Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.form
rename to Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.form
index b6400b7c31..e8162e6b3b 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.form
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.form
@@ -23,10 +23,10 @@
-
+
-
+
@@ -34,6 +34,14 @@
+
+
+
+
+
+
+
+
@@ -41,20 +49,22 @@
-
+
-
-
-
-
+
+
+
+
+
+
+
-
@@ -63,21 +73,21 @@
-
+
-
+
-
+
@@ -87,12 +97,44 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
similarity index 58%
rename from Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java
rename to Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
index ff21ac283b..e79004af6e 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
@@ -1,24 +1,25 @@
/*
-* Autopsy Forensic Browser
-*
-* Copyright 2011-2016 Basis Technology Corp.
-* Contact: carrier sleuthkit 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.
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2011-2016 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.casemodule.services;
import java.awt.BorderLayout;
+import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
@@ -28,11 +29,14 @@ import javax.swing.JOptionPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.openide.util.NbBundle;
+import org.sleuthkit.datamodel.TskData;
-final class NewTagNameDialog extends javax.swing.JDialog {
+final class TagNameDialog extends javax.swing.JDialog {
private static final long serialVersionUID = 1L;
private String userTagDisplayName;
+ private String userTagDescription;
+ private boolean userTagIsNotable;
private BUTTON_PRESSED result;
enum BUTTON_PRESSED {
@@ -42,13 +46,24 @@ final class NewTagNameDialog extends javax.swing.JDialog {
/**
* Creates a new NewUserTagNameDialog dialog.
*/
- NewTagNameDialog() {
- super(new JFrame(NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.title.text")),
- NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.title.text"), true);
+ TagNameDialog() {
+ super(new JFrame(NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.title.text")),
+ NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.title.text"), true);
initComponents();
this.display();
}
+ TagNameDialog(TagNameDefinition tagNameToEdit) {
+ super(new JFrame("Edit 1"),
+ "Edit 2", true);
+ initComponents();
+ tagNameTextField.setText(tagNameToEdit.getDisplayName());
+ descriptionTextArea.setText(tagNameToEdit.getDescription());
+ notableCheckbox.setSelected(tagNameToEdit.isNotable());
+ tagNameTextField.setEnabled(false);
+ this.display();
+ }
+
/**
* Sets display settings for the dialog and adds appropriate listeners.
*/
@@ -56,7 +71,7 @@ final class NewTagNameDialog extends javax.swing.JDialog {
setLayout(new BorderLayout());
/*
- * Center the dialog
+ * Center the dialog
*/
Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
int width = this.getSize().width;
@@ -81,14 +96,17 @@ final class NewTagNameDialog extends javax.swing.JDialog {
public void changedUpdate(DocumentEvent e) {
fire();
}
+
@Override
public void removeUpdate(DocumentEvent e) {
fire();
}
+
@Override
public void insertUpdate(DocumentEvent e) {
fire();
}
+
private void fire() {
enableOkButton();
}
@@ -105,6 +123,7 @@ final class NewTagNameDialog extends javax.swing.JDialog {
/**
* Called when a button is pressed or when the dialog is closed.
+ *
* @param okPressed whether the OK button was pressed.
*/
private void doButtonAction(boolean okPressed) {
@@ -112,38 +131,50 @@ final class NewTagNameDialog extends javax.swing.JDialog {
String newTagDisplayName = tagNameTextField.getText().trim();
if (newTagDisplayName.isEmpty()) {
JOptionPane.showMessageDialog(null,
- NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.message"),
- NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.title"),
+ NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.message"),
+ NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.title"),
JOptionPane.ERROR_MESSAGE);
return;
}
- if (TagsManager.containsIllegalCharacters(newTagDisplayName)) {
+
+ //if a tag name contains illegal characters and is not the name of one of the standard tags
+ if (TagsManager.containsIllegalCharacters(newTagDisplayName) && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(newTagDisplayName)) {
JOptionPane.showMessageDialog(null,
- NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
- NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
+ NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
+ NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
JOptionPane.ERROR_MESSAGE);
return;
}
+ userTagDescription = descriptionTextArea.getText();
userTagDisplayName = newTagDisplayName;
+ userTagIsNotable = notableCheckbox.isSelected();
result = BUTTON_PRESSED.OK;
} else {
result = BUTTON_PRESSED.CANCEL;
}
- setVisible(false);
+ setVisible(false);
}
/**
* Returns the tag name entered by the user.
- *
- * @return a new user tag name
+ *
+ * @return a new user tag name
*/
String getTagName() {
return userTagDisplayName;
}
+ String getTagDesciption() {
+ return userTagDescription;
+ }
+
+ boolean isTagNotable() {
+ return userTagIsNotable;
+ }
+
/**
* Returns information about which button was pressed.
- *
+ *
* @return BUTTON_PRESSED (OK, CANCEL)
*/
BUTTON_PRESSED getResult() {
@@ -151,9 +182,9 @@ final class NewTagNameDialog extends javax.swing.JDialog {
}
/**
- * Enable the OK button if the tag name text field is not empty.
- * Sets the enter button as default, so user can press enter to activate
- * an okButton press and add the tag name.
+ * Enable the OK button if the tag name text field is not empty. Sets the
+ * enter button as default, so user can press enter to activate an okButton
+ * press and add the tag name.
*/
private void enableOkButton() {
okButton.setEnabled(!tagNameTextField.getText().isEmpty());
@@ -173,27 +204,40 @@ final class NewTagNameDialog extends javax.swing.JDialog {
tagNameTextField = new javax.swing.JTextField();
cancelButton = new javax.swing.JButton();
okButton = new javax.swing.JButton();
+ descriptionScrollPane = new javax.swing.JScrollPane();
+ descriptionTextArea = new javax.swing.JTextArea();
+ descriptionLabel = new javax.swing.JLabel();
+ notableCheckbox = new javax.swing.JCheckBox();
setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
- org.openide.awt.Mnemonics.setLocalizedText(newTagNameLabel, org.openide.util.NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.newTagNameLabel.text")); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(newTagNameLabel, org.openide.util.NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.newTagNameLabel.text")); // NOI18N
- tagNameTextField.setText(org.openide.util.NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.tagNameTextField.text")); // NOI18N
+ tagNameTextField.setText(org.openide.util.NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.tagNameTextField.text")); // NOI18N
- org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.cancelButton.text")); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.cancelButton.text")); // NOI18N
cancelButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
cancelButtonActionPerformed(evt);
}
});
- org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.okButton.text")); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.okButton.text")); // NOI18N
okButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
okButtonActionPerformed(evt);
}
});
+ descriptionTextArea.setColumns(20);
+ descriptionTextArea.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
+ descriptionTextArea.setRows(5);
+ descriptionScrollPane.setViewportView(descriptionTextArea);
+
+ org.openide.awt.Mnemonics.setLocalizedText(descriptionLabel, org.openide.util.NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.descriptionLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(notableCheckbox, org.openide.util.NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.notableCheckbox.text")); // NOI18N
+
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
@@ -201,13 +245,19 @@ final class NewTagNameDialog extends javax.swing.JDialog {
.addGroup(layout.createSequentialGroup()
.addContainerGap()
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(tagNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 220, Short.MAX_VALUE)
+ .addComponent(tagNameTextField, javax.swing.GroupLayout.DEFAULT_SIZE, 284, Short.MAX_VALUE)
.addGroup(layout.createSequentialGroup()
.addGap(0, 0, Short.MAX_VALUE)
.addComponent(okButton)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(cancelButton))
- .addComponent(newTagNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
+ .addComponent(newTagNameLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addComponent(descriptionScrollPane, javax.swing.GroupLayout.Alignment.TRAILING)
+ .addGroup(layout.createSequentialGroup()
+ .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(notableCheckbox)
+ .addComponent(descriptionLabel))
+ .addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
layout.setVerticalGroup(
@@ -217,13 +267,16 @@ final class NewTagNameDialog extends javax.swing.JDialog {
.addComponent(newTagNameLabel)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(tagNameTextField, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addContainerGap(50, Short.MAX_VALUE))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap(javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(descriptionLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(descriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 57, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addComponent(notableCheckbox)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 42, Short.MAX_VALUE)
.addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(cancelButton)
- .addComponent(okButton))
- .addContainerGap())
+ .addComponent(okButton)))
);
pack();
@@ -240,7 +293,11 @@ final class NewTagNameDialog extends javax.swing.JDialog {
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton cancelButton;
+ private javax.swing.JLabel descriptionLabel;
+ private javax.swing.JScrollPane descriptionScrollPane;
+ private javax.swing.JTextArea descriptionTextArea;
private javax.swing.JLabel newTagNameLabel;
+ private javax.swing.JCheckBox notableCheckbox;
private javax.swing.JButton okButton;
private javax.swing.JTextField tagNameTextField;
// End of variables declaration//GEN-END:variables
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
index c58201621a..c2e5c06cab 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
@@ -16,7 +16,7 @@
-
+
@@ -29,7 +29,7 @@
-
+
@@ -37,43 +37,39 @@
-
-
-
-
-
-
+
+
+
-
-
-
+
-
+
-
+
-
-
+
+
-
-
-
+
+
+
+
@@ -89,34 +85,46 @@
-
+
-
-
+
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
-
-
-
+
+
+
-
-
+
+
+
-
+
@@ -144,7 +152,7 @@
-
+
@@ -157,6 +165,15 @@
+
+
+
+
+
+
+
+
+
@@ -170,11 +187,67 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -187,15 +260,86 @@
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
index 8fc6a5ff4d..da774f7161 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
@@ -36,15 +36,15 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
private static final long serialVersionUID = 1L;
private static final String DEFAULT_DESCRIPTION = "";
private static final TagName.HTML_COLOR DEFAULT_COLOR = TagName.HTML_COLOR.NONE;
- private final DefaultListModel tagTypesListModel;
- private Set tagTypes;
+ private final DefaultListModel tagTypesListModel;
+ private Set tagTypes;
/**
* Creates new form TagsManagerOptionsPanel
*/
TagOptionsPanel() {
tagTypesListModel = new DefaultListModel<>();
- tagTypes = new TreeSet<>(TagNameDefiniton.getTagNameDefinitions());
+ tagTypes = new TreeSet<>(TagNameDefinition.getTagNameDefinitions());
initComponents();
customizeComponents();
}
@@ -52,7 +52,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
private void customizeComponents() {
tagNamesList.setModel(tagTypesListModel);
tagNamesList.addListSelectionListener((ListSelectionEvent event) -> {
- enableButtons();
+ updatePanel();
});
}
@@ -66,7 +66,6 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
private void initComponents() {
jPanel1 = new javax.swing.JPanel();
- panelDescriptionLabel = new javax.swing.JLabel();
jScrollPane2 = new javax.swing.JScrollPane();
jSplitPane1 = new javax.swing.JSplitPane();
modifyTagTypesListPanel = new javax.swing.JPanel();
@@ -75,14 +74,23 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
tagNamesList = new javax.swing.JList<>();
newTagNameButton = new javax.swing.JButton();
deleteTagNameButton = new javax.swing.JButton();
+ editTagNameButton = new javax.swing.JButton();
+ jScrollPane3 = new javax.swing.JScrollPane();
+ jTextArea1 = new javax.swing.JTextArea();
tagTypesAdditionalPanel = new javax.swing.JPanel();
+ descriptionLabel = new javax.swing.JLabel();
+ descriptionScrollPane = new javax.swing.JScrollPane();
+ descriptionTextArea = new javax.swing.JTextArea();
+ isNotableLabel = new javax.swing.JLabel();
+ notableYesOrNoLabel = new javax.swing.JLabel();
- jPanel1.setPreferredSize(new java.awt.Dimension(750, 500));
+ jPanel1.setPreferredSize(new java.awt.Dimension(750, 490));
- org.openide.awt.Mnemonics.setLocalizedText(panelDescriptionLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.panelDescriptionLabel.text")); // NOI18N
+ jScrollPane2.setPreferredSize(new java.awt.Dimension(750, 490));
- jSplitPane1.setDividerLocation(400);
+ jSplitPane1.setDividerLocation(365);
jSplitPane1.setDividerSize(1);
+ jSplitPane1.setPreferredSize(new java.awt.Dimension(748, 488));
org.openide.awt.Mnemonics.setLocalizedText(tagTypesListLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.tagTypesListLabel.text")); // NOI18N
@@ -91,6 +99,9 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
newTagNameButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/add-tag.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(newTagNameButton, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.newTagNameButton.text")); // NOI18N
+ newTagNameButton.setMaximumSize(new java.awt.Dimension(111, 25));
+ newTagNameButton.setMinimumSize(new java.awt.Dimension(111, 25));
+ newTagNameButton.setPreferredSize(new java.awt.Dimension(111, 25));
newTagNameButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
newTagNameButtonActionPerformed(evt);
@@ -99,12 +110,36 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
deleteTagNameButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/delete-tag.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(deleteTagNameButton, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.deleteTagNameButton.text")); // NOI18N
+ deleteTagNameButton.setMaximumSize(new java.awt.Dimension(111, 25));
+ deleteTagNameButton.setMinimumSize(new java.awt.Dimension(111, 25));
+ deleteTagNameButton.setPreferredSize(new java.awt.Dimension(111, 25));
deleteTagNameButton.addActionListener(new java.awt.event.ActionListener() {
public void actionPerformed(java.awt.event.ActionEvent evt) {
deleteTagNameButtonActionPerformed(evt);
}
});
+ org.openide.awt.Mnemonics.setLocalizedText(editTagNameButton, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.editTagNameButton.text")); // NOI18N
+ editTagNameButton.setMaximumSize(new java.awt.Dimension(111, 25));
+ editTagNameButton.setMinimumSize(new java.awt.Dimension(111, 25));
+ editTagNameButton.setPreferredSize(new java.awt.Dimension(111, 25));
+ editTagNameButton.addActionListener(new java.awt.event.ActionListener() {
+ public void actionPerformed(java.awt.event.ActionEvent evt) {
+ editTagNameButtonActionPerformed(evt);
+ }
+ });
+
+ jTextArea1.setEditable(false);
+ jTextArea1.setBackground(new java.awt.Color(240, 240, 240));
+ jTextArea1.setColumns(20);
+ jTextArea1.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
+ jTextArea1.setLineWrap(true);
+ jTextArea1.setRows(3);
+ jTextArea1.setText(org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.jTextArea1.text")); // NOI18N
+ jTextArea1.setWrapStyleWord(true);
+ jTextArea1.setFocusable(false);
+ jScrollPane3.setViewportView(jTextArea1);
+
javax.swing.GroupLayout modifyTagTypesListPanelLayout = new javax.swing.GroupLayout(modifyTagTypesListPanel);
modifyTagTypesListPanel.setLayout(modifyTagTypesListPanelLayout);
modifyTagTypesListPanelLayout.setHorizontalGroup(
@@ -112,40 +147,88 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
.addGroup(modifyTagTypesListPanelLayout.createSequentialGroup()
.addContainerGap()
.addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.TRAILING)
.addComponent(tagTypesListLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addGroup(modifyTagTypesListPanelLayout.createSequentialGroup()
- .addComponent(newTagNameButton)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(deleteTagNameButton)
- .addGap(0, 113, Short.MAX_VALUE)))
- .addContainerGap())
- );
- modifyTagTypesListPanelLayout.setVerticalGroup(
- modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(modifyTagTypesListPanelLayout.createSequentialGroup()
- .addContainerGap()
- .addComponent(tagTypesListLabel)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 381, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(newTagNameButton)
- .addComponent(deleteTagNameButton))
+ .addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING, false)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(javax.swing.GroupLayout.Alignment.LEADING, modifyTagTypesListPanelLayout.createSequentialGroup()
+ .addComponent(newTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(editTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(deleteTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, 345, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
+ modifyTagTypesListPanelLayout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {deleteTagNameButton, editTagNameButton, newTagNameButton});
+
+ modifyTagTypesListPanelLayout.setVerticalGroup(
+ modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addGroup(modifyTagTypesListPanelLayout.createSequentialGroup()
+ .addGap(10, 10, 10)
+ .addComponent(jScrollPane3, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(tagTypesListLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 355, Short.MAX_VALUE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.UNRELATED)
+ .addGroup(modifyTagTypesListPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(newTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(editTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(deleteTagNameButton, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addContainerGap())
+ );
+
+ modifyTagTypesListPanelLayout.linkSize(javax.swing.SwingConstants.VERTICAL, new java.awt.Component[] {deleteTagNameButton, editTagNameButton, newTagNameButton});
+
jSplitPane1.setLeftComponent(modifyTagTypesListPanel);
+ org.openide.awt.Mnemonics.setLocalizedText(descriptionLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.descriptionLabel.text")); // NOI18N
+
+ descriptionTextArea.setEditable(false);
+ descriptionTextArea.setBackground(new java.awt.Color(240, 240, 240));
+ descriptionTextArea.setColumns(20);
+ descriptionTextArea.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
+ descriptionTextArea.setLineWrap(true);
+ descriptionTextArea.setRows(5);
+ descriptionTextArea.setWrapStyleWord(true);
+ descriptionTextArea.setFocusable(false);
+ descriptionScrollPane.setViewportView(descriptionTextArea);
+
+ org.openide.awt.Mnemonics.setLocalizedText(isNotableLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.isNotableLabel.text")); // NOI18N
+
+ org.openide.awt.Mnemonics.setLocalizedText(notableYesOrNoLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.notableYesOrNoLabel.text")); // NOI18N
+
javax.swing.GroupLayout tagTypesAdditionalPanelLayout = new javax.swing.GroupLayout(tagTypesAdditionalPanel);
tagTypesAdditionalPanel.setLayout(tagTypesAdditionalPanelLayout);
tagTypesAdditionalPanelLayout.setHorizontalGroup(
tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 354, Short.MAX_VALUE)
+ .addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(descriptionScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
+ .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup()
+ .addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(notableYesOrNoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addContainerGap())
);
tagTypesAdditionalPanelLayout.setVerticalGroup(
tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGap(0, 454, Short.MAX_VALUE)
+ .addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup()
+ .addContainerGap()
+ .addComponent(descriptionLabel)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(descriptionScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
+ .addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addComponent(notableYesOrNoLabel))
+ .addContainerGap(351, Short.MAX_VALUE))
);
jSplitPane1.setRightComponent(tagTypesAdditionalPanel);
@@ -157,27 +240,23 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
jPanel1Layout.setHorizontalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(panelDescriptionLabel, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(jScrollPane2))
- .addContainerGap())
+ .addGap(0, 0, 0)
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(0, 0, 0))
);
jPanel1Layout.setVerticalGroup(
jPanel1Layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(jPanel1Layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(panelDescriptionLabel)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, 458, Short.MAX_VALUE)
- .addContainerGap())
+ .addGap(0, 0, 0)
+ .addComponent(jScrollPane2, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
+ .addGap(0, 0, 0))
);
javax.swing.GroupLayout layout = new javax.swing.GroupLayout(this);
this.setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, 778, Short.MAX_VALUE)
+ .addComponent(jPanel1, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
@@ -186,11 +265,11 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
}// //GEN-END:initComponents
private void newTagNameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_newTagNameButtonActionPerformed
- NewTagNameDialog dialog = new NewTagNameDialog();
- NewTagNameDialog.BUTTON_PRESSED result = dialog.getResult();
- if (result == NewTagNameDialog.BUTTON_PRESSED.OK) {
- String newTagDisplayName = dialog.getTagName();
- TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR, "");
+ TagNameDialog dialog = new TagNameDialog();
+ TagNameDialog.BUTTON_PRESSED result = dialog.getResult();
+ if (result == TagNameDialog.BUTTON_PRESSED.OK) {
+ String status = dialog.isTagNotable() ? "(Notable)" : "";
+ TagNameDefinition newTagType = new TagNameDefinition(dialog.getTagName(), dialog.getTagDesciption(), DEFAULT_COLOR, status);
/*
* If tag name already exists, don't add the tag name.
*/
@@ -198,7 +277,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
tagTypes.add(newTagType);
updateTagNamesListModel();
tagNamesList.setSelectedValue(newTagType, true);
- enableButtons();
+ updatePanel();
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
} else {
JOptionPane.showMessageDialog(null,
@@ -210,23 +289,51 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
}//GEN-LAST:event_newTagNameButtonActionPerformed
private void deleteTagNameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_deleteTagNameButtonActionPerformed
- TagNameDefiniton tagName = tagNamesList.getSelectedValue();
+ TagNameDefinition tagName = tagNamesList.getSelectedValue();
tagTypes.remove(tagName);
updateTagNamesListModel();
- enableButtons();
+ updatePanel();
firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+
}//GEN-LAST:event_deleteTagNameButtonActionPerformed
+ private void editTagNameButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_editTagNameButtonActionPerformed
+ TagNameDefinition originalTagName = tagNamesList.getSelectedValue();
+ TagNameDialog dialog = new TagNameDialog(originalTagName);
+ TagNameDialog.BUTTON_PRESSED result = dialog.getResult();
+ if (result == TagNameDialog.BUTTON_PRESSED.OK) {
+ String status = dialog.isTagNotable() ? "(Notable)" : "";
+ TagNameDefinition newTagType = new TagNameDefinition(dialog.getTagName(), dialog.getTagDesciption(), DEFAULT_COLOR, status);
+ /*
+ * If tag name already exists, don't add the tag name.
+ */
+
+ tagTypes.remove(originalTagName);
+ tagTypes.add(newTagType);
+ updateTagNamesListModel();
+ tagNamesList.setSelectedValue(newTagType, true);
+ updatePanel();
+ firePropertyChange(OptionsPanelController.PROP_CHANGED, null, null);
+ }
+ }//GEN-LAST:event_editTagNameButtonActionPerformed
+
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton deleteTagNameButton;
+ private javax.swing.JLabel descriptionLabel;
+ private javax.swing.JScrollPane descriptionScrollPane;
+ private javax.swing.JTextArea descriptionTextArea;
+ private javax.swing.JButton editTagNameButton;
+ private javax.swing.JLabel isNotableLabel;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
private javax.swing.JScrollPane jScrollPane2;
+ private javax.swing.JScrollPane jScrollPane3;
private javax.swing.JSplitPane jSplitPane1;
+ private javax.swing.JTextArea jTextArea1;
private javax.swing.JPanel modifyTagTypesListPanel;
private javax.swing.JButton newTagNameButton;
- private javax.swing.JLabel panelDescriptionLabel;
- private javax.swing.JList tagNamesList;
+ private javax.swing.JLabel notableYesOrNoLabel;
+ private javax.swing.JList tagNamesList;
private javax.swing.JPanel tagTypesAdditionalPanel;
private javax.swing.JLabel tagTypesListLabel;
// End of variables declaration//GEN-END:variables
@@ -236,7 +343,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
*/
private void updateTagNamesListModel() {
tagTypesListModel.clear();
- for (TagNameDefiniton tagName : tagTypes) {
+ for (TagNameDefinition tagName : tagTypes) {
tagTypesListModel.addElement(tagName);
}
}
@@ -246,9 +353,9 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
*/
@Override
public void load() {
- tagTypes = new TreeSet<>(TagNameDefiniton.getTagNameDefinitions());
+ tagTypes = new TreeSet<>(TagNameDefinition.getTagNameDefinitions());
updateTagNamesListModel();
- enableButtons();
+ updatePanel();
}
/**
@@ -256,19 +363,36 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
*/
@Override
public void store() {
- TagNameDefiniton.setTagNameDefinitions(tagTypes);
+ TagNameDefinition.setTagNameDefinitions(tagTypes);
}
/**
* Enables the button components based on the state of the tag types list
* component.
*/
- private void enableButtons() {
+ private void updatePanel() {
/*
* Only enable the delete button when there is a tag type selected in
* the tag types JList.
*/
- deleteTagNameButton.setEnabled(tagNamesList.getSelectedIndex() != -1);
+ boolean isSelected = tagNamesList.getSelectedIndex() != -1;
+ editTagNameButton.setEnabled(isSelected);
+ boolean enableDelete = isSelected && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(tagNamesList.getSelectedValue().getDisplayName());
+ deleteTagNameButton.setEnabled(enableDelete);
+ if (isSelected){
+
+ descriptionTextArea.setText(tagNamesList.getSelectedValue().getDescription());
+ if (tagNamesList.getSelectedValue().isNotable()){
+ notableYesOrNoLabel.setText("Yes");
+ }
+ else {
+ notableYesOrNoLabel.setText("No");
+ }
+ }
+ else {
+ descriptionTextArea.setText("");
+ notableYesOrNoLabel.setText("");
+ }
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index b9f63983fa..5ee847cfa9 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -115,7 +115,7 @@ public class TagsManager implements Closeable {
*/
public static Set getTagDisplayNames() throws TskCoreException {
Set tagDisplayNames = new HashSet<>();
- Set customNames = TagNameDefiniton.getTagNameDefinitions();
+ Set customNames = TagNameDefinition.getTagNameDefinitions();
customNames.forEach((tagType) -> {
tagDisplayNames.add(tagType.getDisplayName());
});
@@ -134,7 +134,7 @@ public class TagsManager implements Closeable {
public static List getNotableTagDisplayNames() {
List tagDisplayNames = new ArrayList<>();
- for (TagNameDefiniton tagDef : TagNameDefiniton.getTagNameDefinitions()) {
+ for (TagNameDefinition tagDef : TagNameDefinition.getTagNameDefinitions()) {
if (tagDef.isNotable()) {
tagDisplayNames.add(tagDef.getDisplayName());
}
@@ -203,8 +203,8 @@ public class TagsManager implements Closeable {
* map.
*/
Map tagNames = new HashMap<>();
- Set customTypes = TagNameDefiniton.getTagNameDefinitions();
- for (TagNameDefiniton tagType : customTypes) {
+ Set customTypes = TagNameDefinition.getTagNameDefinitions();
+ for (TagNameDefinition tagType : customTypes) {
tagNames.put(tagType.getDisplayName(), null);
}
for (TagName tagName : caseDb.getAllTagNames()) {
@@ -268,7 +268,7 @@ public class TagsManager implements Closeable {
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException {
String knownStatus = "";
if (getNotableTagDisplayNames().contains(displayName)) {
- knownStatus = TagNameDefiniton.NOTABLE;
+ knownStatus = TagNameDefinition.NOTABLE;
}
return addTagName(displayName, description, color, knownStatus);
}
@@ -293,9 +293,9 @@ public class TagsManager implements Closeable {
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) throws TagNameAlreadyExistsException, TskCoreException {
try {
TagName tagName = caseDb.addTagName(displayName, description, color);
- Set customTypes = TagNameDefiniton.getTagNameDefinitions();
- customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus));
- TagNameDefiniton.setTagNameDefinitions(customTypes);
+ Set customTypes = TagNameDefinition.getTagNameDefinitions();
+ customTypes.add(new TagNameDefinition(displayName, description, color, knownStatus));
+ TagNameDefinition.setTagNameDefinitions(customTypes);
return tagName;
} catch (TskCoreException ex) {
List existingTagNames = caseDb.getAllTagNames();
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties
index 7ab2c9b2e4..597e896a2a 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/Bundle.properties
@@ -33,9 +33,6 @@ ImportHashDatabaseDialog.bnNewOrganization.text=Add New Organization
ImportHashDatabaseDialog.tfDatabaseName.tooltip=Name for this database
ImportHashDatabaseDialog.tfDatabaseVersion.tooltip.text=Database Version Number
GlobalSettingsPanel.bnImportDatabase.actionCommand=
-GlobalSettingsPanel.bnManageTags.actionCommand=
-GlobalSettingsPanel.bnManageTags.toolTipText=
-GlobalSettingsPanel.bnManageTags.text=Manage Tags
GlobalSettingsPanel.tbOops.text=
GlobalSettingsPanel.lbDatabaseSettings.text=Database Settings
GlobalSettingsPanel.bnImportDatabase.label=Import Hash Database
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form
index 49d525511b..b4a50fc91c 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.form
@@ -28,7 +28,6 @@
-
@@ -48,8 +47,6 @@
-
-
@@ -193,109 +190,6 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
@@ -415,7 +309,7 @@
-
+
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java
index 58eb9fbe40..57c02fc614 100755
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/GlobalSettingsPanel.java
@@ -57,12 +57,8 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
@Messages({"GlobalSettingsPanel.title=Central Repository Settings",
"GlobalSettingsPanel.cbUseCentralRepo.text=Use a central repository",
- "GlobalSettingsPanel.pnTagManagement.border.title=Tags",
"GlobalSettingsPanel.pnCorrelationProperties.border.title=Correlation Properties",
"GlobalSettingsPanel.lbCentralRepository.text=A central repository allows you to correlate files and results between cases.",
- "GlobalSettingsPanel.manageTagsTextArea.text=Configure which tag names are associated with notable items. "
- + "When these tags are used, the file or result will be recorded in the central repository. "
- + "If that file or result is seen again in future cases, it will be flagged.",
"GlobalSettingsPanel.correlationPropertiesTextArea.text=Choose which file and result properties to store in the central repository for later correlation.",
"GlobalSettingsPanel.organizationPanel.border.title=Organizations",
"GlobalSettingsPanel.manageOrganizationButton.text=Manage Organizations",
@@ -100,10 +96,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
lbDbLocationValue = new javax.swing.JLabel();
cbUseCentralRepo = new javax.swing.JCheckBox();
bnImportDatabase = new javax.swing.JButton();
- pnTagManagement = new javax.swing.JPanel();
- bnManageTags = new javax.swing.JButton();
- manageTagsScrollPane = new javax.swing.JScrollPane();
- manageTagsTextArea = new javax.swing.JTextArea();
tbOops = new javax.swing.JTextField();
pnCorrelationProperties = new javax.swing.JPanel();
bnManageTypes = new javax.swing.JButton();
@@ -189,56 +181,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
}
});
- pnTagManagement.setBorder(javax.swing.BorderFactory.createTitledBorder(null, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.pnTagManagement.border.title"), javax.swing.border.TitledBorder.DEFAULT_JUSTIFICATION, javax.swing.border.TitledBorder.DEFAULT_POSITION, new java.awt.Font("Tahoma", 0, 12))); // NOI18N
- pnTagManagement.setPreferredSize(new java.awt.Dimension(674, 97));
-
- org.openide.awt.Mnemonics.setLocalizedText(bnManageTags, org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.bnManageTags.text")); // NOI18N
- bnManageTags.setToolTipText(org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.bnManageTags.toolTipText")); // NOI18N
- bnManageTags.setActionCommand(org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.bnManageTags.actionCommand")); // NOI18N
- bnManageTags.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- bnManageTagsActionPerformed(evt);
- }
- });
-
- manageTagsScrollPane.setBorder(null);
-
- manageTagsTextArea.setEditable(false);
- manageTagsTextArea.setBackground(new java.awt.Color(240, 240, 240));
- manageTagsTextArea.setColumns(20);
- manageTagsTextArea.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
- manageTagsTextArea.setLineWrap(true);
- manageTagsTextArea.setRows(2);
- manageTagsTextArea.setText(org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.manageTagsTextArea.text")); // NOI18N
- manageTagsTextArea.setToolTipText("");
- manageTagsTextArea.setWrapStyleWord(true);
- manageTagsTextArea.setBorder(null);
- manageTagsScrollPane.setViewportView(manageTagsTextArea);
-
- javax.swing.GroupLayout pnTagManagementLayout = new javax.swing.GroupLayout(pnTagManagement);
- pnTagManagement.setLayout(pnTagManagementLayout);
- pnTagManagementLayout.setHorizontalGroup(
- pnTagManagementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(pnTagManagementLayout.createSequentialGroup()
- .addContainerGap()
- .addGroup(pnTagManagementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(pnTagManagementLayout.createSequentialGroup()
- .addComponent(bnManageTags)
- .addGap(0, 555, Short.MAX_VALUE))
- .addGroup(pnTagManagementLayout.createSequentialGroup()
- .addComponent(manageTagsScrollPane)
- .addContainerGap())))
- );
- pnTagManagementLayout.setVerticalGroup(
- pnTagManagementLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(pnTagManagementLayout.createSequentialGroup()
- .addGap(7, 7, 7)
- .addComponent(manageTagsScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 31, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(bnManageTags, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(8, 8, 8))
- );
-
tbOops.setEditable(false);
tbOops.setFont(tbOops.getFont().deriveFont(tbOops.getFont().getStyle() | java.awt.Font.BOLD, 12));
tbOops.setText(org.openide.util.NbBundle.getMessage(GlobalSettingsPanel.class, "GlobalSettingsPanel.tbOops.text")); // NOI18N
@@ -351,7 +293,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
.addComponent(organizationPanel, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(lbCentralRepository, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnCorrelationProperties, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
- .addComponent(pnTagManagement, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
.addComponent(cbUseCentralRepo, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.PREFERRED_SIZE, 186, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(bnImportDatabase, javax.swing.GroupLayout.Alignment.LEADING))
@@ -366,8 +307,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(pnDatabaseConfiguration, javax.swing.GroupLayout.PREFERRED_SIZE, 119, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
- .addComponent(pnTagManagement, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, 0)
.addComponent(pnCorrelationProperties, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGap(0, 0, 0)
.addComponent(organizationPanel, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
@@ -377,8 +316,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
.addComponent(bnImportDatabase)
.addContainerGap())
);
-
- pnTagManagement.getAccessibleContext().setAccessibleName("");
}// //GEN-END:initComponents
private void bnImportDatabaseActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnImportDatabaseActionPerformed
@@ -387,12 +324,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
}//GEN-LAST:event_bnImportDatabaseActionPerformed
- private void bnManageTagsActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnManageTagsActionPerformed
- store();
- ManageTagsDialog dialog = new ManageTagsDialog();
- firePropertyChange(OptionsPanelController.PROP_VALID, null, null);
- }//GEN-LAST:event_bnManageTagsActionPerformed
-
private void bnManageTypesActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_bnManageTypesActionPerformed
store();
ManageCorrelationPropertiesDialog dialog = new ManageCorrelationPropertiesDialog();
@@ -565,11 +496,8 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
private boolean enableButtonSubComponents(Boolean enable) {
boolean ingestRunning = IngestManager.getInstance().isIngestRunning();
pnCorrelationProperties.setEnabled(enable && !ingestRunning);
- pnTagManagement.setEnabled(enable && !ingestRunning);
bnManageTypes.setEnabled(enable && !ingestRunning);
bnImportDatabase.setEnabled(enable && !ingestRunning);
- bnManageTags.setEnabled(enable && !ingestRunning);
- manageTagsTextArea.setEnabled(enable && !ingestRunning);
correlationPropertiesTextArea.setEnabled(enable && !ingestRunning);
organizationPanel.setEnabled(enable && !ingestRunning);
organizationTextArea.setEnabled(enable && !ingestRunning);
@@ -580,7 +508,6 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
// Variables declaration - do not modify//GEN-BEGIN:variables
private javax.swing.JButton bnDbConfigure;
private javax.swing.JButton bnImportDatabase;
- private javax.swing.JButton bnManageTags;
private javax.swing.JButton bnManageTypes;
private javax.swing.JCheckBox cbUseCentralRepo;
private javax.swing.JScrollPane correlationPropertiesScrollPane;
@@ -593,14 +520,11 @@ public final class GlobalSettingsPanel extends IngestModuleGlobalSettingsPanel i
private javax.swing.JLabel lbDbPlatformTypeLabel;
private javax.swing.JLabel lbDbPlatformValue;
private javax.swing.JButton manageOrganizationButton;
- private javax.swing.JScrollPane manageTagsScrollPane;
- private javax.swing.JTextArea manageTagsTextArea;
private javax.swing.JPanel organizationPanel;
private javax.swing.JScrollPane organizationScrollPane;
private javax.swing.JTextArea organizationTextArea;
private javax.swing.JPanel pnCorrelationProperties;
private javax.swing.JPanel pnDatabaseConfiguration;
- private javax.swing.JPanel pnTagManagement;
private javax.swing.JTextField tbOops;
// End of variables declaration//GEN-END:variables
}
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.form b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.form
deleted file mode 100755
index f1ad5a38e4..0000000000
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.form
+++ /dev/null
@@ -1,147 +0,0 @@
-
-
-
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java b/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
deleted file mode 100755
index ff179c3032..0000000000
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/optionspanel/ManageTagsDialog.java
+++ /dev/null
@@ -1,364 +0,0 @@
-/*
- * Central Repository
- *
- * Copyright 2015-2017 Basis Technology Corp.
- * Contact: carrier sleuthkit 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.optionspanel;
-
-import java.awt.Cursor;
-import java.awt.Dimension;
-import java.awt.Toolkit;
-import java.util.ArrayList;
-import java.util.Collections;
-import java.util.List;
-import java.util.logging.Level;
-import javax.swing.JFrame;
-import javax.swing.table.DefaultTableModel;
-import javax.swing.event.TableModelEvent;
-import javax.swing.event.TableModelListener;
-import javax.swing.JOptionPane;
-import org.openide.util.NbBundle.Messages;
-import org.openide.windows.WindowManager;
-import org.sleuthkit.autopsy.casemodule.Case;
-import org.sleuthkit.autopsy.casemodule.services.TagsManager;
-import org.sleuthkit.autopsy.centralrepository.datamodel.EamDb;
-import org.sleuthkit.autopsy.centralrepository.datamodel.EamDbException;
-import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttribute;
-import org.sleuthkit.autopsy.centralrepository.datamodel.EamArtifactUtil;
-import org.sleuthkit.autopsy.coreutils.Logger;
-import org.sleuthkit.datamodel.TskCoreException;
-import org.sleuthkit.datamodel.BlackboardArtifactTag;
-import org.sleuthkit.datamodel.TagName;
-import org.sleuthkit.datamodel.ContentTag;
-import org.sleuthkit.datamodel.TskData;
-
-/**
- * Instances of this class allow a user to select an existing hash database and
- * add it to the set of hash databases used to classify files as unknown, known,
- * or notable.
- */
-final class ManageTagsDialog extends javax.swing.JDialog {
-
- private static final Logger LOGGER = Logger.getLogger(ManageTagsDialog.class.getName());
-
- /**
- * Displays a dialog that allows a user to select an existing hash database
- * and add it to the set of hash databases used to classify files as
- * unknown, known, or notable.
- */
- @Messages({"ManageTagDialog.title=Manage Tags",
- "ManageTagDialog.tagInfo.text=Select the tags that cause files and results to be recorded in the central repository. Additional tags can be created in the Tags options panel."})
- ManageTagsDialog() {
- super((JFrame) WindowManager.getDefault().getMainWindow(),
- Bundle.ManageTagDialog_title(),
- true); // NON-NLS
- initComponents();
- customizeComponents();
- setupHelpTextArea();
- display();
- }
-
-
- @Messages({"ManageTagsDialog.init.failedConnection.msg=Cannot connect to central cepository.",
- "ManageTagsDialog.init.failedGettingTags.msg=Unable to retrieve list of tags.",
- "ManageTagsDialog.tagColumn.header.text=Tags",
- "ManageTagsDialog.notableColumn.header.text=Notable"})
- private void setupHelpTextArea() {
- helpTextArea.setText(Bundle.ManageTagDialog_tagInfo_text());
- }
-
- private void customizeComponents() {
- lbWarnings.setText("");
- EamDb dbManager;
- try {
- dbManager = EamDb.getInstance();
- } catch (EamDbException ex) {
- LOGGER.log(Level.SEVERE, "Failed to connect to central repository database.");
- lbWarnings.setText(Bundle.ManageTagsDialog_init_failedConnection_msg());
- return;
- }
- List badTags = TagsManager.getNotableTagDisplayNames();
-
- List tagNames = new ArrayList<>();
- try {
- tagNames.addAll(TagsManager.getTagDisplayNames());
- } catch (TskCoreException ex) {
- LOGGER.log(Level.WARNING, "Could not get list of tags in case", ex);
- lbWarnings.setText(Bundle.ManageTagsDialog_init_failedGettingTags_msg());
- }
-
- Collections.sort(tagNames);
-
- DefaultTableModel model = (DefaultTableModel) tblTagNames.getModel();
- model.setColumnIdentifiers(new String[] {Bundle.ManageTagsDialog_tagColumn_header_text(), Bundle.ManageTagsDialog_notableColumn_header_text()});
- for (String tagName : tagNames) {
- boolean enabled = badTags.contains(tagName);
- model.addRow(new Object[]{tagName, enabled});
- }
- CheckBoxModelListener listener = new CheckBoxModelListener(this);
- model.addTableModelListener(listener);
- }
-
- private void display() {
- Dimension screenDimension = Toolkit.getDefaultToolkit().getScreenSize();
- setLocation((screenDimension.width - getSize().width) / 2, (screenDimension.height - getSize().height) / 2);
- setVisible(true);
- }
-
- /**
- * This method is called from within the constructor to initialize the form.
- * WARNING: Do NOT modify this code. The content of this method is always
- * regenerated by the Form Editor.
- */
- @SuppressWarnings({"unchecked", "rawtypes"})
- // //GEN-BEGIN:initComponents
- private void initComponents() {
-
- buttonGroup1 = new javax.swing.ButtonGroup();
- okButton = new javax.swing.JButton();
- cancelButton = new javax.swing.JButton();
- tagScrollArea = new javax.swing.JScrollPane();
- tblTagNames = new javax.swing.JTable();
- lbWarnings = new javax.swing.JLabel();
- helpScrollPane = new javax.swing.JScrollPane();
- helpTextArea = new javax.swing.JTextArea();
-
- setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);
-
- org.openide.awt.Mnemonics.setLocalizedText(okButton, org.openide.util.NbBundle.getMessage(ManageTagsDialog.class, "ManageTagsDialog.okButton.text")); // NOI18N
- okButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- okButtonActionPerformed(evt);
- }
- });
-
- org.openide.awt.Mnemonics.setLocalizedText(cancelButton, org.openide.util.NbBundle.getMessage(ManageTagsDialog.class, "ManageTagsDialog.cancelButton.text")); // NOI18N
- cancelButton.addActionListener(new java.awt.event.ActionListener() {
- public void actionPerformed(java.awt.event.ActionEvent evt) {
- cancelButtonActionPerformed(evt);
- }
- });
-
- tblTagNames.setModel(new javax.swing.table.DefaultTableModel(
- new Object [][] {
-
- },
- new String [] {
- "", ""
- }
- ) {
- Class[] types = new Class [] {
- java.lang.Object.class, java.lang.Boolean.class
- };
- boolean[] canEdit = new boolean [] {
- false, true
- };
-
- public Class getColumnClass(int columnIndex) {
- return types [columnIndex];
- }
-
- public boolean isCellEditable(int rowIndex, int columnIndex) {
- return canEdit [columnIndex];
- }
- });
- tagScrollArea.setViewportView(tblTagNames);
-
- helpScrollPane.setBorder(null);
-
- helpTextArea.setEditable(false);
- helpTextArea.setBackground(new java.awt.Color(240, 240, 240));
- helpTextArea.setColumns(20);
- helpTextArea.setFont(new java.awt.Font("Tahoma", 0, 11)); // NOI18N
- helpTextArea.setLineWrap(true);
- helpTextArea.setRows(3);
- helpTextArea.setWrapStyleWord(true);
- helpTextArea.setBorder(null);
- helpTextArea.setFocusable(false);
- helpScrollPane.setViewportView(helpTextArea);
-
- javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
- getContentPane().setLayout(layout);
- layout.setHorizontalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addContainerGap()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(layout.createSequentialGroup()
- .addGap(0, 0, Short.MAX_VALUE)
- .addComponent(okButton)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(cancelButton))
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
- .addComponent(helpScrollPane, javax.swing.GroupLayout.Alignment.LEADING)
- .addComponent(tagScrollArea, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, 328, Short.MAX_VALUE)
- .addComponent(lbWarnings, javax.swing.GroupLayout.Alignment.LEADING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE))
- .addGap(2, 2, 2)))
- .addContainerGap())
- );
-
- layout.linkSize(javax.swing.SwingConstants.HORIZONTAL, new java.awt.Component[] {cancelButton, okButton});
-
- layout.setVerticalGroup(
- layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
- .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
- .addContainerGap()
- .addComponent(helpScrollPane, javax.swing.GroupLayout.PREFERRED_SIZE, 42, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addGap(0, 0, 0)
- .addComponent(tagScrollArea, javax.swing.GroupLayout.DEFAULT_SIZE, 341, Short.MAX_VALUE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(lbWarnings, javax.swing.GroupLayout.PREFERRED_SIZE, 18, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
- .addComponent(okButton)
- .addComponent(cancelButton))
- .addContainerGap())
- );
-
- pack();
- }// //GEN-END:initComponents
-
- private void cancelButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_cancelButtonActionPerformed
- dispose();
- }//GEN-LAST:event_cancelButtonActionPerformed
-
-
- private void okButtonActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_okButtonActionPerformed
- if (setBadTags()) {
- dispose();
- }
- }//GEN-LAST:event_okButtonActionPerformed
-
- private boolean setBadTags() {
- List badTags = new ArrayList<>();
-
- DefaultTableModel model = (DefaultTableModel) tblTagNames.getModel();
- for (int i = 0; i < model.getRowCount(); ++i) {
- String tagName = (String) model.getValueAt(i, 0);
- boolean enabled = (boolean) model.getValueAt(i, 1);
-
- if (enabled) {
- badTags.add(tagName);
- }
- }
- try {
- EamDb dbManager = EamDb.getInstance();
- dbManager.saveSettings();
- } catch (EamDbException ex) {
- LOGGER.log(Level.SEVERE, "Failed to connect to central repository database."); // NON-NLS
- lbWarnings.setText(Bundle.ManageTagsDialog_init_failedConnection_msg());
- return false;
- }
- return true;
- }
-
- /**
- * If the user sets a tag to "Notable", give them the option to update
- * any existing tagged items (in the current case only) in the central repo.
- */
- public class CheckBoxModelListener implements TableModelListener {
- @Messages({"ManageTagsDialog.updateCurrentCase.msg=Mark as notable any files/results in the current case that have this tag?",
- "ManageTagsDialog.updateCurrentCase.title=Update current case?",
- "ManageTagsDialog.updateCurrentCase.error=Error updating existing central repository entries"})
-
- javax.swing.JDialog dialog;
- public CheckBoxModelListener(javax.swing.JDialog dialog){
- this.dialog = dialog;
- }
-
- @Override
- public void tableChanged(TableModelEvent e) {
- int row = e.getFirstRow();
- int column = e.getColumn();
- if (column == 1) {
- DefaultTableModel model = (DefaultTableModel) e.getSource();
- String tagName = (String) model.getValueAt(row, 0);
- Boolean checked = (Boolean) model.getValueAt(row, column);
- if (checked) {
-
- // Don't do anything if there's no case open
- if(Case.isCaseOpen()){
- int dialogButton = JOptionPane.YES_NO_OPTION;
- int dialogResult = JOptionPane.showConfirmDialog (
- null,
- Bundle.ManageTagsDialog_updateCurrentCase_msg(),
- Bundle.ManageTagsDialog_updateCurrentCase_title(),
- dialogButton);
- if(dialogResult == JOptionPane.YES_OPTION){
- try{
- dialog.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
- setArtifactsKnownBadByTag(tagName, Case.getCurrentCase());
- } catch (EamDbException ex) {
- LOGGER.log(Level.SEVERE, "Failed to apply notable status to artifacts in current case", ex);
- JOptionPane.showMessageDialog(null, Bundle.ManageTagsDialog_updateCurrentCase_error());
- } finally {
- dialog.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
- }
- }
- }
- }
- }
- }
- }
-
- /**
- * Set knownBad status for all files/artifacts in the given case that
- * are tagged with the given tag name.
- * Files/artifacts that are not already in the database will be added.
- * @param tagName The name of the tag to search for
- * @param curCase The case to search in
- */
- public void setArtifactsKnownBadByTag(String tagNameString, Case curCase) throws EamDbException{
- try{
- TagName tagName = curCase.getServices().getTagsManager().getDisplayNamesToTagNamesMap().get(tagNameString);
-
- // First find any matching artifacts
- List artifactTags = curCase.getSleuthkitCase().getBlackboardArtifactTagsByTagName(tagName);
-
- for(BlackboardArtifactTag bbTag:artifactTags){
- List convertedArtifacts = EamArtifactUtil.getCorrelationAttributeFromBlackboardArtifact(bbTag.getArtifact(), true, true);
- for (CorrelationAttribute eamArtifact : convertedArtifacts) {
- EamDb.getInstance().setArtifactInstanceKnownStatus(eamArtifact,TskData.FileKnown.BAD);
- }
- }
-
- // Now search for files
- List fileTags = curCase.getSleuthkitCase().getContentTagsByTagName(tagName);
- for(ContentTag contentTag:fileTags){
- final CorrelationAttribute eamArtifact = EamArtifactUtil.getEamArtifactFromContent(contentTag.getContent(),
- TskData.FileKnown.BAD, "");
- if(eamArtifact != null){
- EamDb.getInstance().setArtifactInstanceKnownStatus(eamArtifact, TskData.FileKnown.BAD);
- }
- }
- } catch (TskCoreException ex){
- throw new EamDbException("Error updating artifacts", ex);
- }
-
- }
-
- // Variables declaration - do not modify//GEN-BEGIN:variables
- private javax.swing.ButtonGroup buttonGroup1;
- private javax.swing.JButton cancelButton;
- private javax.swing.JScrollPane helpScrollPane;
- private javax.swing.JTextArea helpTextArea;
- private javax.swing.JLabel lbWarnings;
- private javax.swing.JButton okButton;
- private javax.swing.JScrollPane tagScrollArea;
- private javax.swing.JTable tblTagNames;
- // End of variables declaration//GEN-END:variables
-}
From ebf34dab14ad4517b10af4b370b819bb7ee65ac9 Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Tue, 7 Nov 2017 14:15:49 -0500
Subject: [PATCH 10/51] Allow user to import Encase hashsets into central repo
---
.../ImportCentralRepoDbProgressDialog.java | 179 +++++++++++++++++-
1 file changed, 177 insertions(+), 2 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
index 597cb8c39d..969e84b0b8 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
@@ -26,6 +26,7 @@ import java.io.File;
import java.io.FileReader;
import java.util.HashSet;
import java.util.Set;
+import java.util.List;
import java.util.logging.Level;
import javax.swing.JFrame;
import javax.swing.SwingWorker;
@@ -76,14 +77,24 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
bnOk.setEnabled(false);
}
+ @NbBundle.Messages({"ImportCentralRepoDbProgressDialog.unknownFormat.message=Hash set to import is an unknown format"})
void importFile(String hashSetName, String version, int orgId,
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
boolean readOnly, String importFileName){
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
File importFile = new File(importFileName);
- worker = new ImportIDXWorker(hashSetName, version, orgId, searchDuringIngest, sendIngestMessages,
- knownFilesType, readOnly, importFile);
+ if(importFileName.endsWith(".idx")){ // < need case insensitive
+ worker = new ImportIDXWorker(hashSetName, version, orgId, searchDuringIngest, sendIngestMessages,
+ knownFilesType, readOnly, importFile);
+ } else if(importFileName.endsWith(".hash")){ // < need case insensitive
+ worker = new ImportEncaseWorker(hashSetName, version, orgId, searchDuringIngest, sendIngestMessages,
+ knownFilesType, readOnly, importFile);
+ } else {
+ // We've gotten here with a format that can't be processed
+ JOptionPane.showMessageDialog(null, Bundle.ImportCentralRepoDbProgressDialog_unknownFormat_message());
+ return;
+ }
worker.addPropertyChangeListener(this);
worker.execute();
@@ -131,6 +142,170 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
HashDbManager.HashDatabase getDatabase();
}
+ class ImportEncaseWorker extends SwingWorker implements CentralRepoImportWorker{
+ private final int HASH_IMPORT_THRESHOLD = 10000;
+ private final String hashSetName;
+ private final String version;
+ private final int orgId;
+ private final boolean searchDuringIngest;
+ private final boolean sendIngestMessages;
+ private final HashDbManager.HashDb.KnownFilesType knownFilesType;
+ private final boolean readOnly;
+ private final File importFile;
+ private final long totalLines;
+ private int crIndex = -1;
+ private HashDbManager.CentralRepoHashDb newHashDb = null;
+ private final AtomicLong numLines = new AtomicLong();
+
+ ImportEncaseWorker(String hashSetName, String version, int orgId,
+ boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
+ boolean readOnly, File importFile){
+
+ this.hashSetName = hashSetName;
+ this.version = version;
+ this.orgId = orgId;
+ this.searchDuringIngest = searchDuringIngest;
+ this.sendIngestMessages = sendIngestMessages;
+ this.knownFilesType = knownFilesType;
+ this.readOnly = readOnly;
+ this.importFile = importFile;
+ this.numLines.set(0);
+
+ this.totalLines = getEstimatedTotalHashes();
+ }
+
+ /**
+ * Encase files have a 0x480 byte header, then each hash takes 18 bytes
+ * @return Approximate number of hashes in the file
+ */
+ final long getEstimatedTotalHashes(){
+ long fileSize = importFile.length();
+ if(fileSize < 0x492){
+ return 1; // There's room for at most one hash
+ }
+ return ((fileSize - 0x492) / 18);
+ }
+
+ @Override
+ public HashDbManager.HashDatabase getDatabase(){
+ return newHashDb;
+ }
+
+ @Override
+ public long getLinesProcessed(){
+ return numLines.get();
+ }
+
+ @Override
+ public int getProgressPercentage(){
+ return this.getProgress();
+ }
+
+ @Override
+ protected Void doInBackground() throws Exception {
+
+ EncaseHashSetParser encaseParser = new EncaseHashSetParser(this.importFile.getAbsolutePath());
+
+ TskData.FileKnown knownStatus;
+ if (knownFilesType.equals(HashDbManager.HashDb.KnownFilesType.KNOWN)) {
+ knownStatus = TskData.FileKnown.KNOWN;
+ } else {
+ knownStatus = TskData.FileKnown.BAD;
+ }
+
+ // Create an empty hashset in the central repository
+ crIndex = EamDb.getInstance().newReferenceSet(orgId, hashSetName, version, knownStatus, readOnly);
+
+ EamDb dbManager = EamDb.getInstance();
+ CorrelationAttribute.Type contentType = dbManager.getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID); // get "FILES" type
+
+ Set globalInstances = new HashSet<>();
+
+ while (! encaseParser.doneReading()) {
+ if(isCancelled()){
+ return null;
+ }
+
+ String newHash = encaseParser.getNextHash();
+
+ if(newHash != null){
+ EamGlobalFileInstance eamGlobalFileInstance = new EamGlobalFileInstance(
+ crIndex,
+ newHash,
+ knownStatus,
+ "");
+
+ globalInstances.add(eamGlobalFileInstance);
+ numLines.incrementAndGet();
+
+ if(numLines.get() % HASH_IMPORT_THRESHOLD == 0){
+ dbManager.bulkInsertReferenceTypeEntries(globalInstances, contentType);
+ globalInstances.clear();
+
+ int progress = (int)(numLines.get() * 100 / totalLines);
+ if(progress < 100){
+ this.setProgress(progress);
+ } else {
+ this.setProgress(99);
+ }
+ }
+ }
+ }
+
+ dbManager.bulkInsertReferenceTypeEntries(globalInstances, contentType);
+ this.setProgress(100);
+ return null;
+ }
+
+ private void deleteIncompleteSet(int crIndex){
+ if(crIndex >= 0){
+
+ // This can be slow on large reference sets
+ Executors.newSingleThreadExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ try{
+ EamDb.getInstance().deleteReferenceSet(crIndex);
+ } catch (EamDbException ex2){
+ Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex2);
+ }
+ }
+ });
+ }
+ }
+
+ @Override
+ protected void done() {
+
+ if(isCancelled()){
+ // If the user hit cancel, delete this incomplete hash set from the central repo
+ deleteIncompleteSet(crIndex);
+ return;
+ }
+
+ try {
+ get();
+ try{
+ newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetName, version,
+ crIndex,
+ searchDuringIngest, sendIngestMessages, knownFilesType, readOnly);
+ } catch (TskCoreException ex){
+ JOptionPane.showMessageDialog(null, Bundle.ImportCentralRepoDbProgressDialog_addDbError_message());
+ Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error adding imported hash set", ex);
+ }
+ } catch (Exception ex) {
+ // Delete this incomplete hash set from the central repo
+ if(crIndex >= 0){
+ try{
+ EamDb.getInstance().deleteReferenceSet(crIndex);
+ } catch (EamDbException ex2){
+ Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex);
+ }
+ }
+ }
+ }
+ }
+
class ImportIDXWorker extends SwingWorker implements CentralRepoImportWorker{
private final int HASH_IMPORT_THRESHOLD = 10000;
From 6494a23deeff2507c2215236fbfa01203788f04e Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Tue, 7 Nov 2017 14:19:05 -0500
Subject: [PATCH 11/51] Adding encase parser file
---
.../hashdatabase/EncaseHashSetParser.java | 167 ++++++++++++++++++
1 file changed, 167 insertions(+)
create mode 100644 Core/src/org/sleuthkit/autopsy/modules/hashdatabase/EncaseHashSetParser.java
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/EncaseHashSetParser.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/EncaseHashSetParser.java
new file mode 100644
index 0000000000..df9d78b7a3
--- /dev/null
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/EncaseHashSetParser.java
@@ -0,0 +1,167 @@
+/*
+ * Autopsy Forensic Browser
+ *
+ * Copyright 2011 - 2017 Basis Technology Corp.
+ * Contact: carrier sleuthkit 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.modules.hashdatabase;
+
+import java.io.InputStream;
+import java.io.BufferedInputStream;
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.lang.StringBuilder;
+import java.util.Arrays;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.logging.Level;
+import javax.swing.JOptionPane;
+import org.openide.util.NbBundle;
+import org.sleuthkit.autopsy.core.RuntimeProperties;
+import org.sleuthkit.autopsy.coreutils.Logger;
+import org.sleuthkit.datamodel.TskCoreException;
+
+class EncaseHashSetParser {
+ final byte[] encaseHeader = {(byte)0x48, (byte)0x41, (byte)0x53, (byte)0x48, (byte)0x0d, (byte)0x0a, (byte)0xff, (byte)0x00,
+ (byte)0x02, (byte)0x00, (byte)0x00, (byte)0x00, (byte)0x01, (byte)0x00, (byte)0x00, (byte)0x00};
+ InputStream inputStream;
+ final int expectedHashes;
+ int totalHashesRead = 0;
+
+ /**
+ * Opens the import file and parses the header.
+ * @param filename The Encase hashset
+ * @throws TskCoreException There was an error opening/reading the file or it is not the correct format
+ */
+ @NbBundle.Messages({"EncaseHashSetParser.fileOpenError.text=Error reading import file",
+ "EncaseHashSetParser.wrongFormat.text=Hashset is not Encase format"})
+ EncaseHashSetParser(String filename) throws TskCoreException{
+ try{
+ inputStream = new BufferedInputStream(new FileInputStream(filename));
+
+ // Read in and test the 16 byte header
+ byte[] header = new byte[16];
+ readBuffer(header, 16);
+ if(! Arrays.equals(header, encaseHeader)){
+ displayError(NbBundle.getMessage(this.getClass(),
+ "EncaseHashSetParser.wrongFormat.text"));
+ close();
+ throw new TskCoreException("File " + filename + " does not have an Encase header");
+ }
+
+ // Read in the expected number of hashes
+ byte[] sizeBuffer = new byte[4];
+ readBuffer(sizeBuffer, 4);
+ expectedHashes = ((sizeBuffer[3] & 0xff) << 24) | ((sizeBuffer[2] & 0xff) << 16)
+ | ((sizeBuffer[1] & 0xff) << 8) | (sizeBuffer[0] & 0xff);
+
+ // Read in a bunch of nulls
+ byte[] filler = new byte[0x3f4];
+ readBuffer(filler, 0x3f4);
+
+ // Read in the hash set name
+ byte[] nameBuffer = new byte[0x50];
+ readBuffer(nameBuffer, 0x50);
+
+ // Read in the hash set type
+ byte[] typeBuffer = new byte[0x28];
+ readBuffer(typeBuffer, 0x28);
+
+ } catch (IOException ex){
+ displayError(NbBundle.getMessage(this.getClass(),
+ "EncaseHashSetParser.fileOpenError.text"));
+ close();
+ throw new TskCoreException("Error reading " + filename, ex);
+ } catch (TskCoreException ex){
+ close();
+ throw ex;
+ }
+ }
+
+ int getExpectedHashes(){
+ return expectedHashes;
+ }
+
+ synchronized boolean doneReading(){
+ if(inputStream == null){
+ return true;
+ }
+
+ return(totalHashesRead >= expectedHashes);
+ }
+
+ synchronized String getNextHash() throws TskCoreException{
+ if(inputStream == null){
+ return null;
+ }
+
+ byte[] hashBytes = new byte[16];
+ byte[] divider = new byte[2];
+ try{
+
+ readBuffer(hashBytes, 16);
+ readBuffer(divider, 2);
+
+ StringBuilder sb = new StringBuilder();
+ for (byte b : hashBytes) {
+ sb.append(String.format("%02x", b));
+ }
+
+ totalHashesRead++;
+ return sb.toString();
+ } catch (IOException ex){
+ // Log it and return what we've got
+ Logger.getLogger(EncaseHashSetParser.class.getName()).log(Level.SEVERE, "Ran out of data while reading Encase hash sets", ex);
+ close();
+ throw new TskCoreException("Error reading hash", ex);
+ }
+ }
+
+ synchronized final void close(){
+ if(inputStream != null){
+ try{
+ inputStream.close();
+ } catch (IOException ex){
+ Logger.getLogger(EncaseHashSetParser.class.getName()).log(Level.SEVERE, "Error closing Encase hash set", ex);
+ } finally {
+ inputStream = null;
+ }
+ }
+ }
+
+ @NbBundle.Messages({"EncaseHashSetParser.outOfData.text=Ran out of data while parsing file"})
+ private synchronized void readBuffer(byte[] buffer, int length) throws TskCoreException, IOException {
+ if(inputStream == null){
+ throw new TskCoreException("readBuffer called on null inputStream");
+ }
+ if(length != inputStream.read(buffer)){
+ displayError(NbBundle.getMessage(this.getClass(),
+ "EncaseHashSetParser.outOfData.text"));
+ close();
+ throw new TskCoreException("Ran out of data while parsing Encase file");
+ }
+ }
+
+ @NbBundle.Messages({"EncaseHashSetParser.error.title=Error importing Encase hashset"})
+ private void displayError(String errorText){
+ if(RuntimeProperties.runningWithGUI()){
+ JOptionPane.showMessageDialog(null,
+ errorText,
+ NbBundle.getMessage(this.getClass(),
+ "EncaseHashSetParser.error.title"),
+ JOptionPane.ERROR_MESSAGE);
+ }
+ }
+}
From d49b1667afc9c61fc3aecf8537edf8506e1a0745 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Wed, 8 Nov 2017 09:58:03 -0500
Subject: [PATCH 12/51] 3201 disable tag deletion and editing during ingest
---
.../casemodule/services/Bundle.properties | 7 +-
.../casemodule/services/Bundle_ja.properties | 3 +-
.../casemodule/services/TagOptionsPanel.form | 44 ++++++++--
.../casemodule/services/TagOptionsPanel.java | 86 +++++++++++++++----
4 files changed, 112 insertions(+), 28 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
index 6242c6793d..74938a677a 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
@@ -1,7 +1,7 @@
OptionsCategory_Name_TagNamesOptions=Tags
OptionsCategory_TagNames=TagNames
Blackboard.unableToIndexArtifact.error.msg=Unable to index blackboard artifact {0}
-NewTagNameDialog.title.text=New Tag Name
+NewTagNameDialog.title.text=New Tag
NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message=Tag name may not contain any of the following symbols\: \\ \: * ? " < > | , ;
NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in tag name
NewTagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty
@@ -14,9 +14,10 @@ TagNameDialog.descriptionLabel.text=Description:
TagNameDialog.okButton.text=OK
TagNameDialog.cancelButton.text=Cancel
TagNameDialog.tagNameTextField.text=
-TagNameDialog.newTagNameLabel.text=New Tag Name:
+TagNameDialog.newTagNameLabel.text=Name:
TagNameDialog.notableCheckbox.text=Tag indicates item is notable.
TagOptionsPanel.isNotableLabel.text=Tag indicates item is notable:
TagOptionsPanel.notableYesOrNoLabel.text=
TagOptionsPanel.descriptionLabel.text=Tag Description:
-TagOptionsPanel.jTextArea1.text=Autopsy keeps a list of the tag names you have created in the past. Add more or delete them here.
+TagOptionsPanel.jTextArea1.text=Create and manage tags, which can be applied to files and results in the case. Notable tags will cause items tagged with them to be flagged as notable when using a central repository.
+TagOptionsPanel.ingestRunningWarningLabel.text=Cannot make changes to existing tags when ingest is running!
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle_ja.properties b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle_ja.properties
index a27e3ca586..41e871691b 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle_ja.properties
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle_ja.properties
@@ -1,2 +1,3 @@
TagsManager.predefTagNames.bookmark.text=\u30d6\u30c3\u30af\u30de\u30fc\u30af
-Blackboard.unableToIndexArtifact.error.msg=blackboard\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8{0}\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002
\ No newline at end of file
+Blackboard.unableToIndexArtifact.error.msg=blackboard\u30a2\u30fc\u30c6\u30a3\u30d5\u30a1\u30af\u30c8{0}\u3092\u30a4\u30f3\u30c7\u30c3\u30af\u30b9\u3067\u304d\u307e\u305b\u3093\u3067\u3057\u305f\u3002
+TagOptionsPanel.ingestRunningWarningLabel.text=\u30a4\u30f3\u30b8\u30a7\u30b9\u30c8\u3092\u5b9f\u884c\u4e2d\u306b\u30d5\u30a1\u30a4\u30eb\u30bf\u30a4\u30d7\u5b9a\u7fa9\u3092\u5909\u66f4\u3067\u304d\u307e\u305b\u3093\uff01
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
index c2e5c06cab..541bd90cda 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.form
@@ -203,6 +203,9 @@
+
+
+
@@ -260,18 +263,24 @@
-
-
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
-
+
@@ -287,7 +296,9 @@
-
+
+
+
@@ -339,6 +350,21 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
index da774f7161..ec2caa8d20 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
@@ -18,6 +18,9 @@
*/
package org.sleuthkit.autopsy.casemodule.services;
+import java.awt.EventQueue;
+import java.beans.PropertyChangeEvent;
+import java.beans.PropertyChangeListener;
import java.util.Set;
import java.util.TreeSet;
import javax.swing.DefaultListModel;
@@ -26,6 +29,7 @@ import javax.swing.event.ListSelectionEvent;
import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
+import org.sleuthkit.autopsy.ingest.IngestManager;
import org.sleuthkit.datamodel.TagName;
/**
@@ -38,6 +42,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
private static final TagName.HTML_COLOR DEFAULT_COLOR = TagName.HTML_COLOR.NONE;
private final DefaultListModel tagTypesListModel;
private Set tagTypes;
+ private IngestJobEventPropertyChangeListener ingestJobEventsListener;
/**
* Creates new form TagsManagerOptionsPanel
@@ -54,6 +59,18 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
tagNamesList.addListSelectionListener((ListSelectionEvent event) -> {
updatePanel();
});
+ addIngestJobEventsListener();
+ }
+
+ /**
+ * Add a property change listener that listens to ingest job events to
+ * disable the buttons on the panel if ingest is running. This is done to
+ * prevent changes to user-defined types while the type definitions are in
+ * use.
+ */
+ private void addIngestJobEventsListener() {
+ ingestJobEventsListener = new IngestJobEventPropertyChangeListener();
+ IngestManager.getInstance().addIngestJobEventListener(ingestJobEventsListener);
}
/**
@@ -83,6 +100,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
descriptionTextArea = new javax.swing.JTextArea();
isNotableLabel = new javax.swing.JLabel();
notableYesOrNoLabel = new javax.swing.JLabel();
+ ingestRunningWarningLabel = new javax.swing.JLabel();
jPanel1.setPreferredSize(new java.awt.Dimension(750, 490));
@@ -119,6 +137,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
}
});
+ editTagNameButton.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/images/edit-tag.png"))); // NOI18N
org.openide.awt.Mnemonics.setLocalizedText(editTagNameButton, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.editTagNameButton.text")); // NOI18N
editTagNameButton.setMaximumSize(new java.awt.Dimension(111, 25));
editTagNameButton.setMinimumSize(new java.awt.Dimension(111, 25));
@@ -202,6 +221,10 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
org.openide.awt.Mnemonics.setLocalizedText(notableYesOrNoLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.notableYesOrNoLabel.text")); // NOI18N
+ ingestRunningWarningLabel.setFont(ingestRunningWarningLabel.getFont().deriveFont(ingestRunningWarningLabel.getFont().getStyle() & ~java.awt.Font.BOLD, 11));
+ ingestRunningWarningLabel.setIcon(new javax.swing.ImageIcon(getClass().getResource("/org/sleuthkit/autopsy/modules/filetypeid/warning16.png"))); // NOI18N
+ org.openide.awt.Mnemonics.setLocalizedText(ingestRunningWarningLabel, org.openide.util.NbBundle.getMessage(TagOptionsPanel.class, "TagOptionsPanel.ingestRunningWarningLabel.text")); // NOI18N
+
javax.swing.GroupLayout tagTypesAdditionalPanelLayout = new javax.swing.GroupLayout(tagTypesAdditionalPanel);
tagTypesAdditionalPanel.setLayout(tagTypesAdditionalPanelLayout);
tagTypesAdditionalPanelLayout.setHorizontalGroup(
@@ -210,11 +233,15 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
.addContainerGap()
.addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addComponent(descriptionScrollPane, javax.swing.GroupLayout.DEFAULT_SIZE, 361, Short.MAX_VALUE)
- .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
.addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup()
- .addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
- .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
- .addComponent(notableYesOrNoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE)))
+ .addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
+ .addComponent(descriptionLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 92, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addGroup(tagTypesAdditionalPanelLayout.createSequentialGroup()
+ .addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 150, javax.swing.GroupLayout.PREFERRED_SIZE)
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
+ .addComponent(notableYesOrNoLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 25, javax.swing.GroupLayout.PREFERRED_SIZE))
+ .addComponent(ingestRunningWarningLabel))
+ .addGap(0, 0, Short.MAX_VALUE)))
.addContainerGap())
);
tagTypesAdditionalPanelLayout.setVerticalGroup(
@@ -228,7 +255,9 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
.addGroup(tagTypesAdditionalPanelLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
.addComponent(isNotableLabel, javax.swing.GroupLayout.PREFERRED_SIZE, 22, javax.swing.GroupLayout.PREFERRED_SIZE)
.addComponent(notableYesOrNoLabel))
- .addContainerGap(351, Short.MAX_VALUE))
+ .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED, 304, Short.MAX_VALUE)
+ .addComponent(ingestRunningWarningLabel)
+ .addGap(31, 31, 31))
);
jSplitPane1.setRightComponent(tagTypesAdditionalPanel);
@@ -323,6 +352,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
private javax.swing.JScrollPane descriptionScrollPane;
private javax.swing.JTextArea descriptionTextArea;
private javax.swing.JButton editTagNameButton;
+ private javax.swing.JLabel ingestRunningWarningLabel;
private javax.swing.JLabel isNotableLabel;
private javax.swing.JPanel jPanel1;
private javax.swing.JScrollPane jScrollPane1;
@@ -371,28 +401,54 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
* component.
*/
private void updatePanel() {
+ boolean ingestIsRunning = IngestManager.getInstance().isIngestRunning();
/*
* Only enable the delete button when there is a tag type selected in
* the tag types JList.
*/
+ ingestRunningWarningLabel.setVisible(ingestIsRunning);
boolean isSelected = tagNamesList.getSelectedIndex() != -1;
- editTagNameButton.setEnabled(isSelected);
- boolean enableDelete = isSelected && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(tagNamesList.getSelectedValue().getDisplayName());
+ boolean enableEdit = !ingestIsRunning && isSelected;
+ editTagNameButton.setEnabled(enableEdit);
+ boolean enableDelete = enableEdit && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(tagNamesList.getSelectedValue().getDisplayName());
deleteTagNameButton.setEnabled(enableDelete);
- if (isSelected){
-
+ if (isSelected) {
+
descriptionTextArea.setText(tagNamesList.getSelectedValue().getDescription());
- if (tagNamesList.getSelectedValue().isNotable()){
+ if (tagNamesList.getSelectedValue().isNotable()) {
notableYesOrNoLabel.setText("Yes");
+ } else {
+ notableYesOrNoLabel.setText("No");
}
- else {
- notableYesOrNoLabel.setText("No");
- }
- }
- else {
+ } else {
descriptionTextArea.setText("");
notableYesOrNoLabel.setText("");
}
}
+ /**
+ * @inheritDoc
+ */
+ @Override
+ @SuppressWarnings("FinalizeDeclaration")
+ protected void finalize() throws Throwable {
+ IngestManager.getInstance().removeIngestJobEventListener(ingestJobEventsListener);
+ super.finalize();
+ }
+
+ /**
+ * A property change listener that listens to ingest job events.
+ */
+ private class IngestJobEventPropertyChangeListener implements PropertyChangeListener {
+
+ @Override
+ public void propertyChange(PropertyChangeEvent evt) {
+ EventQueue.invokeLater(new Runnable() {
+ @Override
+ public void run() {
+ updatePanel();
+ }
+ });
+ }
+ }
}
From d9e97d1b94c0ba514621f5e6ec42307ab216c53c Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Wed, 8 Nov 2017 12:08:52 -0500
Subject: [PATCH 13/51] Finished encase hash set importing
---
.../HashDbImportDatabaseDialog.java | 4 +--
.../ImportCentralRepoDbProgressDialog.java | 30 ++++++++++++++++---
2 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java
index 66037cccf9..92e662f43e 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbImportDatabaseDialog.java
@@ -90,11 +90,11 @@ final class HashDbImportDatabaseDialog extends javax.swing.JDialog {
fileChooser.setMultiSelectionEnabled(false);
}
- @NbBundle.Messages({"HashDbImportDatabaseDialog.centralRepoExtFilter.text=Hash Database File (.idx only)"})
+ @NbBundle.Messages({"HashDbImportDatabaseDialog.centralRepoExtFilter.text=Hash Database File (.idx or .hash only)"})
private void updateFileChooserFilter() {
fileChooser.resetChoosableFileFilters();
if(centralRepoRadioButton.isSelected()){
- String[] EXTENSION = new String[]{"idx"}; //NON-NLS
+ String[] EXTENSION = new String[]{"hash", "Hash", "idx"}; //NON-NLS
FileNameExtensionFilter filter = new FileNameExtensionFilter(
NbBundle.getMessage(this.getClass(), "HashDbImportDatabaseDialog.centralRepoExtFilter.text"), EXTENSION);
fileChooser.setFileFilter(filter);
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
index 969e84b0b8..8f83a5e3b4 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
@@ -18,6 +18,7 @@
*/
package org.sleuthkit.autopsy.modules.hashdatabase;
+import java.awt.Color;
import java.awt.Cursor;
import java.beans.PropertyChangeListener;
import java.beans.PropertyChangeEvent;
@@ -84,10 +85,10 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
File importFile = new File(importFileName);
- if(importFileName.endsWith(".idx")){ // < need case insensitive
+ if(importFileName.toLowerCase().endsWith(".idx")){
worker = new ImportIDXWorker(hashSetName, version, orgId, searchDuringIngest, sendIngestMessages,
knownFilesType, readOnly, importFile);
- } else if(importFileName.endsWith(".hash")){ // < need case insensitive
+ } else if(importFileName.toLowerCase().endsWith(".hash")){
worker = new ImportEncaseWorker(hashSetName, version, orgId, searchDuringIngest, sendIngestMessages,
knownFilesType, readOnly, importFile);
} else {
@@ -123,8 +124,14 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
bnCancel.setEnabled(false);
bnOk.setEnabled(true);
- progressBar.setValue(progressBar.getMaximum());
- lbProgress.setText(getProgressString());
+ if(worker.getError().isEmpty()){
+ progressBar.setValue(progressBar.getMaximum());
+ lbProgress.setText(getProgressString());
+ } else {
+ progressBar.setValue(0);
+ lbProgress.setForeground(Color.red);
+ lbProgress.setText(worker.getError());
+ }
}
}
@@ -140,6 +147,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
int getProgressPercentage();
long getLinesProcessed();
HashDbManager.HashDatabase getDatabase();
+ String getError();
}
class ImportEncaseWorker extends SwingWorker implements CentralRepoImportWorker{
@@ -156,6 +164,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
private int crIndex = -1;
private HashDbManager.CentralRepoHashDb newHashDb = null;
private final AtomicLong numLines = new AtomicLong();
+ private String errorString = "";
ImportEncaseWorker(String hashSetName, String version, int orgId,
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
@@ -201,6 +210,11 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
return this.getProgress();
}
+ @Override
+ public String getError(){
+ return errorString;
+ }
+
@Override
protected Void doInBackground() throws Exception {
@@ -274,6 +288,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
}
}
+ @NbBundle.Messages({"ImportCentralRepoDbProgressDialog.importError=Error importing hash set"})
@Override
protected void done() {
@@ -302,6 +317,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex);
}
}
+ errorString = Bundle.ImportCentralRepoDbProgressDialog_importError();
}
}
}
@@ -321,6 +337,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
private int crIndex = -1;
private HashDbManager.CentralRepoHashDb newHashDb = null;
private final AtomicLong numLines = new AtomicLong();
+ private String errorString = "";
ImportIDXWorker(String hashSetName, String version, int orgId,
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
@@ -365,6 +382,11 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
return this.getProgress();
}
+ @Override
+ public String getError(){
+ return errorString;
+ }
+
@Override
protected Void doInBackground() throws Exception {
From feb12e304b2a7e15a6467d0db75f6220fb51e3ed Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Wed, 8 Nov 2017 17:18:22 -0500
Subject: [PATCH 14/51] 3201 fix title for Edit Tag dialog
---
.../casemodule/services/Bundle.properties | 10 +++++-----
.../casemodule/services/TagNameDialog.java | 20 +++++++++----------
2 files changed, 15 insertions(+), 15 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
index 74938a677a..4cca7e78d6 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/Bundle.properties
@@ -1,11 +1,11 @@
OptionsCategory_Name_TagNamesOptions=Tags
OptionsCategory_TagNames=TagNames
Blackboard.unableToIndexArtifact.error.msg=Unable to index blackboard artifact {0}
-NewTagNameDialog.title.text=New Tag
-NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message=Tag name may not contain any of the following symbols\: \\ \: * ? " < > | , ;
-NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in tag name
-NewTagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty
-NewTagNameDialog.JOptionPane.tagNameEmpty.title=Empty tag name
+TagNameDialog.title.text=New Tag
+TagNameDialog.JOptionPane.tagNameIllegalCharacters.message=Tag name may not contain any of the following symbols\: \\ \: * ? " < > | , ;
+TagNameDialog.JOptionPane.tagNameIllegalCharacters.title=Invalid character in tag name
+TagNameDialog.JOptionPane.tagNameEmpty.message=The tag name cannot be empty
+TagNameDialog.JOptionPane.tagNameEmpty.title=Empty tag name
TagOptionsPanel.tagTypesListLabel.text=Tag Names:
TagOptionsPanel.deleteTagNameButton.text=Delete Tag
TagOptionsPanel.newTagNameButton.text=New Tag
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
index e79004af6e..e310c066e5 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
@@ -19,7 +19,6 @@
package org.sleuthkit.autopsy.casemodule.services;
import java.awt.BorderLayout;
-import java.awt.Color;
import java.awt.Dimension;
import java.awt.Toolkit;
import java.awt.event.WindowAdapter;
@@ -29,7 +28,7 @@ import javax.swing.JOptionPane;
import javax.swing.event.DocumentEvent;
import javax.swing.event.DocumentListener;
import org.openide.util.NbBundle;
-import org.sleuthkit.datamodel.TskData;
+import org.openide.util.NbBundle.Messages;
final class TagNameDialog extends javax.swing.JDialog {
@@ -47,15 +46,16 @@ final class TagNameDialog extends javax.swing.JDialog {
* Creates a new NewUserTagNameDialog dialog.
*/
TagNameDialog() {
- super(new JFrame(NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.title.text")),
- NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.title.text"), true);
+ super(new JFrame(NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.title.text")),
+ NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.title.text"), true);
initComponents();
this.display();
}
+ @Messages({"TagNameDialog.editTitle.text=Edit Tag"})
TagNameDialog(TagNameDefinition tagNameToEdit) {
- super(new JFrame("Edit 1"),
- "Edit 2", true);
+ super(new JFrame(NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.editTitle.text")),
+ NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.editTitle.text"), true);
initComponents();
tagNameTextField.setText(tagNameToEdit.getDisplayName());
descriptionTextArea.setText(tagNameToEdit.getDescription());
@@ -131,8 +131,8 @@ final class TagNameDialog extends javax.swing.JDialog {
String newTagDisplayName = tagNameTextField.getText().trim();
if (newTagDisplayName.isEmpty()) {
JOptionPane.showMessageDialog(null,
- NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.message"),
- NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameEmpty.title"),
+ NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameEmpty.message"),
+ NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameEmpty.title"),
JOptionPane.ERROR_MESSAGE);
return;
}
@@ -140,8 +140,8 @@ final class TagNameDialog extends javax.swing.JDialog {
//if a tag name contains illegal characters and is not the name of one of the standard tags
if (TagsManager.containsIllegalCharacters(newTagDisplayName) && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(newTagDisplayName)) {
JOptionPane.showMessageDialog(null,
- NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
- NbBundle.getMessage(TagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
+ NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
+ NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
JOptionPane.ERROR_MESSAGE);
return;
}
From 7a3b009747822fcb525095b764ef688393ac6d0f Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Thu, 9 Nov 2017 07:40:28 -0500
Subject: [PATCH 15/51] Refactoring
---
.../ImportCentralRepoDbProgressDialog.java | 49 +++++++++++++++++++
1 file changed, 49 insertions(+)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
index 8f83a5e3b4..ef81083e40 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
@@ -139,6 +139,55 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
return worker.getLinesProcessed() + Bundle.ImportCentralRepoDbProgressDialog_linesProcessed();
}
+ abstract class CentralRepoImportWorker2 extends SwingWorker{
+ private final int HASH_IMPORT_THRESHOLD = 10000;
+ private final String hashSetName;
+ private final String version;
+ private final int orgId;
+ private final boolean searchDuringIngest;
+ private final boolean sendIngestMessages;
+ private final HashDbManager.HashDb.KnownFilesType knownFilesType;
+ private final boolean readOnly;
+ private final File importFile;
+ private long totalLines;
+ private int crIndex = -1;
+ private HashDbManager.CentralRepoHashDb newHashDb = null;
+ private final AtomicLong numLines = new AtomicLong();
+ private String errorString = "";
+
+ CentralRepoImportWorker2(String hashSetName, String version, int orgId,
+ boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
+ boolean readOnly, File importFile){
+
+ this.hashSetName = hashSetName;
+ this.version = version;
+ this.orgId = orgId;
+ this.searchDuringIngest = searchDuringIngest;
+ this.sendIngestMessages = sendIngestMessages;
+ this.knownFilesType = knownFilesType;
+ this.readOnly = readOnly;
+ this.importFile = importFile;
+ this.numLines.set(0);
+ }
+
+ HashDbManager.HashDatabase getDatabase(){
+ return newHashDb;
+ }
+
+ long getLinesProcessed(){
+ return numLines.get();
+ }
+
+ int getProgressPercentage(){
+ return this.getProgress();
+ }
+
+ String getError(){
+ return errorString;
+ }
+
+ }
+
private interface CentralRepoImportWorker{
void execute();
From 4b6a9cb4a024f50621bb012f202500b0696e7cba Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Thu, 9 Nov 2017 08:09:16 -0500
Subject: [PATCH 16/51] Refactored the database import workers
---
.../ImportCentralRepoDbProgressDialog.java | 324 +++++-------------
1 file changed, 92 insertions(+), 232 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
index 0389cd3460..281583a4bf 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/ImportCentralRepoDbProgressDialog.java
@@ -111,7 +111,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
return null;
}
- @NbBundle.Messages({"ImportCentralRepoDbProgressDialog.linesProcessed= lines processed"})
+ @NbBundle.Messages({"ImportCentralRepoDbProgressDialog.linesProcessed= hashes processed"})
@Override
public void propertyChange(PropertyChangeEvent evt) {
@@ -139,23 +139,23 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
return worker.getLinesProcessed() + Bundle.ImportCentralRepoDbProgressDialog_linesProcessed();
}
- abstract class CentralRepoImportWorker2 extends SwingWorker{
- private final int HASH_IMPORT_THRESHOLD = 10000;
- private final String hashSetName;
- private final String version;
- private final int orgId;
- private final boolean searchDuringIngest;
- private final boolean sendIngestMessages;
- private final HashDbManager.HashDb.KnownFilesType knownFilesType;
- private final boolean readOnly;
- private final File importFile;
- private long totalLines;
- private int crIndex = -1;
- private HashDbManager.CentralRepoHashDb newHashDb = null;
- private final AtomicLong numLines = new AtomicLong();
- private String errorString = "";
+ abstract class CentralRepoImportWorker extends SwingWorker{
+ final int HASH_IMPORT_THRESHOLD = 10000;
+ final String hashSetName;
+ final String version;
+ final int orgId;
+ final boolean searchDuringIngest;
+ final boolean sendIngestMessages;
+ final HashDbManager.HashDb.KnownFilesType knownFilesType;
+ final boolean readOnly;
+ final File importFile;
+ long totalHashes = 1;
+ int referenceSetID = -1;
+ HashDbManager.CentralRepoHashDb newHashDb = null;
+ final AtomicLong numLines = new AtomicLong();
+ String errorString = "";
- CentralRepoImportWorker2(String hashSetName, String version, int orgId,
+ CentralRepoImportWorker(String hashSetName, String version, int orgId,
boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
boolean readOnly, File importFile){
@@ -186,88 +186,88 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
return errorString;
}
- }
-
- private interface CentralRepoImportWorker{
+ /**
+ * Should be called in the constructor to set the max number of hashes.
+ * The value can be updated later after parsing the import file.
+ */
+ abstract void setEstimatedTotalHashes();
- void execute();
- boolean cancel(boolean mayInterruptIfRunning);
- void addPropertyChangeListener(PropertyChangeListener dialog);
- int getProgressPercentage();
- long getLinesProcessed();
- HashDbManager.HashDatabase getDatabase();
- String getError();
+ void deleteIncompleteSet(){
+ if(referenceSetID >= 0){
+
+ // This can be slow on large reference sets
+ Executors.newSingleThreadExecutor().execute(new Runnable() {
+ @Override
+ public void run() {
+ try{
+ EamDb.getInstance().deleteReferenceSet(referenceSetID);
+ } catch (EamDbException ex2){
+ Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex2);
+ }
+ }
+ });
+ }
+ }
+
+ @NbBundle.Messages({"ImportCentralRepoDbProgressDialog.importHashsetError=Error importing hash set",
+ "ImportCentralRepoDbProgressDialog.addDbError.message=Error adding new hash set"})
+ @Override
+ protected void done() {
+
+ if(isCancelled()){
+ // If the user hit cancel, delete this incomplete hash set from the central repo
+ deleteIncompleteSet();
+ return;
+ }
+
+ try {
+ get();
+ try{
+ newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetName, version,
+ referenceSetID,
+ searchDuringIngest, sendIngestMessages, knownFilesType, readOnly);
+ } catch (TskCoreException ex){
+ JOptionPane.showMessageDialog(null, Bundle.ImportCentralRepoDbProgressDialog_addDbError_message());
+ Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error adding imported hash set", ex);
+ }
+ } catch (Exception ex) {
+ // Delete this incomplete hash set from the central repo
+ deleteIncompleteSet();
+ errorString = Bundle.ImportCentralRepoDbProgressDialog_importHashsetError();
+ }
+ }
+
}
- class ImportEncaseWorker extends SwingWorker implements CentralRepoImportWorker{
- private final int HASH_IMPORT_THRESHOLD = 10000;
- private final String hashSetName;
- private final String version;
- private final int orgId;
- private final boolean searchDuringIngest;
- private final boolean sendIngestMessages;
- private final HashDbManager.HashDb.KnownFilesType knownFilesType;
- private final boolean readOnly;
- private final File importFile;
- private final long totalLines;
- private int crIndex = -1;
- private HashDbManager.CentralRepoHashDb newHashDb = null;
- private final AtomicLong numLines = new AtomicLong();
- private String errorString = "";
+ class ImportEncaseWorker extends CentralRepoImportWorker{
ImportEncaseWorker(String hashSetName, String version, int orgId,
- boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
- boolean readOnly, File importFile){
+ boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
+ boolean readOnly, File importFile){
+ super(hashSetName, version, orgId, searchDuringIngest, sendIngestMessages, knownFilesType, readOnly, importFile);
- this.hashSetName = hashSetName;
- this.version = version;
- this.orgId = orgId;
- this.searchDuringIngest = searchDuringIngest;
- this.sendIngestMessages = sendIngestMessages;
- this.knownFilesType = knownFilesType;
- this.readOnly = readOnly;
- this.importFile = importFile;
- this.numLines.set(0);
-
- this.totalLines = getEstimatedTotalHashes();
+ setEstimatedTotalHashes();
}
+
/**
* Encase files have a 0x480 byte header, then each hash takes 18 bytes
* @return Approximate number of hashes in the file
*/
- final long getEstimatedTotalHashes(){
+ @Override
+ final void setEstimatedTotalHashes(){
long fileSize = importFile.length();
if(fileSize < 0x492){
- return 1; // There's room for at most one hash
+ totalHashes = 1; // There's room for at most one hash
}
- return ((fileSize - 0x492) / 18);
- }
-
- @Override
- public HashDbManager.HashDatabase getDatabase(){
- return newHashDb;
- }
-
- @Override
- public long getLinesProcessed(){
- return numLines.get();
- }
-
- @Override
- public int getProgressPercentage(){
- return this.getProgress();
- }
-
- @Override
- public String getError(){
- return errorString;
+ totalHashes = (fileSize - 0x492) / 18;
}
@Override
protected Void doInBackground() throws Exception {
- EncaseHashSetParser encaseParser = new EncaseHashSetParser(this.importFile.getAbsolutePath());
+ EncaseHashSetParser encaseParser = new EncaseHashSetParser(importFile.getAbsolutePath());
+ totalHashes = encaseParser.getExpectedHashes();
TskData.FileKnown knownStatus;
if (knownFilesType.equals(HashDbManager.HashDb.KnownFilesType.KNOWN)) {
@@ -277,7 +277,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
}
// Create an empty hashset in the central repository
- crIndex = EamDb.getInstance().newReferenceSet(orgId, hashSetName, version, knownStatus, readOnly);
+ referenceSetID = EamDb.getInstance().newReferenceSet(orgId, hashSetName, version, knownStatus, readOnly);
EamDb dbManager = EamDb.getInstance();
CorrelationAttribute.Type contentType = dbManager.getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID); // get "FILES" type
@@ -293,7 +293,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
if(newHash != null){
EamGlobalFileInstance eamGlobalFileInstance = new EamGlobalFileInstance(
- crIndex,
+ referenceSetID,
newHash,
knownStatus,
"");
@@ -305,7 +305,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
dbManager.bulkInsertReferenceTypeEntries(globalInstances, contentType);
globalInstances.clear();
- int progress = (int)(numLines.get() * 100 / totalLines);
+ int progress = (int)(numLines.get() * 100 / totalHashes);
if(progress < 100){
this.setProgress(progress);
} else {
@@ -319,90 +319,17 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
this.setProgress(100);
return null;
}
-
- private void deleteIncompleteSet(int crIndex){
- if(crIndex >= 0){
-
- // This can be slow on large reference sets
- Executors.newSingleThreadExecutor().execute(new Runnable() {
- @Override
- public void run() {
- try{
- EamDb.getInstance().deleteReferenceSet(crIndex);
- } catch (EamDbException ex2){
- Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex2);
- }
- }
- });
- }
- }
-
- @NbBundle.Messages({"ImportCentralRepoDbProgressDialog.importError=Error importing hash set"})
- @Override
- protected void done() {
-
- if(isCancelled()){
- // If the user hit cancel, delete this incomplete hash set from the central repo
- deleteIncompleteSet(crIndex);
- return;
- }
-
- try {
- get();
- try{
- newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetName, version,
- crIndex,
- searchDuringIngest, sendIngestMessages, knownFilesType, readOnly);
- } catch (TskCoreException ex){
- JOptionPane.showMessageDialog(null, Bundle.ImportCentralRepoDbProgressDialog_addDbError_message());
- Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error adding imported hash set", ex);
- }
- } catch (Exception ex) {
- // Delete this incomplete hash set from the central repo
- if(crIndex >= 0){
- try{
- EamDb.getInstance().deleteReferenceSet(crIndex);
- } catch (EamDbException ex2){
- Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex);
- }
- }
- errorString = Bundle.ImportCentralRepoDbProgressDialog_importError();
- }
- }
}
- class ImportIDXWorker extends SwingWorker implements CentralRepoImportWorker{
-
- private final int HASH_IMPORT_THRESHOLD = 10000;
- private final String hashSetName;
- private final String version;
- private final int orgId;
- private final boolean searchDuringIngest;
- private final boolean sendIngestMessages;
- private final HashDbManager.HashDb.KnownFilesType knownFilesType;
- private final boolean readOnly;
- private final File importFile;
- private final long totalLines;
- private int referenceSetID = -1;
- private HashDbManager.CentralRepoHashDb newHashDb = null;
- private final AtomicLong numLines = new AtomicLong();
- private String errorString = "";
+
+ class ImportIDXWorker extends CentralRepoImportWorker{
ImportIDXWorker(String hashSetName, String version, int orgId,
- boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
- boolean readOnly, File importFile){
+ boolean searchDuringIngest, boolean sendIngestMessages, HashDbManager.HashDb.KnownFilesType knownFilesType,
+ boolean readOnly, File importFile){
+ super(hashSetName, version, orgId, searchDuringIngest, sendIngestMessages, knownFilesType, readOnly, importFile);
- this.hashSetName = hashSetName;
- this.version = version;
- this.orgId = orgId;
- this.searchDuringIngest = searchDuringIngest;
- this.sendIngestMessages = sendIngestMessages;
- this.knownFilesType = knownFilesType;
- this.readOnly = readOnly;
- this.importFile = importFile;
- this.numLines.set(0);
-
- this.totalLines = getEstimatedTotalHashes();
+ setEstimatedTotalHashes();
}
/**
@@ -411,29 +338,10 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
* progress bar.
* @return Approximate number of hashes in the file
*/
- final long getEstimatedTotalHashes(){
+ @Override
+ final void setEstimatedTotalHashes(){
long fileSize = importFile.length();
- return (fileSize / 0x33 + 1); // IDX file lines are generally 0x33 bytes long, and we don't want this to be zero
- }
-
- @Override
- public HashDbManager.HashDatabase getDatabase(){
- return newHashDb;
- }
-
- @Override
- public long getLinesProcessed(){
- return numLines.get();
- }
-
- @Override
- public int getProgressPercentage(){
- return this.getProgress();
- }
-
- @Override
- public String getError(){
- return errorString;
+ totalHashes = fileSize / 0x33 + 1; // IDX file lines are generally 0x33 bytes long, and we don't want this to be zero
}
@Override
@@ -480,7 +388,7 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
dbManager.bulkInsertReferenceTypeEntries(globalInstances, contentType);
globalInstances.clear();
- int progress = (int)(numLines.get() * 100 / totalLines);
+ int progress = (int)(numLines.get() * 100 / totalHashes);
if(progress < 100){
this.setProgress(progress);
} else {
@@ -494,54 +402,6 @@ class ImportCentralRepoDbProgressDialog extends javax.swing.JDialog implements P
return null;
}
-
- private void deleteIncompleteSet(int idToDelete){
- if(idToDelete >= 0){
-
- // This can be slow on large reference sets
- Executors.newSingleThreadExecutor().execute(new Runnable() {
- @Override
- public void run() {
- try{
- EamDb.getInstance().deleteReferenceSet(idToDelete);
- } catch (EamDbException ex2){
- Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex2);
- }
- }
- });
- }
- }
-
- @NbBundle.Messages({"ImportCentralRepoDbProgressDialog.addDbError.message=Error adding new hash set"})
- @Override
- protected void done() {
- if(isCancelled()){
- // If the user hit cancel, delete this incomplete hash set from the central repo
- deleteIncompleteSet(referenceSetID);
- return;
- }
-
- try {
- get();
- try{
- newHashDb = HashDbManager.getInstance().addExistingCentralRepoHashSet(hashSetName, version,
- referenceSetID,
- searchDuringIngest, sendIngestMessages, knownFilesType, readOnly);
- } catch (TskCoreException ex){
- JOptionPane.showMessageDialog(null, Bundle.ImportCentralRepoDbProgressDialog_addDbError_message());
- Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error adding imported hash set", ex);
- }
- } catch (Exception ex) {
- // Delete this incomplete hash set from the central repo
- if(referenceSetID >= 0){
- try{
- EamDb.getInstance().deleteReferenceSet(referenceSetID);
- } catch (EamDbException ex2){
- Logger.getLogger(ImportCentralRepoDbProgressDialog.class.getName()).log(Level.SEVERE, "Error deleting incomplete hash set from central repository", ex);
- }
- }
- }
- }
}
/**
From c29d90720869852377794d128c51470c1e692859 Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Thu, 9 Nov 2017 15:37:14 -0500
Subject: [PATCH 17/51] Cleanup
---
.../sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java | 4 ++--
.../autopsy/modules/hashdatabase/HashLookupSettingsPanel.java | 4 ++--
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
index 21f6fb9e40..cd0b1339b7 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
@@ -1325,7 +1325,7 @@ public class HashDbManager implements PropertyChangeListener {
} else {
type = TskData.FileKnown.KNOWN;
}
- EamGlobalFileInstance fileInstance = new EamGlobalFileInstance(centralRepoIndex, file.getMd5Hash(),
+ EamGlobalFileInstance fileInstance = new EamGlobalFileInstance(referenceSetID, file.getMd5Hash(),
type, comment);
try{
EamDb.getInstance().addReferenceInstance(fileInstance,EamDb.getInstance().getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID));
@@ -1353,7 +1353,7 @@ public class HashDbManager implements PropertyChangeListener {
} else {
type = TskData.FileKnown.KNOWN;
}
- globalFileInstances.add(new EamGlobalFileInstance(centralRepoIndex, hashEntry.getMd5Hash(), type, hashEntry.getComment()));
+ globalFileInstances.add(new EamGlobalFileInstance(referenceSetID, hashEntry.getMd5Hash(), type, hashEntry.getComment()));
}
try{
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java
index 7629a084fa..0a299a6e87 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupSettingsPanel.java
@@ -922,8 +922,8 @@ public final class HashLookupSettingsPanel extends IngestModuleGlobalSettingsPan
HashDatabase hashDb = new HashDbCreateDatabaseDialog().getHashDatabase();
if (null != hashDb) {
if(hashDb instanceof CentralRepoHashDb){
- int newDbIndex = ((CentralRepoHashDb)hashDb).getCentralRepoIndex();
- newCentralRepoIndices.add(newDbIndex);
+ int newDbIndex = ((CentralRepoHashDb)hashDb).getReferenceSetID();
+ newReferenceSetIDs.add(newDbIndex);
}
hashSetTableModel.refreshModel();
From e1770f5fdfefb9c8549230cef48010c3a7363bfb Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Thu, 9 Nov 2017 16:53:29 -0500
Subject: [PATCH 18/51] 3198 change storage of knownStatus for
TagNameDefinition from String to enum
---
.../casemodule/services/TagNameDefiniton.java | 22 +++++++++----------
.../casemodule/services/TagOptionsPanel.java | 3 ++-
.../casemodule/services/TagsManager.java | 11 +++++-----
3 files changed, 19 insertions(+), 17 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index 171d673cb6..e4987fb207 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -27,6 +27,7 @@ import java.util.Set;
import javax.annotation.concurrent.Immutable;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.TagName;
+import org.sleuthkit.datamodel.TskData;
/**
* A tag name definition consisting of a display name, description and color.
@@ -36,13 +37,12 @@ final class TagNameDefiniton implements Comparable {
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
- private static final String DEFAULT_BAD_TAGS = "Evidence,Notable Item,"
+ private static final String STANDARD_NOTABLE_TAG_DISPLAY_NAMES = "Evidence,Notable Item,"
+ "CAT-1: Child Exploitation (Illegal),CAT-2: Child Exploitation (Non-Illegal/Age Difficult),CAT-3: Child Exploitive"; // NON-NLS
- static final String NOTABLE = "(Notable)";
private final String displayName;
private final String description;
private final TagName.HTML_COLOR color;
- private final String knownStatusDenoted;
+ private final TskData.FileKnown knownStatusDenoted;
/**
* Constructs a tag name definition consisting of a display name,
@@ -52,11 +52,11 @@ final class TagNameDefiniton implements Comparable {
* @param description The description for the tag name.
* @param color The color for the tag name.
*/
- TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, String notable) {
+ TagNameDefiniton(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) {
this.displayName = displayName;
this.description = description;
this.color = color;
- this.knownStatusDenoted = notable;
+ this.knownStatusDenoted = status;
}
/**
@@ -90,7 +90,7 @@ final class TagNameDefiniton implements Comparable {
*
*/
boolean isNotable(){
- return knownStatusDenoted.equals(NOTABLE);
+ return knownStatusDenoted == TskData.FileKnown.BAD;
}
/**
* Compares this tag name definition with the specified tag name definition
@@ -152,7 +152,7 @@ final class TagNameDefiniton implements Comparable {
* that is used by the tags settings file.
*/
private String toSettingsFormat() {
- return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted;
+ return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted.toString();
}
/**
@@ -172,7 +172,7 @@ final class TagNameDefiniton implements Comparable {
if (badTags == null) {
String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
if (badTagsStr == null) {
- badTagsStr = DEFAULT_BAD_TAGS;
+ badTagsStr = STANDARD_NOTABLE_TAG_DISPLAY_NAMES;
}
if (badTagsStr.isEmpty()) {
badTags = new ArrayList<>();
@@ -181,12 +181,12 @@ final class TagNameDefiniton implements Comparable {
}
}
if (badTags.contains(tagNameAttributes[0])) {
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), NOTABLE));
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.BAD));
} else {
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), "")); //add the default value for that tag
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.UNKNOWN)); //add the default value for that tag
}
} else if (tagNameAttributes.length == 4) {
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), tagNameAttributes[3]));
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.valueOf(tagNameAttributes[3])));
}
}
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
index 8fc6a5ff4d..681cc95472 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
@@ -27,6 +27,7 @@ import org.netbeans.spi.options.OptionsPanelController;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.corecomponents.OptionsPanel;
import org.sleuthkit.datamodel.TagName;
+import org.sleuthkit.datamodel.TskData;
/**
* A panel to allow the user to create and delete custom tag types.
@@ -190,7 +191,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
NewTagNameDialog.BUTTON_PRESSED result = dialog.getResult();
if (result == NewTagNameDialog.BUTTON_PRESSED.OK) {
String newTagDisplayName = dialog.getTagName();
- TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR, "");
+ TagNameDefiniton newTagType = new TagNameDefiniton(newTagDisplayName, DEFAULT_DESCRIPTION, DEFAULT_COLOR, TskData.FileKnown.UNKNOWN);
/*
* If tag name already exists, don't add the tag name.
*/
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index f66b195073..8c87475785 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -38,6 +38,7 @@ import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
+import org.sleuthkit.datamodel.TskData;
/**
* A per case Autopsy service that manages the addition of content and artifact
@@ -198,7 +199,7 @@ public class TagsManager implements Closeable {
* name to the case database.
*/
public synchronized TagName addTagName(String displayName) throws TagNameAlreadyExistsException, TskCoreException {
- return addTagName(displayName, "", TagName.HTML_COLOR.NONE, "");
+ return addTagName(displayName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN);
}
/**
@@ -217,7 +218,7 @@ public class TagsManager implements Closeable {
* name to the case database.
*/
public synchronized TagName addTagName(String displayName, String description) throws TagNameAlreadyExistsException, TskCoreException {
- return addTagName(displayName, description, TagName.HTML_COLOR.NONE, "");
+ return addTagName(displayName, description, TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN);
}
/**
@@ -236,9 +237,9 @@ public class TagsManager implements Closeable {
* name to the case database.
*/
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException {
- String knownStatus = "";
+ TskData.FileKnown knownStatus = TskData.FileKnown.UNKNOWN;
if (getNotableTagDisplayNames().contains(displayName)) {
- knownStatus = TagNameDefiniton.NOTABLE;
+ knownStatus = TskData.FileKnown.BAD;
}
return addTagName(displayName, description, color, knownStatus);
}
@@ -260,7 +261,7 @@ public class TagsManager implements Closeable {
* @throws TskCoreException If there is an error adding the tag
* name to the case database.
*/
- public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, String knownStatus) throws TagNameAlreadyExistsException, TskCoreException {
+ public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException {
try {
TagName tagName = caseDb.addTagName(displayName, description, color);
if (!STANDARD_TAG_DISPLAY_NAMES.contains(displayName)) {
From 1a63dc413c5d233712b5fc5b645ef4e6c51385aa Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 10 Nov 2017 09:46:47 -0500
Subject: [PATCH 19/51] 3201 attribute storing knownStatus for TagName renamed
to knownStatus
---
.../casemodule/services/TagNameDefinition.java | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
index 7dd4b5309a..b24913b4e0 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
@@ -46,7 +46,7 @@ final class TagNameDefinition implements Comparable {
private final String displayName;
private final String description;
private final TagName.HTML_COLOR color;
- private final TskData.FileKnown knownStatusDenoted;
+ private final TskData.FileKnown knownStatus;
/**
* Constructs a tag name definition consisting of a display name,
@@ -55,14 +55,14 @@ final class TagNameDefinition implements Comparable {
* @param displayName The display name for the tag name.
* @param description The description for the tag name.
* @param color The color for the tag name.
- * @param knownStatus The status denoted by the tag.
+ * @param knownStatus The status denoted by the tag name.
*/
TagNameDefinition(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown status) {
this.displayName = displayName;
this.description = description;
this.color = color;
- this.knownStatusDenoted = status;
+ this.knownStatus = status;
}
/**
@@ -93,13 +93,13 @@ final class TagNameDefinition implements Comparable {
}
/**
- * Whether or not the status that this tag implies is the Notable status
+ * Whether or not the status that this tag implies Notable status
*
* @return true if the Notable status is implied by this tag, false
* otherwise.
*/
boolean isNotable() {
- return knownStatusDenoted == TskData.FileKnown.BAD;
+ return knownStatus == TskData.FileKnown.BAD;
}
/**
@@ -162,7 +162,7 @@ final class TagNameDefinition implements Comparable {
* that is used by the tags settings file.
*/
private String toSettingsFormat() {
- return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted.toString();
+ return displayName + "," + description + "," + color.name() + "," + knownStatus.toString();
}
/**
From 1b272cf18c14fad285e53fb1bb9519c3fdb4837d Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Tue, 14 Nov 2017 09:26:10 -0500
Subject: [PATCH 20/51] Only display valid hash sets in the ingest module
settings
---
.../HashLookupModuleSettingsPanel.java | 22 +++++++++++++++----
1 file changed, 18 insertions(+), 4 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.java
index c6d3e109fe..d3bfb915d4 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashLookupModuleSettingsPanel.java
@@ -58,8 +58,8 @@ public final class HashLookupModuleSettingsPanel extends IngestModuleIngestJobSe
} catch (TskCoreException ex){
Logger.getLogger(HashLookupModuleSettingsPanel.class.getName()).log(Level.SEVERE, "Error updating central repository hash sets", ex); //NON-NLS
}
- initializeHashSetModels(settings, hashDbManager.getKnownFileHashSets(), knownHashSetModels);
- initializeHashSetModels(settings, hashDbManager.getKnownBadFileHashSets(), knownBadHashSetModels);
+ initializeHashSetModels(settings, validSetsOnly(hashDbManager.getKnownFileHashSets()), knownHashSetModels);
+ initializeHashSetModels(settings, validSetsOnly(hashDbManager.getKnownBadFileHashSets()), knownBadHashSetModels);
}
private void initializeHashSetModels(HashLookupModuleSettings settings, List hashDbs, List hashSetModels) {
@@ -130,8 +130,22 @@ public final class HashLookupModuleSettingsPanel extends IngestModuleIngestJobSe
}
private void updateHashSetModels() {
- updateHashSetModels(hashDbManager.getKnownFileHashSets(), knownHashSetModels);
- updateHashSetModels(hashDbManager.getKnownBadFileHashSets(), knownBadHashSetModels);
+ updateHashSetModels(validSetsOnly(hashDbManager.getKnownFileHashSets()), knownHashSetModels);
+ updateHashSetModels(validSetsOnly(hashDbManager.getKnownBadFileHashSets()), knownBadHashSetModels);
+ }
+
+ private List validSetsOnly(List hashDbs){
+ List validDbs = new ArrayList<>();
+ for(HashDb db:hashDbs){
+ try{
+ if(db.isValid()){
+ validDbs.add(db);
+ }
+ } catch (TskCoreException ex){
+ Logger.getLogger(HashLookupModuleSettingsPanel.class.getName()).log(Level.SEVERE, "Error checking validity for hash set (name = " + db.getHashSetName() + ")", ex); //NON-NLS
+ }
+ }
+ return validDbs;
}
void updateHashSetModels(List hashDbs, List hashSetModels) {
From c2d0bbb932a44167a84d4f1fa0560f1fa2f1827b Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Wed, 15 Nov 2017 11:59:10 -0500
Subject: [PATCH 21/51] 3198 comment getTagNameDefinitions
---
.../casemodule/services/TagNameDefiniton.java | 28 +++++++++----------
.../casemodule/services/TagsManager.java | 9 ++----
2 files changed, 16 insertions(+), 21 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index e4987fb207..d435f2a452 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -85,13 +85,14 @@ final class TagNameDefiniton implements Comparable {
TagName.HTML_COLOR getColor() {
return color;
}
-
+
/**
- *
+ *
*/
- boolean isNotable(){
+ boolean isNotable() {
return knownStatusDenoted == TskData.FileKnown.BAD;
}
+
/**
* Compares this tag name definition with the specified tag name definition
* for order.
@@ -164,28 +165,28 @@ final class TagNameDefiniton implements Comparable {
Set tagNames = new HashSet<>();
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
if (null != setting && !setting.isEmpty()) {
- List badTags = null;
+ List notableTags = null;
List tagNameTuples = Arrays.asList(setting.split(";"));
for (String tagNameTuple : tagNameTuples) {
String[] tagNameAttributes = tagNameTuple.split(",");
- if (tagNameAttributes.length == 3) {
- if (badTags == null) {
+ if (tagNameAttributes.length == 3) { //Upgrade case Tags.properties does not contain any tag definitions with knownStatus
+ if (notableTags == null) {
String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
- if (badTagsStr == null) {
+ if (badTagsStr == null) { //if a badtags list could not be read from a central repository properties file use the defualt bad tags
badTagsStr = STANDARD_NOTABLE_TAG_DISPLAY_NAMES;
}
- if (badTagsStr.isEmpty()) {
- badTags = new ArrayList<>();
+ if (badTagsStr.isEmpty()) { //if a badtags list is empty the user has saved all tags as non-notable so we will have all tags non-notable
+ notableTags = new ArrayList<>();
} else {
- badTags = new ArrayList<>(Arrays.asList(badTagsStr.split(",")));
+ notableTags = new ArrayList<>(Arrays.asList(badTagsStr.split(","))); //if the badtags list was present and had contents use the contents as the current notable tags list
}
}
- if (badTags.contains(tagNameAttributes[0])) {
+ if (notableTags.contains(tagNameAttributes[0])) { //if the name attribute is in the notable tags list add the tag as a notable tag
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.BAD));
- } else {
+ } else { //otherwise add the tag as a default knownStatus tag
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.UNKNOWN)); //add the default value for that tag
}
- } else if (tagNameAttributes.length == 4) {
+ } else if (tagNameAttributes.length == 4) { //if there are 4 attributes its a current list we can use the values present
tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.valueOf(tagNameAttributes[3])));
}
@@ -194,7 +195,6 @@ final class TagNameDefiniton implements Comparable {
return tagNames;
}
-
/**
* Sets the tag name definitions in the tag settings file.
*
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index 8c87475785..58068b27b3 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -119,8 +119,7 @@ public class TagsManager implements Closeable {
*
* @param caseDb The case database.
*/
- TagsManager(SleuthkitCase caseDb
- ) {
+ TagsManager(SleuthkitCase caseDb) {
this.caseDb = caseDb;
}
@@ -237,11 +236,7 @@ public class TagsManager implements Closeable {
* name to the case database.
*/
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException {
- TskData.FileKnown knownStatus = TskData.FileKnown.UNKNOWN;
- if (getNotableTagDisplayNames().contains(displayName)) {
- knownStatus = TskData.FileKnown.BAD;
- }
- return addTagName(displayName, description, color, knownStatus);
+ return addTagName(displayName, description, color, knownStatus,TskData.FileKnown.UNKNOWN);
}
/**
From 3fda67bb223f3ee3ae5d7635841e2698e79a3993 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Wed, 15 Nov 2017 12:25:18 -0500
Subject: [PATCH 22/51] 3199 fix merge error in TagsManager where both old and
new arguments were in method call
---
.../org/sleuthkit/autopsy/casemodule/services/TagsManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index e5e9315e6f..b7978ffd94 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -266,7 +266,7 @@ public class TagsManager implements Closeable {
* name to the case database.
*/
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color) throws TagNameAlreadyExistsException, TskCoreException {
- return addTagName(displayName, description, color, knownStatus,TskData.FileKnown.UNKNOWN);
+ return addTagName(displayName, description, color, TskData.FileKnown.UNKNOWN);
}
/**
From 7f205b3ae4c37bab1980bc8ef22ab3e83cf1af8b Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Wed, 15 Nov 2017 12:34:05 -0500
Subject: [PATCH 23/51] 3201 move fix for blank description on new tag into
3201 from 3202
---
.../sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
index 6505fec9df..fd3663ea7a 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
@@ -299,7 +299,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
TagNameDialog.BUTTON_PRESSED result = dialog.getResult();
if (result == TagNameDialog.BUTTON_PRESSED.OK) {
TskData.FileKnown status = dialog.isTagNotable() ? TskData.FileKnown.BAD : TskData.FileKnown.UNKNOWN;
- TagNameDefinition newTagType = new TagNameDefinition(dialog.getTagName(), DEFAULT_DESCRIPTION, DEFAULT_COLOR, status);
+ TagNameDefinition newTagType = new TagNameDefinition(dialog.getTagName(), dialog.getTagDesciption(), DEFAULT_COLOR, status);
/*
* If tag name already exists, don't add the tag name.
*/
From 19c7cfb7048a6d0cc5cf49965cb709e512383b60 Mon Sep 17 00:00:00 2001
From: "U-BASIS\\zhaohui"
Date: Wed, 15 Nov 2017 13:10:57 -0500
Subject: [PATCH 24/51] 3207: Add a collection of attributes to aritifact
instead of add one attribute at a time.
---
.../eventlisteners/IngestEventsListener.java | 9 +++----
.../modules/filetypeid/FileTypeDetector.java | 7 ++++--
.../hashdatabase/HashDbIngestModule.java | 13 +++++-----
.../autopsy/modules/iOS/CallLogAnalyzer.java | 16 ++++++++-----
.../autopsy/modules/iOS/ContactAnalyzer.java | 11 +++++----
.../modules/iOS/TextMessageAnalyzer.java | 23 ++++++++++--------
.../FilesIdentifierIngestModule.java | 7 ++++--
.../modules/stix/StixArtifactData.java | 10 +++++---
...nterestingArtifactCreatorIngestModule.java | 24 ++++++++++++-------
.../recentactivity/ExtractRegistry.java | 14 ++++++-----
10 files changed, 82 insertions(+), 52 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java
index 02d64904a4..0877bc1685 100644
--- a/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java
+++ b/Core/src/org/sleuthkit/autopsy/centralrepository/eventlisteners/IngestEventsListener.java
@@ -130,17 +130,18 @@ public class IngestEventsListener {
try {
AbstractFile af = bbArtifact.getSleuthkitCase().getAbstractFileById(bbArtifact.getObjectID());
-
+ Collection attributes = new ArrayList<>();
String MODULE_NAME = Bundle.IngestEventsListener_ingestmodule_name();
BlackboardArtifact tifArtifact = af.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_ARTIFACT_HIT);
BlackboardAttribute att = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, MODULE_NAME,
Bundle.IngestEventsListener_prevTaggedSet_text());
BlackboardAttribute att2 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT, MODULE_NAME,
Bundle.IngestEventsListener_prevCaseComment_text() + caseDisplayNames.stream().distinct().collect(Collectors.joining(",", "", "")));
- tifArtifact.addAttribute(att);
- tifArtifact.addAttribute(att2);
- tifArtifact.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT, MODULE_NAME, bbArtifact.getArtifactID()));
+ attributes.add(att);
+ attributes.add(att2);
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT, MODULE_NAME, bbArtifact.getArtifactID()));
+ tifArtifact.addAttributes(attributes);
try {
// index the artifact for keyword search
Blackboard blackboard = Case.getCurrentCase().getServices().getBlackboard();
diff --git a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java
index eb1ab33591..4bfbb8b734 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/filetypeid/FileTypeDetector.java
@@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.modules.filetypeid;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.SortedSet;
@@ -360,8 +361,9 @@ public class FileTypeDetector {
if (fileType.createInterestingFileHit()) {
BlackboardArtifact artifact;
artifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT);
+ Collection attributes = new ArrayList<>();
BlackboardAttribute setNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, FileTypeIdModuleFactory.getModuleName(), fileType.getInterestingFilesSetName());
- artifact.addAttribute(setNameAttribute);
+ attributes.add(setNameAttribute);
/*
* Use the MIME type as the category attribute, i.e., the
@@ -369,8 +371,9 @@ public class FileTypeDetector {
* files set.
*/
BlackboardAttribute ruleNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, FileTypeIdModuleFactory.getModuleName(), fileType.getMimeType());
- artifact.addAttribute(ruleNameAttribute);
+ attributes.add(ruleNameAttribute);
+ artifact.addAttributes(attributes);
/*
* Index the artifact for keyword search.
*/
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java
index 3dd7416872..1ef51bdaeb 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbIngestModule.java
@@ -20,6 +20,7 @@ package org.sleuthkit.autopsy.modules.hashdatabase;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
@@ -296,14 +297,14 @@ public class HashDbIngestModule implements FileIngestModule {
String MODULE_NAME = NbBundle.getMessage(HashDbIngestModule.class, "HashDbIngestModule.moduleName");
BlackboardArtifact badFile = abstractFile.newArtifact(ARTIFACT_TYPE.TSK_HASHSET_HIT);
+ Collection attributes = new ArrayList<>();
//TODO Revisit usage of deprecated constructor as per TSK-583
//BlackboardAttribute att2 = new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_SET_NAME.getTypeID(), MODULE_NAME, "Known Bad", hashSetName);
- BlackboardAttribute att2 = new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_SET_NAME, MODULE_NAME, hashSetName);
- badFile.addAttribute(att2);
- BlackboardAttribute att3 = new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_HASH_MD5, MODULE_NAME, md5Hash);
- badFile.addAttribute(att3);
- BlackboardAttribute att4 = new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT, MODULE_NAME, comment);
- badFile.addAttribute(att4);
+ attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_SET_NAME, MODULE_NAME, hashSetName));
+ attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_HASH_MD5, MODULE_NAME, md5Hash));
+ attributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COMMENT, MODULE_NAME, comment));
+
+ badFile.addAttributes(attributes);
try {
// index the artifact for keyword search
diff --git a/Core/src/org/sleuthkit/autopsy/modules/iOS/CallLogAnalyzer.java b/Core/src/org/sleuthkit/autopsy/modules/iOS/CallLogAnalyzer.java
index bb2657c8ef..cfc7272315 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/iOS/CallLogAnalyzer.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/iOS/CallLogAnalyzer.java
@@ -23,6 +23,8 @@ import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import org.openide.util.NbBundle.Messages;
@@ -116,16 +118,18 @@ class CallLogAnalyzer {
type = resultSet.getString("type"); //NON-NLS
bba = f.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG); //create a call log and then add attributes from result set.
+ Collection attributes = new ArrayList<>();
if (type.equalsIgnoreCase("outgoing")) { //NON-NLS
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, moduleName, number));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, moduleName, number));
} else { /// Covers INCOMING and MISSED
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, moduleName, number));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, moduleName, number));
}
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START, moduleName, date)); // RC: Should be long!
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END, moduleName, duration + date)); // RC: Should be long!
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, type));
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, moduleName, name));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_START, moduleName, date)); // RC: Should be long!
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME_END, moduleName, duration + date)); // RC: Should be long!
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, type));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, moduleName, name));
+ bba.addAttributes(attributes);
try {
// index the artifact for keyword search
blackboard.indexArtifact(bba);
diff --git a/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java b/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java
index ecfce79ae4..efa4494f26 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/iOS/ContactAnalyzer.java
@@ -28,6 +28,8 @@ import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import org.openide.util.NbBundle.Messages;
@@ -128,6 +130,7 @@ class ContactAnalyzer {
BlackboardArtifact bba;
bba = f.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT);
+ Collection attributes = new ArrayList<>();
String name;
String oldName = "";
String mimetype; // either phone or email
@@ -137,16 +140,16 @@ class ContactAnalyzer {
data1 = resultSet.getString("data1"); //NON-NLS
mimetype = resultSet.getString("mimetype"); //NON-NLS
if (name.equals(oldName) == false) {
- bba = f.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT);
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, moduleName, name));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, moduleName, name));
}
if (mimetype.equals("vnd.android.cursor.item/phone_v2")) { //NON-NLS
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, moduleName, data1));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, moduleName, data1));
} else {
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL, moduleName, data1));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL, moduleName, data1));
}
oldName = name;
+ bba.addAttributes(attributes);
try {
// index the artifact for keyword search
blackboard.indexArtifact(bba);
diff --git a/Core/src/org/sleuthkit/autopsy/modules/iOS/TextMessageAnalyzer.java b/Core/src/org/sleuthkit/autopsy/modules/iOS/TextMessageAnalyzer.java
index 7a7e2f0cfa..d1a81663fe 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/iOS/TextMessageAnalyzer.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/iOS/TextMessageAnalyzer.java
@@ -23,6 +23,8 @@ import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.List;
import java.util.logging.Level;
import org.openide.util.NbBundle;
@@ -116,21 +118,22 @@ class TextMessageAnalyzer {
body = resultSet.getString("body"); //NON-NLS
bba = f.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE); //create Message artifact and then add attributes from result set.
-
+ Collection attributes = new ArrayList<>();
// @@@ NEed to put into more specific TO or FROM
if (type.equals("1")) {
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, NbBundle.getMessage(this.getClass(), "TextMessageAnalyzer.bbAttribute.incoming")));
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, moduleName, address));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, NbBundle.getMessage(this.getClass(), "TextMessageAnalyzer.bbAttribute.incoming")));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, moduleName, address));
} else {
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, NbBundle.getMessage(this.getClass(), "TextMessageAnalyzer.bbAttribute.outgoing")));
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, moduleName, address));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, NbBundle.getMessage(this.getClass(), "TextMessageAnalyzer.bbAttribute.outgoing")));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, moduleName, address));
}
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, moduleName, date));
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, type));
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT, moduleName, subject));
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, moduleName, body));
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, moduleName, NbBundle.getMessage(this.getClass(), "TextMessageAnalyzer.bbAttribute.smsMessage")));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, moduleName, date));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, moduleName, type));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT, moduleName, subject));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, moduleName, body));
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, moduleName, NbBundle.getMessage(this.getClass(), "TextMessageAnalyzer.bbAttribute.smsMessage")));
+ bba.addAttributes(attributes);
try {
// index the artifact for keyword search
blackboard.indexArtifact(bba);
diff --git a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java
index 78a8481f17..88ee3ae1b7 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/interestingitems/FilesIdentifierIngestModule.java
@@ -19,6 +19,7 @@
package org.sleuthkit.autopsy.modules.interestingitems;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
import java.util.List;
import java.util.Map;
@@ -121,6 +122,7 @@ final class FilesIdentifierIngestModule implements FileIngestModule {
// blackboard.
String moduleName = InterestingItemsIngestModuleFactory.getModuleName();
BlackboardArtifact artifact = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT);
+ Collection attributes = new ArrayList<>();
// Add a set name attribute to the artifact. This adds a
// fair amount of redundant data to the attributes table
@@ -128,13 +130,14 @@ final class FilesIdentifierIngestModule implements FileIngestModule {
// otherwise would requires reworking the interesting files
// set hit artifact.
BlackboardAttribute setNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, moduleName, filesSet.getName());
- artifact.addAttribute(setNameAttribute);
+ attributes.add(setNameAttribute);
// Add a category attribute to the artifact to record the
// interesting files set membership rule that was satisfied.
BlackboardAttribute ruleNameAttribute = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, moduleName, ruleSatisfied);
- artifact.addAttribute(ruleNameAttribute);
+ attributes.add(ruleNameAttribute);
+ artifact.addAttributes(attributes);
try {
// index the artifact for keyword search
blackboard.indexArtifact(artifact);
diff --git a/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java b/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java
index 8a8466d89f..afc84d87aa 100755
--- a/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/stix/StixArtifactData.java
@@ -18,6 +18,8 @@
*/
package org.sleuthkit.autopsy.modules.stix;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.logging.Level;
import org.openide.util.NbBundle.Messages;
import org.sleuthkit.autopsy.casemodule.Case;
@@ -70,10 +72,12 @@ class StixArtifactData {
}
BlackboardArtifact bba = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_INTERESTING_FILE_HIT);
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, "Stix", setName)); //NON-NLS
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE, "Stix", observableId)); //NON-NLS
- bba.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, "Stix", objType)); //NON-NLS
+ Collection attributes = new ArrayList<>();
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, "Stix", setName)); //NON-NLS
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TITLE, "Stix", observableId)); //NON-NLS
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, "Stix", objType)); //NON-NLS
+ bba.addAttributes(attributes);
try {
// index the artifact for keyword search
blackboard.indexArtifact(bba);
diff --git a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java
index 5e9a876ab6..a57623f02e 100755
--- a/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java
+++ b/Core/src/org/sleuthkit/autopsy/test/InterestingArtifactCreatorIngestModule.java
@@ -18,6 +18,8 @@
*/
package org.sleuthkit.autopsy.test;
+import java.util.ArrayList;
+import java.util.Collection;
import java.util.logging.Level;
import org.openide.util.Exceptions;
@@ -77,6 +79,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt
Blackboard blackboard = Case.getCurrentCase().getServices().getBlackboard();
BlackboardArtifact.Type artifactTypeBase = blackboard.getOrAddArtifactType(ARTIFACT_TYPE_NAMES[randomArtIndex], ARTIFACT_DISPLAY_NAMES[randomArtIndex]);
BlackboardArtifact artifactBase = file.newArtifact(artifactTypeBase.getTypeID());
+ Collection baseAttributes = new ArrayList<>();
String commentTxt;
BlackboardAttribute baseAttr;
switch (artifactBase.getArtifactTypeID()) {
@@ -84,7 +87,7 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt
commentTxt = "www.placeholderWebsiteDOTCOM";
baseAttr = new BlackboardAttribute(
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_URL, "Fake Web BookMark", "www.thisWebsiteIsStillFake.com");
- artifactBase.addAttribute(baseAttr);
+ baseAttributes.add(baseAttr);
break;
case 9:
commentTxt = "fakeKeyword";
@@ -94,29 +97,32 @@ final class InterestingArtifactCreatorIngestModule extends FileIngestModuleAdapt
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, "Fake Keyword Search", "Fake");
BlackboardAttribute keyword = new BlackboardAttribute(
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_KEYWORD, "Fake Keyword Search", "FakeKeyword");
- artifactBase.addAttribute(baseAttr);
- artifactBase.addAttribute(set);
- artifactBase.addAttribute(keyword);
+ baseAttributes.add(baseAttr);
+ baseAttributes.add(set);
+ baseAttributes.add(keyword);
break;
case 25:
commentTxt = "fake phone number from";
baseAttr = new BlackboardAttribute(
BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, "Fake Call Log Whatever", "555-555-5555");
- artifactBase.addAttribute(baseAttr);
+ baseAttributes.add(baseAttr);
break;
default:
commentTxt = "DEPENDENT ON ARTIFACT TYPE";
break;
}
+ artifactBase.addAttributes(baseAttributes);
BlackboardArtifact artifact = file.newArtifact(artifactType.getTypeID());
+ Collection attributes = new ArrayList<>();
BlackboardAttribute att = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SET_NAME, MODULE_NAME, "ArtifactsAndTxt");
BlackboardAttribute att2 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT, MODULE_NAME, commentTxt);
BlackboardAttribute att3 = new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, MODULE_NAME, "");
- artifact.addAttribute(att);
- artifact.addAttribute(att2);
- artifact.addAttribute(att3);
- artifact.addAttribute(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT, MODULE_NAME, artifactBase.getArtifactID()));
+ attributes.add(att);
+ attributes.add(att2);
+ attributes.add(att3);
+ attributes.add(new BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_ASSOCIATED_ARTIFACT, MODULE_NAME, artifactBase.getArtifactID()));
+ artifact.addAttributes(attributes);
} catch (TskCoreException ex) {
logger.log(Level.SEVERE, String.format("Failed to process file (obj_id = %d)", file.getId()), ex);
return ProcessResult.ERROR;
diff --git a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java
index d22ce2ca76..b0af801089 100755
--- a/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java
+++ b/RecentActivity/src/org/sleuthkit/autopsy/recentactivity/ExtractRegistry.java
@@ -649,14 +649,15 @@ class ExtractRegistry extends Extract {
String homeDir = value;
String sid = artnode.getAttribute("sid"); //NON-NLS
String username = artnode.getAttribute("username"); //NON-NLS
-
BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_OS_ACCOUNT);
- bbart.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_NAME,
parentModuleName, username));
- bbart.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_ID,
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_USER_ID,
parentModuleName, sid));
- bbart.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH,
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PATH,
parentModuleName, homeDir));
+
+ bbart.addAttributes(bbattributes);
// index the artifact for keyword search
this.indexArtifact(bbart);
} catch (TskCoreException ex) {
@@ -669,10 +670,11 @@ class ExtractRegistry extends Extract {
String localPath = artnode.getAttribute("localPath"); //NON-NLS
String remoteName = value;
BlackboardArtifact bbart = regFile.newArtifact(ARTIFACT_TYPE.TSK_REMOTE_DRIVE);
- bbart.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_LOCAL_PATH,
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_LOCAL_PATH,
parentModuleName, localPath));
- bbart.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_REMOTE_PATH,
+ bbattributes.add(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_REMOTE_PATH,
parentModuleName, remoteName));
+ bbart.addAttributes(bbattributes);
// index the artifact for keyword search
this.indexArtifact(bbart);
} catch (TskCoreException ex) {
From 5035aa41b4b429d1f6bf2ece3019ebce507b65a0 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Wed, 15 Nov 2017 15:57:28 -0500
Subject: [PATCH 25/51] 3199 include knownStatus in TagName class
---
.../org/sleuthkit/autopsy/casemodule/services/TagsManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index b7978ffd94..4c71284bef 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -288,7 +288,7 @@ public class TagsManager implements Closeable {
*/
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException {
try {
- TagName tagName = caseDb.addTagName(displayName, description, color);
+ TagName tagName = caseDb.addTagName(displayName, description, color, knownStatus);
Set customTypes = TagNameDefiniton.getTagNameDefinitions();
customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus));
TagNameDefiniton.setTagNameDefinitions(customTypes);
From 01fda811d5b003bea32354110df447629239ad32 Mon Sep 17 00:00:00 2001
From: "U-BASIS\\zhaohui"
Date: Thu, 16 Nov 2017 13:56:09 -0500
Subject: [PATCH 26/51] 3207: Update python code to use collection of
attributes instead of adding addtribute one at a time
---
.../android/browserlocation.py | 11 ++++++----
.../android/cachelocation.py | 11 ++++++----
InternalPythonModules/android/calllog.py | 15 +++++++------
InternalPythonModules/android/contact.py | 9 +++++---
.../android/googlemaplocation.py | 21 +++++++++++--------
InternalPythonModules/android/tangomessage.py | 11 ++++++----
InternalPythonModules/android/textmessage.py | 21 +++++++++++--------
InternalPythonModules/android/wwfmessage.py | 12 ++++++-----
.../FindContactsDb.py | 16 +++++++-------
9 files changed, 76 insertions(+), 51 deletions(-)
diff --git a/InternalPythonModules/android/browserlocation.py b/InternalPythonModules/android/browserlocation.py
index ef79a623c2..81ce9d9163 100755
--- a/InternalPythonModules/android/browserlocation.py
+++ b/InternalPythonModules/android/browserlocation.py
@@ -28,6 +28,7 @@ from java.sql import ResultSet
from java.sql import SQLException
from java.sql import Statement
from java.util.logging import Level
+from java.util import ArrayList
from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Blackboard
from org.sleuthkit.autopsy.casemodule.services import FileManager
@@ -89,14 +90,16 @@ class BrowserLocationAnalyzer(general.AndroidComponentAnalyzer):
latitude = Double.valueOf(resultSet.getString("latitude"))
longitude = Double.valueOf(resultSet.getString("longitude"))
+ attributes = ArrayList<>()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE, general.MODULE_NAME, latitude))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, general.MODULE_NAME, longitude))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, timestamp))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, general.MODULE_NAME, "Browser Location History"))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE, general.MODULE_NAME, latitude))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, general.MODULE_NAME, longitude))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, timestamp))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, general.MODULE_NAME, "Browser Location History"))
# artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(),moduleName, accuracy))
# NOTE: originally commented out
+ artifact.addAttributes(attributes);
try:
# index the artifact for keyword search
blackboard = Case.getCurrentCase().getServices().getBlackboard()
diff --git a/InternalPythonModules/android/cachelocation.py b/InternalPythonModules/android/cachelocation.py
index c28aa48fc3..680db6d6e6 100755
--- a/InternalPythonModules/android/cachelocation.py
+++ b/InternalPythonModules/android/cachelocation.py
@@ -25,6 +25,7 @@ from java.lang import ClassNotFoundException
from java.math import BigInteger
from java.nio import ByteBuffer
from java.util.logging import Level
+from java.util import ArrayList
from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Blackboard
from org.sleuthkit.autopsy.casemodule.services import FileManager
@@ -120,13 +121,15 @@ class CacheLocationAnalyzer(general.AndroidComponentAnalyzer):
inputStream.read(tempBytes)
timestamp = BigInteger(tempBytes).longValue() / 1000
+ attributes = ArrayList<>()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE, AndroidAnalyzer.MODULE_NAME, latitude))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, AndroidAnalyzer.MODULE_NAME, longitude))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, AndroidModuleFactorymodule.Name, timestamp))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, AndroidAnalyzer.MODULE_NAME,
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE, AndroidAnalyzer.MODULE_NAME, latitude))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, AndroidAnalyzer.MODULE_NAME, longitude))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, AndroidModuleFactorymodule.Name, timestamp))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, AndroidAnalyzer.MODULE_NAME,
file.getName() + "Location History"))
+ artifact.addAttributes(attributes)
#Not storing these for now.
# artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_VALUE.getTypeID(), AndroidModuleFactorymodule.moduleName, accuracy))
# artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_COMMENT.getTypeID(), AndroidModuleFactorymodule.moduleName, confidence))
diff --git a/InternalPythonModules/android/calllog.py b/InternalPythonModules/android/calllog.py
index 42e3a293a1..c3a65f8f38 100755
--- a/InternalPythonModules/android/calllog.py
+++ b/InternalPythonModules/android/calllog.py
@@ -28,6 +28,7 @@ from java.sql import ResultSet
from java.sql import SQLException
from java.sql import Statement
from java.util.logging import Level
+from java.util import ArrayList
from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Blackboard
from org.sleuthkit.autopsy.casemodule.services import FileManager
@@ -119,17 +120,19 @@ class CallLogAnalyzer(general.AndroidComponentAnalyzer):
name = resultSet.getString("name") # name of person dialed or called. None if unregistered
try:
+ attributes = ArrayList<>()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG) # create a call log and then add attributes from result set.
if direction == CallLogAnalyzer.OUTGOING:
- artifact.addAttribute(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, general.MODULE_NAME, number))
+ attributes.add(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, general.MODULE_NAME, number))
else: # Covers INCOMING and MISSED
- artifact.addAttribute(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, general.MODULE_NAME, number))
+ attributes.add(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, general.MODULE_NAME, number))
- artifact.addAttribute(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_START, general.MODULE_NAME, date))
- artifact.addAttribute(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_END, general.MODULE_NAME, duration + date))
- artifact.addAttribute(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, directionString))
- artifact.addAttribute(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, name))
+ attributes.add(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_START, general.MODULE_NAME, date))
+ attributes.add(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DATETIME_END, general.MODULE_NAME, duration + date))
+ attributes.add(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, directionString))
+ attributes.add(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, name))
+ artifact.addAttributes(attributes)
bbartifacts.append(artifact)
try:
diff --git a/InternalPythonModules/android/contact.py b/InternalPythonModules/android/contact.py
index fe56cc1cbb..75768b8a8e 100755
--- a/InternalPythonModules/android/contact.py
+++ b/InternalPythonModules/android/contact.py
@@ -27,6 +27,7 @@ from java.sql import ResultSet
from java.sql import SQLException
from java.sql import Statement
from java.util.logging import Level
+from java.util import ArrayList
from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Blackboard
from org.sleuthkit.autopsy.casemodule.services import FileManager
@@ -118,6 +119,7 @@ class ContactAnalyzer(general.AndroidComponentAnalyzer):
+ "WHERE mimetype = 'vnd.android.cursor.item/phone_v2' OR mimetype = 'vnd.android.cursor.item/email_v2'\n"
+ "ORDER BY raw_contacts.display_name ASC;")
+ attributes = ArrayList<>()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT)
oldName = ""
while resultSet.next():
@@ -126,14 +128,15 @@ class ContactAnalyzer(general.AndroidComponentAnalyzer):
mimetype = resultSet.getString("mimetype") # either phone or email
if name != oldName:
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT)
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, name))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, name))
if mimetype == "vnd.android.cursor.item/phone_v2":
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, general.MODULE_NAME, data1))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER, general.MODULE_NAME, data1))
else:
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL, general.MODULE_NAME, data1))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL, general.MODULE_NAME, data1))
oldName = name
+ artifact.addAttributes(attributes)
bbartifacts.append(artifact)
try:
diff --git a/InternalPythonModules/android/googlemaplocation.py b/InternalPythonModules/android/googlemaplocation.py
index 066ed2f792..3b4a265937 100755
--- a/InternalPythonModules/android/googlemaplocation.py
+++ b/InternalPythonModules/android/googlemaplocation.py
@@ -28,6 +28,7 @@ from java.sql import ResultSet
from java.sql import SQLException
from java.sql import Statement
from java.util.logging import Level
+from java.util import ArrayList
from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Blackboard
from org.sleuthkit.autopsy.casemodule.services import FileManager
@@ -96,17 +97,19 @@ class GoogleMapLocationAnalyzer(general.AndroidComponentAnalyzer):
source_lat = GoogleMapLocationAnalyzer.convertGeo(resultSet.getString("source_lat"))
source_lng = GoogleMapLocationAnalyzer.convertGeo(resultSet.getString("source_lng"))
+ attributes = ArrayList<>()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE)
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, general.MODULE_NAME, "Destination"))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, time))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END, general.MODULE_NAME, dest_lat))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END, general.MODULE_NAME, dest_lng))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START, general.MODULE_NAME, source_lat))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START, general.MODULE_NAME, source_lng))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, dest_title))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION, general.MODULE_NAME, dest_address))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, general.MODULE_NAME, "Google Maps History"))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, general.MODULE_NAME, "Destination"))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, time))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_END, general.MODULE_NAME, dest_lat))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_END, general.MODULE_NAME, dest_lng))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE_START, general.MODULE_NAME, source_lat))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE_START, general.MODULE_NAME, source_lng))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, dest_title))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION, general.MODULE_NAME, dest_address))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, general.MODULE_NAME, "Google Maps History"))
+ aritfact.addAttributes(attributes)
try:
# index the artifact for keyword search
blackboard = Case.getCurrentCase().getServices().getBlackboard()
diff --git a/InternalPythonModules/android/tangomessage.py b/InternalPythonModules/android/tangomessage.py
index 04223f7fe1..5ba6ad0339 100755
--- a/InternalPythonModules/android/tangomessage.py
+++ b/InternalPythonModules/android/tangomessage.py
@@ -28,6 +28,7 @@ from java.sql import ResultSet
from java.sql import SQLException
from java.sql import Statement
from java.util.logging import Level
+from java.util import ArrayList
from org.apache.commons.codec.binary import Base64
from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Blackboard
@@ -94,12 +95,14 @@ class TangoMessageAnalyzer(general.AndroidComponentAnalyzer):
direction = "Outgoing"
payload = resultSet.getString("payload")
+ attributes = ArrayList<>()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE) #create a call log and then add attributes from result set.
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, create_time))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, direction))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, general.MODULE_NAME, TangoMessageAnalyzer.decodeMessage(conv_id, payload)))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, general.MODULE_NAME, "Tango Message"))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, create_time))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, direction))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, general.MODULE_NAME, TangoMessageAnalyzer.decodeMessage(conv_id, payload)))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, general.MODULE_NAME, "Tango Message"))
+ artifact.addAttributes(attributes)
try:
# index the artifact for keyword search
blackboard = Case.getCurrentCase().getServices().getBlackboard()
diff --git a/InternalPythonModules/android/textmessage.py b/InternalPythonModules/android/textmessage.py
index afca23cdf1..221023ce44 100755
--- a/InternalPythonModules/android/textmessage.py
+++ b/InternalPythonModules/android/textmessage.py
@@ -28,6 +28,7 @@ from java.sql import ResultSet
from java.sql import SQLException
from java.sql import Statement
from java.util.logging import Level
+from java.util import ArrayList
from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Blackboard
from org.sleuthkit.autopsy.casemodule.services import FileManager
@@ -92,19 +93,21 @@ class TextMessageAnalyzer(general.AndroidComponentAnalyzer):
read = resultSet.getInt("read") # may be unread = 0, read = 1
subject = resultSet.getString("subject") # message subject
body = resultSet.getString("body") # message body
+ attributes = ArrayList<>()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE); #create Message artifact and then add attributes from result set.
if resultSet.getString("type") == "1":
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, "Incoming"))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, general.MODULE_NAME, address))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, "Incoming"))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_FROM, general.MODULE_NAME, address))
else:
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, "Outgoing"))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, general.MODULE_NAME, address))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, date))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_READ_STATUS, general.MODULE_NAME, Integer(read)))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT, general.MODULE_NAME, subject))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, general.MODULE_NAME, body))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, general.MODULE_NAME, "SMS Message"))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, "Outgoing"))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, general.MODULE_NAME, address))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, date))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_READ_STATUS, general.MODULE_NAME, Integer(read)))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_SUBJECT, general.MODULE_NAME, subject))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, general.MODULE_NAME, body))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, general.MODULE_NAME, "SMS Message"))
+ artifact.addAttributes(attributes)
bbartifacts.append(artifact)
try:
# index the artifact for keyword search
diff --git a/InternalPythonModules/android/wwfmessage.py b/InternalPythonModules/android/wwfmessage.py
index 97f35869ed..1fe80a099d 100755
--- a/InternalPythonModules/android/wwfmessage.py
+++ b/InternalPythonModules/android/wwfmessage.py
@@ -88,13 +88,15 @@ class WWFMessageAnalyzer(general.AndroidComponentAnalyzer):
user_id = resultSet.getString("user_id") # the ID of the user who sent the message.
game_id = resultSet.getString("game_id") # ID of the game which the the message was sent.
+ attributes = ArrayList<>()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE) # create a call log and then add attributes from result set.
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, created_at))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, user_id))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MSG_ID, general.MODULE_NAME, game_id))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, general.MODULE_NAME, message))
- artifact.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, general.MODULE_NAME, "Words With Friends Message"))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, created_at))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, user_id))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MSG_ID, general.MODULE_NAME, game_id))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, general.MODULE_NAME, message))
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, general.MODULE_NAME, "Words With Friends Message"))
+ artifact.addAttrisbutes(attributes)
try:
# index the artifact for keyword search
blackboard = Case.getCurrentCase().getServices().getBlackboard()
diff --git a/pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py b/pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
index 7a11ed913d..5900f4f04f 100755
--- a/pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
+++ b/pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
@@ -40,6 +40,7 @@ from java.lang import Class
from java.lang import System
from java.sql import DriverManager, SQLException
from java.util.logging import Level
+from java.util import ArrayList
from java.io import File
from org.sleuthkit.datamodel import SleuthkitCase
from org.sleuthkit.datamodel import AbstractFile
@@ -162,17 +163,18 @@ class ContactsDbIngestModule(DataSourceIngestModule):
# Make an artifact on the blackboard, TSK_CONTACT and give it attributes for each of the fields
art = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT)
-
- art.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME_PERSON.getTypeID(),
+ attributes = ArrayList<>()
+
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME_PERSON.getTypeID(),
ContactsDbIngestModuleFactory.moduleName, name))
- art.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL.getTypeID(),
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_EMAIL.getTypeID(),
ContactsDbIngestModuleFactory.moduleName, email))
- art.addAttribute(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER.getTypeID(),
+ attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PHONE_NUMBER.getTypeID(),
ContactsDbIngestModuleFactory.moduleName, phone))
-
-
+
+ art.addAttributes(attributes)
try:
# index the artifact for keyword search
blackboard.indexArtifact(art)
@@ -195,4 +197,4 @@ class ContactsDbIngestModule(DataSourceIngestModule):
"ContactsDb Analyzer", "Found %d files" % fileCount)
IngestServices.getInstance().postMessage(message)
- return IngestModule.ProcessResult.OK
\ No newline at end of file
+ return IngestModule.ProcessResult.OK
From 4ecfb24165ea073cc94e0cff92d0cfa20d66b78b Mon Sep 17 00:00:00 2001
From: "U-BASIS\\zhaohui"
Date: Fri, 17 Nov 2017 09:40:31 -0500
Subject: [PATCH 27/51] 3207: create ArrayList in python
---
InternalPythonModules/android/browserlocation.py | 2 +-
InternalPythonModules/android/cachelocation.py | 2 +-
InternalPythonModules/android/calllog.py | 2 +-
InternalPythonModules/android/contact.py | 2 +-
InternalPythonModules/android/googlemaplocation.py | 2 +-
InternalPythonModules/android/tangomessage.py | 2 +-
InternalPythonModules/android/textmessage.py | 2 +-
InternalPythonModules/android/wwfmessage.py | 2 +-
pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py | 2 +-
9 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/InternalPythonModules/android/browserlocation.py b/InternalPythonModules/android/browserlocation.py
index 81ce9d9163..6db230c2e6 100755
--- a/InternalPythonModules/android/browserlocation.py
+++ b/InternalPythonModules/android/browserlocation.py
@@ -90,7 +90,7 @@ class BrowserLocationAnalyzer(general.AndroidComponentAnalyzer):
latitude = Double.valueOf(resultSet.getString("latitude"))
longitude = Double.valueOf(resultSet.getString("longitude"))
- attributes = ArrayList<>()
+ attributes = ArrayList()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE, general.MODULE_NAME, latitude))
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, general.MODULE_NAME, longitude))
diff --git a/InternalPythonModules/android/cachelocation.py b/InternalPythonModules/android/cachelocation.py
index 680db6d6e6..019c03c654 100755
--- a/InternalPythonModules/android/cachelocation.py
+++ b/InternalPythonModules/android/cachelocation.py
@@ -121,7 +121,7 @@ class CacheLocationAnalyzer(general.AndroidComponentAnalyzer):
inputStream.read(tempBytes)
timestamp = BigInteger(tempBytes).longValue() / 1000
- attributes = ArrayList<>()
+ attributes = ArrayList()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_TRACKPOINT)
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LATITUDE, AndroidAnalyzer.MODULE_NAME, latitude))
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_GEO_LONGITUDE, AndroidAnalyzer.MODULE_NAME, longitude))
diff --git a/InternalPythonModules/android/calllog.py b/InternalPythonModules/android/calllog.py
index c3a65f8f38..6b9cb956d8 100755
--- a/InternalPythonModules/android/calllog.py
+++ b/InternalPythonModules/android/calllog.py
@@ -120,7 +120,7 @@ class CallLogAnalyzer(general.AndroidComponentAnalyzer):
name = resultSet.getString("name") # name of person dialed or called. None if unregistered
try:
- attributes = ArrayList<>()
+ attributes = ArrayList()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CALLLOG) # create a call log and then add attributes from result set.
if direction == CallLogAnalyzer.OUTGOING:
attributes.add(BlackboardAttribute(ATTRIBUTE_TYPE.TSK_PHONE_NUMBER_TO, general.MODULE_NAME, number))
diff --git a/InternalPythonModules/android/contact.py b/InternalPythonModules/android/contact.py
index 75768b8a8e..22eb681061 100755
--- a/InternalPythonModules/android/contact.py
+++ b/InternalPythonModules/android/contact.py
@@ -119,7 +119,7 @@ class ContactAnalyzer(general.AndroidComponentAnalyzer):
+ "WHERE mimetype = 'vnd.android.cursor.item/phone_v2' OR mimetype = 'vnd.android.cursor.item/email_v2'\n"
+ "ORDER BY raw_contacts.display_name ASC;")
- attributes = ArrayList<>()
+ attributes = ArrayList()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT)
oldName = ""
while resultSet.next():
diff --git a/InternalPythonModules/android/googlemaplocation.py b/InternalPythonModules/android/googlemaplocation.py
index 3b4a265937..10a1542568 100755
--- a/InternalPythonModules/android/googlemaplocation.py
+++ b/InternalPythonModules/android/googlemaplocation.py
@@ -97,7 +97,7 @@ class GoogleMapLocationAnalyzer(general.AndroidComponentAnalyzer):
source_lat = GoogleMapLocationAnalyzer.convertGeo(resultSet.getString("source_lat"))
source_lng = GoogleMapLocationAnalyzer.convertGeo(resultSet.getString("source_lng"))
- attributes = ArrayList<>()
+ attributes = ArrayList()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_GPS_ROUTE)
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_CATEGORY, general.MODULE_NAME, "Destination"))
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, time))
diff --git a/InternalPythonModules/android/tangomessage.py b/InternalPythonModules/android/tangomessage.py
index 5ba6ad0339..9a792064da 100755
--- a/InternalPythonModules/android/tangomessage.py
+++ b/InternalPythonModules/android/tangomessage.py
@@ -95,7 +95,7 @@ class TangoMessageAnalyzer(general.AndroidComponentAnalyzer):
direction = "Outgoing"
payload = resultSet.getString("payload")
- attributes = ArrayList<>()
+ attributes = ArrayList()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE) #create a call log and then add attributes from result set.
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, create_time))
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, direction))
diff --git a/InternalPythonModules/android/textmessage.py b/InternalPythonModules/android/textmessage.py
index 221023ce44..55bb563fea 100755
--- a/InternalPythonModules/android/textmessage.py
+++ b/InternalPythonModules/android/textmessage.py
@@ -93,7 +93,7 @@ class TextMessageAnalyzer(general.AndroidComponentAnalyzer):
read = resultSet.getInt("read") # may be unread = 0, read = 1
subject = resultSet.getString("subject") # message subject
body = resultSet.getString("body") # message body
- attributes = ArrayList<>()
+ attributes = ArrayList()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE); #create Message artifact and then add attributes from result set.
if resultSet.getString("type") == "1":
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DIRECTION, general.MODULE_NAME, "Incoming"))
diff --git a/InternalPythonModules/android/wwfmessage.py b/InternalPythonModules/android/wwfmessage.py
index 1fe80a099d..941e81f329 100755
--- a/InternalPythonModules/android/wwfmessage.py
+++ b/InternalPythonModules/android/wwfmessage.py
@@ -88,7 +88,7 @@ class WWFMessageAnalyzer(general.AndroidComponentAnalyzer):
user_id = resultSet.getString("user_id") # the ID of the user who sent the message.
game_id = resultSet.getString("game_id") # ID of the game which the the message was sent.
- attributes = ArrayList<>()
+ attributes = ArrayList()
artifact = abstractFile.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_MESSAGE) # create a call log and then add attributes from result set.
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_DATETIME, general.MODULE_NAME, created_at))
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME, general.MODULE_NAME, user_id))
diff --git a/pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py b/pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
index 5900f4f04f..2aa5d9d9a4 100755
--- a/pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
+++ b/pythonExamples/Aug2015DataSourceTutorial/FindContactsDb.py
@@ -163,7 +163,7 @@ class ContactsDbIngestModule(DataSourceIngestModule):
# Make an artifact on the blackboard, TSK_CONTACT and give it attributes for each of the fields
art = file.newArtifact(BlackboardArtifact.ARTIFACT_TYPE.TSK_CONTACT)
- attributes = ArrayList<>()
+ attributes = ArrayList()
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_NAME_PERSON.getTypeID(),
ContactsDbIngestModuleFactory.moduleName, name))
From 30615f5b7d711161d91e3635ba61e9bbe61cfe82 Mon Sep 17 00:00:00 2001
From: "U-BASIS\\zhaohui"
Date: Fri, 17 Nov 2017 11:06:29 -0500
Subject: [PATCH 28/51] 3207: fix typo
---
InternalPythonModules/android/googlemaplocation.py | 2 +-
InternalPythonModules/android/wwfmessage.py | 3 ++-
2 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/InternalPythonModules/android/googlemaplocation.py b/InternalPythonModules/android/googlemaplocation.py
index 10a1542568..444c0477ee 100755
--- a/InternalPythonModules/android/googlemaplocation.py
+++ b/InternalPythonModules/android/googlemaplocation.py
@@ -109,7 +109,7 @@ class GoogleMapLocationAnalyzer(general.AndroidComponentAnalyzer):
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_LOCATION, general.MODULE_NAME, dest_address))
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_PROG_NAME, general.MODULE_NAME, "Google Maps History"))
- aritfact.addAttributes(attributes)
+ artifact.addAttributes(attributes)
try:
# index the artifact for keyword search
blackboard = Case.getCurrentCase().getServices().getBlackboard()
diff --git a/InternalPythonModules/android/wwfmessage.py b/InternalPythonModules/android/wwfmessage.py
index 941e81f329..e880cc1759 100755
--- a/InternalPythonModules/android/wwfmessage.py
+++ b/InternalPythonModules/android/wwfmessage.py
@@ -26,6 +26,7 @@ from java.sql import ResultSet
from java.sql import SQLException
from java.sql import Statement
from java.util.logging import Level
+from java.util import ArrayList
from org.sleuthkit.autopsy.casemodule import Case
from org.sleuthkit.autopsy.casemodule.services import Blackboard
from org.sleuthkit.autopsy.casemodule.services import FileManager
@@ -96,7 +97,7 @@ class WWFMessageAnalyzer(general.AndroidComponentAnalyzer):
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_TEXT, general.MODULE_NAME, message))
attributes.add(BlackboardAttribute(BlackboardAttribute.ATTRIBUTE_TYPE.TSK_MESSAGE_TYPE, general.MODULE_NAME, "Words With Friends Message"))
- artifact.addAttrisbutes(attributes)
+ artifact.addAttributes(attributes)
try:
# index the artifact for keyword search
blackboard = Case.getCurrentCase().getServices().getBlackboard()
From 743df27125cf4a632288ec49102241533795d6cb Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 17 Nov 2017 14:56:16 -0500
Subject: [PATCH 29/51] 3199 add knownStatus to TagName class and tag_names
table
---
.../casemodule/services/NewTagNameDialog.java | 6 ++-
.../casemodule/services/TagNameDefiniton.java | 37 ++++++++++++++++---
.../casemodule/services/TagsManager.java | 35 +-----------------
.../datamodel/DrawableTagsManager.java | 4 +-
4 files changed, 39 insertions(+), 43 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java
index ff21ac283b..b7b2e66ebc 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/NewTagNameDialog.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
-* Copyright 2011-2016 Basis Technology Corp.
+* Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -117,7 +117,9 @@ final class NewTagNameDialog extends javax.swing.JDialog {
JOptionPane.ERROR_MESSAGE);
return;
}
- if (TagsManager.containsIllegalCharacters(newTagDisplayName)) {
+
+ //if a tag name contains illegal characters and is not the name of one of the standard tags
+ if (TagsManager.containsIllegalCharacters(newTagDisplayName) && !TagNameDefiniton.getStandardTagNames().contains(newTagDisplayName)) {
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
NbBundle.getMessage(NewTagNameDialog.class, "NewTagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index cdae552e81..0c9b3ac41b 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2011-2016 Basis Technology Corp.
+ * Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,9 +25,14 @@ import java.util.List;
import java.util.Objects;
import java.util.Set;
import javax.annotation.concurrent.Immutable;
+import org.openide.util.Exceptions;
+import org.openide.util.NbBundle;
+import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.datamodel.SleuthkitCase;
+import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
/**
@@ -36,11 +41,15 @@ import org.sleuthkit.datamodel.TskData;
@Immutable
final class TagNameDefiniton implements Comparable {
+ @NbBundle.Messages({"TagNameDefiniton.predefTagNames.bookmark.text=Bookmark",
+ "TagNameDefiniton.predefTagNames.followUp.text=Follow Up",
+ "TagNameDefiniion.predefTagNames.notableItem.text=Notable Item"})
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
- private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getNotableItemText(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
- private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getBookmarkText(), TagsManager.getFollowUpText(),
- TagsManager.getNotableItemText(), Category.ONE.getDisplayName(),
+
+ private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniion_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
+ private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_bookmark_text(), Bundle.TagNameDefiniton_predefTagNames_followUp_text(),
+ Bundle.TagNameDefiniion_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(),
Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
private final String displayName;
@@ -64,6 +73,10 @@ final class TagNameDefiniton implements Comparable {
this.knownStatusDenoted = status;
}
+ static List getStandardTagNames() {
+ return STANDARD_TAG_DISPLAY_NAMES;
+ }
+
/**
* Gets the display name for the tag name.
*
@@ -164,6 +177,16 @@ final class TagNameDefiniton implements Comparable {
return displayName + "," + description + "," + color.name() + "," + knownStatusDenoted.toString();
}
+ private TagName saveToCase(SleuthkitCase caseDb) {
+ TagName tagName = null;
+ try {
+ tagName = caseDb.addTagName(displayName, description, color, knownStatusDenoted);
+ } catch (TskCoreException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ return tagName;
+ }
+
/**
* Gets tag name definitions from the tag settings file as well as the
* default tag name definitions.
@@ -202,7 +225,7 @@ final class TagNameDefiniton implements Comparable {
if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) {
tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.BAD));
} else {
- tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN));
+ tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN));
}
}
return tagNames;
@@ -220,6 +243,10 @@ final class TagNameDefiniton implements Comparable {
setting.append(";");
}
setting.append(tagName.toSettingsFormat());
+ if (Case.isCaseOpen()) {
+ SleuthkitCase caseDb = Case.getCurrentCase().getSleuthkitCase();
+ tagName.saveToCase(caseDb);
+ }
}
ModuleSettings.setConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY, setting.toString());
}
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index 4c71284bef..9830a5de56 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
-import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.BlackboardArtifact;
@@ -46,41 +45,9 @@ import org.sleuthkit.datamodel.TskData;
public class TagsManager implements Closeable {
private static final Logger LOGGER = Logger.getLogger(TagsManager.class.getName());
- @NbBundle.Messages({"TagsManager.predefTagNames.bookmark.text=Bookmark",
- "TagsManager.predefTagNames.followUp.text=Follow Up",
- "TagsManager.predefTagNames.notableItem.text=Notable Item"})
- private static final String FOLLOW_UP = Bundle.TagsManager_predefTagNames_followUp_text();
- private static final String BOOKMARK = Bundle.TagsManager_predefTagNames_bookmark_text();
- private static final String NOTABLE_ITEM = Bundle.TagsManager_predefTagNames_notableItem_text();
+
private final SleuthkitCase caseDb;
- /**
- * Get the text for the Follow Up tag.
- *
- * @return FOLLOW_UP
- */
- public static String getFollowUpText() {
- return FOLLOW_UP;
- }
-
- /**
- * Get the text for the Bookmark tag.
- *
- * @return BOOKMARK
- */
- public static String getBookmarkText() {
- return BOOKMARK;
- }
-
- /**
- * Get the text for the Notable Item tag.
- *
- * @return NOTABLE_ITEM
- */
- static String getNotableItemText() {
- return NOTABLE_ITEM;
- }
-
/**
* Tests whether or not a given tag display name contains an illegal
* character.
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
index 6859a12830..0497068924 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
@@ -138,7 +138,7 @@ public class DrawableTagsManager {
public TagName getFollowUpTagName() throws TskCoreException {
synchronized (autopsyTagsManagerLock) {
if (Objects.isNull(followUpTagName)) {
- followUpTagName = getTagName(TagsManager.getFollowUpText());
+ followUpTagName = getTagName(NbBundle.getMessage(DrawableTagsManager.class, "DrawableTagsManager.followUp"));
}
return followUpTagName;
}
@@ -147,7 +147,7 @@ public class DrawableTagsManager {
private Object getBookmarkTagName() throws TskCoreException {
synchronized (autopsyTagsManagerLock) {
if (Objects.isNull(bookmarkTagName)) {
- bookmarkTagName = getTagName(TagsManager.getBookmarkText());
+ bookmarkTagName = getTagName(NbBundle.getMessage(DrawableTagsManager.class, "DrawableTagsManager.bookMark"));
}
return bookmarkTagName;
}
From 5ab65ae0d54824165bce2a9c2755874957b07ff7 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 17 Nov 2017 15:02:28 -0500
Subject: [PATCH 30/51] 3199 fix typo in bundle message name
---
.../autopsy/casemodule/services/TagNameDefiniton.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index 0c9b3ac41b..abe071a0ec 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -43,13 +43,13 @@ final class TagNameDefiniton implements Comparable {
@NbBundle.Messages({"TagNameDefiniton.predefTagNames.bookmark.text=Bookmark",
"TagNameDefiniton.predefTagNames.followUp.text=Follow Up",
- "TagNameDefiniion.predefTagNames.notableItem.text=Notable Item"})
+ "TagNameDefiniton.predefTagNames.notableItem.text=Notable Item"})
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
- private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniion_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
+ private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_bookmark_text(), Bundle.TagNameDefiniton_predefTagNames_followUp_text(),
- Bundle.TagNameDefiniion_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(),
+ Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(),
Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
private final String displayName;
From 0b27196ad415bca34d7baac43cb6312e98f919e4 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 17 Nov 2017 15:37:19 -0500
Subject: [PATCH 31/51] 3201 merge changes from 3199 and resolve conflicts
---
.../services/TagNameDefinition.java | 34 +++++++++++++++---
.../casemodule/services/TagNameDialog.java | 8 ++---
.../casemodule/services/TagOptionsPanel.java | 2 +-
.../casemodule/services/TagsManager.java | 35 +------------------
.../datamodel/DrawableTagsManager.java | 4 +--
5 files changed, 38 insertions(+), 45 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
index 211bbe82e4..c9458dfbd7 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2011-2016 Basis Technology Corp.
+ * Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -25,9 +25,14 @@ import java.util.List;
import java.util.Objects;
import java.util.Set;
import javax.annotation.concurrent.Immutable;
+import org.openide.util.Exceptions;
+import org.openide.util.NbBundle;
+import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.datamodel.SleuthkitCase;
+import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
/**
@@ -36,11 +41,14 @@ import org.sleuthkit.datamodel.TskData;
@Immutable
final class TagNameDefinition implements Comparable {
+ @NbBundle.Messages({"TagNameDefinition.predefTagNames.bookmark.text=Bookmark",
+ "TagNameDefinition.predefTagNames.followUp.text=Follow Up",
+ "TagNameDefinition.predefTagNames.notableItem.text=Notable Item"})
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
- private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getNotableItemText(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
- static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(TagsManager.getBookmarkText(), TagsManager.getFollowUpText(),
- TagsManager.getNotableItemText(), Category.ONE.getDisplayName(),
+ private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefinition_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
+ private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefinition_predefTagNames_bookmark_text(), Bundle.TagNameDefinition_predefTagNames_followUp_text(),
+ Bundle.TagNameDefinition_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(),
Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
private final String displayName;
@@ -65,6 +73,10 @@ final class TagNameDefinition implements Comparable {
this.knownStatus = status;
}
+ static List getStandardTagNames() {
+ return STANDARD_TAG_DISPLAY_NAMES;
+ }
+
/**
* Gets the display name for the tag name.
*
@@ -165,6 +177,16 @@ final class TagNameDefinition implements Comparable {
return displayName + "," + description + "," + color.name() + "," + knownStatus.toString();
}
+ private TagName saveToCase(SleuthkitCase caseDb) {
+ TagName tagName = null;
+ try {
+ tagName = caseDb.addTagName(displayName, description, color, knownStatus);
+ } catch (TskCoreException ex) {
+ Exceptions.printStackTrace(ex);
+ }
+ return tagName;
+ }
+
/**
* Gets tag name definitions from the tag settings file as well as the
* default tag name definitions.
@@ -221,6 +243,10 @@ final class TagNameDefinition implements Comparable {
setting.append(";");
}
setting.append(tagName.toSettingsFormat());
+ if (Case.isCaseOpen()) {
+ SleuthkitCase caseDb = Case.getCurrentCase().getSleuthkitCase();
+ tagName.saveToCase(caseDb);
+ }
}
ModuleSettings.setConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY, setting.toString());
}
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
index e310c066e5..c8d1351763 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
@@ -1,7 +1,7 @@
/*
* Autopsy Forensic Browser
*
- * Copyright 2011-2016 Basis Technology Corp.
+ * Copyright 2011-2017 Basis Technology Corp.
* Contact: carrier sleuthkit org
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -135,10 +135,10 @@ final class TagNameDialog extends javax.swing.JDialog {
NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameEmpty.title"),
JOptionPane.ERROR_MESSAGE);
return;
- }
-
+ }
//if a tag name contains illegal characters and is not the name of one of the standard tags
- if (TagsManager.containsIllegalCharacters(newTagDisplayName) && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(newTagDisplayName)) {
+ if (TagsManager.containsIllegalCharacters(newTagDisplayName) && !TagNameDefinition.getStandardTagNames().contains(newTagDisplayName)) {
+
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
index fd3663ea7a..61314e6f1f 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagOptionsPanel.java
@@ -411,7 +411,7 @@ final class TagOptionsPanel extends javax.swing.JPanel implements OptionsPanel {
boolean isSelected = tagNamesList.getSelectedIndex() != -1;
boolean enableEdit = !ingestIsRunning && isSelected;
editTagNameButton.setEnabled(enableEdit);
- boolean enableDelete = enableEdit && !TagNameDefinition.STANDARD_TAG_DISPLAY_NAMES.contains(tagNamesList.getSelectedValue().getDisplayName());
+ boolean enableDelete = enableEdit && !TagNameDefinition.getStandardTagNames().contains(tagNamesList.getSelectedValue().getDisplayName());
deleteTagNameButton.setEnabled(enableDelete);
if (isSelected) {
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index 49b25b54db..5699034f7b 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -27,7 +27,6 @@ import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.logging.Level;
-import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.datamodel.BlackboardArtifact;
@@ -46,41 +45,9 @@ import org.sleuthkit.datamodel.TskData;
public class TagsManager implements Closeable {
private static final Logger LOGGER = Logger.getLogger(TagsManager.class.getName());
- @NbBundle.Messages({"TagsManager.predefTagNames.bookmark.text=Bookmark",
- "TagsManager.predefTagNames.followUp.text=Follow Up",
- "TagsManager.predefTagNames.notableItem.text=Notable Item"})
- private static final String FOLLOW_UP = Bundle.TagsManager_predefTagNames_followUp_text();
- private static final String BOOKMARK = Bundle.TagsManager_predefTagNames_bookmark_text();
- private static final String NOTABLE_ITEM = Bundle.TagsManager_predefTagNames_notableItem_text();
+
private final SleuthkitCase caseDb;
- /**
- * Get the text for the Follow Up tag.
- *
- * @return FOLLOW_UP
- */
- public static String getFollowUpText() {
- return FOLLOW_UP;
- }
-
- /**
- * Get the text for the Bookmark tag.
- *
- * @return BOOKMARK
- */
- public static String getBookmarkText() {
- return BOOKMARK;
- }
-
- /**
- * Get the text for the Notable Item tag.
- *
- * @return NOTABLE_ITEM
- */
- static String getNotableItemText() {
- return NOTABLE_ITEM;
- }
-
/**
* Tests whether or not a given tag display name contains an illegal
* character.
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
index 6859a12830..0497068924 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
@@ -138,7 +138,7 @@ public class DrawableTagsManager {
public TagName getFollowUpTagName() throws TskCoreException {
synchronized (autopsyTagsManagerLock) {
if (Objects.isNull(followUpTagName)) {
- followUpTagName = getTagName(TagsManager.getFollowUpText());
+ followUpTagName = getTagName(NbBundle.getMessage(DrawableTagsManager.class, "DrawableTagsManager.followUp"));
}
return followUpTagName;
}
@@ -147,7 +147,7 @@ public class DrawableTagsManager {
private Object getBookmarkTagName() throws TskCoreException {
synchronized (autopsyTagsManagerLock) {
if (Objects.isNull(bookmarkTagName)) {
- bookmarkTagName = getTagName(TagsManager.getBookmarkText());
+ bookmarkTagName = getTagName(NbBundle.getMessage(DrawableTagsManager.class, "DrawableTagsManager.bookMark"));
}
return bookmarkTagName;
}
From f156b2c0bdf0299e7e85f5cefe85f720110e1e11 Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Fri, 17 Nov 2017 15:44:32 -0500
Subject: [PATCH 32/51] Cleanup
---
.../core.jar/org/netbeans/core/startup/Bundle.properties | 4 ++--
.../org/netbeans/core/windows/view/ui/Bundle.properties | 6 +++---
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties
index 2922cd2054..0de39782ca 100644
--- a/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties
+++ b/branding/core/core.jar/org/netbeans/core/startup/Bundle.properties
@@ -1,5 +1,5 @@
#Updated by build script
-#Thu, 07 Sep 2017 13:53:53 -0400
+#Wed, 08 Nov 2017 17:45:11 -0500
LBL_splash_window_title=Starting Autopsy
SPLASH_HEIGHT=314
SPLASH_WIDTH=538
@@ -8,4 +8,4 @@ SplashRunningTextBounds=0,289,538,18
SplashRunningTextColor=0x0
SplashRunningTextFontSize=19
-currentVersion=Autopsy 4.4.2
+currentVersion=Autopsy 4.5.0
diff --git a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties
index 2ac51b0cbd..f18b1cb91d 100644
--- a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties
+++ b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties
@@ -1,4 +1,4 @@
#Updated by build script
-#Thu, 07 Sep 2017 13:53:53 -0400
-CTL_MainWindow_Title=Autopsy 4.4.2
-CTL_MainWindow_Title_No_Project=Autopsy 4.4.2
+##Wed, 08 Nov 2017 17:45:11 -0500
+CTL_MainWindow_Title=Autopsy 4.5.0
+CTL_MainWindow_Title_No_Project=Autopsy 4.5.0
From 83d805aa9b46d6b79afb682f01d3f63a23a55683 Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Fri, 17 Nov 2017 15:48:15 -0500
Subject: [PATCH 33/51] Cleanup
---
.../org/netbeans/core/windows/view/ui/Bundle.properties | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties
index f18b1cb91d..fa55dddb62 100644
--- a/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties
+++ b/branding/modules/org-netbeans-core-windows.jar/org/netbeans/core/windows/view/ui/Bundle.properties
@@ -1,4 +1,4 @@
#Updated by build script
-##Wed, 08 Nov 2017 17:45:11 -0500
+#Wed, 08 Nov 2017 17:45:11 -0500
CTL_MainWindow_Title=Autopsy 4.5.0
CTL_MainWindow_Title_No_Project=Autopsy 4.5.0
From e24518be5139fae1c863bc8d32649c312b335ace Mon Sep 17 00:00:00 2001
From: Ann Priestman
Date: Fri, 17 Nov 2017 15:52:37 -0500
Subject: [PATCH 34/51] Cleanup
---
.../sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
index bfe10f2c08..8e0f5422a1 100644
--- a/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
+++ b/Core/src/org/sleuthkit/autopsy/modules/hashdatabase/HashDbManager.java
@@ -1281,7 +1281,7 @@ public class HashDbManager implements PropertyChangeListener {
EamDb.getInstance().bulkInsertReferenceTypeEntries(globalFileInstances,
EamDb.getInstance().getCorrelationTypeById(CorrelationAttribute.FILES_TYPE_ID));
} catch (EamDbException ex){
- throw new TskCoreException("Error adding hashes", ex);
+ throw new TskCoreException("Error adding hashes to " + getDisplayName(), ex);
}
}
From bfaec69477a8007fabe0fd27ca87fb1187f3ecd8 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 17 Nov 2017 17:04:04 -0500
Subject: [PATCH 35/51] 3199 fix renamed sleuthkit method use in autopsy
---
.../org/sleuthkit/autopsy/casemodule/services/TagsManager.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index 9830a5de56..adfcbf0029 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -255,7 +255,7 @@ public class TagsManager implements Closeable {
*/
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException {
try {
- TagName tagName = caseDb.addTagName(displayName, description, color, knownStatus);
+ TagName tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatus);
Set customTypes = TagNameDefiniton.getTagNameDefinitions();
customTypes.add(new TagNameDefiniton(displayName, description, color, knownStatus));
TagNameDefiniton.setTagNameDefinitions(customTypes);
From d8a75596a2f0b2031baa06cd313e21b3263c4511 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 17 Nov 2017 17:05:05 -0500
Subject: [PATCH 36/51] 3199 fix second usage of addOrUpdateTagName
---
.../sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index abe071a0ec..8c7d29baa3 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -180,7 +180,7 @@ final class TagNameDefiniton implements Comparable {
private TagName saveToCase(SleuthkitCase caseDb) {
TagName tagName = null;
try {
- tagName = caseDb.addTagName(displayName, description, color, knownStatusDenoted);
+ tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
}
From 8533ce98fb56bf14ecdb55e4c4ed3017e918f88e Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 17 Nov 2017 17:13:02 -0500
Subject: [PATCH 37/51] 3201 merge changes from 3199 regarding refactor of
addTagName method name
---
.../autopsy/casemodule/services/TagNameDefinition.java | 2 +-
.../sleuthkit/autopsy/casemodule/services/TagNameDialog.java | 3 +--
.../org/sleuthkit/autopsy/casemodule/services/TagsManager.java | 2 +-
3 files changed, 3 insertions(+), 4 deletions(-)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
index c9458dfbd7..2153b35522 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefinition.java
@@ -180,7 +180,7 @@ final class TagNameDefinition implements Comparable {
private TagName saveToCase(SleuthkitCase caseDb) {
TagName tagName = null;
try {
- tagName = caseDb.addTagName(displayName, description, color, knownStatus);
+ tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatus);
} catch (TskCoreException ex) {
Exceptions.printStackTrace(ex);
}
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
index c8d1351763..f923717760 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDialog.java
@@ -135,10 +135,9 @@ final class TagNameDialog extends javax.swing.JDialog {
NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameEmpty.title"),
JOptionPane.ERROR_MESSAGE);
return;
- }
+ }
//if a tag name contains illegal characters and is not the name of one of the standard tags
if (TagsManager.containsIllegalCharacters(newTagDisplayName) && !TagNameDefinition.getStandardTagNames().contains(newTagDisplayName)) {
-
JOptionPane.showMessageDialog(null,
NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameIllegalCharacters.message"),
NbBundle.getMessage(TagNameDialog.class, "TagNameDialog.JOptionPane.tagNameIllegalCharacters.title"),
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
index 5699034f7b..de16d9456f 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagsManager.java
@@ -255,7 +255,7 @@ public class TagsManager implements Closeable {
*/
public synchronized TagName addTagName(String displayName, String description, TagName.HTML_COLOR color, TskData.FileKnown knownStatus) throws TagNameAlreadyExistsException, TskCoreException {
try {
- TagName tagName = caseDb.addTagName(displayName, description, color, knownStatus);
+ TagName tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatus);
Set customTypes = TagNameDefinition.getTagNameDefinitions();
customTypes.add(new TagNameDefinition(displayName, description, color, knownStatus));
TagNameDefinition.setTagNameDefinitions(customTypes);
From 4bc8d85acdcc4dc52ed55f2c05b826bae01c2f80 Mon Sep 17 00:00:00 2001
From: William Schaefer
Date: Fri, 17 Nov 2017 19:08:59 -0500
Subject: [PATCH 38/51] 3199 clean up read Tags properties code and rename
Category to DhsImageCategory
---
.../casemodule/services/TagNameDefiniton.java | 114 +++++++++++++-----
.../Category.java => DhsImageCategory.java} | 20 +--
.../actions/CategorizeAction.java | 30 ++---
.../actions/CategorizeGroupAction.java | 14 +--
.../CategorizeSelectedFilesAction.java | 4 +-
.../datamodel/CategoryManager.java | 54 ++++-----
.../datamodel/DrawableAttribute.java | 8 +-
.../imagegallery/datamodel/DrawableDB.java | 10 +-
.../imagegallery/datamodel/DrawableFile.java | 14 +--
.../datamodel/DrawableTagsManager.java | 4 +-
.../datamodel/grouping/GroupManager.java | 12 +-
.../imagegallery/gui/SummaryTablePane.java | 16 +--
.../autopsy/imagegallery/gui/Toolbar.java | 6 +-
.../gui/drawableviews/DrawableView.java | 24 ++--
.../gui/drawableviews/GroupPane.java | 26 ++--
.../gui/drawableviews/MetaDataPane.java | 4 +-
.../gui/drawableviews/SlideShowView.java | 8 +-
17 files changed, 210 insertions(+), 158 deletions(-)
rename Core/src/org/sleuthkit/autopsy/datamodel/{tags/Category.java => DhsImageCategory.java} (85%)
diff --git a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
index 8c7d29baa3..e2fa9f4af4 100755
--- a/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
+++ b/Core/src/org/sleuthkit/autopsy/casemodule/services/TagNameDefiniton.java
@@ -24,13 +24,14 @@ import java.util.HashSet;
import java.util.List;
import java.util.Objects;
import java.util.Set;
+import java.util.logging.Level;
import javax.annotation.concurrent.Immutable;
-import org.openide.util.Exceptions;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
+import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ModuleSettings;
import org.sleuthkit.datamodel.TagName;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import org.sleuthkit.datamodel.SleuthkitCase;
import org.sleuthkit.datamodel.TskCoreException;
import org.sleuthkit.datamodel.TskData;
@@ -41,17 +42,18 @@ import org.sleuthkit.datamodel.TskData;
@Immutable
final class TagNameDefiniton implements Comparable {
+ private static final Logger LOGGER = Logger.getLogger(TagNameDefiniton.class.getName());
@NbBundle.Messages({"TagNameDefiniton.predefTagNames.bookmark.text=Bookmark",
"TagNameDefiniton.predefTagNames.followUp.text=Follow Up",
"TagNameDefiniton.predefTagNames.notableItem.text=Notable Item"})
private static final String TAGS_SETTINGS_NAME = "Tags"; //NON-NLS
private static final String TAG_NAMES_SETTING_KEY = "TagNames"; //NON-NLS
- private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(), Category.TWO.getDisplayName(), Category.THREE.getDisplayName()); // NON-NLS
+ private static final List STANDARD_NOTABLE_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), DhsImageCategory.ONE.getDisplayName(), DhsImageCategory.TWO.getDisplayName(), DhsImageCategory.THREE.getDisplayName()); // NON-NLS
private static final List STANDARD_TAG_DISPLAY_NAMES = Arrays.asList(Bundle.TagNameDefiniton_predefTagNames_bookmark_text(), Bundle.TagNameDefiniton_predefTagNames_followUp_text(),
- Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), Category.ONE.getDisplayName(),
- Category.TWO.getDisplayName(), Category.THREE.getDisplayName(),
- Category.FOUR.getDisplayName(), Category.FIVE.getDisplayName());
+ Bundle.TagNameDefiniton_predefTagNames_notableItem_text(), DhsImageCategory.ONE.getDisplayName(),
+ DhsImageCategory.TWO.getDisplayName(), DhsImageCategory.THREE.getDisplayName(),
+ DhsImageCategory.FOUR.getDisplayName(), DhsImageCategory.FIVE.getDisplayName());
private final String displayName;
private final String description;
private final TagName.HTML_COLOR color;
@@ -182,7 +184,7 @@ final class TagNameDefiniton implements Comparable {
try {
tagName = caseDb.addOrUpdateTagName(displayName, description, color, knownStatusDenoted);
} catch (TskCoreException ex) {
- Exceptions.printStackTrace(ex);
+ LOGGER.log(Level.SEVERE, "Error updating non-file object ", ex);
}
return tagName;
}
@@ -195,42 +197,92 @@ final class TagNameDefiniton implements Comparable {
*/
static synchronized Set getTagNameDefinitions() {
Set tagNames = new HashSet<>();
- List standardTags = new ArrayList<>(STANDARD_TAG_DISPLAY_NAMES); //modifiable copy of default tags list for us to keep track of which ones already exist
+ //modifiable copy of default tags list for us to keep track of which default tags have already been created
+ Set standardTags = new HashSet<>(STANDARD_TAG_DISPLAY_NAMES);
String setting = ModuleSettings.getConfigSetting(TAGS_SETTINGS_NAME, TAG_NAMES_SETTING_KEY);
if (null != setting && !setting.isEmpty()) {
List tagNameTuples = Arrays.asList(setting.split(";"));
- List notableTags = new ArrayList<>();
- String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
- if (badTagsStr == null || badTagsStr.isEmpty()) { //if there were no bad tags in the central repo properties file use the default list
- notableTags.addAll(STANDARD_NOTABLE_TAG_DISPLAY_NAMES);
- } else { //otherwise use the list that was in the central repository properties file
- notableTags.addAll(Arrays.asList(badTagsStr.split(",")));
+ int numberOfAttributes = 0;
+ if (tagNameTuples.size() > 0) {
+ // Determine if Tags.properties file needs to be upgraded
+ numberOfAttributes = tagNameTuples.get(0).split(",").length;
}
- for (String tagNameTuple : tagNameTuples) { //for each tag listed in the tags properties file
- String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes
- if (tagNameAttributes.length == 3) { //if there are only 3 attributes so Tags.properties does not contain any tag definitions with knownStatus
- standardTags.remove(tagNameAttributes[0]); //remove tag from default tags we need to create still
- if (notableTags.contains(tagNameAttributes[0])) { //if tag should be notable mark create it as such
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.BAD));
- } else { //otherwise create it as unknown
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.UNKNOWN)); //add the default value for that tag
- }
- } else if (tagNameAttributes.length == 4) { //if there are 4 attributes its a current list we can use the values present
- standardTags.remove(tagNameAttributes[0]); //remove tag from default tags we need to create still
- tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1], TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.valueOf(tagNameAttributes[3])));
+ if (numberOfAttributes == 3) {
+ // Upgrade Tags.Properties with the settings in Central Repository Settings if necessary
+ tagNames.addAll(upgradeTagPropertiesFile(tagNameTuples, standardTags));
+ } else if (numberOfAttributes == 4) {
+ // if the Tags.Properties file is up to date parse it
+ tagNames.addAll(readCurrentTagPropertiesFile(tagNameTuples, standardTags));
+ }
+ //create standard tags which should always exist which were not already created for whatever reason, such as upgrade
+ for (String standardTagName : standardTags) {
+ if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) {
+ tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.BAD));
+ } else {
+ tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN));
}
}
}
- for (String standardTagName : standardTags) { //create standard tags which should always exist which were not already created for whatever reason, such as upgrade
- if (STANDARD_NOTABLE_TAG_DISPLAY_NAMES.contains(standardTagName)) {
- tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.BAD));
- } else {
- tagNames.add(new TagNameDefiniton(standardTagName, "", TagName.HTML_COLOR.NONE, TskData.FileKnown.UNKNOWN));
+ return tagNames;
+
+ }
+
+ /**
+ * Read the central repository properties file to get any knownStatus
+ * related tag settings that may exist in it.
+ *
+ * @param tagProperties the list of comma seperated tags in the
+ * Tags.properties file
+ * @param standardTagsToBeCreated the list of standard tags which have yet
+ * to be created
+ *
+ * @return tagNames a list of TagNameDefinitions
+ */
+ private static Set upgradeTagPropertiesFile(List tagProperties, Set standardTagsToBeCreated) {
+ Set tagNames = new HashSet<>();
+ List legacyNotableTags = new ArrayList<>();
+ String badTagsStr = ModuleSettings.getConfigSetting("CentralRepository", "db.badTags"); // NON-NLS
+ if (badTagsStr == null || badTagsStr.isEmpty()) { //if there were no bad tags in the central repo properties file use the default list
+ legacyNotableTags.addAll(STANDARD_NOTABLE_TAG_DISPLAY_NAMES);
+ } else { //otherwise use the list that was in the central repository properties file
+ legacyNotableTags.addAll(Arrays.asList(badTagsStr.split(",")));
+ }
+ for (String tagNameTuple : tagProperties) {
+ String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes
+ standardTagsToBeCreated.remove(tagNameAttributes[0]); //remove the tag from the list of standard tags which have not been created
+ if (legacyNotableTags.contains(tagNameAttributes[0])) { //if tag should be notable mark create it as such
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1],
+ TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.BAD));
+ } else { //otherwise create it as unknown
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1],
+ TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.UNKNOWN)); //add the default value for that tag
}
}
return tagNames;
}
+ /**
+ * Read the Tags.properties file to get the TagNameDefinitions that are
+ * preserved accross cases.
+ *
+ * @param tagProperties the list of comma seperated tags in the
+ * Tags.properties file
+ * @param standardTagsToBeCreated the list of standard tags which have yet
+ * to be created
+ *
+ * @return tagNames a list of TagNameDefinitions
+ */
+ private static Set readCurrentTagPropertiesFile(List tagProperties, Set standardTagsToBeCreated) {
+ Set tagNames = new HashSet<>();
+ for (String tagNameTuple : tagProperties) {
+ String[] tagNameAttributes = tagNameTuple.split(","); //get the attributes
+ standardTagsToBeCreated.remove(tagNameAttributes[0]); //remove the tag from the list of standard tags which have not been created
+ tagNames.add(new TagNameDefiniton(tagNameAttributes[0], tagNameAttributes[1],
+ TagName.HTML_COLOR.valueOf(tagNameAttributes[2]), TskData.FileKnown.valueOf(tagNameAttributes[3])));
+ }
+ return tagNames;
+ }
+
/**
* Sets the tag name definitions in the tag settings file.
*
diff --git a/Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java b/Core/src/org/sleuthkit/autopsy/datamodel/DhsImageCategory.java
similarity index 85%
rename from Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java
rename to Core/src/org/sleuthkit/autopsy/datamodel/DhsImageCategory.java
index 39d624110f..2357c61599 100644
--- a/Core/src/org/sleuthkit/autopsy/datamodel/tags/Category.java
+++ b/Core/src/org/sleuthkit/autopsy/datamodel/DhsImageCategory.java
@@ -16,7 +16,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-package org.sleuthkit.autopsy.datamodel.tags;
+package org.sleuthkit.autopsy.datamodel;
import com.google.common.collect.ImmutableList;
import java.util.Map;
@@ -38,6 +38,7 @@ import javafx.scene.layout.CornerRadii;
import javafx.scene.layout.Region;
import javafx.scene.paint.Color;
import org.openide.util.NbBundle;
+import org.sleuthkit.autopsy.datamodel.Bundle;
/**
* Enum to represent the six categories in the DHS image categorization scheme.
@@ -48,7 +49,7 @@ import org.openide.util.NbBundle;
"Category.four=CAT-4: Exemplar/Comparison (Internal Use Only)",
"Category.five=CAT-5: Non-pertinent",
"Category.zero=CAT-0: Uncategorized"})
-public enum Category {
+public enum DhsImageCategory {
/*
* This order of declaration is required so that Enum's compareTo method
@@ -65,22 +66,21 @@ public enum Category {
private static final BorderWidths BORDER_WIDTHS_2 = new BorderWidths(2);
private static final CornerRadii CORNER_RADII_4 = new CornerRadii(4);
- public static ImmutableList getNonZeroCategories() {
+ public static ImmutableList getNonZeroCategories() {
return nonZeroCategories;
}
- private static final ImmutableList nonZeroCategories =
- ImmutableList.of(Category.FIVE, Category.FOUR, Category.THREE, Category.TWO, Category.ONE);
+ private static final ImmutableList nonZeroCategories =
+ ImmutableList.of(DhsImageCategory.FIVE, DhsImageCategory.FOUR, DhsImageCategory.THREE, DhsImageCategory.TWO, DhsImageCategory.ONE);
/**
* map from displayName to enum value
*/
- private static final Map nameMap =
- Stream.of(values()).collect(Collectors.toMap(
- Category::getDisplayName,
+ private static final Map nameMap =
+ Stream.of(values()).collect(Collectors.toMap(DhsImageCategory::getDisplayName,
Function.identity()));
- public static Category fromDisplayName(String displayName) {
+ public static DhsImageCategory fromDisplayName(String displayName) {
return nameMap.get(displayName);
}
@@ -99,7 +99,7 @@ public enum Category {
private final int id;
private Image snapshot;
- private Category(Color color, int id, String name) {
+ private DhsImageCategory(Color color, int id, String name) {
this.color = color;
this.displayName = name;
this.id = id;
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
index e55078018e..3f8b3aecd0 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeAction.java
@@ -40,7 +40,7 @@ import org.controlsfx.control.action.ActionUtils;
import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableFile;
@@ -60,15 +60,15 @@ public class CategorizeAction extends Action {
private final ImageGalleryController controller;
private final UndoRedoManager undoManager;
- private final Category cat;
+ private final DhsImageCategory cat;
private final Set selectedFileIDs;
private final Boolean createUndo;
- public CategorizeAction(ImageGalleryController controller, Category cat, Set selectedFileIDs) {
+ public CategorizeAction(ImageGalleryController controller, DhsImageCategory cat, Set selectedFileIDs) {
this(controller, cat, selectedFileIDs, true);
}
- private CategorizeAction(ImageGalleryController controller, Category cat, Set selectedFileIDs, Boolean createUndo) {
+ private CategorizeAction(ImageGalleryController controller, DhsImageCategory cat, Set selectedFileIDs, Boolean createUndo) {
super(cat.getDisplayName());
this.controller = controller;
this.undoManager = controller.getUndoManager();
@@ -103,7 +103,7 @@ public class CategorizeAction extends Action {
// Each category get an item in the sub-menu. Selecting one of these menu items adds
// a tag with the associated category.
- for (final Category cat : Category.values()) {
+ for (final DhsImageCategory cat : DhsImageCategory.values()) {
MenuItem categoryItem = ActionUtils.createMenuItem(new CategorizeAction(controller, cat, selected));
getItems().add(categoryItem);
}
@@ -118,9 +118,9 @@ public class CategorizeAction extends Action {
private final Set fileIDs;
private final boolean createUndo;
- private final Category cat;
+ private final DhsImageCategory cat;
- CategorizeTask(Set fileIDs, @Nonnull Category cat, boolean createUndo) {
+ CategorizeTask(Set fileIDs, @Nonnull DhsImageCategory cat, boolean createUndo) {
super();
this.fileIDs = fileIDs;
java.util.Objects.requireNonNull(cat);
@@ -132,14 +132,14 @@ public class CategorizeAction extends Action {
public void run() {
final DrawableTagsManager tagsManager = controller.getTagsManager();
final CategoryManager categoryManager = controller.getCategoryManager();
- Map oldCats = new HashMap<>();
+ Map oldCats = new HashMap<>();
TagName tagName = categoryManager.getTagName(cat);
- TagName catZeroTagName = categoryManager.getTagName(Category.ZERO);
+ TagName catZeroTagName = categoryManager.getTagName(DhsImageCategory.ZERO);
for (long fileID : fileIDs) {
try {
DrawableFile file = controller.getFileFromId(fileID); //drawable db access
if (createUndo) {
- Category oldCat = file.getCategory(); //drawable db access
+ DhsImageCategory oldCat = file.getCategory(); //drawable db access
TagName oldCatTagName = categoryManager.getTagName(oldCat);
if (false == tagName.equals(oldCatTagName)) {
oldCats.put(fileID, oldCat);
@@ -147,7 +147,7 @@ public class CategorizeAction extends Action {
}
final List fileTags = tagsManager.getContentTags(file);
- if (tagName == categoryManager.getTagName(Category.ZERO)) {
+ if (tagName == categoryManager.getTagName(DhsImageCategory.ZERO)) {
// delete all cat tags for cat-0
fileTags.stream()
.filter(tag -> CategoryManager.isCategoryTagName(tag.getName()))
@@ -189,11 +189,11 @@ public class CategorizeAction extends Action {
@Immutable
private final class CategorizationChange implements UndoRedoManager.UndoableCommand {
- private final Category newCategory;
- private final ImmutableMap oldCategories;
+ private final DhsImageCategory newCategory;
+ private final ImmutableMap oldCategories;
private final ImageGalleryController controller;
- CategorizationChange(ImageGalleryController controller, Category newCategory, Map oldCategories) {
+ CategorizationChange(ImageGalleryController controller, DhsImageCategory newCategory, Map oldCategories) {
this.controller = controller;
this.newCategory = newCategory;
this.oldCategories = ImmutableMap.copyOf(oldCategories);
@@ -216,7 +216,7 @@ public class CategorizeAction extends Action {
@Override
public void undo() {
- for (Map.Entry entry : oldCategories.entrySet()) {
+ for (Map.Entry entry : oldCategories.entrySet()) {
new CategorizeAction(controller, entry.getValue(), Collections.singleton(entry.getKey()), false)
.handle(null);
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
index 439bb59512..f568fbd105 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeGroupAction.java
@@ -38,7 +38,7 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryPreferences;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import org.sleuthkit.datamodel.TskCoreException;
/**
@@ -49,7 +49,7 @@ public class CategorizeGroupAction extends CategorizeAction {
private final static Logger LOGGER = Logger.getLogger(CategorizeGroupAction.class.getName());
- public CategorizeGroupAction(Category newCat, ImageGalleryController controller) {
+ public CategorizeGroupAction(DhsImageCategory newCat, ImageGalleryController controller) {
super(controller, newCat, null);
setEventHandler(actionEvent -> {
ObservableList fileIDs = controller.viewState().get().getGroup().getFileIDs();
@@ -58,12 +58,12 @@ public class CategorizeGroupAction extends CategorizeAction {
//if they have preveiously disabled the warning, just go ahead and apply categories.
addCatToFiles(ImmutableSet.copyOf(fileIDs));
} else {
- final Map catCountMap = new HashMap<>();
+ final Map catCountMap = new HashMap<>();
for (Long fileID : fileIDs) {
try {
- Category category = controller.getFileFromId(fileID).getCategory();
- if (false == Category.ZERO.equals(category) && newCat.equals(category) == false) {
+ DhsImageCategory category = controller.getFileFromId(fileID).getCategory();
+ if (false == DhsImageCategory.ZERO.equals(category) && newCat.equals(category) == false) {
catCountMap.merge(category, 1L, Long::sum);
}
} catch (TskCoreException ex) {
@@ -86,14 +86,14 @@ public class CategorizeGroupAction extends CategorizeAction {
"CategorizeGroupAction.fileCountMessage={0} with {1}",
"CategorizeGroupAction.dontShowAgain=Don't show this message again",
"CategorizeGroupAction.fileCountHeader=Files in the following categories will have their categories overwritten: "})
- private void showConfirmationDialog(final Map catCountMap, Category newCat, ObservableList fileIDs) {
+ private void showConfirmationDialog(final Map catCountMap, DhsImageCategory newCat, ObservableList fileIDs) {
ButtonType categorizeButtonType =
new ButtonType(Bundle.CategorizeGroupAction_OverwriteButton_text(), ButtonBar.ButtonData.APPLY);
VBox textFlow = new VBox();
- for (Map.Entry entry : catCountMap.entrySet()) {
+ for (Map.Entry entry : catCountMap.entrySet()) {
if (entry.getKey().equals(newCat) == false) {
if (entry.getValue() > 0) {
Label label = new Label(Bundle.CategorizeGroupAction_fileCountMessage(entry.getValue(), entry.getKey().getDisplayName()),
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
index be8c3644bb..bb8cd9de96 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/actions/CategorizeSelectedFilesAction.java
@@ -19,14 +19,14 @@
package org.sleuthkit.autopsy.imagegallery.actions;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
/**
*
*/
public class CategorizeSelectedFilesAction extends CategorizeAction {
- public CategorizeSelectedFilesAction(Category cat, ImageGalleryController controller) {
+ public CategorizeSelectedFilesAction(DhsImageCategory cat, ImageGalleryController controller) {
super(controller, cat, null);
setEventHandler(actionEvent ->
addCatToFiles(controller.getSelectionModel().getSelected())
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
index 33bc9a58d4..66aa6c578d 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/CategoryManager.java
@@ -35,7 +35,7 @@ import org.sleuthkit.autopsy.casemodule.events.ContentTagAddedEvent;
import org.sleuthkit.autopsy.casemodule.events.ContentTagDeletedEvent;
import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import org.sleuthkit.datamodel.ContentTag;
import org.sleuthkit.datamodel.TagName;
import org.sleuthkit.datamodel.TskCoreException;
@@ -80,13 +80,13 @@ public class CategoryManager {
* the count related methods go through this cache, which loads initial
* values from the database if needed.
*/
- private final LoadingCache categoryCounts =
+ private final LoadingCache categoryCounts =
CacheBuilder.newBuilder().build(CacheLoader.from(this::getCategoryCountHelper));
/**
* cached TagNames corresponding to Categories, looked up from
* autopsyTagManager at initial request or if invalidated by case change.
*/
- private final LoadingCache catTagNameMap =
+ private final LoadingCache catTagNameMap =
CacheBuilder.newBuilder().build(CacheLoader.from(
cat -> getController().getTagsManager().getTagName(cat)
));
@@ -119,18 +119,18 @@ public class CategoryManager {
}
/**
- * get the number of file with the given {@link Category}
+ * get the number of file with the given {@link DhsImageCategory}
*
* @param cat get the number of files with Category = cat
*
* @return the number of files with the given Category
*/
- synchronized public long getCategoryCount(Category cat) {
- if (cat == Category.ZERO) {
+ synchronized public long getCategoryCount(DhsImageCategory cat) {
+ if (cat == DhsImageCategory.ZERO) {
// Keeping track of the uncategorized files is a bit tricky while ingest
// is going on, so always use the list of file IDs we already have along with the
// other category counts instead of trying to track it separately.
- long allOtherCatCount = getCategoryCount(Category.ONE) + getCategoryCount(Category.TWO) + getCategoryCount(Category.THREE) + getCategoryCount(Category.FOUR) + getCategoryCount(Category.FIVE);
+ long allOtherCatCount = getCategoryCount(DhsImageCategory.ONE) + getCategoryCount(DhsImageCategory.TWO) + getCategoryCount(DhsImageCategory.THREE) + getCategoryCount(DhsImageCategory.FOUR) + getCategoryCount(DhsImageCategory.FIVE);
return db.getNumberOfImageFilesInList() - allOtherCatCount;
} else {
return categoryCounts.getUnchecked(cat).sum();
@@ -139,24 +139,24 @@ public class CategoryManager {
/**
* increment the cached value for the number of files with the given
- * {@link Category}
+ * {@link DhsImageCategory}
*
* @param cat the Category to increment
*/
- synchronized public void incrementCategoryCount(Category cat) {
- if (cat != Category.ZERO) {
+ synchronized public void incrementCategoryCount(DhsImageCategory cat) {
+ if (cat != DhsImageCategory.ZERO) {
categoryCounts.getUnchecked(cat).increment();
}
}
/**
* decrement the cached value for the number of files with the given
- * {@link Category}
+ * {@link DhsImageCategory}
*
* @param cat the Category to decrement
*/
- synchronized public void decrementCategoryCount(Category cat) {
- if (cat != Category.ZERO) {
+ synchronized public void decrementCategoryCount(DhsImageCategory cat) {
+ if (cat != DhsImageCategory.ZERO) {
categoryCounts.getUnchecked(cat).decrement();
}
}
@@ -171,7 +171,7 @@ public class CategoryManager {
* @return a LongAdder whose value is set to the number of file with the
* given Category
*/
- synchronized private LongAdder getCategoryCountHelper(Category cat) {
+ synchronized private LongAdder getCategoryCountHelper(DhsImageCategory cat) {
LongAdder longAdder = new LongAdder();
longAdder.decrement();
try {
@@ -188,7 +188,7 @@ public class CategoryManager {
*
* @param fileIDs
*/
- public void fireChange(Collection fileIDs, Category newCategory) {
+ public void fireChange(Collection fileIDs, DhsImageCategory newCategory) {
categoryEventBus.post(new CategoryChangeEvent(fileIDs, newCategory));
}
@@ -231,21 +231,21 @@ public class CategoryManager {
*
* @return the TagName used for this Category
*/
- synchronized public TagName getTagName(Category cat) {
+ synchronized public TagName getTagName(DhsImageCategory cat) {
return catTagNameMap.getUnchecked(cat);
}
- public static Category categoryFromTagName(TagName tagName) {
- return Category.fromDisplayName(tagName.getDisplayName());
+ public static DhsImageCategory categoryFromTagName(TagName tagName) {
+ return DhsImageCategory.fromDisplayName(tagName.getDisplayName());
}
public static boolean isCategoryTagName(TagName tName) {
- return Category.isCategoryName(tName.getDisplayName());
+ return DhsImageCategory.isCategoryName(tName.getDisplayName());
}
public static boolean isNotCategoryTagName(TagName tName) {
- return Category.isNotCategoryName(tName.getDisplayName());
+ return DhsImageCategory.isNotCategoryName(tName.getDisplayName());
}
@@ -270,8 +270,8 @@ public class CategoryManager {
} catch (TskCoreException tskException) {
LOGGER.log(Level.SEVERE, "Failed to get content tags for content. Unable to maintain category in a consistent state.", tskException); //NON-NLS
}
- Category newCat = CategoryManager.categoryFromTagName(addedTag.getName());
- if (newCat != Category.ZERO) {
+ DhsImageCategory newCat = CategoryManager.categoryFromTagName(addedTag.getName());
+ if (newCat != DhsImageCategory.ZERO) {
incrementCategoryCount(newCat);
}
@@ -285,8 +285,8 @@ public class CategoryManager {
TagName tagName = deletedTagInfo.getName();
if (isCategoryTagName(tagName)) {
- Category deletedCat = CategoryManager.categoryFromTagName(tagName);
- if (deletedCat != Category.ZERO) {
+ DhsImageCategory deletedCat = CategoryManager.categoryFromTagName(tagName);
+ if (deletedCat != DhsImageCategory.ZERO) {
decrementCategoryCount(deletedCat);
}
fireChange(Collections.singleton(deletedTagInfo.getContentID()), null);
@@ -301,15 +301,15 @@ public class CategoryManager {
public static class CategoryChangeEvent {
private final ImmutableSet fileIDs;
- private final Category newCategory;
+ private final DhsImageCategory newCategory;
- public CategoryChangeEvent(Collection fileIDs, Category newCategory) {
+ public CategoryChangeEvent(Collection fileIDs, DhsImageCategory newCategory) {
super();
this.fileIDs = ImmutableSet.copyOf(fileIDs);
this.newCategory = newCategory;
}
- public Category getNewCategory() {
+ public DhsImageCategory getNewCategory() {
return newCategory;
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
index 0ac5142f3c..c3b8771b6d 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableAttribute.java
@@ -18,7 +18,7 @@
*/
package org.sleuthkit.autopsy.imagegallery.datamodel;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
@@ -84,14 +84,14 @@ public class DrawableAttribute> {
* //TODO: this has lead to awkward hard to maintain code, and little
* advantage. move categories into DrawableDB?
*/
- public final static DrawableAttribute CATEGORY =
- new DrawableAttribute(AttributeName.CATEGORY, Bundle.DrawableAttribute_category(),
+ public final static DrawableAttribute CATEGORY =
+ new DrawableAttribute(AttributeName.CATEGORY, Bundle.DrawableAttribute_category(),
false,
"category-icon.png", //NON-NLS
f -> Collections.singleton(f.getCategory())) {
@Override
- public Node getGraphicForValue(Category val) {
+ public Node getGraphicForValue(DhsImageCategory val) {
return val.getGraphic();
}
};
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
index 5426ac205a..fa008fe3e9 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableDB.java
@@ -18,7 +18,7 @@
*/
package org.sleuthkit.autopsy.imagegallery.datamodel;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;
@@ -231,7 +231,7 @@ public final class DrawableDB {
insertHashHitStmt = prepareStatement("INSERT OR IGNORE INTO hash_set_hits (hash_set_id, obj_id) VALUES (?,?)"); //NON-NLS
- for (Category cat : Category.values()) {
+ for (DhsImageCategory cat : DhsImageCategory.values()) {
insertGroup(cat.getDisplayName(), DrawableAttribute.CATEGORY);
}
initializeImageList();
@@ -1016,7 +1016,7 @@ public final class DrawableDB {
case MIME_TYPE:
return groupManager.getFileIDsWithMimeType((String) groupKey.getValue());
case CATEGORY:
- return groupManager.getFileIDsWithCategory((Category) groupKey.getValue());
+ return groupManager.getFileIDsWithCategory((DhsImageCategory) groupKey.getValue());
case TAGS:
return groupManager.getFileIDsWithTag((TagName) groupKey.getValue());
}
@@ -1195,7 +1195,7 @@ public final class DrawableDB {
*
* @return the number of the with the given category
*/
- public long getCategoryCount(Category cat) {
+ public long getCategoryCount(DhsImageCategory cat) {
try {
TagName tagName = controller.getTagsManager().getTagName(cat);
if (nonNull(tagName)) {
@@ -1233,7 +1233,7 @@ public final class DrawableDB {
DrawableTagsManager tagsManager = controller.getTagsManager();
// get a comma seperated list of TagName ids for non zero categories
- String catTagNameIDs = Category.getNonZeroCategories().stream()
+ String catTagNameIDs = DhsImageCategory.getNonZeroCategories().stream()
.map(tagsManager::getTagName)
.map(TagName::getId)
.map(Object::toString)
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
index 5b40c9240c..af26dd2e97 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableFile.java
@@ -18,7 +18,7 @@
*/
package org.sleuthkit.autopsy.imagegallery.datamodel;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import java.lang.ref.SoftReference;
import java.text.MessageFormat;
import java.util.ArrayList;
@@ -85,7 +85,7 @@ public abstract class DrawableFile {
private final SimpleBooleanProperty analyzed;
- private final SimpleObjectProperty category = new SimpleObjectProperty<>(null);
+ private final SimpleObjectProperty category = new SimpleObjectProperty<>(null);
private String make;
@@ -216,17 +216,17 @@ public abstract class DrawableFile {
return "";
}
- public void setCategory(Category category) {
+ public void setCategory(DhsImageCategory category) {
categoryProperty().set(category);
}
- public Category getCategory() {
+ public DhsImageCategory getCategory() {
updateCategory();
return category.get();
}
- public SimpleObjectProperty categoryProperty() {
+ public SimpleObjectProperty categoryProperty() {
return category;
}
@@ -238,9 +238,9 @@ public abstract class DrawableFile {
category.set(getContentTags().stream()
.map(Tag::getName).filter(CategoryManager::isCategoryTagName)
.map(TagName::getDisplayName)
- .map(Category::fromDisplayName)
+ .map(DhsImageCategory::fromDisplayName)
.sorted().findFirst() //sort by severity and take the first
- .orElse(Category.ZERO)
+ .orElse(DhsImageCategory.ZERO)
);
} catch (TskCoreException ex) {
LOGGER.log(Level.WARNING, "problem looking up category for " + this.getContentPathSafe(), ex); //NON-NLS
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
index 0497068924..cb30c37bab 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/DrawableTagsManager.java
@@ -18,7 +18,7 @@
*/
package org.sleuthkit.autopsy.imagegallery.datamodel;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import com.google.common.eventbus.AsyncEventBus;
import com.google.common.eventbus.EventBus;
import java.util.Collections;
@@ -229,7 +229,7 @@ public class DrawableTagsManager {
}
}
- public TagName getTagName(Category cat) {
+ public TagName getTagName(DhsImageCategory cat) {
try {
return getTagName(cat.getDisplayName());
} catch (TskCoreException ex) {
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
index e62c2b6541..7dddfa5ca8 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/datamodel/grouping/GroupManager.java
@@ -71,7 +71,7 @@ import org.sleuthkit.autopsy.coreutils.Logger;
import org.sleuthkit.autopsy.coreutils.ThreadConfined;
import org.sleuthkit.autopsy.coreutils.ThreadConfined.ThreadType;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableDB;
@@ -332,7 +332,7 @@ public class GroupManager {
switch (groupBy.attrName) {
//these cases get special treatment
case CATEGORY:
- values = (List) Arrays.asList(Category.values());
+ values = (List) Arrays.asList(DhsImageCategory.values());
break;
case TAGS:
values = (List) controller.getTagsManager().getTagNamesInUse().stream()
@@ -388,7 +388,7 @@ public class GroupManager {
switch (groupKey.getAttribute().attrName) {
//these cases get special treatment
case CATEGORY:
- fileIDsToReturn = getFileIDsWithCategory((Category) groupKey.getValue());
+ fileIDsToReturn = getFileIDsWithCategory((DhsImageCategory) groupKey.getValue());
break;
case TAGS:
fileIDsToReturn = getFileIDsWithTag((TagName) groupKey.getValue());
@@ -409,13 +409,13 @@ public class GroupManager {
// @@@ This was kind of slow in the profiler. Maybe we should cache it.
// Unless the list of file IDs is necessary, use countFilesWithCategory() to get the counts.
- public Set getFileIDsWithCategory(Category category) throws TskCoreException {
+ public Set getFileIDsWithCategory(DhsImageCategory category) throws TskCoreException {
Set fileIDsToReturn = Collections.emptySet();
if (nonNull(db)) {
try {
final DrawableTagsManager tagsManager = controller.getTagsManager();
- if (category == Category.ZERO) {
- List< TagName> tns = Stream.of(Category.ONE, Category.TWO, Category.THREE, Category.FOUR, Category.FIVE)
+ if (category == DhsImageCategory.ZERO) {
+ List< TagName> tns = Stream.of(DhsImageCategory.ONE, DhsImageCategory.TWO, DhsImageCategory.THREE, DhsImageCategory.FOUR, DhsImageCategory.FIVE)
.map(tagsManager::getTagName)
.collect(Collectors.toList());
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
index 2841eb5325..44814e2c9a 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/SummaryTablePane.java
@@ -36,7 +36,7 @@ import org.openide.util.NbBundle;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
/**
* Displays summary statistics (counts) for each group
@@ -44,13 +44,13 @@ import org.sleuthkit.autopsy.datamodel.tags.Category;
public class SummaryTablePane extends AnchorPane {
@FXML
- private TableColumn, String> catColumn;
+ private TableColumn, String> catColumn;
@FXML
- private TableColumn, Long> countColumn;
+ private TableColumn, Long> countColumn;
@FXML
- private TableView> tableView;
+ private TableView> tableView;
private final ImageGalleryController controller;
@FXML
@@ -67,11 +67,11 @@ public class SummaryTablePane extends AnchorPane {
tableView.prefHeightProperty().set(7 * 25);
//set up columns
- catColumn.setCellValueFactory((TableColumn.CellDataFeatures, String> p) -> new SimpleObjectProperty<>(p.getValue().getKey().getDisplayName()));
+ catColumn.setCellValueFactory((TableColumn.CellDataFeatures, String> p) -> new SimpleObjectProperty<>(p.getValue().getKey().getDisplayName()));
catColumn.setPrefWidth(USE_COMPUTED_SIZE);
catColumn.setText(Bundle.SummaryTablePane_catColumn());
- countColumn.setCellValueFactory((TableColumn.CellDataFeatures, Long> p) -> new SimpleObjectProperty<>(p.getValue().getValue()));
+ countColumn.setCellValueFactory((TableColumn.CellDataFeatures, Long> p) -> new SimpleObjectProperty<>(p.getValue().getValue()));
countColumn.setPrefWidth(USE_COMPUTED_SIZE);
countColumn.setText(Bundle.SummaryTablePane_countColumn());
@@ -93,9 +93,9 @@ public class SummaryTablePane extends AnchorPane {
*/
@Subscribe
public void handleCategoryChanged(org.sleuthkit.autopsy.imagegallery.datamodel.CategoryManager.CategoryChangeEvent evt) {
- final ObservableList> data = FXCollections.observableArrayList();
+ final ObservableList> data = FXCollections.observableArrayList();
if (Case.isCaseOpen()) {
- for (Category cat : Category.values()) {
+ for (DhsImageCategory cat : DhsImageCategory.values()) {
data.add(new Pair<>(cat, controller.getCategoryManager().getCategoryCount(cat)));
}
}
diff --git a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
index 6cb29d46d1..40dad21cf2 100755
--- a/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
+++ b/ImageGallery/src/org/sleuthkit/autopsy/imagegallery/gui/Toolbar.java
@@ -49,7 +49,7 @@ import org.sleuthkit.autopsy.imagegallery.FXMLConstructor;
import org.sleuthkit.autopsy.imagegallery.ImageGalleryController;
import org.sleuthkit.autopsy.imagegallery.actions.CategorizeGroupAction;
import org.sleuthkit.autopsy.imagegallery.actions.TagGroupAction;
-import org.sleuthkit.autopsy.datamodel.tags.Category;
+import org.sleuthkit.autopsy.datamodel.DhsImageCategory;
import org.sleuthkit.autopsy.imagegallery.datamodel.DrawableAttribute;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.DrawableGroup;
import org.sleuthkit.autopsy.imagegallery.datamodel.grouping.GroupSortBy;
@@ -154,13 +154,13 @@ public class Toolbar extends ToolBar {
}
});
- CategorizeGroupAction cat5GroupAction = new CategorizeGroupAction(Category.FIVE, controller);
+ CategorizeGroupAction cat5GroupAction = new CategorizeGroupAction(DhsImageCategory.FIVE, controller);
catGroupMenuButton.setOnAction(cat5GroupAction);
catGroupMenuButton.setText(cat5GroupAction.getText());
catGroupMenuButton.setGraphic(cat5GroupAction.getGraphic());
catGroupMenuButton.showingProperty().addListener(showing -> {
if (catGroupMenuButton.isShowing()) {
- List